[forge-users] support for nested classes.

Rudy De Busscher rdebusscher at gmail.com
Wed Feb 1 07:02:15 EST 2012


Hi Lincoln,

see  https://issues.jboss.org/browse/FORGE-471 with a rather extended
explanation.

Regards
Rudy

On 31 January 2012 18:50, Lincoln Baxter, III <lincolnbaxter at gmail.com>wrote:

> Hi Rudy,
>
> You're right: We don't yet have nested class support, and the top-level
> class is what should be returned, so I'm a bit surprised that this is what
> is happening. Do you know if this problem is caused by the JavaParser API
> or by the forge Resources API?
>
> Care to file an issue? Thanks!
>
> https://issues.jboss.org/browse/FORGE
>
> ~Lincoln
>
> On Tue, Jan 31, 2012 at 10:06 AM, Rudy De Busscher <rdebusscher at gmail.com>wrote:
>
>> Hi All,
>>
>> Seems that nested classes aren't handled correctly by forge.
>>
>> If you have a java source file like this
>>
>> public class CustomProjectStageHolder implements ProjectStageHolder
>> {
>>     public static final class CustomProjectStage extends ProjectStage
>>     {
>>         private static final long serialVersionUID = 1029094387976167179L;
>>     }
>>
>>     public static final CustomProjectStage CustomProjectStage = new CustomProjectStage();
>> }
>>
>>
>> And consider then following statements:
>>
>> JavaResource javaResource = factory.getResourceFrom(new File("/path/to/file/RudyHolder.java")).reify(JavaResource.class);
>>
>> javaResource.getJavaSource().getQualifiedName();
>>
>>
>> The javaResource is indeed pointing to the file, you can verify with javaResource.getFullyQualifiedName()
>>
>> But if you ask for the javaSource, as in the second statement, you get the nested class, CustomProjectStage in our example.
>>
>>
>> Relation between JavaResource and JavaSource indicates that multiple classes per java file wasn't considered.  And isn't common for entity classes etc that have to be handled by Forge.
>>
>> So when there are no plans in supporting this in Forge, isn't it logic to return the main class, instead of the nested class?
>>
>>
>> Thx for the clarification.
>>
>>
>> Regards
>>
>> Rudy
>>
>>
>>
>> --
>>
>> Rudy De Busscher
>> http://www.c4j.be
>>
>>
>> _______________________________________________
>> forge-users mailing list
>> forge-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/forge-users
>>
>>
>
>
> --
> Lincoln Baxter, III
> http://ocpsoft.com
> http://scrumshark.com
> "Keep it Simple"
>
> _______________________________________________
> forge-users mailing list
> forge-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-users
>
>


-- 
Rudy De Busscher
http://www.c4j.be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-users/attachments/20120201/95972410/attachment.html 


More information about the forge-users mailing list