Skip to content

Commit

Permalink
Unified representation of non-generic types to always represent non-g…
Browse files Browse the repository at this point in the history
…eneric types as explicitly non-generic.
  • Loading branch information
Rafael Winterhalter committed Oct 13, 2015
1 parent f230533 commit 12a4266
Show file tree
Hide file tree
Showing 6 changed files with 272 additions and 340 deletions.
Expand Up @@ -708,7 +708,7 @@ public ParameterList<ParameterDescription.InDefinedShape> getParameters() {

@Override
public GenericTypeList getExceptionTypes() {
return new GenericTypeList.LazyProjection.OfConstructorExceptionTypes(constructor);
return new GenericTypeList.OfConstructorExceptionTypes(constructor);
}

@Override
Expand Down Expand Up @@ -808,7 +808,7 @@ public ParameterList<ParameterDescription.InDefinedShape> getParameters() {

@Override
public GenericTypeList getExceptionTypes() {
return new GenericTypeList.LazyProjection.OfMethodExceptionTypes(method);
return new GenericTypeList.OfMethodExceptionTypes(method);
}

@Override
Expand Down Expand Up @@ -1139,7 +1139,7 @@ public TypeSubstituting(GenericTypeDescription declaringType,

@Override
public GenericTypeList getTypeVariables() {
return methodDescription.getTypeVariables().accept(new VariableRetainingDelegator());
return new GenericTypeList.ForDetachedTypes(methodDescription.getTypeVariables(), new VariableRetainingDelegator());
}

@Override
Expand All @@ -1154,7 +1154,7 @@ public ParameterList<?> getParameters() {

@Override
public GenericTypeList getExceptionTypes() {
return methodDescription.getExceptionTypes().accept(new VariableRetainingDelegator());
return new GenericTypeList.ForDetachedTypes(methodDescription.getExceptionTypes(), new VariableRetainingDelegator());
}

@Override
Expand Down Expand Up @@ -1281,7 +1281,7 @@ protected RetainedVariable(GenericTypeDescription typeVariable) {

@Override
public GenericTypeList getUpperBounds() {
return typeVariable.getUpperBounds().accept(VariableRetainingDelegator.this);
return new GenericTypeList.ForDetachedTypes(typeVariable.getUpperBounds(), VariableRetainingDelegator.this);
}

@Override
Expand Down
Expand Up @@ -284,7 +284,10 @@ abstract class AbstractBase extends ModifierReviewable.AbstractBase implements T

@Override
public GenericTypeDescription getSuperType() {
return LazyProjection.OfTransformedType.of(getDeclaredSuperType(), RawTypeWrapper.INSTANCE);
GenericTypeDescription superType = getDeclaredSuperType();
return superType == null
? TypeDescription.UNDEFINED
: superType.accept(RawTypeWrapper.INSTANCE);
}

/**
Expand All @@ -296,7 +299,7 @@ public GenericTypeDescription getSuperType() {

@Override
public GenericTypeList getInterfaces() {
return new GenericTypeList.OfTransformedTypes(getDeclaredInterfaces(), RawTypeWrapper.INSTANCE);
return new GenericTypeList.ForDetachedTypes(getDeclaredInterfaces(), RawTypeWrapper.INSTANCE);
}

/**
Expand Down Expand Up @@ -723,7 +726,7 @@ public GenericTypeDescription onTypeVariable(GenericTypeDescription typeVariable

@Override
public GenericTypeDescription onNonGenericType(GenericTypeDescription typeDescription) {
return new ForNonGenericType(typeDescription.asErasure());
return new ForNonGenericType.Latent(typeDescription.asErasure());
}

@Override
Expand Down Expand Up @@ -752,7 +755,7 @@ protected RawTypeVariable(GenericTypeDescription typeVariable) {

@Override
public GenericTypeList getUpperBounds() {
return new GenericTypeList.OfTransformedTypes(typeVariable.getUpperBounds(), RawTypeWrapper.INSTANCE);
return new GenericTypeList.ForDetachedTypes(typeVariable.getUpperBounds(), RawTypeWrapper.INSTANCE);
}

@Override
Expand Down Expand Up @@ -885,7 +888,7 @@ public GenericTypeDescription getDeclaredSuperType() {
public GenericTypeList getDeclaredInterfaces() {
return isArray()
? ARRAY_INTERFACES
: new GenericTypeList.LazyProjection.OfInterfaces(type);
: new GenericTypeList.OfLoadedInterfaceTypes(type);
}

@Override
Expand Down

0 comments on commit 12a4266

Please sign in to comment.