mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
Fix issue with <clinit> methods introduced by previous commit
This commit is contained in:
parent
ed627459c8
commit
7a03ad6c5e
|
@ -47,9 +47,13 @@ public class Linker {
|
||||||
MethodReference methodRef = method.getReference();
|
MethodReference methodRef = method.getReference();
|
||||||
MethodDependencyInfo methodDep = dependency.getMethod(methodRef);
|
MethodDependencyInfo methodDep = dependency.getMethod(methodRef);
|
||||||
if (methodDep == null || !methodDep.isUsed()) {
|
if (methodDep == null || !methodDep.isUsed()) {
|
||||||
|
if (method.hasModifier(ElementModifier.STATIC)) {
|
||||||
|
cls.removeMethod(method);
|
||||||
|
} else {
|
||||||
method.getModifiers().add(ElementModifier.ABSTRACT);
|
method.getModifiers().add(ElementModifier.ABSTRACT);
|
||||||
method.getModifiers().remove(ElementModifier.NATIVE);
|
method.getModifiers().remove(ElementModifier.NATIVE);
|
||||||
method.setProgram(null);
|
method.setProgram(null);
|
||||||
|
}
|
||||||
} else if (method.getProgram() != null) {
|
} else if (method.getProgram() != null) {
|
||||||
link(method.getReference(), method.getProgram());
|
link(method.getReference(), method.getProgram());
|
||||||
}
|
}
|
||||||
|
|
|
@ -963,9 +963,13 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
|
||||||
for (MethodHolder method : cls.getMethods().toArray(new MethodHolder[0])) {
|
for (MethodHolder method : cls.getMethods().toArray(new MethodHolder[0])) {
|
||||||
MethodDependencyInfo methodDep = dependencyAnalyzer.getMethod(method.getReference());
|
MethodDependencyInfo methodDep = dependencyAnalyzer.getMethod(method.getReference());
|
||||||
if (methodDep == null || !methodDep.isUsed()) {
|
if (methodDep == null || !methodDep.isUsed()) {
|
||||||
|
if (method.hasModifier(ElementModifier.STATIC)) {
|
||||||
|
cls.removeMethod(method);
|
||||||
|
} else {
|
||||||
method.getModifiers().add(ElementModifier.ABSTRACT);
|
method.getModifiers().add(ElementModifier.ABSTRACT);
|
||||||
method.getModifiers().remove(ElementModifier.NATIVE);
|
method.getModifiers().remove(ElementModifier.NATIVE);
|
||||||
method.setProgram(null);
|
method.setProgram(null);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MethodReader methodReader = classReader.getMethod(method.getDescriptor());
|
MethodReader methodReader = classReader.getMethod(method.getDescriptor());
|
||||||
if (methodReader != null && methodReader.getProgram() != null) {
|
if (methodReader != null && methodReader.getProgram() != null) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user