Issues regarding imports
Roy van Rijn
roy.van.rijn at gmail.com
Mon Jun 29 10:23:14 UTC 2015
Hey all,
After exploring the JShell a little more I've found one annoyance and
one possible improvement.
If you have an illegal import you'll get an error message. There is
already an issue in the JBS about the formatting of this error
(JDK-8129418), but the thing that bugs me is the following:
==================
-> import unknown.*
| Error:
| package unknown does not exist
| import unknown.*;
| ^
-> System.out.println("Test");
| Error:
| package unknown does not exist
| import unknown.*;
| ^
Test
==================
It keeps repeating the unknown import for each consecutive call. This
looks like a bug to me.
One thing I was wondering about, now that we have code completion,
would it be possible to have automatic imports as well? If I mention a
class that is currently unknown, maybe it could prompt possible
imports? Most of the time there are just a few implementations anyway.
Here is how it *could* work in the JShell:
==================
-> Predicate<Integer> isEven = n -> n%2==0;
Class Predicate not found, did you mean:
1) java.util.function.Predicate
2) javax.sql.rowset.Predicate
3) javax.persistence.criteria.Predicate
1
Class java.util.function.Predicate added as import.
->
==================
Just a suggestion, any thoughts?
Roy
More information about the kulla-dev
mailing list