Search code examples
javaeclipsedebuggingreflectionbreakpoints

Error debugging CGLIB FastClass on eclipse


I'm trying to debug an java eclipse project with some problem!

I'm starting using CGLIB to make faster reflection calls using the index metod.

example

FastClass fastClass = FastClass.create(getClass());
int index = fastClass.getIndex("methodName", new Class[] { Object.class });
fastClass.invoke(index, this, new Object[] { obj } );

now when i try to put a breakpoint into a class that is called by fastreflection method this is the eclipse output.

Breakpoint output

I try to change compiler option on generate line number with no results.

I also upload an eclipse project (built with Juno version) that replicates the problem!!

http://www.filefactory.com/file/4zryz3gjgbyh/n/FastDebug.rar

Thanks!


Solution

  • I "resolved"(understand) the problem, but it is not a problem with Eclipse. When you launch the program this line: FastClass.create(ReflectionTarget.class); ends up creating an entirely new version of the compiled class removing all non-essential stuff from the classfile to make it "fast" - that includes all the line number / debug infos, which means the breakpoint cannot be set in it.

    http://cglib.sourceforge.net/xref/net/sf/cglib/core/package-summary.html

    There's no javadoc and you need to read the source but now i understand this is not a problem but a feature of this method to make fast reflection!