Skip to content

Commit

Permalink
Added adjustment in type pool to consider interface bound.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Jan 11, 2016
1 parent d96b431 commit 4a7ca30
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 26 deletions.
51 changes: 50 additions & 1 deletion byte-buddy-dep/src/main/java/net/bytebuddy/pool/TypePool.java
Expand Up @@ -4058,6 +4058,8 @@ protected interface GenericTypeToken {
*/ */
Generic toGenericType(TypePool typePool, TypeVariableSource typeVariableSource, String typePath, Map<String, List<AnnotationToken>> annotationTokens); Generic toGenericType(TypePool typePool, TypeVariableSource typeVariableSource, String typePath, Map<String, List<AnnotationToken>> annotationTokens);


boolean isPrimaryBound(TypePool typePool);

interface OfFormalTypeVariable { interface OfFormalTypeVariable {


Generic toGenericType(TypePool typePool, Generic toGenericType(TypePool typePool,
Expand Down Expand Up @@ -4171,6 +4173,11 @@ public Generic toGenericType(TypePool typePool, TypeVariableSource typeVariableS
typeDescription); typeDescription);
} }


@Override
public boolean isPrimaryBound(TypePool typePool) {
throw new IllegalStateException("A primitive type cannot be a type variable bound: " + this);
}

@Override @Override
public String toString() { public String toString() {
return "TypePool.LazyTypeDescription.GenericTypeToken.ForPrimitiveType." + name(); return "TypePool.LazyTypeDescription.GenericTypeToken.ForPrimitiveType." + name();
Expand Down Expand Up @@ -4232,6 +4239,11 @@ public Generic toGenericType(TypePool typePool,
: annotationTokens); : annotationTokens);
} }


@Override
public boolean isPrimaryBound(TypePool typePool) {
throw new IllegalStateException("A wildcard type cannot be a type variable bound: " + this);
}

@Override @Override
public String toString() { public String toString() {
return "TypePool.LazyTypeDescription.GenericTypeToken.ForUnboundWildcard." + name(); return "TypePool.LazyTypeDescription.GenericTypeToken.ForUnboundWildcard." + name();
Expand Down Expand Up @@ -4915,6 +4927,11 @@ public Generic toGenericType(TypePool typePool, TypeVariableSource typeVariableS
typePool.describe(name).resolve()); typePool.describe(name).resolve());
} }


@Override
public boolean isPrimaryBound(TypePool typePool) {
return !typePool.describe(name).resolve().isInterface();
}

@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
return this == other || !(other == null || getClass() != other.getClass()) && name.equals(((ForRawType) other).name); return this == other || !(other == null || getClass() != other.getClass()) && name.equals(((ForRawType) other).name);
Expand Down Expand Up @@ -4998,6 +5015,11 @@ public Generic toGenericType(TypePool typePool, TypeVariableSource typeVariableS
} }
} }


@Override
public boolean isPrimaryBound(TypePool typePool) {
return true;
}

@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
return this == other || !(other == null || getClass() != other.getClass()) && symbol.equals(((ForTypeVariable) other).symbol); return this == other || !(other == null || getClass() != other.getClass()) && symbol.equals(((ForTypeVariable) other).symbol);
Expand Down Expand Up @@ -5201,7 +5223,9 @@ protected LazyBoundTokenList(TypePool typePool,


@Override @Override
public Generic get(int index) { public Generic get(int index) {
Map<String, List<AnnotationToken>> annotationTokens = this.annotationTokens.get(index); Map<String, List<AnnotationToken>> annotationTokens = this.annotationTokens.get(index + (boundTypeTokens.get(0).isPrimaryBound(typePool)
? 0
: 1));
return boundTypeTokens.get(index).toGenericType(typePool, return boundTypeTokens.get(index).toGenericType(typePool,
typeVariableSource, typeVariableSource,
EMPTY_TYPE_PATH, EMPTY_TYPE_PATH,
Expand Down Expand Up @@ -5243,6 +5267,11 @@ public Generic toGenericType(TypePool typePool, TypeVariableSource typeVariableS
return new LazyGenericArray(typePool, typeVariableSource, typePath, annotationTokens, componentTypeToken); return new LazyGenericArray(typePool, typeVariableSource, typePath, annotationTokens, componentTypeToken);
} }


@Override
public boolean isPrimaryBound(TypePool typePool) {
throw new IllegalStateException("A generic array type cannot be a type variable bound: " + this);
}

@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
return this == other || !(other == null || getClass() != other.getClass()) return this == other || !(other == null || getClass() != other.getClass())
Expand Down Expand Up @@ -5323,6 +5352,11 @@ public Generic toGenericType(TypePool typePool, TypeVariableSource typeVariableS
return new LazyLowerBoundWildcard(typePool, typeVariableSource, typePath, annotationTokens, boundTypeToken); return new LazyLowerBoundWildcard(typePool, typeVariableSource, typePath, annotationTokens, boundTypeToken);
} }


@Override
public boolean isPrimaryBound(TypePool typePool) {
throw new IllegalStateException("A wildcard type cannot be a type variable bound: " + this);
}

@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
return this == other || !(other == null || getClass() != other.getClass()) return this == other || !(other == null || getClass() != other.getClass())
Expand Down Expand Up @@ -5409,6 +5443,11 @@ public Generic toGenericType(TypePool typePool,
return new LazyLowerBoundWildcard(typePool, typeVariableSource, typePath, annotationTokens, boundTypeToken); return new LazyLowerBoundWildcard(typePool, typeVariableSource, typePath, annotationTokens, boundTypeToken);
} }


@Override
public boolean isPrimaryBound(TypePool typePool) {
throw new IllegalStateException("A wildcard type cannot be a type variable bound: " + this);
}

@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
return this == other || !(other == null || getClass() != other.getClass()) return this == other || !(other == null || getClass() != other.getClass())
Expand Down Expand Up @@ -5499,6 +5538,11 @@ public Generic toGenericType(TypePool typePool, TypeVariableSource typeVariableS
return new LazyParameterizedType(typePool, typeVariableSource, typePath, annotationTokens, name, parameterTypeTokens); return new LazyParameterizedType(typePool, typeVariableSource, typePath, annotationTokens, name, parameterTypeTokens);
} }


@Override
public boolean isPrimaryBound(TypePool typePool) {
return !typePool.describe(name).resolve().isInterface();
}

@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
return this == other || !(other == null || getClass() != other.getClass()) return this == other || !(other == null || getClass() != other.getClass())
Expand Down Expand Up @@ -5560,6 +5604,11 @@ public Generic toGenericType(TypePool typePool,
return new LazyParameterizedType(typePool, typeVariableSource, typePath, annotationTokens, name, parameterTypeTokens, ownerTypeToken); return new LazyParameterizedType(typePool, typeVariableSource, typePath, annotationTokens, name, parameterTypeTokens, ownerTypeToken);
} }


@Override
public boolean isPrimaryBound(TypePool typePool) {
return !typePool.describe(name).resolve().isInterface();
}

/** /**
* A lazy description of a parameterized type with an owner type. * A lazy description of a parameterized type with an owner type.
*/ */
Expand Down
Expand Up @@ -1249,20 +1249,20 @@ public void testTypeAnnotationsFieldType() throws Exception {
assertThat(fieldType.getSort(), is(TypeDefinition.Sort.GENERIC_ARRAY)); assertThat(fieldType.getSort(), is(TypeDefinition.Sort.GENERIC_ARRAY));
assertThat(fieldType.getDeclaredAnnotations().size(), is(1)); assertThat(fieldType.getDeclaredAnnotations().size(), is(1));
assertThat(fieldType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(fieldType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(fieldType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(18)); assertThat(fieldType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(21));
assertThat(fieldType.getComponentType().getSort(), is(TypeDefinition.Sort.GENERIC_ARRAY)); assertThat(fieldType.getComponentType().getSort(), is(TypeDefinition.Sort.GENERIC_ARRAY));
assertThat(fieldType.getComponentType().getDeclaredAnnotations().size(), is(1)); assertThat(fieldType.getComponentType().getDeclaredAnnotations().size(), is(1));
assertThat(fieldType.getComponentType().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(fieldType.getComponentType().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(fieldType.getComponentType().getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(19)); assertThat(fieldType.getComponentType().getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(22));
assertThat(fieldType.getComponentType().getComponentType().getSort(), is(TypeDefinition.Sort.PARAMETERIZED)); assertThat(fieldType.getComponentType().getComponentType().getSort(), is(TypeDefinition.Sort.PARAMETERIZED));
assertThat(fieldType.getComponentType().getComponentType().getDeclaredAnnotations().size(), is(1)); assertThat(fieldType.getComponentType().getComponentType().getDeclaredAnnotations().size(), is(1));
assertThat(fieldType.getComponentType().getComponentType().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(fieldType.getComponentType().getComponentType().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(fieldType.getComponentType().getComponentType().getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(16)); assertThat(fieldType.getComponentType().getComponentType().getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(19));
assertThat(fieldType.getComponentType().getComponentType().getParameters().getOnly().getSort(), is(TypeDefinition.Sort.WILDCARD)); assertThat(fieldType.getComponentType().getComponentType().getParameters().getOnly().getSort(), is(TypeDefinition.Sort.WILDCARD));
assertThat(fieldType.getComponentType().getComponentType().getParameters().getOnly().getDeclaredAnnotations().size(), is(1)); assertThat(fieldType.getComponentType().getComponentType().getParameters().getOnly().getDeclaredAnnotations().size(), is(1));
assertThat(fieldType.getComponentType().getComponentType().getParameters().getOnly().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(fieldType.getComponentType().getComponentType().getParameters().getOnly().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(fieldType.getComponentType().getComponentType().getParameters().getOnly().getDeclaredAnnotations() assertThat(fieldType.getComponentType().getComponentType().getParameters().getOnly().getDeclaredAnnotations()
.ofType(typeAnnotation).getValue(value, Integer.class), is(17)); .ofType(typeAnnotation).getValue(value, Integer.class), is(20));
} }


@Test @Test
Expand All @@ -1276,7 +1276,7 @@ public void testTypeAnnotationsMethodReturnType() throws Exception {
assertThat(returnType.getSort(), is(TypeDefinition.Sort.NON_GENERIC)); assertThat(returnType.getSort(), is(TypeDefinition.Sort.NON_GENERIC));
assertThat(returnType.getDeclaredAnnotations().size(), is(1)); assertThat(returnType.getDeclaredAnnotations().size(), is(1));
assertThat(returnType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(returnType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(returnType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(22)); assertThat(returnType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(25));
} }


@Test @Test
Expand All @@ -1290,15 +1290,15 @@ public void testTypeAnnotationsMethodParameterType() throws Exception {
assertThat(parameterType.getSort(), is(TypeDefinition.Sort.GENERIC_ARRAY)); assertThat(parameterType.getSort(), is(TypeDefinition.Sort.GENERIC_ARRAY));
assertThat(parameterType.getDeclaredAnnotations().size(), is(1)); assertThat(parameterType.getDeclaredAnnotations().size(), is(1));
assertThat(parameterType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(parameterType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(parameterType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(24)); assertThat(parameterType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(27));
assertThat(parameterType.getComponentType().getSort(), is(TypeDefinition.Sort.GENERIC_ARRAY)); assertThat(parameterType.getComponentType().getSort(), is(TypeDefinition.Sort.GENERIC_ARRAY));
assertThat(parameterType.getComponentType().getDeclaredAnnotations().size(), is(1)); assertThat(parameterType.getComponentType().getDeclaredAnnotations().size(), is(1));
assertThat(parameterType.getComponentType().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(parameterType.getComponentType().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(parameterType.getComponentType().getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(25)); assertThat(parameterType.getComponentType().getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(28));
assertThat(parameterType.getComponentType().getComponentType().getSort(), is(TypeDefinition.Sort.VARIABLE)); assertThat(parameterType.getComponentType().getComponentType().getSort(), is(TypeDefinition.Sort.VARIABLE));
assertThat(parameterType.getComponentType().getComponentType().getDeclaredAnnotations().size(), is(1)); assertThat(parameterType.getComponentType().getComponentType().getDeclaredAnnotations().size(), is(1));
assertThat(parameterType.getComponentType().getComponentType().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(parameterType.getComponentType().getComponentType().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(parameterType.getComponentType().getComponentType().getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(23)); assertThat(parameterType.getComponentType().getComponentType().getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(26));
} }


@Test @Test
Expand All @@ -1312,7 +1312,7 @@ public void testTypeAnnotationsSuperType() throws Exception {
assertThat(superType.getSort(), is(TypeDefinition.Sort.NON_GENERIC)); assertThat(superType.getSort(), is(TypeDefinition.Sort.NON_GENERIC));
assertThat(superType.getDeclaredAnnotations().size(), is(1)); assertThat(superType.getDeclaredAnnotations().size(), is(1));
assertThat(superType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(superType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(superType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(12)); assertThat(superType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(15));
} }


@Test @Test
Expand All @@ -1326,18 +1326,18 @@ public void testTypeAnnotationsInterfaceType() throws Exception {
assertThat(firstInterfaceType.getSort(), is(TypeDefinition.Sort.PARAMETERIZED)); assertThat(firstInterfaceType.getSort(), is(TypeDefinition.Sort.PARAMETERIZED));
assertThat(firstInterfaceType.getDeclaredAnnotations().size(), is(1)); assertThat(firstInterfaceType.getDeclaredAnnotations().size(), is(1));
assertThat(firstInterfaceType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(firstInterfaceType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(firstInterfaceType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(13)); assertThat(firstInterfaceType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(16));
assertThat(firstInterfaceType.getParameters().getOnly().getSort(), is(TypeDefinition.Sort.NON_GENERIC)); assertThat(firstInterfaceType.getParameters().getOnly().getSort(), is(TypeDefinition.Sort.NON_GENERIC));
assertThat(firstInterfaceType.getParameters().getOnly().getDeclaredAnnotations().size(), is(1)); assertThat(firstInterfaceType.getParameters().getOnly().getDeclaredAnnotations().size(), is(1));
assertThat(firstInterfaceType.getParameters().getOnly().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(firstInterfaceType.getParameters().getOnly().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(firstInterfaceType.getParameters().getOnly().getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(14)); assertThat(firstInterfaceType.getParameters().getOnly().getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(17));
TypeDescription.Generic secondInterfaceType = describeInterfaceType(samples, 1); TypeDescription.Generic secondInterfaceType = describeInterfaceType(samples, 1);
assertThat(secondInterfaceType.getSort(), is(TypeDefinition.Sort.PARAMETERIZED)); assertThat(secondInterfaceType.getSort(), is(TypeDefinition.Sort.PARAMETERIZED));
assertThat(secondInterfaceType.getDeclaredAnnotations().size(), is(0)); assertThat(secondInterfaceType.getDeclaredAnnotations().size(), is(0));
assertThat(secondInterfaceType.getParameters().get(0).getSort(), is(TypeDefinition.Sort.NON_GENERIC)); assertThat(secondInterfaceType.getParameters().get(0).getSort(), is(TypeDefinition.Sort.NON_GENERIC));
assertThat(secondInterfaceType.getParameters().get(0).getDeclaredAnnotations().size(), is(1)); assertThat(secondInterfaceType.getParameters().get(0).getDeclaredAnnotations().size(), is(1));
assertThat(secondInterfaceType.getParameters().get(0).getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(secondInterfaceType.getParameters().get(0).getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(secondInterfaceType.getParameters().get(0).getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(15)); assertThat(secondInterfaceType.getParameters().get(0).getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(18));
assertThat(secondInterfaceType.getParameters().get(1).getSort(), is(TypeDefinition.Sort.NON_GENERIC)); assertThat(secondInterfaceType.getParameters().get(1).getSort(), is(TypeDefinition.Sort.NON_GENERIC));
assertThat(secondInterfaceType.getParameters().get(1).getDeclaredAnnotations().size(), is(0)); assertThat(secondInterfaceType.getParameters().get(1).getDeclaredAnnotations().size(), is(0));
} }
Expand All @@ -1353,12 +1353,12 @@ public void testTypeAnnotationExceptionType() throws Exception {
assertThat(firstExceptionType.getSort(), is(TypeDefinition.Sort.VARIABLE)); assertThat(firstExceptionType.getSort(), is(TypeDefinition.Sort.VARIABLE));
assertThat(firstExceptionType.getDeclaredAnnotations().size(), is(1)); assertThat(firstExceptionType.getDeclaredAnnotations().size(), is(1));
assertThat(firstExceptionType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(firstExceptionType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(firstExceptionType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(26)); assertThat(firstExceptionType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(29));
TypeDescription.Generic secondExceptionType = describeExceptionType(samples.getDeclaredMethod(FOO, Exception[][].class), 1); TypeDescription.Generic secondExceptionType = describeExceptionType(samples.getDeclaredMethod(FOO, Exception[][].class), 1);
assertThat(secondExceptionType.getSort(), is(TypeDefinition.Sort.NON_GENERIC)); assertThat(secondExceptionType.getSort(), is(TypeDefinition.Sort.NON_GENERIC));
assertThat(secondExceptionType.getDeclaredAnnotations().size(), is(1)); assertThat(secondExceptionType.getDeclaredAnnotations().size(), is(1));
assertThat(secondExceptionType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(secondExceptionType.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(secondExceptionType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(27)); assertThat(secondExceptionType.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(30));
} }


@Test @Test
Expand Down
Expand Up @@ -117,12 +117,16 @@ public void testTypeVariableV() throws Exception {
assertThat(v.getUpperBounds().get(0).getParameters().get(1).getParameters().getOnly().getLowerBounds().getOnly().getDeclaredAnnotations() assertThat(v.getUpperBounds().get(0).getParameters().get(1).getParameters().getOnly().getLowerBounds().getOnly().getDeclaredAnnotations()
.ofType(typeAnnotation).getValue(value, Integer.class), is(12)); .ofType(typeAnnotation).getValue(value, Integer.class), is(12));
assertThat(v.getUpperBounds().get(0).getParameters().get(1).getParameters().getOnly().getLowerBounds().getOnly().getUpperBounds().get(0) assertThat(v.getUpperBounds().get(0).getParameters().get(1).getParameters().getOnly().getLowerBounds().getOnly().getUpperBounds().get(0)
.getSort(), is(TypeDefinition.Sort.PARAMETERIZED)); .getSort(), is(TypeDefinition.Sort.NON_GENERIC));
assertThat(v.getUpperBounds().get(0).getParameters().get(1).getParameters().getOnly().getLowerBounds().getOnly().getUpperBounds().get(0) assertThat(v.getUpperBounds().get(0).getParameters().get(1).getParameters().getOnly().getLowerBounds().getOnly().getUpperBounds().get(0)
.getDeclaredAnnotations().size(), is(0));
assertThat(v.getUpperBounds().get(0).getParameters().get(1).getParameters().getOnly().getLowerBounds().getOnly().getUpperBounds().get(1)
.getSort(), is(TypeDefinition.Sort.PARAMETERIZED));
assertThat(v.getUpperBounds().get(0).getParameters().get(1).getParameters().getOnly().getLowerBounds().getOnly().getUpperBounds().get(1)
.getDeclaredAnnotations().size(), is(1)); .getDeclaredAnnotations().size(), is(1));
assertThat(v.getUpperBounds().get(0).getParameters().get(1).getParameters().getOnly().getLowerBounds().getOnly().getUpperBounds().get(0) assertThat(v.getUpperBounds().get(0).getParameters().get(1).getParameters().getOnly().getLowerBounds().getOnly().getUpperBounds().get(1)
.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); .getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(v.getUpperBounds().get(0).getParameters().get(1).getParameters().getOnly().getLowerBounds().getOnly().getUpperBounds().get(0) assertThat(v.getUpperBounds().get(0).getParameters().get(1).getParameters().getOnly().getLowerBounds().getOnly().getUpperBounds().get(1)
.getDeclaredAnnotations().getOnly().prepare(typeAnnotation).getValue(value, Integer.class), is(3)); .getDeclaredAnnotations().getOnly().prepare(typeAnnotation).getValue(value, Integer.class), is(3));
} }


Expand All @@ -135,10 +139,10 @@ public void testMethodVariableT() throws Exception {
assertThat(t.getSort(), is(TypeDefinition.Sort.VARIABLE)); assertThat(t.getSort(), is(TypeDefinition.Sort.VARIABLE));
assertThat(t.getDeclaredAnnotations().size(), is(1)); assertThat(t.getDeclaredAnnotations().size(), is(1));
assertThat(t.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(t.getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(t.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(20)); assertThat(t.getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(23));
assertThat(t.getUpperBounds().getOnly().getSort(), is(TypeDefinition.Sort.NON_GENERIC)); assertThat(t.getUpperBounds().getOnly().getSort(), is(TypeDefinition.Sort.NON_GENERIC));
assertThat(t.getUpperBounds().getOnly().getDeclaredAnnotations().size(), is(1)); assertThat(t.getUpperBounds().getOnly().getDeclaredAnnotations().size(), is(1));
assertThat(t.getUpperBounds().getOnly().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true)); assertThat(t.getUpperBounds().getOnly().getDeclaredAnnotations().isAnnotationPresent(typeAnnotation), is(true));
assertThat(t.getUpperBounds().getOnly().getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(21)); assertThat(t.getUpperBounds().getOnly().getDeclaredAnnotations().ofType(typeAnnotation).getValue(value, Integer.class), is(24));
} }
} }

0 comments on commit 4a7ca30

Please sign in to comment.