You are here: Home JastAdd Forums The JastAdd Extensible Java Compiler (JastAddJ) Compiling threadLocal objects
Document Actions

Compiling threadLocal objects

Up to The JastAdd Extensible Java Compiler (JastAddJ)

Compiling threadLocal objects

Posted by Malte Appeltauer at May 27. 2008

Hi,


I have trouble compiling classes with threadLocal objects. Here is an example
---------------------
private static final Obj myVar = new Obj();
private static ThreadLocal myThreadLocalVar = new ThreadLocal() {      
       protected Object initialValue() {
            return myVar;
        }
    };
----------------------
JastAdd doesn't generate the auxiliary class files. The (JastAdd) JavaCompiler doesn't complain but when I run the program with java the following error occurs:
  ------------------------
Exception in thread "main" java.lang.ClassFormatError: Catch type in exception table has bad constant type in class XXX
  ------------------------


Any ideas?
Cheers, Malte


Re: Compiling threadLocal objects

Posted by Torbjörn Ekman at May 27. 2008

Hi Malte,


I can unfortunately not reproduce the error. Could you please send me the source file, and generated erroneous bytecode? That would help enormously in debugging the problem.


Cheers
/Torbjorn


Powered by Ploneboard