forked from JavaTX/JavaCompilerCore
modified: ../../../../main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java
basetype und RefType Fehler korrigiert Methode basetypeComp eingefuegt.
This commit is contained in:
parent
8ec1c5148b
commit
1ec7a78b14
@ -941,6 +941,17 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
return null;
|
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 name name of a method
|
||||||
* @param i number of parameters
|
* @param i number of parameters
|
||||||
@ -958,11 +969,15 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
for(java.lang.reflect.Method m : methods) {
|
for(java.lang.reflect.Method m : methods) {
|
||||||
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(".", "/"))
|
||||||
|
) ) {
|
||||||
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()) && !pTypes[j].getName().replace(".", "/").equals(Type.getInternalName(Object.class))) {
|
if(!typesOfParams[j].replaceAll("/", ".").equals(pTypes[j].getName())
|
||||||
|
&& !basetypeComp(typesOfParams[j], pTypes[j].getName())
|
||||||
|
&& !pTypes[j].getName().replace(".", "/").equals(Type.getInternalName(Object.class))) {
|
||||||
typesEqual = false;
|
typesEqual = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user