# HG changeset patch # User lana # Date 1435534785 25200 # Node ID cf6355e77564459d6fd53ae85c439f4dc5b033f7 # Parent 689103ee872c0d15077fe4f9604aa7e3ea33fe76# Parent 81ce5febcae83aec811e727af3a8acc5736b42c7 Merge diff -r 689103ee872c -r cf6355e77564 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Sun Jun 28 16:39:45 2015 -0700 @@ -37,6 +37,7 @@ import com.sun.tools.javac.resources.CompilerProperties.Fragments; import com.sun.tools.javac.tree.*; import com.sun.tools.javac.util.*; +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.tools.javac.util.List; @@ -3612,6 +3613,18 @@ } } + // Check that packages imported are in scope (JLS 7.4.3, 6.3, 6.5.3.1, 6.5.3.2) + public void checkImportedPackagesObservable(final JCCompilationUnit toplevel) { + for (JCImport imp : toplevel.getImports()) { + if (!imp.staticImport && TreeInfo.name(imp.qualid) == names.asterisk) { + TypeSymbol tsym = ((JCFieldAccess)imp.qualid).selected.type.tsym; + if (tsym.kind == PCK && tsym.members().isEmpty() && !tsym.exists()) { + log.error(DiagnosticFlag.RESOLVE_ERROR, imp.pos, "doesnt.exist", tsym); + } + } + } + } + private boolean checkTypeContainsImportableElement(TypeSymbol tsym, TypeSymbol origin, PackageSymbol packge, Name name, Set processed) { if (tsym == null || !processed.add(tsym)) return false; diff -r 689103ee872c -r cf6355e77564 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Sun Jun 28 16:39:45 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, 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 @@ -1197,10 +1197,13 @@ //if a class is defined within a lambda, the lambda must capture //its enclosing instance (if any) TranslationContext localContext = context(); - while (localContext != null) { - if (localContext.tree.getTag() == LAMBDA) { + final TypeSymbol outerInstanceSymbol = tree.sym.type.getEnclosingType().tsym; + while (localContext != null && !localContext.owner.isStatic()) { + if (localContext.tree.hasTag(LAMBDA)) { + JCTree block = capturedDecl(localContext.depth, outerInstanceSymbol); + if (block == null) break; ((LambdaTranslationContext)localContext) - .addSymbol(tree.sym.type.getEnclosingType().tsym, CAPTURED_THIS); + .addSymbol(outerInstanceSymbol, CAPTURED_THIS); } localContext = localContext.prev; } @@ -1236,7 +1239,7 @@ } } else if (tree.sym.owner.kind == TYP) { TranslationContext localContext = context(); - while (localContext != null) { + while (localContext != null && !localContext.owner.isStatic()) { if (localContext.tree.hasTag(LAMBDA)) { JCTree block = capturedDecl(localContext.depth, tree.sym); if (block == null) break; @@ -1312,10 +1315,15 @@ boolean isLocal = def.isLocal(); if ((inReferencedClass && isLocal || lambdaNewClassFilter(context(), tree))) { TranslationContext localContext = context(); - while (localContext != null) { - if (localContext.tree.getTag() == LAMBDA) { + final TypeSymbol outerInstanceSymbol = tree.type.getEnclosingType().tsym; + while (localContext != null && !localContext.owner.isStatic()) { + if (localContext.tree.hasTag(LAMBDA)) { + if (outerInstanceSymbol != null) { + JCTree block = capturedDecl(localContext.depth, outerInstanceSymbol); + if (block == null) break; + } ((LambdaTranslationContext)localContext) - .addSymbol(tree.type.getEnclosingType().tsym, CAPTURED_THIS); + .addSymbol(outerInstanceSymbol, CAPTURED_THIS); } localContext = localContext.prev; } @@ -1404,7 +1412,7 @@ // A select of this or super means, if we are in a lambda, // we much have an instance context TranslationContext localContext = context(); - while (localContext != null) { + while (localContext != null && !localContext.owner.isStatic()) { if (localContext.tree.hasTag(LAMBDA)) { JCClassDecl clazz = (JCClassDecl)capturedDecl(localContext.depth, tree.sym); if (clazz == null) break; @@ -1579,7 +1587,7 @@ switch (block.tree.getTag()) { case CLASSDEF: ClassSymbol clazz = ((JCClassDecl)block.tree).sym; - if (sym.isMemberOf(clazz, types)) { + if (clazz.isSubClass(sym, types) || sym.isMemberOf(clazz, types)) { return currentDepth > depth ? null : block.tree; } break; diff -r 689103ee872c -r cf6355e77564 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java Sun Jun 28 16:39:45 2015 -0700 @@ -218,6 +218,7 @@ resolve.run(); chk.checkImportsUnique(toplevel); chk.checkImportsResolvable(toplevel); + chk.checkImportedPackagesObservable(toplevel); toplevel.namedImportScope.finalizeScope(); toplevel.starImportScope.finalizeScope(); } finally { @@ -323,7 +324,10 @@ chk.importAccessible(sym, packge); // Import-on-demand java.lang. - importAll(tree.pos, syms.enterPackage(names.java_lang), env); + PackageSymbol javaLang = syms.enterPackage(names.java_lang); + if (javaLang.members().isEmpty() && !javaLang.exists()) + throw new FatalError(diags.fragment("fatal.err.no.java.lang")); + importAll(tree.pos, javaLang, env); // Process the package def and all import clauses. if (tree.getPackage() != null) @@ -414,16 +418,6 @@ private void importAll(int pos, final TypeSymbol tsym, Env env) { - // Check that packages imported from exist (JLS ???). - if (tsym.kind == PCK && tsym.members().isEmpty() && !tsym.exists()) { - // If we can't find java.lang, exit immediately. - if (((PackageSymbol)tsym).fullname.equals(names.java_lang)) { - JCDiagnostic msg = diags.fragment("fatal.err.no.java.lang"); - throw new FatalError(msg); - } else { - log.error(DiagnosticFlag.RESOLVE_ERROR, pos, "doesnt.exist", tsym); - } - } env.toplevel.starImportScope.importAll(types, tsym.members(), typeImportFilter, false); } diff -r 689103ee872c -r cf6355e77564 langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Sun Jun 28 16:39:45 2015 -0700 @@ -910,14 +910,14 @@ /** * Get the marker anchor which will be added to the documentation tree. * - * @param anchorName the anchor name attribute + * @param anchorName the anchor name or id attribute * @param anchorContent the content that should be added to the anchor * @return a content tree for the marker anchor */ public Content getMarkerAnchor(String anchorName, Content anchorContent) { if (anchorContent == null) anchorContent = new Comment(" "); - Content markerAnchor = HtmlTree.A_ID(anchorName, anchorContent); + Content markerAnchor = HtmlTree.A(configuration.htmlVersion, anchorName, anchorContent); return markerAnchor; } diff -r 689103ee872c -r cf6355e77564 langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java Sun Jun 28 16:39:45 2015 -0700 @@ -264,7 +264,8 @@ */ private void addLine(Content pre, String line, int currentLineNo) { if (line != null) { - Content anchor = HtmlTree.A_ID("line." + Integer.toString(currentLineNo), + Content anchor = HtmlTree.A(configuration.htmlVersion, + "line." + Integer.toString(currentLineNo), new StringContent(utils.replaceTabs(configuration, line))); pre.addContent(anchor); pre.addContent(NEW_LINE); diff -r 689103ee872c -r cf6355e77564 langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Sun Jun 28 16:39:45 2015 -0700 @@ -226,15 +226,19 @@ } /** - * Generates an HTML anchor tag with id attribute and content. + * Generates an HTML anchor tag with an id or a name attribute and content. * - * @param id id for the anchor tag + * @param htmlVersion the version of the generated HTML + * @param attr name or id attribute for the anchor tag * @param body content for the anchor tag * @return an HtmlTree object */ - public static HtmlTree A_ID(String id, Content body) { + public static HtmlTree A(HtmlVersion htmlVersion, String attr, Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.A); - htmltree.addAttr(HtmlAttr.ID, nullCheck(id)); + htmltree.addAttr((htmlVersion == HtmlVersion.HTML4) + ? HtmlAttr.NAME + : HtmlAttr.ID, + nullCheck(attr)); htmltree.addContent(nullCheck(body)); return htmltree; } @@ -846,7 +850,8 @@ public boolean isValid() { switch (htmlTag) { case A : - return (hasAttr(HtmlAttr.ID) || (hasAttr(HtmlAttr.HREF) && hasContent())); + return (hasAttr(HtmlAttr.NAME) || hasAttr(HtmlAttr.ID) || (hasAttr(HtmlAttr.HREF) + && hasContent())); case BR : return (!hasContent() && (!hasAttrs() || hasAttr(HtmlAttr.CLEAR))); case IFRAME : diff -r 689103ee872c -r cf6355e77564 langtools/test/TEST.groups --- a/langtools/test/TEST.groups Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/test/TEST.groups Sun Jun 28 16:39:45 2015 -0700 @@ -22,11 +22,14 @@ # Tiered testing definitions -# All langtools tests are tier 1 +# All langtools tests are tier 1. tier1 = \ tools \ com \ lib -# No langtools tests are tier 2 +# No langtools tests are tier 2. tier2 = + +# No langtools tests are tier 3 either. +tier3 = diff -r 689103ee872c -r cf6355e77564 langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java --- a/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java Sun Jun 28 16:39:45 2015 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4638136 7198273 8025633 + * @bug 4638136 7198273 8025633 8081854 * @summary Add ability to skip over nav bar for accessibility * @author dkramer * @library ../lib @@ -50,14 +50,14 @@ checkOutput("p1/C1.html", true, // Top navbar "Skip navigation links", - // Top navbar - "\n" + // Top navbar + "\n" + "\n" + "", // Bottom navbar "Skip navigation links", - // Bottom navbar - "\n" + // Bottom navbar + "\n" + "\n" + ""); diff -r 689103ee872c -r cf6355e77564 langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java --- a/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java Sun Jun 28 16:39:45 2015 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 8025633 8025524 + * @bug 8025633 8025524 8081854 * @summary Test for valid name attribute in HTML anchors. * @author Bhavesh Patel * @library ../lib @@ -54,15 +54,15 @@ // Test some section markers and links to these markers checkOutput("pkg1/RegClass.html", true, - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", ""); // Test some members and link to these members @@ -73,59 +73,59 @@ // Test some fields checkOutput("pkg1/RegClass.html", true, - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", ""); checkOutput("pkg1/DeprMemClass.html", true, - "", + "", ""); // Test constructor checkOutput("pkg1/RegClass.html", true, - "", + "", ""); // Test some methods checkOutput("pkg1/RegClass.html", true, - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", ""); checkOutput("pkg1/DeprMemClass.html", true, - "", + "", ""); // Test enum checkOutput("pkg1/RegClass.Te$t_Enum.html", true, - "", + "", ""); // Test nested class checkOutput("pkg1/RegClass._NestedClas$.html", true, - "", + "", ""); // Test class use page @@ -144,11 +144,11 @@ // Test serialized form page checkOutput("serialized-form.html", true, //This is the marker for the link that appears in the pkg1.RegClass.html page - ""); + ""); // Test member name index page checkOutput("index-all.html", true, - "", + "", "$", "_"); diff -r 689103ee872c -r cf6355e77564 langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java --- a/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java Sun Jun 28 16:39:45 2015 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 8025633 + * @bug 8025633 8081854 * @summary Make sure that annotations types with optional elements have * element headers * @author Mahmood Ali @@ -48,6 +48,6 @@ checkExit(Exit.OK); checkOutput("pkg/AnnotationOptional.html", true, - ""); + ""); } } diff -r 689103ee872c -r cf6355e77564 langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java --- a/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java Sun Jun 28 16:39:45 2015 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 8025524 8031625 + * @bug 8025524 8031625 8081854 * @summary Test for constructor name which should be a non-qualified name. * @author Bhavesh Patel * @library ../lib @@ -59,21 +59,21 @@ + "" + "NestedInner(int)", "Outer()", - "", + "", "Outer(int i)", - ""); + ""); checkOutput("pkg1/Outer.Inner.html", true, "Inner()", - "", + "", "Inner(int i)", - ""); + ""); checkOutput("pkg1/Outer.Inner.NestedInner.html", true, "NestedInner()", - "", + "", "NestedInner(int i)", - ""); + ""); checkOutput("pkg1/Outer.Inner.html", false, "Outer.Inner--", diff -r 689103ee872c -r cf6355e77564 langtools/test/com/sun/javadoc/testHref/TestHref.java --- a/langtools/test/com/sun/javadoc/testHref/TestHref.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java Sun Jun 28 16:39:45 2015 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4663254 8016328 8025633 8026567 + * @bug 4663254 8016328 8025633 8026567 8081854 * @summary Verify that spaces do not appear in hrefs and anchors. * @author jamieh * @library ../lib @@ -54,11 +54,11 @@ //Member summary table link. "href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\"", //Anchor test. - "\n" + "\n" + "\n" + "", //Backward compatibility anchor test."pkg/C1.html", - "\n" + "\n" + "\n" + ""); diff -r 689103ee872c -r cf6355e77564 langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java --- a/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java Sun Jun 28 16:39:45 2015 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 8072945 + * @bug 8072945 8081854 * @summary Test the version of HTML generated by the javadoc tool. * @author bpatel * @library ../lib @@ -1172,7 +1172,7 @@ checkOutput("overview-summary.html", true, "", "\n" + "\n" + "\n" + "", "\n" @@ -1194,7 +1194,7 @@ checkOutput("pkg/package-summary.html", true, "", "\n" + "\n" + "\n" + "", "
", @@ -1208,7 +1208,7 @@ checkOutput("pkg/package-tree.html", true, "", "\n" + "\n" + "\n" + "", "
  • "); @@ -1217,7 +1217,7 @@ checkOutput("pkg1/package-use.html", true, "", "\n" + "\n" + "\n" + "", "
  • "); @@ -1234,7 +1234,7 @@ checkOutput("pkg/compact1-package-summary.html", true, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1248,7 +1248,7 @@ checkOutput("compact1-summary.html", true, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1262,7 +1262,7 @@ checkOutput("constant-values.html", true, "", "\n" + "\n" + "\n" + "", "\n" @@ -1273,7 +1273,7 @@ checkOutput("deprecated-list.html", true, "", "\n" + "\n" + "\n" + "", "\n" @@ -1295,7 +1295,7 @@ checkOutput("serialized-form.html", true, "", "\n" + "\n" + "\n" + "", "\n" @@ -1307,7 +1307,7 @@ checkOutput("overview-tree.html", true, "", "\n" + "\n" + "\n" + "", "
  • ", @@ -1326,7 +1326,7 @@ checkOutput("index-all.html", true, "", "\n" + "\n" + "\n" + "", "\n" @@ -1342,7 +1342,7 @@ checkOutput("help-doc.html", true, "", "\n" + "\n" + "\n" + "", "\n" @@ -1359,54 +1359,54 @@ checkOutput("pkg/AnotherClass.html", true, "", "\n" + "\n" + "\n" + "", "\n" + "
    ", "\n" + "
  • ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", - "
  • \n" + "
  • \n" + "\n" + "\n" + "

    Uses of RegClass in pkg

    \n" @@ -1623,7 +1623,7 @@ checkOutput("overview-summary.html", false, "", "\n" + "\n" + "\n" + "", "
  • \n" @@ -1662,7 +1662,7 @@ checkOutput("pkg/package-summary.html", false, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1681,7 +1681,7 @@ checkOutput("pkg/package-tree.html", false, "", "\n" + "\n" + "\n" + "", "
    \n" @@ -1705,7 +1705,7 @@ checkOutput("pkg1/package-use.html", false, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1742,7 +1742,7 @@ checkOutput("pkg/compact1-package-summary.html", false, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1761,7 +1761,7 @@ checkOutput("compact1-summary.html", false, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1782,7 +1782,7 @@ checkOutput("constant-values.html", false, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1803,7 +1803,7 @@ checkOutput("deprecated-list.html", false, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1820,7 +1820,7 @@ checkOutput("serialized-form.html", false, "", "\n" + "\n" + "\n" + "", "
    \n" @@ -1838,7 +1838,7 @@ checkOutput("overview-tree.html", false, "", "\n" + "\n" + "\n" + "", "
    \n" @@ -1862,7 +1862,7 @@ checkOutput("index-all.html", false, "", "\n" + "\n" + "\n" + "", "
    \n" @@ -1884,7 +1884,7 @@ checkOutput("help-doc.html", false, "", "\n" + "\n" + "\n" + "", "
    \n" @@ -1906,7 +1906,7 @@ checkOutput("pkg/AnotherClass.html", false, "", "\n" + "\n" + "\n" + "", "
    \n" @@ -1916,46 +1916,46 @@ + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
      \n" - + "
    • \n" + + "
    • \n" + "\n" + "\n" + "

      Element Detail

      ", @@ -2130,7 +2130,7 @@ checkOutput("pkg1/class-use/RegClass.html", false, "", "\n" + "\n" + "\n" + "", "
      \n" @@ -2139,7 +2139,7 @@ "
      \n" + "
      ", "
    ", - "
    \n" + "
    \n" + "\n" + "\n" + "

    Uses of RegClass in pkg

    \n" diff -r 689103ee872c -r cf6355e77564 langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java --- a/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Thu Jun 25 10:21:41 2015 -0700 +++ b/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Sun Jun 28 16:39:45 2015 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 7112427 8012295 8025633 8026567 8061305 + * @bug 7112427 8012295 8025633 8026567 8061305 8081854 * @summary Test of the JavaFX doclet features. * @author jvalenta * @library ../lib @@ -100,11 +100,11 @@ "pkg2"); checkExit(Exit.OK); checkOutput("pkg2/Test.html", true, - "
  • \n" + "
  • \n" + "\n" + "\n" + "

    Property Detail

    \n" - + "\n" + + "\n" + "\n" + "\n" + "
      \n" @@ -113,7 +113,7 @@ + "
      public java.lang.Object betaProperty
      \n" + "\n" + "
    \n" - + "\n" + + "\n" + "\n" + "\n" + "
      \n" @@ -123,7 +123,7 @@ + "java.lang.String> gammaProperty\n" + "\n" + "
    \n" - + "\n" + + "\n" + "\n" + "\n" + "
  • " diff -r 689103ee872c -r cf6355e77564 langtools/test/tools/javac/importChecks/ImportsObservable.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/importChecks/ImportsObservable.java Sun Jun 28 16:39:45 2015 -0700 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2015, 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 4869999 + * @summary Verify that the compiler does not prematurely decide a package is not observable. + * @compile ImportsObservable.java + */ + +import javax.*; +import javax.swing.*; +public class ImportsObservable { +} diff -r 689103ee872c -r cf6355e77564 langtools/test/tools/javac/lambda/NestedCapture04.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/NestedCapture04.java Sun Jun 28 16:39:45 2015 -0700 @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2015, 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 8076538 + * @summary Verify error at runtime due to incorrect classification of a lambda as being instance capturing + * @run main NestedCapture04 + */ +public class NestedCapture04 { + + public static interface Ftype { + int get(int v); + } + + public static class A { + static int counter = 0; + } + public static Ftype x0; + public static void main(String[] args) throws Throwable { + doit(); + } + public static Object doit() throws Throwable { + Ftype x0_ = + (int y0) -> { + A.counter++; + Ftype x1 = (int y1) -> { + A.counter++; + class Cltype2 { + Cltype2 meth(Cltype2 w) { + A.counter++; + class Cltype3 { + class Inclass3 { + public int iv; + Inclass3() { iv = 0; } + Inclass3 clmeth(Inclass3 a) { + A.counter++; + class Cltype4 { + Cltype4 (Cltype4 z) { + Ftype x5 = (int y5) -> { + A.counter++; + class Cltype6 { + Cltype6 meth(Cltype6 w) { + A.counter++; + class Cltype7 { + class Inclass7 { + public int iv; + Inclass7() { iv = 0; } + Inclass7 clmeth(Inclass7 a) { + A.counter++; + class Cltype8 { + Cltype8 (Cltype8 z) { + Ftype x9 = (int y9) -> { + A.counter++; + return y9; + }; + x9.get(2); + if ( z == null) { + A.counter++; + return; + } + A.counter+=100; + } + } + Cltype8 v = new Cltype8(null); + return a; + } + } + } + Cltype7.Inclass7 c = new Cltype7().new Inclass7(); + c.clmeth((Cltype7.Inclass7)null); + return w; + } + } + Cltype6 v = new Cltype6().meth(new Cltype6()); + return y5; + }; + x5.get(2); + if ( z == null) { + A.counter++; + return; + } + A.counter+=100; + } + } + Cltype4 v = new Cltype4(null); + return a; + } + } + } + Cltype3.Inclass3 c = new Cltype3().new Inclass3(); + c.clmeth((Cltype3.Inclass3)null); + return w; + } + } + Cltype2 v = new Cltype2().meth(new Cltype2()); + return y1; + }; + x1.get(2); + return y0; +}; + return x0 = x0_; + } +}