diff --git a/core/src/main/java/org/teavm/model/analysis/ClassInitializerAnalysis.java b/core/src/main/java/org/teavm/model/analysis/ClassInitializerAnalysis.java index 6d6940a2d..b4d59a89d 100644 --- a/core/src/main/java/org/teavm/model/analysis/ClassInitializerAnalysis.java +++ b/core/src/main/java/org/teavm/model/analysis/ClassInitializerAnalysis.java @@ -33,6 +33,7 @@ import org.teavm.model.BasicBlockReader; import org.teavm.model.ClassHierarchy; import org.teavm.model.ClassReader; import org.teavm.model.ElementModifier; +import org.teavm.model.FieldReader; import org.teavm.model.FieldReference; import org.teavm.model.ListableClassReaderSource; import org.teavm.model.MethodDescriptor; @@ -220,6 +221,13 @@ public class ClassInitializerAnalysis implements ClassInitializerInfo { @Override public void putField(VariableReader instance, FieldReference field, VariableReader value, ValueType fieldType) { if (instance == null) { + ClassReader cls = classes.get(field.getClassName()); + if (cls != null) { + FieldReader fieldReader = cls.getField(field.getFieldName()); + if (fieldReader != null && fieldReader.hasModifier(ElementModifier.FINAL)) { + return; + } + } touchField(field); } }