Test case and fix for #4672#4673
Conversation
....jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CircularDependencyModelTests.java
Outdated
Show resolved
Hide resolved
| createJavaProject(PROJECT_NAME, new String[] { "src" }, | ||
| new String[] { "JCL21_LIB" }, "bin", "25"); |
There was a problem hiding this comment.
Earlier Java versions should be tested too. @stephan-herrmann wasn't there a test class that ran several tests with different Java versions? I can't find it anymore.
There was a problem hiding this comment.
Actually this line causes error The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files because no classpath variable "JCL21_LIB" has been initialized.
It looks like the line was copied from Java21ElementTests, which shows the same bug, actually two bugs:
- compliance and classpath should use the same version
- initialized variables have one more underscore, like "JCL_25_LIB"
Interestingly, this error has no impact on the actual bug being witnessed by the test.
There was a problem hiding this comment.
Oh, thank you for the info. I didn't actually experience that error while running the test locally.
What do you recommend to use in this case? Does the test need to explicitly test for several Java versions or is it enough to test for 1 version (which one)?
There was a problem hiding this comment.
I'll update the library and compliance to be the same version.
initialized variables have one more underscore, like "JCL_25_LIB"
Most other places I see references to JCL*_LIB it only has one underscore
There was a problem hiding this comment.
Oh, thank you for the info. I didn't actually experience that error while running the test locally.
Just put a breakpoint in org.eclipse.jdt.internal.compiler.problem.ProblemHandler.handle(int, String[], int, String[], int, int, int, ReferenceContext, CompilationResult) (I constantly have one breakpoint right after case ProblemSeverities.Error), to see the error (still).
It has no obvious effect on the test, but adds unnecessary noise.
There was a problem hiding this comment.
Okay, I'll address this for the test case I added.
Do you think it's important to fix the other occurances (in a separate PR?)Not a big deal, so I would actually appreciate this little cleanup even as part of the current PR. I'll make a small note about it in the final commit comment when merging.
As we are in collaboration mode here, please make any changes now as separate commits, rather than history re-writing, thanks.
You didn't see these, @datho7561 ?
There was a problem hiding this comment.
I've added the fix for Java21ElementTests, sorry about rewriting history on the PR earlier.
There was a problem hiding this comment.
I've added the fix for Java21ElementTests,
thanks
sorry about rewriting history on the PR earlier.
It's OK, people have different habits.
To explain my request: I personally prefer to see all incremental changes as a fix evolves. It helps my style of reviewing. And unfortunately, github is inferior (compared to gerrit, gitlab) in showing these differences when force-push is involved.
There was a problem hiding this comment.
Unfortunately there's more confusion regarding Java21ElementTests:
- Apparently it was introduced when Java 21 introduced instance main methods as a preview.
- Meanwhile that feature has matured (no more preview) but it requires source level 25
@datho7561 Do you mind further cleaning up in this direction?
- rename the class to Java25ElementTests
- check if it is still included at the correct location in the suite
- configure it to use "JCL_25_LIB" and "25"
1245df0 to
9d12e15
Compare
|
from #4672 (comment) :
This option looked simplest to me. By integrating the new flag also in GlobalStateMemento we support arbitrary interleaving between two modes, supertype lookup, other type lookup:
I put the new flag into the ROOT_ONLY discipline, meaning: we don't maintain separate flags per Perhaps even |
Signed-off-by: David Thompson <davthomp@redhat.com>
Likewise suspend this effect during non-super type lookup.
|
Looks like that fix worked; I'll push the change to the variable in the test now. |
f8b28e7 to
0afce74
Compare
Signed-off-by: David Thompson <davthomp@redhat.com>
…in methods) Signed-off-by: David Thompson <davthomp@redhat.com>
|
Thanks @datho7561 & @fedejeanne for great collaboration! |
What it does
Adds a (failing) test case for #4672
How to test
Through CI
Author checklist