Skip to content
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

fix java source lang record handling #3048

Merged
merged 2 commits into from
May 18, 2024
Merged

fix java source lang record handling #3048

merged 2 commits into from
May 18, 2024

Conversation

cdietrich
Copy link
Member

No description provided.

@cdietrich cdietrich added this to the Release_2.33 milestone May 17, 2024
@cdietrich cdietrich requested a review from szarnekow May 17, 2024 16:13
Copy link
Contributor

@LorenzoBettini LorenzoBettini left a comment

Choose a reason for hiding this comment

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

In general, I'd like to have a test that would fail without this change. Instead, org.eclipse.xtext.java.tests.JavaSourceLanguageTest.testJava21Record() still succeeds without this change.

For example, in the current shape, if I comment

		javaConfig.setJavaSourceLevel(JavaVersion.JAVA21);
		javaConfig.setJavaTargetLevel(JavaVersion.JAVA21);

the test fails; so I was misled that everything else would work by just setting the Java version.

Or did I miss something?

See also the other small changes.

@cdietrich
Copy link
Member Author

grafik

@cdietrich
Copy link
Member Author

for me it fails without change

@cdietrich cdietrich force-pushed the cd-java-source-lang-21 branch 3 times, most recently from 1ae01d3 to 19acf4b Compare May 17, 2024 17:07
@@ -126,6 +126,9 @@ public JvmDeclaredType createType(TypeDeclaration type, String packageName) {
case TypeDeclaration.ANNOTATION_TYPE_DECL:
jvmType = TypesFactory.eINSTANCE.createJvmAnnotationType();
break;
case TypeDeclaration.RECORD_DECL:
Copy link
Member Author

Choose a reason for hiding this comment

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

its a final. so it will get inlined anyway. afaik

Copy link
Contributor

Choose a reason for hiding this comment

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

Even better ;)

@LorenzoBettini
Copy link
Contributor

for me it fails without change

@cdietrich

Yes, I verified that in your branch.

I was referring to the previous shape of the test: without the JAVA_21 specification it was failing, with the specification it was succeeding, but it wasn't testing much as you said.

Maybe it's worthwhile to leave a comment in the resourceSet method in the test, or in the test class in general stressing that to correctly test something in this test you should... etc. etc.

From what you said in the previous comments also in the other issues, my mistake was not thinking about the install stub step which doesn't report errors, and then the binary class is found. Or did I misunderstand that as well? In general, it would be better to avoid such problems in the future, that's why I'd leave a comment in the test. Basically, I didn't understand how that test was supposed to work.

As for the rest, I'm fine with the PR.

@cdietrich
Copy link
Member Author

@LorenzoBettini have no longer access to a dev setup. feel free to push a comment with a commit to this brAnch

@LorenzoBettini
Copy link
Contributor

@LorenzoBettini have no longer access to a dev setup. feel free to push a comment with a commit to this brAnch

Yes I can do that, but I still don't understand what was wrong with the previous version of the test.
That's why I asked you. I can put the comment if you explain what the problem was before

@cdietrich
Copy link
Member Author

@LorenzoBettini i have understood that in the previos version the resourceset method already triggers the install stubs thing and thus does it with java 8 (or 5) or whatever default is and there it does not fail

Signed-off-by: Christian Dietrich <christian.dietrich.opensource@gmail.com>
Signed-off-by: Christian Dietrich <christian.dietrich.opensource@gmail.com>
@LorenzoBettini
Copy link
Contributor

Thank you @cdietrich for adding the comment and fixing this!

@cdietrich cdietrich merged commit 334864b into main May 18, 2024
11 checks passed
@cdietrich cdietrich deleted the cd-java-source-lang-21 branch May 18, 2024 10:43
@LorenzoBettini
Copy link
Contributor

@szarnekow could you please explain where the JavaDerivedStateComputer is used?

@cdietrich
Copy link
Member Author

Cause gradle uses the Java source language under the hood to get index entries for Java files in the project

@LorenzoBettini
Copy link
Contributor

Ok! That's why it never came into play in my tests and PRs! So Gradle doesn't use Standalone builder.

So, even more sensible, please try the experiments I said in my comment in the reference projects issue.

@cdietrich
Copy link
Member Author

Yes it uses the new builder

org.eclipse.xtext.build.IncrementalBuilder

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.

None yet

2 participants