I am using ASM 4.0 and have encountered a strange problem with org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.class class from JBoss distribution
The problem is that after no-op transformation one of the methods of this class,
public synchronized byte[]
org$jboss$jms$client$delegate$ClientClusteredConnectionFactoryDelegate$getClientAOPStack$aop()
has the following
LineNumberTable:
line 232: 0
line 240: 52
line 242: 77
LocalVariableTable:
Start Length Slot Name Signature
52 -52 2 aopStackProvider
Lorg/jboss/jms/delegate/ConnectionFactoryDelegate;
0 0 2 e
Lorg/jboss/jms/exception/MessagingNetworkFailureException;
36 -36 1 server I
0 0 0 this
Lorg/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate;
And before transformation those were:
LineNumberTable:
line 232: 0
line 234: 34
line 238: 45
line 240: 52
line 242: 77
line 244: 84
line 246: 85
line 234: 116
line 250: 122
LocalVariableTable:
Start Length Slot Name Signature
52 32 2 aopStackProvider
Lorg/jboss/jms/delegate/ConnectionFactoryDelegate;
85 31 2 e
Lorg/jboss/jms/exception/MessagingNetworkFailureException;
36 86 1 server I
0 132 0 this
Lorg/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate;
As a result I have
java.lang.ClassFormatError: Invalid length 65484 in LocalVariableTable
in class file org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate
Can anyone help me with this problem?
A colleague of mine found out the following: If for some reason, in the original bytecode LocalVariableTable contains invalid offsets, which point not at the end of the instruction, but in the middle of it, then after visiting by ASM, one gets negative offsets. The solution would be either to strip off debug information completely, by using ClassReader.SKIP_DEBUG option of ASM. Or to detect when ASM cannot determine the end offset of the local variable and to skip that particular variable in
visitLocalVariablemethod ofMethodAdapter