From 06748fa12b828b04d6993eb02731055e4b3f6306 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Thu, 17 Nov 2022 14:35:37 +0100 Subject: [PATCH] Fix class initializer optimization. Assume that class initializer is dynamic if it initializes another class with dynamic initializer --- .../org/teavm/model/analysis/ClassInitializerAnalysis.java | 3 +++ 1 file changed, 3 insertions(+) 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 a036d44b2..b439ae005 100644 --- a/core/src/main/java/org/teavm/model/analysis/ClassInitializerAnalysis.java +++ b/core/src/main/java/org/teavm/model/analysis/ClassInitializerAnalysis.java @@ -289,6 +289,9 @@ public class ClassInitializerAnalysis implements ClassInitializerInfo { } analyze(className); + if (isDynamicInitializer(className)) { + methodInfo.anyFieldModified = true; + } } private void analyzeCalledMethod(MethodInfo calledMethod) {