Änderung von hashCode() und equals(), in IntermediateGenericType und IntermediateRefType, auf Basis von getSignature() und nicht mehr getFullyQualifiedName().

This commit is contained in:
Etienne Zink 2022-03-19 18:32:12 +01:00
parent be307e95a6
commit 9baf89acc2
2 changed files with 15 additions and 15 deletions

View File

@ -43,21 +43,21 @@ public final class IntermediateGenericType extends IntermediateType {
if (!(o instanceof IntermediateGenericType)) return false;
IntermediateGenericType intermediateGenericType = (IntermediateGenericType) o;
if(!getFullyQualifiedName().equals(intermediateGenericType.getFullyQualifiedName())) return false;
if(!genericName.equals(intermediateGenericType.getGenericName())) return false;
if(!getSignature().equals(intermediateGenericType.getSignature())) return false;
if(!genericName.equals(intermediateGenericType.genericName)) return false;
return true;
}
@Override
public int hashCode() {
int prime = 31;
int result = hashCode;
if (result == 0){
result += getFullyQualifiedName().hashCode();
result = prime * result + genericName.hashCode();
hashCode = result;
int hashCode = this.hashCode;
if (hashCode == 0){
hashCode += getSignature().hashCode();
hashCode = prime * hashCode + genericName.hashCode();
this.hashCode = hashCode;
}
return result;
return hashCode;
}
@Override

View File

@ -44,7 +44,7 @@ public final class IntermediateRefType extends IntermediateType{
if (!(o instanceof IntermediateRefType)) return false;
IntermediateRefType intermediateRefType = (IntermediateRefType) o;
if(!getFullyQualifiedName().equals(intermediateRefType.getFullyQualifiedName())) return false;
if(!getSignature().equals(intermediateRefType.getSignature())) return false;
for(int index = 0; index < typParameters.size(); index++){
if(!typParameters.get(index).equals(intermediateRefType.typParameters.get(index))) return false;
@ -55,15 +55,15 @@ public final class IntermediateRefType extends IntermediateType{
@Override
public int hashCode() {
int prime = 31;
int result = hashCode;
if (result == 0){
result += getFullyQualifiedName().hashCode();
int hashCode = this.hashCode;
if (hashCode == 0){
hashCode += getSignature().hashCode();
for (IntermediateType typeParameter:typParameters) {
result = prime * result + typeParameter.hashCode();
hashCode = prime * hashCode + typeParameter.hashCode();
}
hashCode = result;
this.hashCode = hashCode;
}
return result;
return hashCode;
}
@Override