-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #2184: NPE on package-info.java without package declaration.
- Loading branch information
Showing
2 changed files
with
7 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
867c3ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldnt there be a comment why the catch is needed and that this is actually a bug in javac and this is a workaround? shouldnt the fix involve making sure at least in the future the correct file is reported when javac generates weird exceptions in places? me and the other guy we lost more time in finding this bug than it took to hackfix this. the debugging and reporting experience in the future could be aided if a more extensive resolution is made to make the error case more easily there might be more such errors lurking in the future, so this would be a worthy investment, paying off better than fighting just a symptom
867c3ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really appreciate you took the time to chase down the cause of the problem, and that you created a git repo for me to clone.
Occasionally we add comments for certain workarounds. In this case, the git annotation should help to find the reason for the catch.
We also considered an alternative fix: skip package-info.java and module-info.java
If you want to spend time on improving the code or error reporting, you could create a pull request. Before you start working on it, please check with us if we would agree with your chosen solution.
867c3ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was a good idea, I've added the some comments in ff1c01d
867c3ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Masterxilo - did you manage to report it to Oracle (probably possible) or OpenJDK (probably impossible)? I can see only the old NPE ... in TreeInfo.declarationFor method (and corresponding OpenJDK) but for other case.
867c3ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@psygielo I've also reproduced it with Zulu JDK btw
867c3ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amseager
No surprise as it's OpenJDK based.
On the other hand - ECJ works fine.