diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TClass.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TClass.java index 676a9edf0..f27377f16 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TClass.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TClass.java @@ -153,6 +153,7 @@ public class TClass extends TObject implements TAnnotatedElement { return Address.ofObject(this).toStructure().simpleName; } + @DelegateTo("setSimpleNameCacheLowLevel") private void setSimpleNameCache(String value) { simpleName = value; } diff --git a/core/src/main/java/org/teavm/backend/c/generate/ClassGenerator.java b/core/src/main/java/org/teavm/backend/c/generate/ClassGenerator.java index bcbf6c6a3..d2b3a697b 100644 --- a/core/src/main/java/org/teavm/backend/c/generate/ClassGenerator.java +++ b/core/src/main/java/org/teavm/backend/c/generate/ClassGenerator.java @@ -248,9 +248,10 @@ public class ClassGenerator { FieldReference[] instanceFields = new FieldReference[cls.getFields().size()]; int instanceIndex = 0; for (FieldHolder field : cls.getFields()) { - if (field.hasModifier(ElementModifier.STATIC)) { + if (field.hasModifier(ElementModifier.STATIC) || isMonitorField(field.getReference())) { continue; } + String fieldName = context.getNames().forMemberField(field.getReference()); structWriter.printStrictType(field.getType()).print(" ").print(fieldName).println(";"); if (isReferenceType(field.getType())) { @@ -267,6 +268,10 @@ public class ClassGenerator { structWriter.outdent().print("} ").print(name).println(";"); } + private boolean isMonitorField(FieldReference field) { + return field.getClassName().equals("java.lang.Object") && field.getFieldName().equals("monitor"); + } + private void generateClassStaticFields(ClassHolder cls) { CodeWriter fieldsWriter = structuresWriter.fragment();