synchronized(this) block causes: java.lang.ClassFormatError: Illegal exception table range in class file
I am using the bytecode outliner plugin in Eclispe to create ASM code from java
code. I am using ASM v2.
I have some code that works fine. If I then add a synchronized(this) block into
the code and use the resulting ASM code generated from the bytecode outliner I
get the following exception.
Exception in thread "main" java.lang.ClassFormatError: Illegal exception table
range in class file app/data/EBug$$EntityBean
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at
The Java code this is based on is:
private Object ebeanGetIdentity() {
if (ebeanIdentity != null || getId() == null) {
if (ebeanIdentity == null) {
synchronized(this) {
//if (ebeanIdentity == null){
ebeanIdentity = new Object();
//}
}
}
return ebeanIdentity;
}
return getId();
}
If I comment out the synchronized(this) { and its closing } then the resulting
ASM code works fine. Putting back the synchronized block and I get the
exception above.
I will upload a file that has the resulting ASM code in two methods. One of
the methods works (no synchronized) and the other results in the exception above.
thanks, Rob.