Problems around import statement

bitter_fox bitterfoxc at gmail.com
Wed Dec 3 13:34:17 UTC 2014


Hi, Robert.
The REPL is very good tool!!

But I found some problems around import.

First of all, REPL does not evaluate the statement which is following
import statement:
=============
-> import java.util.*;int n = 0;
LINE: import java.util.*;int n = 0;
+++++WRAP
nullimport java.util.*;int n = 0;

-----

Added import: import java.util.*;int n = 0;

Resulting imports: package REPL;
import java.util.*;int n = 0;

->
=============

Sould it be evaluated by REPL?


Secondary, when we write any statement which is following import statement,
it make the unnecessary error for the following statement:

=============
-> import java.util.*;int n = 0;

(...)

-> ;
LINE: ;
+++++WRAP
;


-----
AST: 0 - 1 = 1
Compile: ";"
unprocessedSource: ""
+++++WRAP
package REPL;
import java.util.*;int n = 0;

public class $REPL0 {
    public static void do_it() throws Throwable {
        ;
    }
}

|  Error --
|  class, interface, or enum expected
|  ;
|  ^---------------------------------^
printDiagnostics start-pos = -1 ==> -126 -- wrap =
tool.TaskFactory$CompileTask at 50f8360d
Code: compiler.err.expected3,  Kind: ERROR
Pos: 33 (-1 - 33)
=============

Finally, when we add illegal imports such as "import not.found.*;", the
error for the illegal imports comes up lazy.
=============
-> import not.found.*;

-> System.out.println("hello");
-----
|  Error --
|  package not.found does not exist
|  System.out.println("hello");
|  ^
=============

I think we have to improve the implementation for import statements from
the regex impl.
Would you add these issue to TODO?

Regards,
Shinya Yoshida(@bitter_fox, shinyafox)


More information about the kulla-dev mailing list