forked from JavaTX/JavaCompilerCore
refactoring and commenting
This commit is contained in:
parent
ea32cd5680
commit
a16e62f4bd
@ -17,15 +17,16 @@ public final class ExtendsType extends WildcardType {
|
||||
super("? extends " + extendedType.getName(), extendedType);
|
||||
}
|
||||
|
||||
/**
|
||||
* The extended type e.g. Integer in "? extends Integer"
|
||||
*/
|
||||
public UnifyType getExtendedType() {
|
||||
return wildcardedType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeParams getTypeParams() {
|
||||
return wildcardedType.getTypeParams();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type parameters of the wildcarded type and returns a new extendstype that extends that type.
|
||||
*/
|
||||
@Override
|
||||
public UnifyType setTypeParams(TypeParams newTp) {
|
||||
return new ExtendsType(wildcardedType.setTypeParams(newTp));
|
||||
|
@ -4,11 +4,23 @@ import java.util.Set;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
|
||||
/**
|
||||
* A super wildcard type e.g. ? super Integer.
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public final class SuperType extends WildcardType {
|
||||
|
||||
/**
|
||||
* Creates a new instance "? extends superedType"
|
||||
* @param superedType The type that is supered e.g. Integer in "? super Integer"
|
||||
*/
|
||||
public SuperType(UnifyType superedType) {
|
||||
super("? super " + superedType.getName(), superedType);
|
||||
}
|
||||
|
||||
/**
|
||||
* The type that is supered e.g. Integer in "? super Integer"
|
||||
*/
|
||||
public UnifyType getSuperedType() {
|
||||
return wildcardedType;
|
||||
}
|
||||
@ -18,11 +30,9 @@ public final class SuperType extends WildcardType {
|
||||
return "? super " + wildcardedType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeParams getTypeParams() {
|
||||
return wildcardedType.getTypeParams();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type parameters of the wildcarded type and returns a new supertype that supers that type.
|
||||
*/
|
||||
@Override
|
||||
public UnifyType setTypeParams(TypeParams newTp) {
|
||||
return new SuperType(wildcardedType.setTypeParams(newTp));
|
||||
|
@ -29,6 +29,14 @@ public abstract class WildcardType extends UnifyType {
|
||||
return wildcardedType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type parameters of the WILDCARDED TYPE.
|
||||
*/
|
||||
@Override
|
||||
public TypeParams getTypeParams() {
|
||||
return wildcardedType.getTypeParams();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return wildcardedType.hashCode() + getName().hashCode() + 17;
|
||||
|
Loading…
Reference in New Issue
Block a user