[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    Re: Missing EnclosingMethod attribute in JvmtiClassFileReconstituter.cpp
From:       David Holmes <david.holmes () oracle ! com>
Date:       2023-03-27 2:31:55
Message-ID: ac77814d-09a4-caff-047f-edb6cbef7100 () oracle ! com
[Download RAW message or body]

Hi Manuel,

On 14/02/2023 9:14 pm, Manuel Álvarez Álvarez wrote:
> Dear all,
> 
> When dealing with enclosed classes, frameworks like bytebuddy use the 
> EnclosingMethod attribute in order to discover generic type argument 
> bounds. When retransforming a class, the  JvmtiClassFileReconstituter.cpp 
> omits the enclosing attributes (they are available in the 
> java.lang.Class object) so the bytes received by the transformer are 
> missing the attribute potentially causing issues downstream.
> 
> Are there any strong reasons why these attributes are not written by the 
> JvmtiClassFileReconstituter?

I can't find anything specific about why this is missing, just a general 
note in the JVMTI spec for retransformClasses that some attributes may 
be missing:

"The initial class file bytes represent the bytes passed to 
ClassLoader.defineClass or RedefineClasses (before any transformations 
were applied), however they may not exactly match them. The constant 
pool may differ in ways described in GetConstantPool. Constant pool 
indices in the bytecodes of methods will correspond. Some attributes may 
not be present."

I suspect the omission is simply because this is not an attribute that 
the VM uses in any way.

Others may have more insight.

Cheers,
David

> Kind regards and thank you in advance,
> 
> Manuel.
> 
> 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic