diff --git a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateExtendsWildcard.java b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateExtendsWildcard.java index b4f575977..eda1eafd2 100644 --- a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateExtendsWildcard.java +++ b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateExtendsWildcard.java @@ -8,6 +8,30 @@ import de.dhbwstuttgart.parser.scope.JavaClassName; * @since Studienarbeit Type Erasure * @author etiennezink */ -public final class IntermediateExtendsWildcard { +public final class IntermediateExtendsWildcard extends IntermediateType { //ToDo + + public IntermediateExtendsWildcard(JavaClassName className) { + super(className); + } + + @Override + public boolean equals(Object o) { + return false; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public String getSignature() { + return null; + } + + @Override + public String getDescriptor() { + return null; + } } diff --git a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateGenericType.java b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateGenericType.java index 053cd0db3..9a36e5664 100644 --- a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateGenericType.java +++ b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateGenericType.java @@ -38,24 +38,6 @@ public final class IntermediateGenericType extends IntermediateType { this.genericName = genericName; } - @Override - public String getSignature() { - String signature = this.signature; - if (!signature.equals("")) return this.signature; - signature += String.format("T%s;", genericName); - this.signature = signature; - return signature; - } - - @Override - public String getDescriptor() { - String descriptor = this.descriptor; - if (!descriptor.equals("")) return this.descriptor; - descriptor = String.format("L%s;", getFullyQualifiedName()).replace('.','/'); - this.descriptor = descriptor; - return descriptor; - } - @Override public boolean equals(Object o) { if (!(o instanceof IntermediateGenericType)) return false; @@ -78,6 +60,24 @@ public final class IntermediateGenericType extends IntermediateType { return result; } + @Override + public String getSignature() { + String signature = this.signature; + if (!signature.equals("")) return this.signature; + signature += String.format("T%s;", genericName); + this.signature = signature; + return signature; + } + + @Override + public String getDescriptor() { + String descriptor = this.descriptor; + if (!descriptor.equals("")) return this.descriptor; + descriptor = String.format("L%s;", getFullyQualifiedName()).replace('.','/'); + this.descriptor = descriptor; + return descriptor; + } + public String getGenericName() { return genericName; } diff --git a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateRefType.java b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateRefType.java index f8b908b99..c121becb9 100644 --- a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateRefType.java +++ b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateRefType.java @@ -39,6 +39,33 @@ public final class IntermediateRefType extends IntermediateType{ this.typParameters = Collections.unmodifiableList(typParameters); } + @Override + public boolean equals(Object o) { + if (!(o instanceof IntermediateRefType)) return false; + + IntermediateRefType intermediateRefType = (IntermediateRefType) o; + if(!getFullyQualifiedName().equals(intermediateRefType.getFullyQualifiedName())) return false; + + for(int index = 0; index < typParameters.size(); index++){ + if(!typParameters.get(index).equals(intermediateRefType.typParameters.get(index))) return false; + } + return true; + } + + @Override + public int hashCode() { + int prime = 31; + int result = hashCode; + if (result == 0){ + result += getFullyQualifiedName().hashCode(); + for (IntermediateType typeParameter:typParameters) { + result = prime * result + typeParameter.hashCode(); + } + hashCode = result; + } + return result; + } + @Override public String getSignature() { String signature = this.signature; @@ -70,33 +97,6 @@ public final class IntermediateRefType extends IntermediateType{ return descriptor; } - @Override - public boolean equals(Object o) { - if (!(o instanceof IntermediateRefType)) return false; - - IntermediateRefType intermediateRefType = (IntermediateRefType) o; - if(!getFullyQualifiedName().equals(intermediateRefType.getFullyQualifiedName())) return false; - - for(int index = 0; index < typParameters.size(); index++){ - if(!typParameters.get(index).equals(intermediateRefType.typParameters.get(index))) return false; - } - return true; - } - - @Override - public int hashCode() { - int prime = 31; - int result = hashCode; - if (result == 0){ - result += getFullyQualifiedName().hashCode(); - for (IntermediateType typeParameter:typParameters) { - result = prime * result + typeParameter.hashCode(); - } - hashCode = result; - } - return result; - } - public int getTypParameterSize(){ return typParameters.size(); } /** diff --git a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateSuperWildcard.java b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateSuperWildcard.java index 1fe48acee..42fdaf370 100644 --- a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateSuperWildcard.java +++ b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateSuperWildcard.java @@ -8,6 +8,30 @@ import de.dhbwstuttgart.parser.scope.JavaClassName; * @since Studienarbeit Type Erasure * @author etiennezink */ -public final class IntermediateSuperWildcard { +public final class IntermediateSuperWildcard extends IntermediateType { //ToDo + + public IntermediateSuperWildcard(JavaClassName className) { + super(className); + } + + @Override + public boolean equals(Object o) { + return false; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public String getSignature() { + return null; + } + + @Override + public String getDescriptor() { + return null; + } }