[groovy-dev] CompileUnit and ClassLoader

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[groovy-dev] CompileUnit and ClassLoader

Jochen Theodorou
Hi,

CompileUnit does take a ClassLoader in constructor, I would like to
change this to GroovyClassLoader. It would simplify some things. So I am
asking if there is a special reason that this Class is taking ClassLoader.

bye blackdrag
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [groovy-dev] CompileUnit and ClassLoader

Jeremy Rayner
Apart from obvious best practice of generalisation,

*inside the constructor of ProcessingUnit we have...
         this.classLoader = (classLoader == null ? new
GroovyClassLoader(parent, configuration) : classLoader);

So... CompilationUnit could be initialised with a non
GroovyClassLoader, and this is
one of the callers of the CompileUnit constructor


* org.codehaus.groovy.classgen.TestSupport.java uses it, I imagine
without specifying GroovyClassLoader.


Hope these help,

As to the _actual_ reason... Best ask James :-)

Jez.


On 11/2/05, Jochen Theodorou <[hidden email]> wrote:
> Hi,
>
> CompileUnit does take a ClassLoader in constructor, I would like to
> change this to GroovyClassLoader. It would simplify some things. So I am
> asking if there is a special reason that this Class is taking ClassLoader.
>
> bye blackdrag
>


--
Groovy JSR Co-Spec Lead
http://javanicus.com/blog2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [groovy-dev] CompileUnit and ClassLoader

Hein Meling-2
In reply to this post by Jochen Theodorou
I think it is ok, for the parts I'm concerned with; namely the eclipse
plugin and the groovyc ant task.  Be aware you'll also have to change
this in CompilationUnit and maybe elsewhere, I think.

Hein

On Wed, 2005-11-02 at 12:30 +0100, Jochen Theodorou wrote:
> Hi,
>
> CompileUnit does take a ClassLoader in constructor, I would like to
> change this to GroovyClassLoader. It would simplify some things. So I am
> asking if there is a special reason that this Class is taking ClassLoader.
>
> bye blackdrag
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [groovy-dev] CompileUnit and ClassLoader

Jochen Theodorou
Hein Meling schrieb:

> I think it is ok, for the parts I'm concerned with; namely the eclipse
> plugin and the groovyc ant task.  Be aware you'll also have to change
> this in CompilationUnit and maybe elsewhere, I think.

ProcessingUnit too ;)

bye blackdrag
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [groovy-dev] CompileUnit and ClassLoader

Jochen Theodorou
In reply to this post by Jeremy Rayner
Jeremy Rayner schrieb:

> Apart from obvious best practice of generalisation,
>
> *inside the constructor of ProcessingUnit we have...
>          this.classLoader = (classLoader == null ? new
> GroovyClassLoader(parent, configuration) : classLoader);
>
> So... CompilationUnit could be initialised with a non
> GroovyClassLoader, and this is
> one of the callers of the CompileUnit constructor

yes, but is it needed... or better is it useful? The common usecase is
to use a GroovyClassLoader it seems. I think this awas only because of
the CompilerClasLoader we had.

> * org.codehaus.groovy.classgen.TestSupport.java uses it, I imagine
> without specifying GroovyClassLoader.

it uses the parent of the GroovyClassLoader... and that part is makred
as possible bug if I remember right.

> As to the _actual_ reason... Best ask James :-)

ok, I hope I'll get an answer ;)

bye blackdrag
Loading...