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

Run on Java toolchain 21 #337

Closed
wants to merge 20 commits into from
Closed

Run on Java toolchain 21 #337

wants to merge 20 commits into from

Conversation

timtebeek
Copy link
Contributor

Mostly to flush out issues with the build, and to be able to add new SequencedCollection recipes for getFirst, getLast & addFirst.

Mostly to flush out issues with the build
@timtebeek timtebeek self-assigned this Nov 2, 2023
@timtebeek
Copy link
Contributor Author

As discussed one on one; copied here for future follow up

Ah yes, I have seen that. Here's what's happening:
Anywhere in the tests we construct a gradle dependency model, which any test that calls withToolingApi() does, it is achieved by writing the build.gradle to disk at some temporary location and calling OpenRewriteModelBuilder.forProjectDirectory().
That in turn uses Gradle's tooling API to extract the relevant dependency information and translate it into our GradleProject marker.

Now the problem seems to be that Gradle's tooling API doesn't work quite right when running on Java 21
I haven't debugged into Gradle's code, but I speculate that it is compiling the build script itself to a Java 21 (bytecode version 65) class file, and then passes that in to part of its process which does not support it
So we should probably tell Gradle about it

@timtebeek
Copy link
Contributor Author

@sambsnyd We're now instead getting this stacktrace on anything that tries to open classpath resource jars:

at java.util.Objects.requireNonNull(Objects.java:233)	
at org.openrewrite.java.JavaParser.dependenciesFromResources(JavaParser.java:185)	
at org.openrewrite.java.JavaParser$Builder.classpathFromResources(JavaParser.java:379)	
at org.openrewrite.java.migrate.jakarta.RemovedUIComponentConstantTest.defaults(RemovedUIComponentConstantTest.java:32)	
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:140)	
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:132)	
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:127)	
at org.openrewrite.java.migrate.jakarta.RemovedUIComponentConstantTest.removedUIComponentConstant_1(RemovedUIComponentConstantTest.java:40)	
at java.lang.invoke.LambdaForm$DMH/0x00007f81c4164000.invokeVirtual(LambdaForm$DMH)	
at java.lang.invoke.LambdaForm$MH/0x00007f81c4098800.invoke(LambdaForm$MH)	
at java.lang.invoke.Invokers$Holder.invokeExact_MT(Invokers$Holder)	
at java.lang.reflect.Method.invoke(Method.java:580)	
at java.util.ArrayList.forEach(ArrayList.java:1596)	
at java.util.ArrayList.forEach(ArrayList.java:1596)	

I'm going to guess and say that's progress, but don't yet know what we'd need now. :)

@timtebeek
Copy link
Contributor Author

There's quite some fixes in this branch that can already be merged, as those tests are only run on Java 21:

Then when run here they lead to less to debug and fix; likely only the classpath resource jar issues

@timtebeek
Copy link
Contributor Author

Wondering if there might have been any relation to this reported issue & fix:

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Some suggestions could not be made:

  • src/test/java/org/openrewrite/java/migrate/maven/UpdateMavenProjectPropertyJavaVersionTest.java
    • lines 172-172

@timtebeek
Copy link
Contributor Author

Closing for now as there's no immediate fix expected in this repository.

@timtebeek timtebeek closed this Jul 29, 2024
@timtebeek timtebeek deleted the java_toolchain_21 branch July 29, 2024 14:32
@timtebeek timtebeek restored the java_toolchain_21 branch August 16, 2024 14:34
@timtebeek timtebeek deleted the java_toolchain_21 branch August 16, 2024 14:34
@timtebeek timtebeek restored the java_toolchain_21 branch August 16, 2024 15:53
@timtebeek timtebeek reopened this Aug 16, 2024
@timtebeek timtebeek closed this Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working java 21+ parser-java
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant