Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8165276 Spec states to invoke the premain method in an agent class if it's public but implementation differs
  3. JDK-8250552

Release Note: Requirements of an Agent's premain Method Changed to Conform to the Specification

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: P4
    • Resolution: Delivered
    • Affects Version/s: 17
    • Fix Version/s: 17
    • Component/s: core-svc

      Description

      The `java.lang.instrument` implementation has been changed in this release to require that agent `premain` and `agentmain` methods are public. The specification has always required this, but it was not enforced. Attempting to run with an agent where these methods are not public will fail with an exception such as:

      `java.lang.IllegalAccessException: method <fully-qualified-class-name>.premain must be declared public`.

      A related change in this release is that the `premain` and `agentmain` methods must be defined in the agent class. The implementation no longer searches for these methods in superclasses.



        Attachments

          Activity

            People

            Assignee:
            sspitsyn Serguei Spitsyn
            Reporter:
            mwthomps Marty Thompson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: