Hinzufügen der extends-Beziehung von IntermediateExtendsWildcard und IntermediateSuperWildcard zu IntermediateType, ohne Implementierungen.

This commit is contained in:
Etienne Zink 2022-03-19 18:16:50 +01:00
parent 36ef1e124a
commit df4faebd92
4 changed files with 95 additions and 47 deletions

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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(); }
/**

View File

@ -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;
}
}