<div dir="ltr">But: Equality test is not going to work in all cases. Not all information from the source is compiled into the class file by the java compiler.  For example, erasure (generics) and SOURCE and CLASS RetentionPolicy on annotations.<div>
<br></div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Feb 23, 2013 at 3:07 PM, John Franey <span dir="ltr">&lt;<a href="mailto:jjfraney@gmail.com" target="_blank">jjfraney@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I agree.  Here is the impact on the implementation.<div><br></div><div>First, equals/hashcode cannot depend on internals of their class, instead they must be implemented in terms of the public methods of the java model interface.  JavaClassImplOne and JavaClassImplTwo would have different internal variables.</div>

<div><br></div><div>Second, equals cannot fail if the compared objects are not the same class, e.g. JavaClassImplOne and JavaClassImplTwo.  e.g., use other.isAssignable(JavaClass.class).</div><div><br></div>
<div>Third, equals/hashcode implementations that depend only on the methods of the java model api would probably not belong in the impl package.  They would probably be better located in the api package.   Then JavaClassImplTwo would not have to depend on impl.JavaClass to share equals/hashcode.  This would mean that some interfaces in api package would have to be abstract classes.</div>

<div><br></div><div>Others?</div><div><br></div><div>Thoughts?</div><div><br></div><div>Regards,</div><div>John</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sat, Feb 23, 2013 at 1:45 PM, George Gastaldi <span dir="ltr">&lt;<a href="mailto:ggastald@redhat.com" target="_blank">ggastald@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

IMHO, equals should return true in this case only if the class structure (including attributes, interfaces, methods) matches. The fact that a class is editable or not shouldn&#39;t matter in terms of comparison.<br>
<br>
Em 23/02/2013, ąs 15:38, John Franey &lt;<a href="mailto:jjfraney@gmail.com" target="_blank">jjfraney@gmail.com</a>&gt; escreveu:<br>
<div><div><br>
&gt;<br>
&gt; This is with respect to providing an alternate java model implementation for binary classes defined in other projects.<br>
&gt;<br>
&gt; Given two JavaClass with exactly the same java definition, but one comes from source code, and the other from a binary class file, (or in other terms, one is editable, the other is not), would (javaClass1.equals(javaClass2) == true)?<br>


&gt;<br>
&gt; It likely does not matter in practice.  The likelihood of a forge developer creating as source class with a definition exactly like a binary dependency seems very low, not impossible, but low.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; John<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; forge-dev mailing list<br>
&gt; <a href="mailto:forge-dev@lists.jboss.org" target="_blank">forge-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br>
<br>
_______________________________________________<br>
forge-dev mailing list<br>
<a href="mailto:forge-dev@lists.jboss.org" target="_blank">forge-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a></blockquote></div><br></div>
</div></div></blockquote></div><br></div>