Bug in org.objectweb.asm.util.CheckClassAdapter.visitInnerClass() regarding inner class name
The latest asm release throws the following Exception.
> Exception in thread "main" java.lang.IllegalArgumentException: Invalid inner
class name (must be a valid Java identifier): 1
> at
org.objectweb.asm.util.CheckMethodAdapter.checkIdentifier(CheckMethodAdapter.java:1102)
> at
org.objectweb.asm.util.CheckMethodAdapter.checkIdentifier(CheckMethodAdapter.java:1078)
> at
org.objectweb.asm.util.CheckClassAdapter.visitInnerClass(CheckClassAdapter.java:443)
> at org.objectweb.asm.ClassReader.accept(ClassReader.java:655)
> at org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
> at main.ClassInstrumenter.instrumentClass(ClassInstrumenter.java:35)
> at main.PathTraversal.processTargetJar(PathTraversal.java:27)
> at main.PathTraversal.instrument(PathTraversal.java:73)
> at main.Main.main(Main.java:123)
Relevant to this exception is:
> http://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html#jls-13.1
This happens due to CheckMethodAdapter.checkIdentifier(), which expects the
*simple* name of a local or anonymous class to be a "valid java identifier".
This is checked by you with:
> Character.isJavaIdentifierStart()
and
> Character.isJavaIdentifierPart()
But (simple) binary names of local classes start with a sequence of digits
before the actual java identifier follows. Binary names of anonymous classes
only consist of the digit sequence.
I would like to have a patch submitted, but how this should be actually designed
is left up to you. My idea is to add an additional method for checking internal
and anonymous class names.