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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to