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

Introduce support for Java9/10/11 #155

Closed
wants to merge 22 commits into from

Conversation

ShawnLi-25
Copy link
Contributor

@ShawnLi-25 ShawnLi-25 commented Nov 26, 2020

This is the final cumulative PR for the whole feature. We also break it down into multiple small patches to be more readable for review.

Our work enables NonDex to support Java9/10/11 Maven projects. It's also compilable in either Java8 or Java9/10/11 environment. The result of our recent experiments on open-source project dataset proves that the tool works fine on both Java8 and Java9/10/11 projects.

The migration job can be broke down as the following:

  1. Use JRT filesystem to extract runtime classes to be instrumented in replace of rt.jar in Java9+
    (Reason: JRE images in Java9+ no longer contain the files lib/rt.jar, lib/tools.jar, lib/dt.jar, and other internal JAR files.)
  2. Implement custom Level class to replace java.util.logging.Level.
    (Reason: In Java 9+, the original logger java.util.logging has been separated into an isolated module called java.logging, and we can not access the logger in java.base module in Java 9+).
  3. Postpone NonDex initialization in ControlNondeterminism after VM is booted, otherwise we'll have ExceptionInInitializerError when instrumenting java.util.HashMap/concurrent.ConcurrentHashMap
    (Reason: Java9+ changes the implementation of VM.class that loads these class too early even during VM initPhase. Since NonDex instruments these classes, the accidental order of class loading will crash the JVM)
  4. Refactor Instrumenter.java to be workable with Java9+.
  5. Update related Maven plugins & Upgrade ASM5 to ASM9 to support later Java versions.

Please feel free to comment and follow up. Thank you!

@august782
Copy link
Contributor

Are the three pull requests #157, #158, #159 meant to subsume this pull request? Is there anything more in this pull request to be considered if the other three are all merged?

@ShawnLi-25
Copy link
Contributor Author

Are the three pull requests #157, #158, #159 meant to subsume this pull request? Is there anything more in this pull request to be considered if the other three are all merged?

Yes, the subsequent pull requests are subsumed to this one.
Yes, there are around 2 more pull requests to allow NonDex to work with Java9/10/11.

@@ -23,7 +32,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<version>2.22.2</version>

Choose a reason for hiding this comment

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

This is optional: you may want to use something like <surefire.version>2.22.2</surefire.version> in properties, and then use <version>${surefire.version}</version> for all occurrences.

And I am not sure whether using a more recent version would help, as discussed in #154 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right! We don't necessarily need to do this upgrade for Surefire here. I'll revert the changes here in the break-down PR.

@Anjiang-Wei
Copy link

Did your PRs pass the integration tests under nondex-maven-plugin/src/it/? After I git clone https://github.com/mojilin/NonDex, I found that I was only able to build from source after deleting those integration tests. I am not sure whether you also encounted the same issue.

@ShawnLi-25
Copy link
Contributor Author

Did your PRs pass the integration tests under nondex-maven-plugin/src/it/? After I git clone https://github.com/mojilin/NonDex, I found that I was only able to build from source after deleting those integration tests. I am not sure whether you also encounted the same issue.

I just pushed a new patch to deal with this issue on Ubuntu. Please check if it works in your dev environment.

@Anjiang-Wei
Copy link

It works in my dev environment. Thanks for your changes!

@august782
Copy link
Contributor

Should we be reviewing more this big PR? Is the intent to have more PRs that break down the functionality more, in addition to the #157, #158, #159 that are already submitted?

@ShawnLi-25
Copy link
Contributor Author

Should we be reviewing more this big PR? Is the intent to have more PRs that break down the functionality more, in addition to the #157, #158, #159 that are already submitted?

No, please check out the separate ones (i.e. #157, #158, #159). It'll be much better to review the separate PRs. I'll close this one later. And we plan to have 2 more PRs for the entire feature.

@pbludov
Copy link

pbludov commented Dec 2, 2021

@ShawnLi-25, do you plan to continue working on this PR? We are going to upgrade to JDK11 and the lack of support in NonDex is the only blocker.

@ShawnLi-25
Copy link
Contributor Author

ShawnLi-25 commented Dec 2, 2021 via email

@darko-marinov
Copy link
Contributor

@pbludov and @ShawnLi-25, we have added JDK11 support, for now just in 1.1.3-SNAPSHOT but we hope to release a new NonDex version to Maven Central soon.

@rnveach
Copy link

rnveach commented Oct 15, 2022

@darko-marinov Is there any plans to release this?

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

Successfully merging this pull request may close these issues.

7 participants