mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Add info about Java 14 record to IR. Add support to Metaprogramming API
This commit is contained in:
parent
670f24a4af
commit
fdfd923ac6
|
@ -38,7 +38,8 @@ public enum ElementModifier {
|
||||||
SYNCHRONIZED,
|
SYNCHRONIZED,
|
||||||
TRANSIENT,
|
TRANSIENT,
|
||||||
VARARGS,
|
VARARGS,
|
||||||
VOLATILE;
|
VOLATILE,
|
||||||
|
RECORD;
|
||||||
|
|
||||||
public static int pack(Set<ElementModifier> elementModifiers) {
|
public static int pack(Set<ElementModifier> elementModifiers) {
|
||||||
ElementModifier[] knownModifiers = ElementModifier.values();
|
ElementModifier[] knownModifiers = ElementModifier.values();
|
||||||
|
|
|
@ -505,6 +505,9 @@ public class Parser {
|
||||||
member.getModifiers().add(ElementModifier.VOLATILE);
|
member.getModifiers().add(ElementModifier.VOLATILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((access & Opcodes.ACC_RECORD) != 0) {
|
||||||
|
member.getModifiers().add(ElementModifier.RECORD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseAnnotations(AnnotationContainer annotations, List<AnnotationNode> visibleAnnotations,
|
private void parseAnnotations(AnnotationContainer annotations, List<AnnotationNode> visibleAnnotations,
|
||||||
|
|
|
@ -30,6 +30,8 @@ public interface ReflectClass<T> extends ReflectAnnotatedElement {
|
||||||
|
|
||||||
boolean isEnum();
|
boolean isEnum();
|
||||||
|
|
||||||
|
boolean isRecord();
|
||||||
|
|
||||||
T[] getEnumConstants();
|
T[] getEnumConstants();
|
||||||
|
|
||||||
int getModifiers();
|
int getModifiers();
|
||||||
|
|
|
@ -86,6 +86,12 @@ public class ReflectClassImpl<T> implements ReflectClass<T> {
|
||||||
return classReader != null && classReader.readModifiers().contains(ElementModifier.ENUM);
|
return classReader != null && classReader.readModifiers().contains(ElementModifier.ENUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRecord() {
|
||||||
|
resolve();
|
||||||
|
return classReader != null && classReader.readModifiers().contains(ElementModifier.RECORD);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public T[] getEnumConstants() {
|
public T[] getEnumConstants() {
|
||||||
|
|
|
@ -26,6 +26,8 @@ import org.teavm.model.ElementReader;
|
||||||
import org.teavm.model.ValueType;
|
import org.teavm.model.ValueType;
|
||||||
|
|
||||||
public class ReflectContext {
|
public class ReflectContext {
|
||||||
|
private static final int RECORD = 0x10000;
|
||||||
|
|
||||||
private ClassReaderSource classSource;
|
private ClassReaderSource classSource;
|
||||||
private ClassHierarchy hierarchy;
|
private ClassHierarchy hierarchy;
|
||||||
private Map<ValueType, ReflectClassImpl<?>> classes = new HashMap<>();
|
private Map<ValueType, ReflectClassImpl<?>> classes = new HashMap<>();
|
||||||
|
@ -108,6 +110,9 @@ public class ReflectContext {
|
||||||
if (modifierSet.contains(ElementModifier.VOLATILE)) {
|
if (modifierSet.contains(ElementModifier.VOLATILE)) {
|
||||||
modifiers |= Modifier.VOLATILE;
|
modifiers |= Modifier.VOLATILE;
|
||||||
}
|
}
|
||||||
|
if (modifierSet.contains(ElementModifier.RECORD)) {
|
||||||
|
modifiers |= RECORD;
|
||||||
|
}
|
||||||
return modifiers;
|
return modifiers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user