mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix passing reflection tests with fast global analysis enabled
This commit is contained in:
parent
c53a563e96
commit
72275a0877
|
@ -17,6 +17,7 @@ package org.teavm.classlib.support;
|
||||||
|
|
||||||
import java.lang.invoke.SerializedLambda;
|
import java.lang.invoke.SerializedLambda;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.teavm.classlib.ReflectionContext;
|
import org.teavm.classlib.ReflectionContext;
|
||||||
|
@ -30,6 +31,9 @@ public class ReflectionSupplierImpl implements ReflectionSupplier {
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> getAccessibleFields(ReflectionContext context, String className) {
|
public Collection<String> getAccessibleFields(ReflectionContext context, String className) {
|
||||||
ClassReader cls = context.getClassSource().get(className);
|
ClassReader cls = context.getClassSource().get(className);
|
||||||
|
if (cls == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
Set<String> fields = new HashSet<>();
|
Set<String> fields = new HashSet<>();
|
||||||
for (FieldReader field : cls.getFields()) {
|
for (FieldReader field : cls.getFields()) {
|
||||||
if (field.getAnnotations().get(Reflectable.class.getName()) != null) {
|
if (field.getAnnotations().get(Reflectable.class.getName()) != null) {
|
||||||
|
@ -42,6 +46,9 @@ public class ReflectionSupplierImpl implements ReflectionSupplier {
|
||||||
@Override
|
@Override
|
||||||
public Collection<MethodDescriptor> getAccessibleMethods(ReflectionContext context, String className) {
|
public Collection<MethodDescriptor> getAccessibleMethods(ReflectionContext context, String className) {
|
||||||
ClassReader cls = context.getClassSource().get(className);
|
ClassReader cls = context.getClassSource().get(className);
|
||||||
|
if (cls == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
Set<MethodDescriptor> methods = new HashSet<>();
|
Set<MethodDescriptor> methods = new HashSet<>();
|
||||||
for (MethodReader method : cls.getMethods()) {
|
for (MethodReader method : cls.getMethods()) {
|
||||||
if (method.getAnnotations().get(Reflectable.class.getName()) != null) {
|
if (method.getAnnotations().get(Reflectable.class.getName()) != null) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user