Hi All,

Please review the updated webrev- http://cr.openjdk.java.net/~srastogi/8149574/webrev.07/

Changed the anonymous class package with no package name.

Regards,
Shilpi

On 5/11/2016 8:22 PM, Paul Sandoz wrote:
Hi Shilpi,

What makes me slightly queasy about the constant pool patching of T is it’s 
quite fragile and it produces a class with a slightly inconsistent state 
regarding the InnerClasses structures. It’s probably mostly harmless but still 
bothers me.

One solution is to combine ASM with constant pool patching. Use ASM to generate 
the class bytes, and query the constant pool in the ClassWriter, then remember 
the class bytes, the pool size, and index to patch (a cursory glance at 
ClassWriter suggests this is possible).

But i think Michael raises an important point about simplification using the 
default package, if that is possible. However, if the default package is to be 
used ASM is still required to generate class bytes and define the class 
anonymously within the scope of the host class. Thus in this approach the 
addition of patching should not add much more complexity and i think would be 
more in sync with that of the host class.

Paul.

On 11 May 2016, at 13:24, shilpi.rast...@oracle.com wrote:

Hi All,

Please review the following-

https://bugs.openjdk.java.net/browse/JDK-8149574

Solution: Changed anonymous class package name with the package name of its 
host class.

Two approaches to solve this-
1.  Parse .class and get the class name index form constant pool and patch it 
with new name
http://cr.openjdk.java.net/~srastogi/8149574/webrev.05/

2. Create class with new name (With ASM)
http://cr.openjdk.java.net/~srastogi/8149574/webrev.06/

Which approach is better?

Thanks,
Shilpi




Reply via email to