Re: trouble with LDC

Simon IJskes <[email protected]> Sun, 8 Oct 2017 18:59:44 +0200
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
I can see the owner in the constant pool, with an index unused in the 
code, so i guess at runtime the jvm verifies via the constant pool as well.

On 08-10-17 18:56, dbrosIus wrote:
> What's worse is the same thing happens for static final fields from 
> other classes, so you can never know for sure.
> 
> -------- Original message --------
> From: Simon IJskes <[email protected]>
> Date: 10/8/17 11:57 AM (GMT-05:00)
> To: [email protected]
> Subject: [asm] trouble with LDC
> 
> Hi,
> 
> i'm making a dependency verifier based on ASM6.0.
> 
> I'm using class files generated by 1.8.0_144.
> 
> // adhoq example:
> 
> class C {
> static String c = "abc" ;
> }
> 
> class R {
> 
> public void method()
> {
> String s = C.s ;
> }
> 
> } ;
> 
> When R is parsed by ClassReader, ending up in MethodVisitor, the
> 
>       public void visitLdcInsn( Object cst )
> 
> is passed a String with the value "abc". No way for the visitor to find
> out its 'owner' was C. The javap disassembly reveals:
> 
> ldc           #7
> 
> constant pool:
> #7 = String #74
> #74 = Utf8  abc
> 
> so, indeed no ref to the owner C.
> 
> i think, the only way to accurately verify the dependency is by walking
> the constant pool. but how to access these? any hints? other ways to
> find the owner?
> 
> Thanks,
> Simon
> 
> 
> -- 
> You receive this message as a subscriber of the [email protected] mailing list.
> To unsubscribe: mailto:[email protected]
> For general help: mailto:[email protected]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws


-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws