You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/09/28 13:34:04 UTC

[GitHub] [pulsar] nicoloboschi opened a new pull request, #17873: [branch-2.11] Ensure JDK8 compatibilty for Pulsar java clients

nicoloboschi opened a new pull request, #17873:
URL: https://github.com/apache/pulsar/pull/17873

   ### Motivation
   
   `pulsar-package-core` module is built with the maven compiler release flag equals to 17. However this module is used by the `pulsar-client-admin-original` module and we need to ensure binary compatibility to JDK8 for all the java client artifacts.
   See more context here https://github.com/apache/pulsar/pull/17855
   
   I did a simple test simulating an upgrade to Pulsar 2.11.0 in a JDK8 java application, like this
   
   ```
   public static void main(String[] args) throws Exception {
           @Cleanup
           final PulsarAdmin admin = PulsarAdmin.builder()
                   .serviceHttpUrl("http://localhost:8080")
                   .build();
           final PackageMetadata mypackage = admin.packages().getMetadata("mypackage");
   
       }
   ```
   
   and I got this error
   
   ```
   java.lang.UnsupportedClassVersionError: org/apache/pulsar/packages/management/core/common/PackageName has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
       at java.lang.ClassLoader.defineClass1 (Native Method)
       at java.lang.ClassLoader.defineClass (ClassLoader.java:757)
       at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:142)
       at java.net.URLClassLoader.defineClass (URLClassLoader.java:473)
       at java.net.URLClassLoader.access$100 (URLClassLoader.java:74)
       at java.net.URLClassLoader$1.run (URLClassLoader.java:369)
       at java.net.URLClassLoader$1.run (URLClassLoader.java:363)
       at java.security.AccessController.doPrivileged (Native Method)
       at java.net.URLClassLoader.findClass (URLClassLoader.java:362)
       at java.lang.ClassLoader.loadClass (ClassLoader.java:419)
       at java.lang.ClassLoader.loadClass (ClassLoader.java:352)
       at org.apache.pulsar.client.admin.internal.PackagesImpl.getMetadataAsync (PackagesImpl.java:69)
       at org.apache.pulsar.client.admin.internal.PackagesImpl.lambda$getMetadata$0 (PackagesImpl.java:64)
       at org.apache.pulsar.client.admin.internal.BaseResource.sync (BaseResource.java:292)
       at org.apache.pulsar.client.admin.internal.PackagesImpl.getMetadata (PackagesImpl.java:64)
       at com.nicoloboschi.MainClient.main (MainClient.java:26)
    ```
   
   ### Modifications
   - Set the release flag to 8 for the packages-core module
   - Added the enforcer to the pulsar-client-all module to verify binary compatibility to jdk8
   
   - [x] `doc-not-needed` 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] lhotari commented on a diff in pull request #17873: [branch-2.11] Ensure JDK8 compatibilty for Pulsar java clients

Posted by GitBox <gi...@apache.org>.
lhotari commented on code in PR #17873:
URL: https://github.com/apache/pulsar/pull/17873#discussion_r982426664


##########
pulsar-client-all/pom.xml:
##########
@@ -397,6 +397,33 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>${maven-enforcer-plugin.version}</version>
+        <executions>
+          <execution>
+            <id>enforce-bytecode-version</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <enforceBytecodeVersion>
+                  <maxJdkVersion>1.8</maxJdkVersion>

Review Comment:
   I guess it would be consistent to use the `pulsar.client.compiler.release` property
   ```suggestion
                     <maxJdkVersion>${pulsar.client.compiler.release}</maxJdkVersion>
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] HQebupt commented on pull request #17873: [branch-2.11] Ensure JDK8 compatibilty for Pulsar java clients

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #17873:
URL: https://github.com/apache/pulsar/pull/17873#issuecomment-1260959191

   LGTM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] lhotari commented on a diff in pull request #17873: [branch-2.11] Ensure JDK8 compatibilty for Pulsar java clients

Posted by GitBox <gi...@apache.org>.
lhotari commented on code in PR #17873:
URL: https://github.com/apache/pulsar/pull/17873#discussion_r982428338


##########
pulsar-client-all/pom.xml:
##########
@@ -397,6 +397,33 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>${maven-enforcer-plugin.version}</version>
+        <executions>
+          <execution>
+            <id>enforce-bytecode-version</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <enforceBytecodeVersion>
+                  <maxJdkVersion>1.8</maxJdkVersion>
+                </enforceBytecodeVersion>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+        <dependencies>
+          <dependency>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>extra-enforcer-rules</artifactId>
+            <version>1.6.1</version>

Review Comment:
   Perhaps this could be managed in the same way as other version numbers?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nicoloboschi merged pull request #17873: [branch-2.11] Ensure JDK8 compatibilty for Pulsar java clients

Posted by GitBox <gi...@apache.org>.
nicoloboschi merged PR #17873:
URL: https://github.com/apache/pulsar/pull/17873


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nicoloboschi commented on pull request #17873: [branch-2.11] Ensure JDK8 compatibilty for Pulsar java clients

Posted by GitBox <gi...@apache.org>.
nicoloboschi commented on PR #17873:
URL: https://github.com/apache/pulsar/pull/17873#issuecomment-1260932820

   > Good catch. I think the master branch need this patch also.
   
   Yes, I added it in https://github.com/apache/pulsar/pull/17855


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org