Skip to content

Commit

Permalink
Fix equality on BISerializable
Browse files Browse the repository at this point in the history
If used in a GlobalBindings in multiple schema files, it might lead to an error caused by XJC thinking there are multiple different GlobalBinding definitions.

See Github issue 687.

Signed-off-by: Bjørn Mølgård Vester <[email protected]>
  • Loading branch information
bjornvester authored and lukasj committed Sep 3, 2021
1 parent 1b47ba8 commit e1151f0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,6 @@ public boolean isEqual(BIGlobalBinding b) {
this.fixedAttributeAsConstantProperty == b.fixedAttributeAsConstantProperty &&
this.generateEnumMemberName == b.generateEnumMemberName &&
this.codeGenerationStrategy == b.codeGenerationStrategy &&
this.serializable == b.serializable &&
this.superClass == b.superClass &&
this.superInterface == b.superInterface &&
this.generateElementClass == b.generateElementClass &&
Expand All @@ -552,6 +551,7 @@ public boolean isEqual(BIGlobalBinding b) {
isEqual(this.noUnmarshaller, b.noUnmarshaller) &&
isEqual(this.noValidator, b.noValidator) &&
isEqual(this.noValidatingUnmarshaller, b.noValidatingUnmarshaller) &&
isEqual(this.serializable, b.serializable) &&
isEqual(this.typeSubstitution, b.typeSubstitution) &&
isEqual(this.simpleMode, b.simpleMode) &&
isEqual(this.enumBaseTypes, b.enumBaseTypes) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package com.sun.tools.xjc.reader.xmlschema.bindinfo;

import jakarta.xml.bind.annotation.XmlAttribute;
import java.util.Objects;


/**
Expand All @@ -26,4 +27,17 @@ public final class BISerializable {
/** serial version UID, or null to avoid generating the serialVersionUID field. */
@XmlAttribute
public Long uid;

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BISerializable that = (BISerializable) o;
return Objects.equals(uid, that.uid);
}

@Override
public int hashCode() {
return Objects.hash(uid);
}
}

0 comments on commit e1151f0

Please sign in to comment.