modified: ../../../../main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java

Methode unbenannt in unbox
This commit is contained in:
pl@gohorb.ba-horb.de 2020-01-21 19:48:31 +01:00
parent e581050a61
commit 8d72b58fcc

View File

@ -942,7 +942,7 @@ public class BytecodeGenMethod implements StatementVisitor {
} }
boolean basetypeComp(String demanded, String given) { boolean unbox(String demanded, String given) {
if (demanded.equals("java/lang/Boolean") && given.equals("boolean")) return true; 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/Integer") && given.equals("int")) return true;
if (demanded.equals("java/lang/Short") && given.equals("short")) return true; if (demanded.equals("java/lang/Short") && given.equals("short")) return true;
@ -970,13 +970,13 @@ public class BytecodeGenMethod implements StatementVisitor {
if(name.equals(m.getName()) && i == m.getParameterCount() && if(name.equals(m.getName()) && i == m.getParameterCount() &&
(methCallType.equals(m.getReturnType().getName().replace(".", "/")) || (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(".", "/")) unbox(methCallType, m.getReturnType().getName().replace(".", "/"))
) ) { ) ) {
boolean typesEqual = true; boolean typesEqual = true;
Class<?>[] pTypes = m.getParameterTypes(); Class<?>[] pTypes = m.getParameterTypes();
for(int j = 0; j<typesOfParams.length; ++j) { for(int j = 0; j<typesOfParams.length; ++j) {
if(!typesOfParams[j].replaceAll("/", ".").equals(pTypes[j].getName()) if(!typesOfParams[j].replaceAll("/", ".").equals(pTypes[j].getName())
&& !basetypeComp(typesOfParams[j], pTypes[j].getName()) && !unbox(typesOfParams[j], pTypes[j].getName())
&& !pTypes[j].getName().replace(".", "/").equals(Type.getInternalName(Object.class))) { && !pTypes[j].getName().replace(".", "/").equals(Type.getInternalName(Object.class))) {
typesEqual = false; typesEqual = false;
break; break;