Skip to content

Take release level into account when check for java9#4529

Merged
stephan-herrmann merged 1 commit intoeclipse-jdt:masterfrom
laeubi:issue_4399
Nov 11, 2025
Merged

Take release level into account when check for java9#4529
stephan-herrmann merged 1 commit intoeclipse-jdt:masterfrom
laeubi:issue_4399

Conversation

@laeubi
Copy link
Copy Markdown
Contributor

@laeubi laeubi commented Oct 16, 2025

Currently in SearchableEnvironment we only check if the project level is larger java9plus but when constructing a release specific SearchableEnvironment this needs to take the release option into account instead.

Fix #4399

@stephan-herrmann can you review / merge this?

@stephan-herrmann
Copy link
Copy Markdown
Contributor

Could we please have a unit test? ReconcilerMultiReleaseTests seems to have all the infrastructure needed for this, right?

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Oct 28, 2025

@stephan-herrmann sorry I forget about this but now was hit by the problem as well... I adjusted the test and hope it is ready for a submission now!

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Oct 28, 2025

Build is green, so would be ready for submission!

@stephan-herrmann
Copy link
Copy Markdown
Contributor

@stephan-herrmann sorry I forget about this but now was hit by the problem as well... I adjusted the test and hope it is ready for a submission now!

Sorry, I'm still more than busy with the fallout from #4293

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Oct 28, 2025

@stephan-herrmann sorry I forget about this but now was hit by the problem as well... I adjusted the test and hope it is ready for a submission now!

Sorry, I'm still more than busy with the fallout from #4293

I understand that but given only one line changes and covered by test you might consider it somewhere in between. If I can help anything let me know but it feels you are the expert and probably can handle it better than me :-)

@stephan-herrmann
Copy link
Copy Markdown
Contributor

FYI, the build problem is caused by eclipse-pde/eclipse.pde#2096

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Nov 5, 2025

FYI, the build problem is caused by eclipse-pde/eclipse.pde#2096

I take a look into this, and hope it is resolved soon (at worst we need to revert the changes in API tools) if this is resolved do you think we can have this for M3?

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Nov 7, 2025

@stephan-herrmann kindly request your review, build is green again!

@stephan-herrmann
Copy link
Copy Markdown
Contributor

@stephan-herrmann kindly request your review, build is green again!

looking through my list of review requests I didn't find this PR :)

Anyway, I found it again, looking into it now.

Copy link
Copy Markdown
Contributor

@stephan-herrmann stephan-herrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide a test case that shows the bug (i.e., fails without the fix).

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Nov 11, 2025

@stephan-herrmann I have simplified the test project find it here now it works without the m2e part
mrproject_plain.zip.

If I import that project, then go to the java15 folder and open MultiReleaseClass I get

grafik

Regarding the test it seems that I do something wrong previously used JCL_8_LIB and did not failed... I'll investigate on this but I'm quite sure this change is need I just seem to fail write correct reconcile tests :-\

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Nov 11, 2025

I played around with the test and it seems to reproduce the issue but sometimes when switching between branches the test is not updated and give strange results... I have now put the changes on a new PR that hopefully will show the testfailure:

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Nov 11, 2025

@stephan-herrmann this one now shows the failure on master:

https://ci.eclipse.org/jdt/job/eclipse.jdt.core-Github/job/PR-4612/1/testReport/junit/org.eclipse.jdt.core.tests.model/ReconcilerMultiReleaseTests/testNoErrorsAfterEdit/

I have rebased my change here and now we should see no failure anymore.

@stephan-herrmann
Copy link
Copy Markdown
Contributor

I have rebased my change here and now we should see no failure anymore.

The test shows a different error, which is only the result of using jclMin, which doesn't have System.getProperty(). And since it's a different error, it's not fixed in this PR.

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Nov 11, 2025

I have rebased my change here and now we should see no failure anymore.

The test shows a different error, which is only the result of using jclMin, which doesn't have System.getProperty(). And since it's a different error, it's not fixed in this PR.

Then I need some hint from the JDT experts here, I can see the error clearly in the IDE (see screenshot above) but have no clue how to get the same setup in the tests, whatever I try I either get no errors at all or even completely different ones like java.lang.Object not found...

@stephan-herrmann
Copy link
Copy Markdown
Contributor

If I import that project, then go to the java15 folder and open MultiReleaseClass I get ...

Now I see it, and here's the difference between the example project and the unit test: the latter fails to set "module=true" on the JCL_21_LIB classpath entry. Simply because the project compliance is 1.8. It seems you need to modify one more classpath entry after createJavaProject()

Currently in SearchableEnvironment we only check if the project level is
larger java9plus but when constructing a release specific
SearchableEnvironment this needs to take the release option into account
instead.

Fix eclipse-jdt#4399
@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Nov 11, 2025

It seems you need to modify one more classpath entry after createJavaProject()

I now created it as java 21 project, then set compliance manually to java 1.8... this still gives more errors than in the IDE but at least fails without and succeeds with the patch... the module=true is automatically set somewhere in the magic of the test helper classes.

@stephan-herrmann stephan-herrmann self-requested a review November 11, 2025 19:15
Copy link
Copy Markdown
Contributor

@stephan-herrmann stephan-herrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated test reproduces the problem, which is effectively fixed by this PR. We're good.

@stephan-herrmann stephan-herrmann merged commit b1652c2 into eclipse-jdt:master Nov 11, 2025
13 checks passed
@stephan-herrmann stephan-herrmann added this to the 4.38 M3 milestone Nov 11, 2025
@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Nov 12, 2025

@stephan-herrmann thanks for taking care of this. As M3 is soon I likely will need to delay other work to the next release, but this bug was really a blocker so good it is solved now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multirelease support: imports in editor cannot be resolved

2 participants