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

Allow to build Pulsar with JDK11 and -Dmaven.compiler.release=8 #9580

Merged
merged 2 commits into from
Feb 12, 2021

Conversation

eolivelli
Copy link
Contributor

Master Issue: #9578

Motivation

If you try to build Pulsar on JDK11 and add the --release flag to javac (that is -Dmaven.compiler.release=8 in Maven terms) you see errors due to some internal APIs that have been hidden to the user at build time.

Modifications

  • Fix usages of internal JRE APIs that are still accessible at runtime even on JDK11 but they are not visible at build time in JDK8
  • add tests

@SuppressWarnings("restriction")
private static sun.management.HotspotRuntimeMBean runtime;
private static Object /*sun.management.HotspotRuntimeMBean*/ runtime;
private static Method getTotalSafepointTimeHandle;
Copy link
Member

Choose a reason for hiding this comment

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

nit: naming this getTotalSafepointTimeMethod instead of *Handle? Since there's also java.lang.invoke.MethodHandle which is different than java.lang.reflect.Method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried with method hanldes but I was not able to access the method.
So I did fall back to old reflection style

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM

@aahmed-se
Copy link
Contributor

@eolivelli please follow up with an mr to update github workflows to use jdk11.

@eolivelli
Copy link
Contributor Author

@aahmed-se I wanted to do it, but in order to do it we have to work on the pulsar build images.
I will send a separate patch.

Please commit this first simple step

@eolivelli
Copy link
Contributor Author

/pulsarbot rerun-failure-tests

@merlimat merlimat added this to the 2.8.0 milestone Feb 12, 2021
@merlimat merlimat merged commit 731c18f into apache:master Feb 12, 2021
eolivelli added a commit to datastax/pulsar that referenced this pull request May 13, 2021
…he#9580)

* Allow to build Pulsar with JDK11 and -Dmaven.compiler.release=8

* fix style

Co-authored-by: Enrico Olivelli <eolivelli@apache.org>
(cherry picked from commit 731c18f)
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.

4 participants