forked from JavaTX/JavaCompilerCore
Fix NPE in generics, probably because interface method don't have code
This commit is contained in:
parent
66c8c307b0
commit
a1b5c0541b
13
resources/bytecode/javFiles/Bug293.jav
Normal file
13
resources/bytecode/javFiles/Bug293.jav
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import java.lang.Integer;
|
||||||
|
import java.lang.Float;
|
||||||
|
|
||||||
|
public class Bug293 {
|
||||||
|
bar(a) {
|
||||||
|
return 2 * a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IFoo {
|
||||||
|
void ga();
|
||||||
|
}
|
||||||
|
|
@ -753,7 +753,9 @@ public abstract class GenerateGenerics {
|
|||||||
}
|
}
|
||||||
doIterationForMethods(classOrInterface);
|
doIterationForMethods(classOrInterface);
|
||||||
for (var method : classOrInterface.getMethods()) {
|
for (var method : classOrInterface.getMethods()) {
|
||||||
referenced.addAll(usedTPHsOfMethods.get(method));
|
var usedTPHs = usedTPHsOfMethods.get(method);
|
||||||
|
if (usedTPHs != null)
|
||||||
|
referenced.addAll(usedTPHs);
|
||||||
}
|
}
|
||||||
eliminateInnerTypeVariables(referenced, input);
|
eliminateInnerTypeVariables(referenced, input);
|
||||||
}
|
}
|
||||||
|
@ -933,4 +933,11 @@ public class TestComplete {
|
|||||||
var clazz = classFiles.get("Bug290A");
|
var clazz = classFiles.get("Bug290A");
|
||||||
var instance = clazz.getDeclaredConstructor().newInstance();
|
var instance = clazz.getDeclaredConstructor().newInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBug293() throws Exception {
|
||||||
|
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug293.jav");
|
||||||
|
var clazz = classFiles.get("Bug293");
|
||||||
|
var instance = clazz.getDeclaredConstructor().newInstance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user