diff --git a/jso/impl/src/main/java/org/teavm/jso/impl/JSClassProcessor.java b/jso/impl/src/main/java/org/teavm/jso/impl/JSClassProcessor.java index ba0b970a0..472e104f9 100644 --- a/jso/impl/src/main/java/org/teavm/jso/impl/JSClassProcessor.java +++ b/jso/impl/src/main/java/org/teavm/jso/impl/JSClassProcessor.java @@ -104,18 +104,20 @@ class JSClassProcessor { private final JSTypeHelper typeHelper; private final Diagnostics diagnostics; private final Map overriddenMethodCache = new HashMap<>(); + private final boolean strict; private JSValueMarshaller marshaller; private IncrementalDependencyRegistration incrementalCache; private JSImportAnnotationCache annotationCache; private ClassReader objectClass; JSClassProcessor(ClassReaderSource classSource, JSTypeHelper typeHelper, JSBodyRepository repository, - Diagnostics diagnostics, IncrementalDependencyRegistration incrementalCache) { + Diagnostics diagnostics, IncrementalDependencyRegistration incrementalCache, boolean strict) { this.classSource = classSource; this.typeHelper = typeHelper; this.repository = repository; this.diagnostics = diagnostics; this.incrementalCache = incrementalCache; + this.strict = strict; javaInvocationProcessor = new JavaInvocationProcessor(typeHelper, repository, classSource, diagnostics); annotationCache = new JSImportAnnotationCache(classSource, diagnostics); @@ -477,7 +479,7 @@ class JSClassProcessor { ClassReader targetClass = classSource.get(targetClassName); if (targetClass.getAnnotations().get(JSFunctor.class.getName()) == null) { - if (isTransparent(targetClassName)) { + if (!strict || isTransparent(targetClassName)) { var assign = new AssignInstruction(); assign.setLocation(location.getSourceLocation()); assign.setAssignee(cast.getValue()); diff --git a/jso/impl/src/main/java/org/teavm/jso/impl/JSObjectClassTransformer.java b/jso/impl/src/main/java/org/teavm/jso/impl/JSObjectClassTransformer.java index 3137a7ba0..cc4d8a398 100644 --- a/jso/impl/src/main/java/org/teavm/jso/impl/JSObjectClassTransformer.java +++ b/jso/impl/src/main/java/org/teavm/jso/impl/JSObjectClassTransformer.java @@ -70,7 +70,7 @@ class JSObjectClassTransformer implements ClassHolderTransformer { if (processor == null || processor.getClassSource() != hierarchy.getClassSource()) { typeHelper = new JSTypeHelper(hierarchy.getClassSource()); processor = new JSClassProcessor(hierarchy.getClassSource(), typeHelper, repository, - context.getDiagnostics(), context.getIncrementalCache()); + context.getDiagnostics(), context.getIncrementalCache(), context.isStrict()); } processor.processClass(cls); if (typeHelper.isJavaScriptClass(cls.getName())) { diff --git a/tools/junit/src/main/java/org/teavm/junit/TestPlatformSupport.java b/tools/junit/src/main/java/org/teavm/junit/TestPlatformSupport.java index b6cc01e95..62383bc82 100644 --- a/tools/junit/src/main/java/org/teavm/junit/TestPlatformSupport.java +++ b/tools/junit/src/main/java/org/teavm/junit/TestPlatformSupport.java @@ -85,6 +85,7 @@ abstract class TestPlatformSupport { .setClassSource(classSource) .setReferenceCache(referenceCache) .setDependencyAnalyzerFactory(dependencyAnalyzerFactory) + .setStrict(true) .build(); configuration.apply(vm);