[forge-dev] JavaType vs JavaSource

Antonio Goncalves antonio.mailing at gmail.com
Fri Mar 13 17:18:35 EDT 2015

Hi all,

I am having a look at some code and realize that I don't understand the
subtle difference between JavaType and JavaSource in certain cases. In some
visitor code (see below), I see :

JavaType<?> javaType = resource.getJavaType();

And other times I see :

JavaSource<?> javaSource = javaResource.getJavaType();

So I look at the code. JavaSource extends from JavaType, adds one method,
and then they both implement similar interfaces (JavaDocCapable vs

So, in the following example, why use JavaSource instead of JavaType ?


            public void visit(VisitContext context, JavaResource resource)
                  *JavaType<?> javaType = resource.getJavaType();*
                  if (javaType.isClass() &&
               catch (FileNotFoundException e)
                  // ignore

Antonio Goncalves
Software architect and Java Champion

Web site <http://www.antoniogoncalves.org/> | Twitter
<http://twitter.com/agoncal> | LinkedIn <http://www.linkedin.com/in/agoncal>
 | Paris JUG <http://www.parisjug.org/> | Devoxx France
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20150313/c7b3a8e8/attachment.html 

More information about the forge-dev mailing list