mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-09 00:14:10 -08:00
JS: don't remove class name from metadata when it's referenced indirectly from array class
This commit is contained in:
parent
7a03ad6c5e
commit
f028f8db37
|
@ -19,7 +19,6 @@ import com.carrotsearch.hppc.ObjectIntHashMap;
|
||||||
import com.carrotsearch.hppc.ObjectIntMap;
|
import com.carrotsearch.hppc.ObjectIntMap;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -632,17 +631,33 @@ public class Renderer implements RenderingManager {
|
||||||
MethodDependencyInfo getNameMethod = context.getDependencyInfo().getMethod(
|
MethodDependencyInfo getNameMethod = context.getDependencyInfo().getMethod(
|
||||||
new MethodReference(Class.class, "getName", String.class));
|
new MethodReference(Class.class, "getName", String.class));
|
||||||
if (getNameMethod != null) {
|
if (getNameMethod != null) {
|
||||||
classesRequiringName.addAll(Arrays.asList(getNameMethod.getVariable(0).getClassValueNode().getTypes()));
|
addClassesRequiringName(classesRequiringName, getNameMethod.getVariable(0).getClassValueNode().getTypes());
|
||||||
}
|
}
|
||||||
MethodDependencyInfo getSimpleNameMethod = context.getDependencyInfo().getMethod(
|
MethodDependencyInfo getSimpleNameMethod = context.getDependencyInfo().getMethod(
|
||||||
new MethodReference(Class.class, "getSimpleName", String.class));
|
new MethodReference(Class.class, "getSimpleName", String.class));
|
||||||
if (getSimpleNameMethod != null) {
|
if (getSimpleNameMethod != null) {
|
||||||
classesRequiringName.addAll(Arrays.asList(
|
addClassesRequiringName(classesRequiringName,
|
||||||
getSimpleNameMethod.getVariable(0).getClassValueNode().getTypes()));
|
getSimpleNameMethod.getVariable(0).getClassValueNode().getTypes());
|
||||||
}
|
}
|
||||||
return classesRequiringName;
|
return classesRequiringName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addClassesRequiringName(Set<String> target, String[] source) {
|
||||||
|
for (String typeName : source) {
|
||||||
|
if (typeName.startsWith("[")) {
|
||||||
|
if (!typeName.endsWith(";")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int index = 0;
|
||||||
|
while (typeName.charAt(index) == '[') {
|
||||||
|
++index;
|
||||||
|
}
|
||||||
|
typeName = typeName.substring(index, typeName.length() - 1).replace('/', '.');
|
||||||
|
}
|
||||||
|
target.add(typeName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void collectMethodsToCopyFromInterfaces(ClassReader cls, List<MethodReference> targetList) {
|
private void collectMethodsToCopyFromInterfaces(ClassReader cls, List<MethodReference> targetList) {
|
||||||
Set<MethodDescriptor> implementedMethods = new HashSet<>();
|
Set<MethodDescriptor> implementedMethods = new HashSet<>();
|
||||||
implementedMethods.addAll(targetList.stream().map(method -> method.getDescriptor())
|
implementedMethods.addAll(targetList.stream().map(method -> method.getDescriptor())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user