use of net.bytebuddy.description.type.TypeVariableToken in project byte-buddy by raphw.
the class MethodGraphCompilerDefaultTest method testOrphanedBridge.
@Test
public void testOrphanedBridge() throws Exception {
MethodDescription.SignatureToken bridgeMethod = new MethodDescription.SignatureToken("foo", TypeDescription.VOID, Collections.<TypeDescription>emptyList());
TypeDescription typeDescription = new InstrumentedType.Default("foo", Opcodes.ACC_PUBLIC, TypeDescription.Generic.OBJECT, Collections.<TypeVariableToken>emptyList(), Collections.<TypeDescription.Generic>emptyList(), Collections.<FieldDescription.Token>emptyList(), Collections.singletonList(new MethodDescription.Token("foo", Opcodes.ACC_BRIDGE, TypeDescription.Generic.VOID, Collections.<TypeDescription.Generic>emptyList())), Collections.<AnnotationDescription>emptyList(), TypeInitializer.None.INSTANCE, LoadedTypeInitializer.NoOp.INSTANCE, TypeDescription.UNDEFINED, MethodDescription.UNDEFINED, TypeDescription.UNDEFINED, Collections.<TypeDescription>emptyList(), false, false, false);
MethodGraph.Linked methodGraph = MethodGraph.Compiler.Default.forJavaHierarchy().compile(typeDescription);
assertThat(methodGraph.listNodes().size(), is(1 + TypeDescription.OBJECT.getDeclaredMethods().filter(ElementMatchers.isVirtual()).size()));
MethodGraph.Node node = methodGraph.locate(bridgeMethod);
assertThat(node.getSort(), is(MethodGraph.Node.Sort.RESOLVED));
assertThat(node.getRepresentative().asSignatureToken(), is(bridgeMethod));
assertThat(node.getMethodTypes().size(), is(1));
assertThat(node.getMethodTypes(), hasItem(bridgeMethod.asTypeToken()));
assertThat(node.getVisibility(), is(Visibility.PACKAGE_PRIVATE));
}
Aggregations