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

Support JDK19 #5124

Merged
merged 2 commits into from
Aug 19, 2022
Merged

Support JDK19 #5124

merged 2 commits into from
Aug 19, 2022

Conversation

jbescos
Copy link
Member

@jbescos jbescos commented Aug 10, 2022

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  53:02 min
[INFO] Finished at: 2022-08-10T13:31:12+02:00
[INFO] ------------------------------------------------------------------------

jbescos@jbescos-TECRA-X40-E:~/workspace/jersey$ mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/jbescos/programs/apache-maven-3.6.3
Java version: 19-ea, vendor: Oracle Corporation, runtime: /home/jbescos/programs/java/jdk-19
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-107-generic", arch: "amd64", family: "unix"

Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
@senivam
Copy link
Contributor

senivam commented Aug 10, 2022

org.apache.groovy:groovy-all: CQ24207

Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
@jansupol
Copy link
Contributor

My JDK:

java version "19.0.1"
Java(TM) SE Runtime Environment (build 19.0.1+5-12)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.1+5-12, mixed mode, sharing)

And the result:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:testCompile (default-testCompile) on project jersey-container-grizzly2-http: Compilation failure: Compilation failure:
[ERROR] /jersey/containers/grizzly2-http/src/test/java/org/glassfish/jersey/grizzly2/httpserver/test/tools/JerseyHttpClientThread.java:[53,15] java.lang.Thread.Builder is a preview API and is disabled by default.
[ERROR]   (use --enable-preview to enable preview APIs)
[ERROR] /jersey/containers/grizzly2-http/src/test/java/org/glassfish/jersey/grizzly2/httpserver/test/tools/JerseyHttpClientThread.java:[53,45] incompatible types: jakarta.ws.rs.client.Invocation.Builder cannot be converted to java.lang.Thread.Builder
[ERROR] /jersey/containers/grizzly2-http/src/test/java/org/glassfish/jersey/grizzly2/httpserver/test/tools/JerseyHttpClientThread.java:[54,42] cannot find symbol
[ERROR]   symbol:   method get()
[ERROR]   location: variable builder of type java.lang.Thread.Builder

Is it an odd JDK bug?

@jbescos
Copy link
Member Author

jbescos commented Aug 16, 2022

/jersey/containers/grizzly2-http/src/test/java/org/glassfish/jersey/grizzly2/httpserver/test/tools/JerseyHttpClientThread.java

There is no such /jersey/containers/grizzly2-http/src/test/java/org/glassfish/jersey/grizzly2/httpserver/test/tools/JerseyHttpClientThread.java file, right?. Is it a local change that you could have?.

@senivam
Copy link
Contributor

senivam commented Aug 16, 2022

@jbescos, it appears since 3.x - added a year ago by Payara guys. But when your PR is merged into the 3.x, this will become an issue :) however, this is very probably a bug in JDK not in your (or theirs) code.

@jbescos
Copy link
Member Author

jbescos commented Aug 16, 2022

@jbescos, it appears since 3.x - added a year ago by Payara guys. But when your PR is merged into the 3.x, this will become an issue :) however, this is very probably a bug in JDK not in your (or theirs) code.

It looks adding this --enable-preview should pass. We can also wait for a final JDK19 version to try it.

@jansupol
Copy link
Contributor

JerseyHttpClientThread has:

        final WebTarget path = client.target(getSettings().targetUri.toString());
        final Builder builder = path.request();

But the compiler for some reason thinks the Builder is Thread.Builder instead of Invocation.Builder....

@jbescos
Copy link
Member Author

jbescos commented Aug 16, 2022

JerseyHttpClientThread has:

        final WebTarget path = client.target(getSettings().targetUri.toString());
        final Builder builder = path.request();

But the compiler for some reason thinks the Builder is Thread.Builder instead of Invocation.Builder....

Yes, I noticed that and it makes no sense. There is no point to fail with that because the signature of the method clearly returns Invocation.Builder. That must be a bug.

We can wait for a final JDK19 release and compile with it. Is there a release date for that?.

@jansupol
Copy link
Contributor

After a discussion with the JDK team: The issue is that JerseyHttpClientThread extends Thread and hence the Builder is the Thread.Builder. So it is enough to explicitly say:

 final Invocation.Builder builder = path.request();

@jbescos
Copy link
Member Author

jbescos commented Aug 18, 2022

After a discussion with the JDK team: The issue is that JerseyHttpClientThread extends Thread and hence the Builder is the Thread.Builder. So it is enough to explicitly say:

 final Invocation.Builder builder = path.request();

I see. Anyway that is for 3.x branch because in master there is no JerseyHttpClientThread class.

I can create a separate PR to make that change to prevent this issue will happen once we migrate master changes to 3.x:
final Invocation.Builder builder = path.request();

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

Successfully merging this pull request may close these issues.

None yet

3 participants