Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8292629

Compilation failure: incompatible types: jakarta.ws.rs.client.Invocation.Builder cannot be converted to java.lang.Thread.Builder

XMLWordPrintable

    • generic
    • generic
    • Not verified

      A DESCRIPTION OF THE PROBLEM :
      Compiler wrongly uses import classes.

      import jakarta.ws.rs.client.Client;
      import jakarta.ws.rs.client.ClientBuilder;
      import jakarta.ws.rs.client.Invocation.Builder;
      ...
          public void doGetAndCheckResponse() throws Throwable {
              final WebTarget path = client.target(getSettings().targetUri.toString());
              final Builder builder = path.request(); //Invocation.Builder, not Thread.Builder
              final Response response = builder.get();
              final String responseMsg = response.readEntity(String.class);
              assertEquals(200, response.getStatus());
              assertEquals("Got it!", responseMsg);
          }

      The class is https://github.com/eclipse-ee4j/jersey/blob/3.x/containers/grizzly2-http/src/test/java/org/glassfish/jersey/grizzly2/httpserver/test/tools/JerseyHttpClientThread.java



      REGRESSION : Last worked in version 18.0.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      This occurs when building Jersey with JDK 19 java version "19.0.1" 2022-10-18
      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)

      To reproduce, clone Jersey, branch 3.x:
      git clone https://github.com/eclipse-ee4j/jersey.git .
      git checkout 3.x
      mvn clean install -DskipTests

      Build fails after about 40s (longer when pulling dependencies).

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Build passes
      ACTUAL -
      Build fails

      CUSTOMER SUBMITTED WORKAROUND :
      Using JDK 18.

            adev Anupam Dev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: