Description
JShell recovers from references to undeclared variables/classes -- as is needed for forward references, such as yours.
It detects these based on (hidden to the user, "cannot find symbol") underlying javac error messages. So, for example (extracted and simplified example):
jshell> class C { void foo() { var action = Property.ACTION; }}
| created class C, however, it cannot be instantiated or its methods invoked until variable Property is declared
/open and command-line do not show these messages.
Your two layer deep reference to an undeclared identifier generated a different error message from javac, and displayed this error:
jshell> class C { void foo() { var action = Property.ACTION.get(); }}
| Error:
| package Property does not exist
| class C { void foo() { var action = Property.ACTION.get(); }}
| ^-------------^
When an error, rather than a recoverable undeclared variable occurs, all the error messages are shown.
--- original report ---
Hi kulla-dev,
I'm still working on Bach.java (Java Shell Builder tool) and today
its compilation stopped working when `jshell Bach.java` is invoked.
Same goes for `/open Bach.java` within a jshell session.
Calling `java Bach.java` (JEP 330) runs successfully for all revisions.
I described the issue in more detail at [1] -- here is the gist:
- revision from yesterday [2] works
- revision from today [3] chokes.
Here is the diff [4] of the two revisions.
I tried hard to find the underlying issue...
- renamed types within Bach.java
- reduced total file size by
- removing unused enum constants
- removing all Javadoc
...to no avail.
What barrier am I hitting here?
Cheers,
Christian
[1] https://github.com/sormuras/bach/issues/43
[2]
https://raw.githubusercontent.com/sormuras/bach/5e7165ef06c26423d8906038f2e061eb6cd8f374/src/bach/Bach.java
[3]
https://raw.githubusercontent.com/sormuras/bach/13cf5eb5a9045ac0158d6da585105d359591ba7f/src/bach/Bach.java
[4]
https://github.com/sormuras/bach/commit/13cf5eb5a9045ac0158d6da585105d359591ba7f
It detects these based on (hidden to the user, "cannot find symbol") underlying javac error messages. So, for example (extracted and simplified example):
jshell> class C { void foo() { var action = Property.ACTION; }}
| created class C, however, it cannot be instantiated or its methods invoked until variable Property is declared
/open and command-line do not show these messages.
Your two layer deep reference to an undeclared identifier generated a different error message from javac, and displayed this error:
jshell> class C { void foo() { var action = Property.ACTION.get(); }}
| Error:
| package Property does not exist
| class C { void foo() { var action = Property.ACTION.get(); }}
| ^-------------^
When an error, rather than a recoverable undeclared variable occurs, all the error messages are shown.
--- original report ---
Hi kulla-dev,
I'm still working on Bach.java (Java Shell Builder tool) and today
its compilation stopped working when `jshell Bach.java` is invoked.
Same goes for `/open Bach.java` within a jshell session.
Calling `java Bach.java` (JEP 330) runs successfully for all revisions.
I described the issue in more detail at [1] -- here is the gist:
- revision from yesterday [2] works
- revision from today [3] chokes.
Here is the diff [4] of the two revisions.
I tried hard to find the underlying issue...
- renamed types within Bach.java
- reduced total file size by
- removing unused enum constants
- removing all Javadoc
...to no avail.
What barrier am I hitting here?
Cheers,
Christian
[1] https://github.com/sormuras/bach/issues/43
[2]
https://raw.githubusercontent.com/sormuras/bach/5e7165ef06c26423d8906038f2e061eb6cd8f374/src/bach/Bach.java
[3]
https://raw.githubusercontent.com/sormuras/bach/13cf5eb5a9045ac0158d6da585105d359591ba7f/src/bach/Bach.java
[4]
https://github.com/sormuras/bach/commit/13cf5eb5a9045ac0158d6da585105d359591ba7f