RE: trouble with LDC

dbrosIus <[email protected]> Sun, 08 Oct 2017 12:56:45 -0400
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
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