From aeb8bb92ed78aee9718a5f078826b5d692dc30be Mon Sep 17 00:00:00 2001 From: Fayez Abu Alia Date: Wed, 19 Sep 2018 13:05:00 +0200 Subject: [PATCH] Bug 108 gefixt --- .../bytecode/signature/Signature.java | 2 -- .../bytecode/signature/TypeToSignature.java | 4 ++-- test/bytecode/Tph5Test.java | 5 +++-- test/bytecode/javFiles/Tph5.jav | 14 ++++++++++---- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/de/dhbwstuttgart/bytecode/signature/Signature.java b/src/de/dhbwstuttgart/bytecode/signature/Signature.java index 4daf3ded9..600238952 100644 --- a/src/de/dhbwstuttgart/bytecode/signature/Signature.java +++ b/src/de/dhbwstuttgart/bytecode/signature/Signature.java @@ -178,7 +178,6 @@ public class Signature { if(hasTPHs(ref)) createSignatureForParameterizedType(ref); - System.out.println("HAS WC = " + hasWC(ref)); if(hasWC(ref)) createSigForParamTypeWithWC(ref); } @@ -234,7 +233,6 @@ public class Signature { if(p instanceof WildcardType) { if(((WildcardType) p).getInnerType() instanceof GenericRefType) { String name = new TypeToSignature().visit((GenericRefType)((WildcardType) p).getInnerType()); - System.out.println("NAME WC = " + name); if(!genericsAndBoundsMethod.containsKey(name) && !genericsAndBounds.containsKey(name)) { sw.visitFormalTypeParameter(name); sw.visitClassBound().visitClassType(Type.getInternalName(Object.class)); diff --git a/src/de/dhbwstuttgart/bytecode/signature/TypeToSignature.java b/src/de/dhbwstuttgart/bytecode/signature/TypeToSignature.java index 6e73d8eed..7d47406d6 100644 --- a/src/de/dhbwstuttgart/bytecode/signature/TypeToSignature.java +++ b/src/de/dhbwstuttgart/bytecode/signature/TypeToSignature.java @@ -34,9 +34,9 @@ public class TypeToSignature implements TypeVisitor { // params += "L"+param.toString().replace(".", "/"); // } params += param.acceptTV(new TypeToSignature()); - if(!(param instanceof RefType)) + + if(param instanceof TypePlaceholder) params += ";"; -// if(it.hasNext())params += ";"; } params += ">"; } diff --git a/test/bytecode/Tph5Test.java b/test/bytecode/Tph5Test.java index 7d44e5e52..4107cca2d 100644 --- a/test/bytecode/Tph5Test.java +++ b/test/bytecode/Tph5Test.java @@ -36,8 +36,9 @@ public class Tph5Test { @Test public void test() throws Exception { - Method m = classToTest.getDeclaredMethod("m", Object.class, Object.class, Object.class); - Object result = m.invoke(instanceOfClass, "xx",2,3); +// Method m = classToTest.getDeclaredMethod("m", Object.class, Object.class, Object.class); + Method m = classToTest.getDeclaredMethod("m", Object.class, Object.class); +// Object result = m.invoke(instanceOfClass, "xx",2,3); //assertEquals(2,result); } diff --git a/test/bytecode/javFiles/Tph5.jav b/test/bytecode/javFiles/Tph5.jav index 1772b7ce3..e73cfa2cb 100644 --- a/test/bytecode/javFiles/Tph5.jav +++ b/test/bytecode/javFiles/Tph5.jav @@ -1,7 +1,13 @@ public class Tph5 { - m(a,b,c){ - a = c; - b = c; - return a; +// m(a,b,c){ +// a = c; +// b = c; +// return a; +// } + + m(x,y){ + x = m2(y); } + + m2(y) { return y; } }