[antlr-interest] class loaders

Terence Parr parrt at cs.usfca.edu
Fri Aug 4 09:55:19 PDT 2006


  hi,

we have to discuss class loaders again ;)

Currently, I load error templates like this:

ClassLoader cl = Thread.currentThread().getContextClassLoader();
InputStream is = cl.getResourceAsStream(fileName);

Jean tells me that integrating with eclipse and Intellij requires  
that the class loader of the surrounding class be used:

InputStream is = ErrorManager.class.getClassLoader 
().getResourceAsStream(fileName);

  we are not sure why but it probably has something to do with  
different versions of ANTLR visible in the class path when embedded  
in other applications.

I know hibernate and other people have asked me to correct this  
previously in ANTLR.the " correct" method was as you see first above.

   So, what is the correct answer? do we need a flag that says which  
flavor to use?

Ter


More information about the antlr-interest mailing list