I play with JShell and try to convert a variable to its original form. To do this, I reset everything in REPL using /r, then I imported java.util.*and created a list:
-> import java.util.*;
-> List<String> l = new ArrayList<>(Arrays.asList("a", "b"));
| Modified variable l of type List<String> with initial value [a, b]
Now I am trying to convert the list values to uppercase, so I do:
-> l.replaceAll(String::toUpperCase)
-> l
| Variable l of type List<String> has value [A, B]
The list of executable source that I typed with /list(or /l) shows:
-> /l
1 : List<String> l = new ArrayList<>(Arrays.asList("a", "b"));
2 : l.replaceAll(String::toUpperCase)
3 : l
Now, when I try to reset the list to step 1 (before changing its values), I get the operator import:
-> /1
import java.util.*;
Does anyone know why this is happening? I tried the same without instructions import, but I get the same result (I assume this is due to the fact that it is explicitly imported).
, /l all, :
-> /l all
s1 : import java.util.*;
s2 : import java.io.*;
s3 : import java.math.*;
s4 : import java.net.*;
s5 : import java.util.concurrent.*;
s6 : import java.util.prefs.*;
s7 : import java.util.regex.*;
s8 : void printf(String format, Object... args) { System.out.printf(format, args); }
1 : String a = "a";
2 : a = "b"
, /1 import, . , import java.util.*; , s5 import java.util.concurrent.*; ( ).