diff --git a/resources/bytecode/javFiles/Bug307.jav b/resources/bytecode/javFiles/Bug307.jav new file mode 100644 index 00000000..48b2b4e1 --- /dev/null +++ b/resources/bytecode/javFiles/Bug307.jav @@ -0,0 +1,44 @@ +public class Bug307 { + public void main() { + IVisitor v = new Visitor(); + Impl2 f = new Impl2(); + + f.accept(v); + } +} + +interface IVisitor { + void visit(Impl1 f); + void visit(Impl2 fb); +} + +interface IAcceptor { + void accept(IVisitor v); +} + +class Visitor implements IVisitor { + + @Override + public void visit(Impl1 f) { + } + + @Override + public void visit(Impl2 fb) { + } +} + +class Impl1 implements IAcceptor { + + @Override + public void accept(IVisitor v) { + v.visit(this); + } +} + +class Impl2 implements IAcceptor { + + @Override + public void accept(IVisitor v) { + v.visit(this); + } +} diff --git a/src/test/java/TestComplete.java b/src/test/java/TestComplete.java index ebc973cf..707762cd 100644 --- a/src/test/java/TestComplete.java +++ b/src/test/java/TestComplete.java @@ -1022,4 +1022,12 @@ public class TestComplete { var clazz = classFiles.get("Bug306"); var instance = clazz.getDeclaredConstructor().newInstance(); } + + @Test + public void testBug307() throws Exception { + var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug307.jav"); + var clazz = classFiles.get("Bug307"); + var instance = clazz.getDeclaredConstructor().newInstance(); + clazz.getDeclaredMethod("main").invoke(instance); + } }