Skip to content

Commit

Permalink
Unignored tests that do not longer fail as a result of extending the …
Browse files Browse the repository at this point in the history
…API.
  • Loading branch information
Rafael Winterhalter committed Jul 20, 2015
1 parent a985cf7 commit 0cfbed1
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 48 deletions.
@@ -1,5 +1,6 @@
package net.bytebuddy.dynamic;

import net.bytebuddy.asm.ClassVisitorWrapper;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.modifier.Ownership;
import net.bytebuddy.description.modifier.TypeManifestation;
Expand All @@ -13,9 +14,12 @@
import net.bytebuddy.implementation.bytecode.constant.TextConstant;
import net.bytebuddy.implementation.bytecode.member.MethodReturn;
import net.bytebuddy.test.scope.GenericType;
import net.bytebuddy.test.utility.CallTraceable;
import net.bytebuddy.test.utility.ClassFileExtraction;
import org.hamcrest.core.Is;
import org.junit.Test;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

import java.lang.reflect.*;
Expand Down Expand Up @@ -237,4 +241,62 @@ public static void invoke() {
foo = FOO;
}
}

public static class BridgeRetention<T> {

public T foo() {
return null;
}

public static class Inner extends BridgeRetention<String> {
/* empty */
}
}

public static class SuperCall<T> extends CallTraceable {

public T foo(T value) {
register(FOO);
return value;
}

public static class Inner extends SuperCall<String> {
/* empty */
}
}

protected static class MethodCallValidator extends MethodVisitor {

public static class ClassWrapper implements ClassVisitorWrapper {

@Override
public ClassVisitor wrap(ClassVisitor classVisitor) {
return new ClassValidator(classVisitor);
}
}

private static class ClassValidator extends ClassVisitor {

private ClassValidator(ClassVisitor classVisitor) {
super(Opcodes.ASM5, classVisitor);
}

@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
return new MethodCallValidator(super.visitMethod(access, name, desc, signature, exceptions));
}
}

private MethodCallValidator(MethodVisitor methodVisitor) {
super(Opcodes.ASM5, methodVisitor);
}

@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
if (!name.equals(MethodDescription.CONSTRUCTOR_INTERNAL_NAME)) {
assertThat(desc, is("(Ljava/lang/Object;)Ljava/lang/Object;"));
}
super.visitMethodInsn(opcode, owner, name, desc, itf);
}
}
}
@@ -1,5 +1,7 @@
package net.bytebuddy.dynamic.scaffold.inline;

import net.bytebuddy.asm.ClassVisitorWrapper;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.AbstractDynamicTypeBuilderTest;
import net.bytebuddy.dynamic.ClassFileLocator;
Expand All @@ -20,6 +22,8 @@
import org.hamcrest.core.Is;
import org.junit.*;
import org.junit.rules.MethodRule;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

import java.lang.reflect.*;
Expand Down Expand Up @@ -199,10 +203,10 @@ public void testBridgeMethodCreation() throws Exception {

@Test
@SuppressWarnings("unchecked")
@Ignore("Does not invoke correct method - but JVM fixes resolution")
public void testBridgeMethodSuperTypeInvocation() throws Exception {
Class<?> dynamicType = create(SuperCall.Inner.class)
.method(named(FOO)).intercept(SuperMethodCall.INSTANCE)
.classVisitor(new MethodCallValidator.ClassWrapper())
.make()
.load(getClass().getClassLoader(), ClassLoadingStrategy.Default.CHILD_FIRST)
.getLoaded();
Expand Down Expand Up @@ -232,27 +236,4 @@ public static void invoke() {
bar = BAR;
}
}

public static class BridgeRetention<T> {

public T foo() {
return null;
}

public static class Inner extends BridgeRetention<String> {
/* empty */
}
}

public static class SuperCall<T> extends CallTraceable {

public T foo(T value) {
register(FOO);
return value;
}

public static class Inner extends SuperCall<String> {
/* empty */
}
}
}
Expand Up @@ -370,10 +370,10 @@ public void testBridgeMethodCreation() throws Exception {

@Test
@SuppressWarnings("unchecked")
@Ignore("Does not invoke correct method - but JVM fixes resolution")
public void testBridgeMethodSuperTypeInvocation() throws Exception {
Class<?> dynamicType = create(SuperCall.Inner.class)
.method(named(FOO)).intercept(SuperMethodCall.INSTANCE)
.classVisitor(new MethodCallValidator.ClassWrapper())
.make()
.load(getClass().getClassLoader(), ClassLoadingStrategy.Default.CHILD_FIRST)
.getLoaded();
Expand Down Expand Up @@ -452,27 +452,4 @@ private void foo() {
/* empty */
}
}

public static class BridgeRetention<T> {

public T foo() {
return null;
}

public static class Inner extends BridgeRetention<String> {
/* empty */
}
}

public static class SuperCall<T> extends CallTraceable {

public T foo(T value) {
register(FOO);
return value;
}

public static class Inner extends SuperCall<String> {
/* empty */
}
}
}

0 comments on commit 0cfbed1

Please sign in to comment.