From 1ec7a78b1475c68f68154f4c482087a8db65fdc6 Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Tue, 21 Jan 2020 18:04:56 +0100 Subject: [PATCH] modified: ../../../../main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java basetype und RefType Fehler korrigiert Methode basetypeComp eingefuegt. --- .../bytecode/BytecodeGenMethod.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java b/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java index 35ad67da8..60622f72b 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java @@ -941,6 +941,17 @@ public class BytecodeGenMethod implements StatementVisitor { return null; } + + boolean basetypeComp(String demanded, String given) { + if (demanded.equals("java/lang/Boolean") && given.equals("boolean")) return true; + if (demanded.equals("java/lang/Integer") && given.equals("int")) return true; + if (demanded.equals("java/lang/Short") && given.equals("short")) return true; + if (demanded.equals("java/lang/Byte") && given.equals("byte")) return true; + if (demanded.equals("java/lang/Double") && given.equals("double")) return true; + if (demanded.equals("java/lang/Float") && given.equals("float")) return true; + return false; + } + /** * @param name name of a method * @param i number of parameters @@ -958,11 +969,15 @@ public class BytecodeGenMethod implements StatementVisitor { for(java.lang.reflect.Method m : methods) { if(name.equals(m.getName()) && i == m.getParameterCount() && (methCallType.equals(m.getReturnType().getName().replace(".", "/")) || - m.getReturnType().getName().replace(".", "/").equals(Type.getInternalName(Object.class)))) { + m.getReturnType().getName().replace(".", "/").equals(Type.getInternalName(Object.class)) || + basetypeComp(methCallType, m.getReturnType().getName().replace(".", "/")) + ) ) { boolean typesEqual = true; Class[] pTypes = m.getParameterTypes(); for(int j = 0; j