Skip to content

Commit

Permalink
Fix Equals generation for Java Protocol Classes (#3092)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierredebelen authored Sep 16, 2024
1 parent d360a4f commit deba37c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ function <<access.private>> meta::protocols::generation::java::generateEquals(ba
j_declare($variable, $parameter->j_cast($base)),
j_return($c->hierarchicalProperties()->fold({p,a|
let propertyType = javaObject();//pureTypeToJavaType($conventions, $p);
let eq =if ($p->functionReturnType().rawType->isNotEmpty() && $p->functionReturnType().rawType->toOne()->instanceOf(meta::pure::metamodel::type::PrimitiveType) && $p->functionReturnMultiplicity()->isToOne(),
let eq =if(pureTypeToJavaType($conventions, $p->functionReturnType().rawType->toOne(), $p->functionReturnMultiplicity())->isPrimitive(),
|j_eq(
j_field(j_this($base), $p.name->toOne(), $propertyType),
j_field($variable, $p.name->toOne(), $propertyType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ function <<test.Test>> meta::protocols::generation::java::tests::objectMethodsIm
' return false;\n'+
' }\n'+
' SubType that = (SubType) obj;\n'+
' return this.prop == that.prop && this.other == that.other;\n'+
' return this.prop == that.prop && Objects.equals(this.other, that.other);\n'+
' }\n'+
'\n'+
' public String toString()\n'+
Expand Down

0 comments on commit deba37c

Please sign in to comment.