RFR: 8165276: Spec states that invoke the premain method in an agent cl…

Serguei Spitsyn sspitsyn at openjdk.java.net
Tue Dec 8 11:46:36 UTC 2020


This change have been already reviewed by Mandy, Alan and David.
Now, the PR approval is needed.
The push was postponed because the CSR was not approved at that time (it is now):
   https://bugs.openjdk.java.net/browse/JDK-8248189
Investigation of existing popular java agents was requested by Joe.
----------

The java.lang.instrument spec:
  https://docs.oracle.com/en/java/javase/15/docs/api/java.instrument/java/lang/instrument/package-summary.html

Summary:
  The java.lang.instrument spec clearly states:
    "The agent class must implement a public static premain method
     similar in principle to the main application entry point."
  Current implementation of sun/instrument/InstrumentationImpl.java
  allows the premain method be non-public which violates the spec.
  This fix aligns the implementation with the spec.

Testing:
  A mach5 run of jdk_instrument tests is in progress.

-------------

Commit messages:
 - JDK-8165276 Spec states that invoke the premain method in an agent class if it's public but implementation differs

Changes: https://git.openjdk.java.net/jdk/pull/1694/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1694&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8165276
  Stats: 356 lines in 26 files changed: 251 ins; 56 del; 49 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1694.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1694/head:pull/1694

PR: https://git.openjdk.java.net/jdk/pull/1694


More information about the serviceability-dev mailing list