From 9baf89acc28616f77613d1935b6c376256b04af9 Mon Sep 17 00:00:00 2001 From: Etienne Zink Date: Sat, 19 Mar 2022 18:32:12 +0100 Subject: [PATCH] =?UTF-8?q?=C3=84nderung=20von=20hashCode()=20und=20equals?= =?UTF-8?q?(),=20in=20IntermediateGenericType=20und=20IntermediateRefType,?= =?UTF-8?q?=20auf=20Basis=20von=20getSignature()=20und=20nicht=20mehr=20ge?= =?UTF-8?q?tFullyQualifiedName().?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../types/IntermediateGenericType.java | 16 ++++++++-------- .../intermediate/types/IntermediateRefType.java | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateGenericType.java b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateGenericType.java index 9a36e566..f833d121 100644 --- a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateGenericType.java +++ b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateGenericType.java @@ -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 diff --git a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateRefType.java b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateRefType.java index 0f44ec3e..bba52531 100644 --- a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateRefType.java +++ b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateRefType.java @@ -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