-
Notifications
You must be signed in to change notification settings - Fork 131
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
False type mismatch on array initializer with null annotations (regression 2023-03) #1067
Conversation
@srikanth-sankaran , @iloveeclipse I plan to have a look at other issues linked from #1007 on Thursday, with a goal to have this merged before RC1. Until then feel free to have a look, test against other reports, improve ... whatever may be needed to get this into good shape in time. |
...re.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
Outdated
Show resolved
Hide resolved
...clipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
Outdated
Show resolved
Hide resolved
The PR fixes #1007, tests pass.
|
A simple project example: A potential patch:
|
Thanks, @snjeza I can reproduce. |
Thanks, this helps to understand the chain of causality. Still I prefer to avoid undesired side effects (ahead of time) rather than repairing broken results after the fact. I have a patch-in-progress, that fixes this issue, just need to resolve some hiccups in existing tests :) |
c5bf8ba
to
dd82bcc
Compare
The example from redhat-developer/vscode-java#3076 led me to revise the implementation strategy. Before updating the PR description, here's the old version for posterity:
|
Of these the following have been fixed with tests to witness:
eclipse-jdtls/eclipse.jdt.ls#2386 is just the downstream of #629. I don't (yet) have a test case for #875. |
@stephan-herrmann You may want to take a look at #875 (comment) |
dd82bcc
to
722d245
Compare
Thanks, I saw it. But I saw no proof that it's really the same issue 😄 |
722d245
to
0d7d3c4
Compare
With just a tiny improvement of my fix I could also resolve #986 |
I can reproduce the issue described at #875 (comment) using the jdt.core master - https://github.com/eclipse/xtext/blob/main/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractCompositeValidatorTest.java#L140 |
Thanks for testing! Looking at that test class, yes, the class, whose literal is used as an annotation argument will not have been connected yet, because it sits in the same compilation unit as the type being processed. It will be processed later based on source order. Additionally, this declaration in With this I'm convinced it's a duplicate indeed, and forgo writing another test. |
(regression 2023-03) Avoids any risky ahead-of-time resolving of annotation details Common point-fix for these problems: * eclipse-jdt#1007 * eclipse-jdt#854 * redhat-developer/vscode-java#3076 * eclipse-jdt#986 Reverts/replaces part of the fix from: * eclipse-jdt#630
0d7d3c4
to
a3c9928
Compare
Now that tests passed: @srikanth-sankaran may I get your review for inclusion in RC1. I promise I'll stop force-pushing more changes now :) @iloveeclipse can I get your project lead's approval? Thanks. |
I'm in the middle of preparing an alternative, even safer PR. I hope to be able to complete it today. |
While it was fairly straight-forward to get this approach to pass all tests, there's a known weakness, for which I don't know what symptoms it might cause, but from looking at the code this approach creates the following issue: When For that reason I created an alternative, more drastic approach in PR #1077. |
Moving forward I'm putting my money on #1077 instead of this PR. |
Resolved indeed via #1077 |
fixes #1007
Here I removed one code block from #630 and made resolving on one particular call path deferrable.
This breaks the following unfortunate chain:
(since #630, still needed and retained)
( #630, now removed)
Starting at (4) different test cases had different ways to cause havoc (different ways to trigger undesired ahead-of-time side-effects). So that point offered itself as a suitable location for severing the unfortunate chain and start deferring instead.
The complex part is making the set of deferred tasks as narrow as possible (see new method
Annotation.shouldDeferResolvingDetails()
).I merged the solution into prior art around
ClassScope#deferredBoundChecks
, which works fine. Only the nameClassScope.checkParameterizedTypeBounds()
is no longer accurate (I simply forgot to change it).