diff a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
@@ -83,12 +83,10 @@
 import com.sun.tools.javac.util.Log.DiscardDiagnosticHandler;
 import com.sun.tools.javac.util.Log.WriterKind;
 
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 
-import com.sun.tools.javac.code.Lint;
-import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Symbol.ModuleSymbol;
 
 import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.resources.CompilerProperties.Fragments;
 import com.sun.tools.javac.resources.CompilerProperties.Notes;
@@ -1561,10 +1559,12 @@
          */
         class ScanNested extends TreeScanner {
             Set<Env<AttrContext>> dependencies = new LinkedHashSet<>();
             protected boolean hasLambdas;
             protected boolean hasPatterns;
+            protected boolean hasValueClasses;
+            protected boolean hasStrictFields;
             @Override
             public void visitClassDef(JCClassDecl node) {
                 Type st = types.supertype(node.sym.type);
                 boolean envForSuperTypeFound = false;
                 while (!envForSuperTypeFound && st.hasTag(CLASS)) {
@@ -1572,10 +1572,11 @@
                     Env<AttrContext> stEnv = enter.getEnv(c);
                     if (stEnv != null && env != stEnv) {
                         if (dependencies.add(stEnv)) {
                             boolean prevHasLambdas = hasLambdas;
                             boolean prevHasPatterns = hasPatterns;
+                            boolean prevHasStrictFields = hasStrictFields;
                             try {
                                 scan(stEnv.tree);
                             } finally {
                                 /*
                                  * ignore any updates to hasLambdas and hasPatterns
@@ -1584,16 +1585,18 @@
                                  * available only to those classes that contain
                                  * lambdas or patterns, respectivelly
                                  */
                                 hasLambdas = prevHasLambdas;
                                 hasPatterns = prevHasPatterns;
+                                hasStrictFields = prevHasStrictFields;
                             }
                         }
                         envForSuperTypeFound = true;
                     }
                     st = types.supertype(st);
                 }
+                hasValueClasses = node.sym.isValueClass();
                 super.visitClassDef(node);
             }
             @Override
             public void visitLambda(JCLambda tree) {
                 hasLambdas = true;
@@ -1629,16 +1632,22 @@
             @Override
             public void visitSwitchExpression(JCSwitchExpression tree) {
                 hasPatterns |= tree.patternSwitch;
                 super.visitSwitchExpression(tree);
             }
+
+            @Override
+            public void visitVarDef(JCVariableDecl tree) {
+                hasStrictFields |= tree.sym.isStrict();
+                super.visitVarDef(tree);
+            }
         }
         ScanNested scanner = new ScanNested();
         scanner.scan(env.tree);
         for (Env<AttrContext> dep: scanner.dependencies) {
-        if (!compileStates.isDone(dep, CompileState.WARN))
-            desugaredEnvs.put(dep, desugar(warn(flow(attribute(dep)))));
+            if (!compileStates.isDone(dep, CompileState.WARN))
+                desugaredEnvs.put(dep, desugar(warn(flow(attribute(dep)))));
         }
 
         //We need to check for error another time as more classes might
         //have been attributed and analyzed at this stage
         if (shouldStop(CompileState.TRANSTYPES))
@@ -1713,10 +1722,19 @@
                 for (JCTree def : cdefs) {
                     LambdaToMethod.instance(context).translateTopLevelClass(env, def, localMake);
                 }
                 compileStates.put(env, CompileState.UNLAMBDA);
             }
+
+            if (scanner.hasValueClasses || scanner.hasStrictFields) {
+                if (shouldStop(CompileState.STRICT_FIELDS_PROXIES))
+                    return;
+                for (JCTree def : cdefs) {
+                    LocalProxyVarsGen.instance(context).translateTopLevelClass(def, localMake);
+                }
+                compileStates.put(env, CompileState.STRICT_FIELDS_PROXIES);
+            }
 
             //generate code for each class
             for (List<JCTree> l = cdefs; l.nonEmpty(); l = l.tail) {
                 JCClassDecl cdef = (JCClassDecl)l.head;
                 results.add(new Pair<>(env, cdef));
