Skip to content

Commit

Permalink
Fixed resolution of type variables for transformed methods and fields…
Browse files Browse the repository at this point in the history
… which was based on the declaring type rather than the instrumented type. As a result, resolved type variables could not be found or were found incorrectly.
  • Loading branch information
raphw committed Aug 1, 2016
1 parent f3da996 commit f63611e
Show file tree
Hide file tree
Showing 15 changed files with 274 additions and 266 deletions.
@@ -1,7 +1,6 @@
package net.bytebuddy.description;

import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.type.TypeDefinition;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.description.type.TypeList;

Expand Down Expand Up @@ -69,10 +68,10 @@ interface Visitor<T> {
/**
* Applies the visitor on a type.
*
* @param typeDefinition The type onto which this visitor is applied.
* @param typeDescription The type onto which this visitor is applied.
* @return The visitor's return value.
*/
T onType(TypeDefinition typeDefinition);
T onType(TypeDescription typeDescription);

/**
* Applies the visitor on a method.
Expand All @@ -93,8 +92,8 @@ enum NoOp implements Visitor<TypeVariableSource> {
INSTANCE;

@Override
public TypeVariableSource onType(TypeDefinition typeDefinition) {
return typeDefinition;
public TypeVariableSource onType(TypeDescription typeDescription) {
return typeDescription;
}

@Override
Expand Down
Expand Up @@ -649,7 +649,7 @@ private static boolean isAnnotationType(TypeDescription annotationType, Annotati
public TypeVariableSource getEnclosingSource() {
return isStatic()
? TypeVariableSource.UNDEFINED
: getDeclaringType();
: getDeclaringType().asErasure();
}

@Override
Expand Down
Expand Up @@ -2,7 +2,6 @@

import net.bytebuddy.description.ModifierReviewable;
import net.bytebuddy.description.NamedElement;
import net.bytebuddy.description.TypeVariableSource;
import net.bytebuddy.description.field.FieldList;
import net.bytebuddy.description.method.MethodList;
import net.bytebuddy.implementation.bytecode.StackSize;
Expand All @@ -14,7 +13,7 @@
/**
* Implementations define a type, either as a {@link TypeDescription} or as a {@link TypeDescription.Generic}.
*/
public interface TypeDefinition extends NamedElement, TypeVariableSource, ModifierReviewable.ForTypeDefinition, Iterable<TypeDefinition> {
public interface TypeDefinition extends NamedElement, ModifierReviewable.ForTypeDefinition, Iterable<TypeDefinition> {

/**
* Returns this type definition as a generic type.
Expand Down

0 comments on commit f63611e

Please sign in to comment.