-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8349132: javac Analyzers should handle non-deferrable errors #23387
Conversation
👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into |
@lahodaj This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 92 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
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.
Looks good to me. And thanks for the great analysis.
I was wondering, the third error is not coming from the DiamondInitializer
is seems. It must have been one of the subsequent, right?: LambdaAnalyzer
, RedundantTypeArgAnalyzer
, RedundantLocalVarTypeAnalyzer
, RedundantLocalVarTypeAnalyzerForEach
.
The third error comes from the DiamondInitializer (I checked, the rewrites are queued, and run later, but I printed the analyzer that scheduled the rewrite). |
/integrate |
Going to push as commit 3cf04de.
Your commit was automatically rebased without conflicts. |
Consider this test script:
It fails with:
The reason for this is as follows: Some errors reported by javac have the "NON_DEFERRABLE" flag, which means the error should not be stored in
DeferredDiagnosticHandler
, but rather should be reported immediately.This is particularly the case when e.g. entering the sources before annotation processing - the errors found during this enter run may be resolved by the AP. So, ordinary errors are stored in
DeferredDiagnosticHandler
and reported later if needed. Non-deferrable errors are not stored, but reported immediately, as those are typically serious errors that cannot be fixed by AP.javac also has an
Analyzer
, which looks for code simplifications by speculatively simplifying the code, and re-attributing it to see if it would still compile. It is usingDeferredDiagnosticHandler
, so that if any errors are found during the speculative attribution, the code simplification is rejected.But, if a non-deferrable error is reported during the speculative attribution, it is passed through
DeferredDiagnosticHandler
undetected, and theAnalyzer
may try to do further evaluations - which may crash the compiler.The proposal in the PR is to catch all errors while doing this speculative attribution for the
Analyzer
. As a consequence, the speculative code rewrite is found to be problematic, is rejected, and there's no crash.Note this will also avoid the third error reported in the above case - that error comes directly from the speculative attribution, and it seems incorrect to report it.
Progress
Warning
8349132: javac Analyzers should handle non-deferrable errors
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23387/head:pull/23387
$ git checkout pull/23387
Update a local copy of the PR:
$ git checkout pull/23387
$ git pull https://git.openjdk.org/jdk.git pull/23387/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23387
View PR using the GUI difftool:
$ git pr show -t 23387
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23387.diff
Using Webrev
Link to Webrev Comment