java - How to inspect runtime annotations with javassist -



java - How to inspect runtime annotations with javassist -

when attempting inspect code @ runtime using javassist need @ annotations. simple example:

classpool pool = classpool.getdefault(); ctclass clazz = pool.getctclass("org.junit.test"); boolean found = false; (object annotation : clazz.getavailableannotations()) { if ("java.lang.annotation.target".equals(annotation.getclass().getname())) { found = true; } }

the problem code never sets found = true. annotation classes returned are:

com.sun.proxy.$proxy8 com.sun.proxy.$proxy9

any thought how actual annotations rather proxies? or how 1 actual annotation proxy?

annotation objects not direct instances of annotation type, instances of (proxy in case) object implements annotation interface.

try if (annotation instanceof java.lang.annotation.target)

java javassist

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -