Merge
authorlana
Fri, 11 Nov 2016 05:56:09 +0000
changeset 41993 c8260c3ae93b
parent 41989 d9aa38b9c278 (current diff)
parent 41992 720257f5307d (diff)
child 41994 e43f670394ca
Merge
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java	Fri Nov 11 05:11:55 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java	Fri Nov 11 05:56:09 2016 +0000
@@ -137,12 +137,18 @@
     /** Returns true iff the given Symbol is in this scope or any outward scope.
      */
     public boolean includes(final Symbol sym) {
+        return includes(sym, RECURSIVE);
+    }
+
+    /** Returns true iff the given Symbol is in this scope, optionally checking outward scopes.
+     */
+    public boolean includes(final Symbol sym, LookupKind lookupKind) {
         return getSymbolsByName(sym.name, new Filter<Symbol>() {
             @Override
             public boolean accepts(Symbol t) {
                 return t == sym;
             }
-        }).iterator().hasNext();
+        }, lookupKind).iterator().hasNext();
     }
 
     /** Returns true iff this scope does not contain any Symbol. Does not inspect outward scopes.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Nov 11 05:11:55 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Nov 11 05:56:09 2016 +0000
@@ -62,6 +62,7 @@
 
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
+import com.sun.tools.javac.code.Scope.LookupKind;
 import static com.sun.tools.javac.code.TypeTag.ARRAY;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
@@ -2186,7 +2187,11 @@
             // Sometimes anonymous classes don't have an outer
             // instance, however, there is no reliable way to tell so
             // we never strip this$n
-            if (!currentOwner.name.isEmpty())
+            // ditto for local classes. Local classes that have an enclosing method set
+            // won't pass the "hasOuterInstance" check above, but those that don't have an
+            // enclosing method (i.e. from initializers) will pass that check.
+            boolean local = !currentOwner.owner.members().includes(currentOwner, LookupKind.NON_RECURSIVE);
+            if (!currentOwner.name.isEmpty() && !local)
                 type = new MethodType(adjustMethodParams(flags, type.getParameterTypes()),
                                       type.getReturnType(),
                                       type.getThrownTypes(),
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Fri Nov 11 05:11:55 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Fri Nov 11 05:56:09 2016 +0000
@@ -35,6 +35,7 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.EnumSet;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
@@ -43,6 +44,7 @@
 import java.util.ServiceLoader;
 import java.util.Set;
 import java.util.TreeSet;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.StreamSupport;
@@ -200,31 +202,37 @@
         // The standard file manager code knows to split apart the NULL-separated components.
         @Override
         public boolean process(OptionHelper helper, String option, String arg) {
-            if (!arg.contains("=")) { // could be more strict regeex, e.g. "(?i)[a-z0-9_.]+=.*"
-                helper.error(Errors.LocnInvalidArgForXpatch(arg));
+            if (arg.isEmpty()) {
+                helper.error("err.no.value.for.option", option);
+                return true;
+            } else if (getPattern().matcher(arg).matches()) {
+                String prev = helper.get(PATCH_MODULE);
+                if (prev == null) {
+                    super.process(helper, option, arg);
+                    return false;
+                } else {
+                    String argModulePackage = arg.substring(0, arg.indexOf('='));
+                    boolean isRepeated = Arrays.stream(prev.split("\0"))
+                            .map(s -> s.substring(0, s.indexOf('=')))
+                            .collect(Collectors.toSet())
+                            .contains(argModulePackage);
+                    if (isRepeated) {
+                        helper.error("err.repeated.value.for.patch.module", argModulePackage);
+                        return true;
+                    } else {
+                        super.process(helper, option, prev + '\0' + arg);
+                        return false;
+                    }
+                }
+            } else {
+                helper.error("err.bad.value.for.option", option, arg);
+                return true;
             }
-
-            String previous = helper.get(this);
-            if (previous == null) {
-                return super.process(helper, option, arg);
-            }
+        }
 
-            Map<String,String> map = new LinkedHashMap<>();
-            for (String s : previous.split("\0")) {
-                int sep = s.indexOf('=');
-                map.put(s.substring(0, sep), s.substring(sep + 1));
-            }
-
-            int sep = arg.indexOf('=');
-            map.put(arg.substring(0, sep), arg.substring(sep + 1));
-
-            StringBuilder sb = new StringBuilder();
-            map.forEach((m, p) -> {
-                if (sb.length() > 0)
-                    sb.append('\0');
-                sb.append(m).append('=').append(p);
-            });
-            return super.process(helper, option, sb.toString());
+        @Override
+        public Pattern getPattern() {
+            return Pattern.compile("([^/]+)=(,*[^,].*)");
         }
     },
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties	Fri Nov 11 05:11:55 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties	Fri Nov 11 05:56:09 2016 +0000
@@ -361,6 +361,8 @@
     bad value for {0} option: ''{1}''
 javac.err.no.value.for.option=\
     no value for {0} option
+javac.err.repeated.value.for.patch.module=\
+    --patch-module specified more than once for {0}
 
 ## messages
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java	Fri Nov 11 05:11:55 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java	Fri Nov 11 05:56:09 2016 +0000
@@ -939,6 +939,17 @@
             public void put(String name, String value) {
                 compOpts.put(name, value);
             }
+
+            @Override
+            public void remove(String name) {
+                compOpts.remove(name);
+            }
+
+            @Override
+            public boolean handleFileManagerOption(com.sun.tools.javac.main.Option option, String value) {
+                fileManagerOpts.put(option, value);
+                return true;
+            }
         };
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java	Fri Nov 11 05:11:55 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java	Fri Nov 11 05:56:09 2016 +0000
@@ -57,63 +57,56 @@
     BOOTCLASSPATH("-bootclasspath", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg);
+            Option.BOOT_CLASS_PATH.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     CLASS_PATH("--class-path -classpath -cp", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.CLASS_PATH, arg);
+            Option.CLASS_PATH.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     EXTDIRS("-extdirs", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.EXTDIRS, arg);
+            Option.EXTDIRS.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     SOURCE_PATH("--source-path -sourcepath", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.SOURCE_PATH, arg);
-        }
-    },
-
-    SYSCLASSPATH("-sysclasspath", HIDDEN, true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg);
+            Option.SOURCE_PATH.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     MODULE_SOURCE_PATH("--module-source-path", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.MODULE_SOURCE_PATH, arg);
+            Option.MODULE_SOURCE_PATH.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     UPGRADE_MODULE_PATH("--upgrade-module-path", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.UPGRADE_MODULE_PATH, arg);
+            Option.UPGRADE_MODULE_PATH.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     SYSTEM("--system", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.SYSTEM, arg);
+            Option.SYSTEM.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     MODULE_PATH("--module-path -p", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.MODULE_PATH, arg);
+            Option.MODULE_PATH.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
@@ -141,7 +134,7 @@
     ENCODING("-encoding", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.ENCODING, arg);
+            Option.ENCODING.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
@@ -290,14 +283,6 @@
 
     // ----- output control options -----
 
-    PROMPT("-prompt", HIDDEN) {
-        @Override
-        public void process(Helper helper) {
-            helper.compOpts.put("-prompt", "-prompt");
-            helper.promptOnError = true;
-        }
-    },
-
     QUIET("-quiet", STANDARD) {
         @Override
         public void process(Helper helper) {
--- a/langtools/test/jdk/javadoc/tool/modules/Modules.java	Fri Nov 11 05:11:55 2016 +0000
+++ b/langtools/test/jdk/javadoc/tool/modules/Modules.java	Fri Nov 11 05:56:09 2016 +0000
@@ -296,7 +296,7 @@
         checkMembersSelected("pkg2.B.f");
     }
 
-//    @Test @ignore JDK-8166379
+    @Test
     public void testPatchModuleOption(Path base) throws Exception {
         Path src = base.resolve("src");
         Path modulePath = base.resolve("modules");
--- a/langtools/test/tools/javac/modules/PatchModulesTest.java	Fri Nov 11 05:11:55 2016 +0000
+++ b/langtools/test/tools/javac/modules/PatchModulesTest.java	Fri Nov 11 05:56:09 2016 +0000
@@ -91,12 +91,28 @@
     }
 
     @Test
-    public void testLastOneWins(Path base) throws Exception {
+    public void testDuplicates(Path base) throws Exception {
         test(asList("java.base=a", "java.compiler=b", "java.base=c"),
-            "{java.base=[c], java.compiler=[b]}");
+            false, "--patch-module specified more than once for java.base");
+    }
+
+    @Test
+    public void testEmpty(Path base) throws Exception {
+        test(asList(""),
+            false, "no value for --patch-module option");
+    }
+
+    @Test
+    public void testInvalid(Path base) throws Exception {
+        test(asList("java.base/java.lang=."),
+            false, "bad value for --patch-module option: 'java.base/java.lang=.'");
     }
 
     void test(List<String> patches, String expect) throws Exception {
+        test(patches, true, expect);
+    }
+
+    void test(List<String> patches, boolean expectOK, String expect) throws Exception {
         JavacTool tool = (JavacTool) ToolProvider.getSystemJavaCompiler();
         StringWriter sw = new StringWriter();
         try (PrintWriter pw = new PrintWriter(sw)) {
@@ -121,6 +137,17 @@
                 tb.out.println("Found:  " + found);
                 error("output not as expected");
             }
+        } catch (IllegalArgumentException e) {
+            if (expectOK) {
+                error("unexpected exception: " + e);
+                throw e;
+            }
+            String found = e.getMessage();
+            if (!found.equals(expect)) {
+                tb.out.println("Expect: " + expect);
+                tb.out.println("Found:  " + found);
+                error("output not as expected");
+            }
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.java	Fri Nov 11 05:56:09 2016 +0000
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8166700
+ * @summary Check that local classes originating in static initializer can be loaded properly.
+ * @modules jdk.compiler
+ * @build LocalTest$1Local LocalTest$2Local LocalTest$3Local LocalTest$4Local LocalTest$5Local LocalTest
+ * @compile LocalClassesModel.java
+ * @compile/process/ref=LocalClassesModel.out -processor LocalClassesModel LocalTest$1Local LocalTest$2Local LocalTest$3Local LocalTest$4Local LocalTest$5Local LocalTest
+ */
+
+import java.util.Set;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.util.ElementFilter;
+
+@SupportedAnnotationTypes("*")
+public class LocalClassesModel extends AbstractProcessor {
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        for (TypeElement root : ElementFilter.typesIn(roundEnv.getRootElements())) {
+            System.out.println(processingEnv.getElementUtils().getBinaryName(root));
+            for (ExecutableElement constr : ElementFilter.constructorsIn(root.getEnclosedElements())) {
+                System.out.print("  (");
+                boolean first = true;
+                for (VariableElement param : constr.getParameters()) {
+                    if (!first) {
+                        System.out.print(", ");
+                    }
+                    first = false;
+                    System.out.print(param.asType().toString());
+                }
+                System.out.println(")");
+            }
+        }
+
+        return false;
+    }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latestSupported();
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.out	Fri Nov 11 05:56:09 2016 +0000
@@ -0,0 +1,12 @@
+LocalTest$1Local
+  ()
+LocalTest$2Local
+  (LocalTest)
+LocalTest$3Local
+  ()
+LocalTest$4Local
+  (LocalTest)
+LocalTest$5Local
+  (LocalTest)
+LocalTest
+  ()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$1Local.jcod	Fri Nov 11 05:56:09 2016 +0000
@@ -0,0 +1,77 @@
+class LocalTest$1Local {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #12; // #1    
+    class #13; // #2    
+    class #16; // #3    
+    Utf8 "<init>"; // #4    
+    Utf8 "()V"; // #5    
+    Utf8 "Code"; // #6    
+    Utf8 "LineNumberTable"; // #7    
+    Utf8 "SourceFile"; // #8    
+    Utf8 "LocalTest.java"; // #9    
+    Utf8 "EnclosingMethod"; // #10    
+    class #17; // #11    
+    NameAndType #4 #5; // #12    
+    Utf8 "LocalTest$1Local"; // #13    
+    Utf8 "Local"; // #14    
+    Utf8 "InnerClasses"; // #15    
+    Utf8 "java/lang/Object"; // #16    
+    Utf8 "LocalTest"; // #17    
+  } // Constant Pool
+
+  0x0020; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0000; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#7) { // LineNumberTable
+              [] { // LineNumberTable
+                0  3;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#8) { // SourceFile
+      #9;
+    } // end SourceFile
+    ;
+    Attr(#10) { // EnclosingMethod
+      #11 #0;
+    } // end EnclosingMethod
+    ;
+    Attr(#15) { // InnerClasses
+      [] { // InnerClasses
+        #2 #0 #14 0;
+      }
+    } // end InnerClasses
+  } // Attributes
+} // end class LocalTest$1Local
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$2Local.jcod	Fri Nov 11 05:56:09 2016 +0000
@@ -0,0 +1,90 @@
+class LocalTest$2Local {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Field #3 #15; // #1    
+    Method #4 #16; // #2    
+    class #17; // #3    
+    class #20; // #4    
+    Utf8 "this$0"; // #5    
+    Utf8 "LLocalTest;"; // #6    
+    Utf8 "<init>"; // #7    
+    Utf8 "(LLocalTest;)V"; // #8    
+    Utf8 "Code"; // #9    
+    Utf8 "LineNumberTable"; // #10    
+    Utf8 "SourceFile"; // #11    
+    Utf8 "LocalTest.java"; // #12    
+    Utf8 "EnclosingMethod"; // #13    
+    class #21; // #14    
+    NameAndType #5 #6; // #15    
+    NameAndType #7 #22; // #16    
+    Utf8 "LocalTest$2Local"; // #17    
+    Utf8 "Local"; // #18    
+    Utf8 "InnerClasses"; // #19    
+    Utf8 "java/lang/Object"; // #20    
+    Utf8 "LocalTest"; // #21    
+    Utf8 "()V"; // #22    
+  } // Constant Pool
+
+  0x0020; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+    { // Member
+      0x1010; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+      } // Attributes
+    } // Member
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0000; // access
+      #7; // name_cpx
+      #8; // sig_cpx
+      [] { // Attributes
+        Attr(#9) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB500012AB700;
+            0x02B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#10) { // LineNumberTable
+              [] { // LineNumberTable
+                0  6;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#11) { // SourceFile
+      #12;
+    } // end SourceFile
+    ;
+    Attr(#13) { // EnclosingMethod
+      #14 #0;
+    } // end EnclosingMethod
+    ;
+    Attr(#19) { // InnerClasses
+      [] { // InnerClasses
+        #3 #0 #18 0;
+      }
+    } // end InnerClasses
+  } // Attributes
+} // end class LocalTest$2Local
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$3Local.jcod	Fri Nov 11 05:56:09 2016 +0000
@@ -0,0 +1,79 @@
+class LocalTest$3Local {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #13; // #1    
+    class #14; // #2    
+    class #17; // #3    
+    Utf8 "<init>"; // #4    
+    Utf8 "()V"; // #5    
+    Utf8 "Code"; // #6    
+    Utf8 "LineNumberTable"; // #7    
+    Utf8 "SourceFile"; // #8    
+    Utf8 "LocalTest.java"; // #9    
+    Utf8 "EnclosingMethod"; // #10    
+    class #18; // #11    
+    NameAndType #19 #5; // #12    
+    NameAndType #4 #5; // #13    
+    Utf8 "LocalTest$3Local"; // #14    
+    Utf8 "Local"; // #15    
+    Utf8 "InnerClasses"; // #16    
+    Utf8 "java/lang/Object"; // #17    
+    Utf8 "LocalTest"; // #18    
+    Utf8 "test1"; // #19    
+  } // Constant Pool
+
+  0x0020; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0000; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#7) { // LineNumberTable
+              [] { // LineNumberTable
+                0  9;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#8) { // SourceFile
+      #9;
+    } // end SourceFile
+    ;
+    Attr(#10) { // EnclosingMethod
+      #11 #12;
+    } // end EnclosingMethod
+    ;
+    Attr(#16) { // InnerClasses
+      [] { // InnerClasses
+        #2 #0 #15 0;
+      }
+    } // end InnerClasses
+  } // Attributes
+} // end class LocalTest$3Local
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$4Local.jcod	Fri Nov 11 05:56:09 2016 +0000
@@ -0,0 +1,92 @@
+class LocalTest$4Local {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Field #3 #16; // #1    
+    Method #4 #17; // #2    
+    class #18; // #3    
+    class #21; // #4    
+    Utf8 "this$0"; // #5    
+    Utf8 "LLocalTest;"; // #6    
+    Utf8 "<init>"; // #7    
+    Utf8 "(LLocalTest;)V"; // #8    
+    Utf8 "Code"; // #9    
+    Utf8 "LineNumberTable"; // #10    
+    Utf8 "SourceFile"; // #11    
+    Utf8 "LocalTest.java"; // #12    
+    Utf8 "EnclosingMethod"; // #13    
+    class #22; // #14    
+    NameAndType #23 #24; // #15    
+    NameAndType #5 #6; // #16    
+    NameAndType #7 #24; // #17    
+    Utf8 "LocalTest$4Local"; // #18    
+    Utf8 "Local"; // #19    
+    Utf8 "InnerClasses"; // #20    
+    Utf8 "java/lang/Object"; // #21    
+    Utf8 "LocalTest"; // #22    
+    Utf8 "test2"; // #23    
+    Utf8 "()V"; // #24    
+  } // Constant Pool
+
+  0x0020; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+    { // Member
+      0x1010; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+      } // Attributes
+    } // Member
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0000; // access
+      #7; // name_cpx
+      #8; // sig_cpx
+      [] { // Attributes
+        Attr(#9) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB500012AB700;
+            0x02B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#10) { // LineNumberTable
+              [] { // LineNumberTable
+                0  12;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#11) { // SourceFile
+      #12;
+    } // end SourceFile
+    ;
+    Attr(#13) { // EnclosingMethod
+      #14 #15;
+    } // end EnclosingMethod
+    ;
+    Attr(#20) { // InnerClasses
+      [] { // InnerClasses
+        #3 #0 #19 0;
+      }
+    } // end InnerClasses
+  } // Attributes
+} // end class LocalTest$4Local
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$5Local.jcod	Fri Nov 11 05:56:09 2016 +0000
@@ -0,0 +1,90 @@
+class LocalTest$5Local {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Field #3 #16; // #1    
+    Method #4 #15; // #2    
+    class #17; // #3    
+    class #20; // #4    
+    Utf8 "this$0"; // #5    
+    Utf8 "LLocalTest;"; // #6    
+    Utf8 "<init>"; // #7    
+    Utf8 "(LLocalTest;)V"; // #8    
+    Utf8 "Code"; // #9    
+    Utf8 "LineNumberTable"; // #10    
+    Utf8 "SourceFile"; // #11    
+    Utf8 "LocalTest.java"; // #12    
+    Utf8 "EnclosingMethod"; // #13    
+    class #21; // #14    
+    NameAndType #7 #22; // #15    
+    NameAndType #5 #6; // #16    
+    Utf8 "LocalTest$5Local"; // #17    
+    Utf8 "Local"; // #18    
+    Utf8 "InnerClasses"; // #19    
+    Utf8 "java/lang/Object"; // #20    
+    Utf8 "LocalTest"; // #21    
+    Utf8 "()V"; // #22    
+  } // Constant Pool
+
+  0x0020; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+    { // Member
+      0x1010; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+      } // Attributes
+    } // Member
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0000; // access
+      #7; // name_cpx
+      #8; // sig_cpx
+      [] { // Attributes
+        Attr(#9) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB500012AB700;
+            0x02B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#10) { // LineNumberTable
+              [] { // LineNumberTable
+                0  15;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#11) { // SourceFile
+      #12;
+    } // end SourceFile
+    ;
+    Attr(#13) { // EnclosingMethod
+      #14 #15;
+    } // end EnclosingMethod
+    ;
+    Attr(#19) { // InnerClasses
+      [] { // InnerClasses
+        #3 #0 #18 0;
+      }
+    } // end InnerClasses
+  } // Attributes
+} // end class LocalTest$5Local
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest.jcod	Fri Nov 11 05:56:09 2016 +0000
@@ -0,0 +1,160 @@
+class LocalTest {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #20; // #1    
+    class #21; // #2    
+    class #22; // #3    
+    class #23; // #4    
+    Utf8 "Local"; // #5    
+    Utf8 "InnerClasses"; // #6    
+    class #24; // #7    
+    class #25; // #8    
+    class #26; // #9    
+    class #27; // #10    
+    Utf8 "test1"; // #11    
+    Utf8 "()V"; // #12    
+    Utf8 "Code"; // #13    
+    Utf8 "LineNumberTable"; // #14    
+    Utf8 "test2"; // #15    
+    Utf8 "<init>"; // #16    
+    Utf8 "<clinit>"; // #17    
+    Utf8 "SourceFile"; // #18    
+    Utf8 "LocalTest.java"; // #19    
+    NameAndType #16 #12; // #20    
+    Utf8 "LocalTest"; // #21    
+    Utf8 "java/lang/Object"; // #22    
+    Utf8 "LocalTest$5Local"; // #23    
+    Utf8 "LocalTest$4Local"; // #24    
+    Utf8 "LocalTest$3Local"; // #25    
+    Utf8 "LocalTest$2Local"; // #26    
+    Utf8 "LocalTest$1Local"; // #27    
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0008; // access
+      #11; // name_cpx
+      #12; // sig_cpx
+      [] { // Attributes
+        Attr(#13) { // Code
+          0; // max_stack
+          0; // max_locals
+          Bytes[]{
+            0xB1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#14) { // LineNumberTable
+              [] { // LineNumberTable
+                0  10;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0000; // access
+      #15; // name_cpx
+      #12; // sig_cpx
+      [] { // Attributes
+        Attr(#13) { // Code
+          0; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0xB1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#14) { // LineNumberTable
+              [] { // LineNumberTable
+                0  13;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0000; // access
+      #16; // name_cpx
+      #12; // sig_cpx
+      [] { // Attributes
+        Attr(#13) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#14) { // LineNumberTable
+              [] { // LineNumberTable
+                0  14;
+                4  16;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0008; // access
+      #17; // name_cpx
+      #12; // sig_cpx
+      [] { // Attributes
+        Attr(#13) { // Code
+          0; // max_stack
+          0; // max_locals
+          Bytes[]{
+            0xB1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#14) { // LineNumberTable
+              [] { // LineNumberTable
+                0  4;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#18) { // SourceFile
+      #19;
+    } // end SourceFile
+    ;
+    Attr(#6) { // InnerClasses
+      [] { // InnerClasses
+        #4 #0 #5 0;
+        #7 #0 #5 0;
+        #8 #0 #5 0;
+        #9 #0 #5 0;
+        #10 #0 #5 0;
+      }
+    } // end InnerClasses
+  } // Attributes
+} // end class LocalTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest.orign	Fri Nov 11 05:56:09 2016 +0000
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**The jcod files are generated from this file, compiled by JDK 8 javac.
+ */
+public class LocalTest {
+    static {
+        class Local { }
+    }
+    {
+        class Local { }
+    }
+    static void test1() {
+        class Local { }
+    }
+    void test2() {
+        class Local { }
+    }
+    LocalTest() {
+        class Local { }
+    }
+}
+