diff --git a/core/src/main/java/org/teavm/model/ElementModifier.java b/core/src/main/java/org/teavm/model/ElementModifier.java index 4f51e37fa..37bf8a45c 100644 --- a/core/src/main/java/org/teavm/model/ElementModifier.java +++ b/core/src/main/java/org/teavm/model/ElementModifier.java @@ -38,7 +38,8 @@ public enum ElementModifier { SYNCHRONIZED, TRANSIENT, VARARGS, - VOLATILE; + VOLATILE, + RECORD; public static int pack(Set elementModifiers) { ElementModifier[] knownModifiers = ElementModifier.values(); diff --git a/core/src/main/java/org/teavm/parsing/Parser.java b/core/src/main/java/org/teavm/parsing/Parser.java index e3d8ca397..6290480fb 100644 --- a/core/src/main/java/org/teavm/parsing/Parser.java +++ b/core/src/main/java/org/teavm/parsing/Parser.java @@ -505,6 +505,9 @@ public class Parser { member.getModifiers().add(ElementModifier.VOLATILE); } } + if ((access & Opcodes.ACC_RECORD) != 0) { + member.getModifiers().add(ElementModifier.RECORD); + } } private void parseAnnotations(AnnotationContainer annotations, List visibleAnnotations, diff --git a/metaprogramming/api/src/main/java/org/teavm/metaprogramming/ReflectClass.java b/metaprogramming/api/src/main/java/org/teavm/metaprogramming/ReflectClass.java index c7bdaae97..d4097a2ee 100644 --- a/metaprogramming/api/src/main/java/org/teavm/metaprogramming/ReflectClass.java +++ b/metaprogramming/api/src/main/java/org/teavm/metaprogramming/ReflectClass.java @@ -30,6 +30,8 @@ public interface ReflectClass extends ReflectAnnotatedElement { boolean isEnum(); + boolean isRecord(); + T[] getEnumConstants(); int getModifiers(); diff --git a/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/reflect/ReflectClassImpl.java b/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/reflect/ReflectClassImpl.java index 39e985d28..cc77f2020 100644 --- a/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/reflect/ReflectClassImpl.java +++ b/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/reflect/ReflectClassImpl.java @@ -86,6 +86,12 @@ public class ReflectClassImpl implements ReflectClass { return classReader != null && classReader.readModifiers().contains(ElementModifier.ENUM); } + @Override + public boolean isRecord() { + resolve(); + return classReader != null && classReader.readModifiers().contains(ElementModifier.RECORD); + } + @SuppressWarnings("unchecked") @Override public T[] getEnumConstants() { diff --git a/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/reflect/ReflectContext.java b/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/reflect/ReflectContext.java index 99b282c13..f7aaaca03 100644 --- a/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/reflect/ReflectContext.java +++ b/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/reflect/ReflectContext.java @@ -26,6 +26,8 @@ import org.teavm.model.ElementReader; import org.teavm.model.ValueType; public class ReflectContext { + private static final int RECORD = 0x10000; + private ClassReaderSource classSource; private ClassHierarchy hierarchy; private Map> classes = new HashMap<>(); @@ -108,6 +110,9 @@ public class ReflectContext { if (modifierSet.contains(ElementModifier.VOLATILE)) { modifiers |= Modifier.VOLATILE; } + if (modifierSet.contains(ElementModifier.RECORD)) { + modifiers |= RECORD; + } return modifiers; } }