Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-331

Byteman should enable references to unexported module-public classes from compiled rules

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 4.0.0-BETA3
    • 4.0.0-BETA2
    • None
    • None

    Description

      The Byteman compiler translates rules to bytecode which is attached to a class located in the unnamed module. This means that the generated bytecode may not reference public classes that are not generally exported by their containing module. To understand the distinction consider the expression

      BIND

      u = jdk.internal.misc.Unsafe.theUnsafe

      The value used to initialise variable u is of type Unsafe. While Unsafe is indeed a public type it is not exported to the unnamed module. As a consequence, the generated bytecode suffers a verifier error at any point when the value u is consumed.

      A poor solution to this problem would be to type the value as Object and perform accesses using reflection wherever possible. A better solution might be to generate the bytecode attached to a class located in a module dynamically created by Byteman to which the necessary packages were exported.

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-adinn Andrew Dinn
              rhn-engineering-adinn Andrew Dinn
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: