private constructors for generated classes

christian.humer at gmail.com christian.humer at gmail.com
Tue Apr 14 10:12:45 UTC 2015


Hi,

There is no way to make the node constructors public with an annotation. 
For quick experiments I usually copy the generated code and alter it or 
directly or you can modify the generator code. You can alter 
NodeFactoryFactory#createFactoryMethods and modify the line:

ElementUtils.setVisibility(constructor.getModifiers(), 
Modifier.PRIVATE);
to
ElementUtils.setVisibility(constructor.getModifiers(), Modifier.PUBLIC);
to make the node constructors visible.

Happy experimenting.

- Christian Humer




------ Original Message ------
From: "Yanlin Wang" <huohuohuomumu at gmail.com>
To: graal-dev at openjdk.java.net
Sent: 14.04.2015 09:53:44
Subject: private constructors for generated classes

>I noticed that when using Truffle, constructors for generated classes 
>are private by default.
>For example, in the “mumbler” tutorial 
>(http://cesquivias.github.io/blog/2014/12/02/writing-a-language-in-truffle-part-2-using-truffle-and-graal/#installing-graal--truffle), 
>  the generated class DefineNodeGen has a private constructor.
>
>But for for some special experiments, I want to use these constructors 
>directly. Is there any way (truffle annotations) I can use to make 
>these constructors public? Thanks :)
>
>Regards,
>Grace
>



More information about the graal-dev mailing list