<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>IMHO, there is a minor difference that may explain it. JavaType should be used when the object might be a compiled java type vs when you have the source code of a Java type (JavaSource). In practice they don't differ much but afaik this was the main difference.</div><div><br></div><div>PS: Roaster does not support parsing of compiled java types yet, but the model is ready for this feature when it becomes available.<br><br><br></div><div><br>Em 13/03/2015, às 18:19, Antonio Goncalves &lt;<a href="mailto:antonio.mailing@gmail.com">antonio.mailing@gmail.com</a>&gt; escreveu:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div><div>Hi all,</div><div><br></div><div>I am having a look at some code and realize that I don't understand the subtle difference between <font face="monospace, monospace">JavaType</font> and <font face="monospace, monospace">JavaSource</font>&nbsp;in certain cases. In some visitor code (see below), I see :</div><div><br></div><div><font face="monospace, monospace">JavaType&lt;?&gt; javaType = resource.getJavaType();<br></font></div><div><br></div><div>And other times I see :</div><div><br></div><div><font face="monospace, monospace">JavaSource&lt;?&gt; javaSource = javaResource.getJavaType();<br></font></div><div><br></div><div>So I look at the code. <font face="monospace, monospace">JavaSource</font> extends from <font face="monospace, monospace">JavaType</font>, adds one method, and then they both implement similar interfaces (<font face="monospace, monospace">JavaDocCapable</font> vs <font face="monospace, monospace">JavaDocCapableSource</font>).</div><div><br></div><div>So, in the following example, why use <font face="monospace, monospace">JavaSource</font> instead of <font face="monospace, monospace">JavaType</font> ?</div><div><br></div><div>Thanks</div><div>Antonio</div><div><br></div><div><font face="monospace, monospace">&nbsp;@Override</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void visit(VisitContext context, JavaResource resource)</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;try</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b><font color="#ff0000">JavaType&lt;?&gt; javaType = resource.getJavaType();</font></b></font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (javaType.isClass() &amp;&amp; !javaType.hasAnnotation(Entity.class) javaSource.hasAnnotation(MappedSuperclass.class))</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;classes.add(resource);</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;catch (FileNotFoundException e)</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // ignore</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</font></div><div><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font></div></div><div><br></div><div><br></div>-- <br><div class="gmail_signature">Antonio Goncalves&nbsp;<br>Software architect and Java Champion<br><br><a href="http://www.antoniogoncalves.org/" target="_blank">Web site</a>&nbsp;|&nbsp;<a href="http://twitter.com/agoncal" target="_blank">Twitter</a>&nbsp;|&nbsp;<a href="http://www.linkedin.com/in/agoncal" target="_blank">LinkedIn</a>&nbsp;|&nbsp;<a href="http://www.parisjug.org/" target="_blank">Paris JUG</a>&nbsp;|&nbsp;<a href="http://www.devoxx.fr/" target="_blank">Devoxx France</a></div>
</div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>forge-dev mailing list</span><br><span><a href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a></span><br><span><a href="https://lists.jboss.org/mailman/listinfo/forge-dev">https://lists.jboss.org/mailman/listinfo/forge-dev</a></span></div></blockquote></body></html>