--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu Apr 21 13:37:01 2016 -0700
@@ -4491,10 +4491,11 @@
chk.checkNonCyclicElements(tree);
// Check for proper use of serialVersionUID
- if (env.info.lint.isEnabled(LintCategory.SERIAL) &&
- isSerializable(c.type) &&
- (c.flags() & Flags.ENUM) == 0 &&
- checkForSerial(c)) {
+ if (env.info.lint.isEnabled(LintCategory.SERIAL)
+ && isSerializable(c.type)
+ && (c.flags() & Flags.ENUM) == 0
+ && !c.isAnonymous()
+ && checkForSerial(c)) {
checkSerialVersionUID(tree, c);
}
if (allowTypeAnnos) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ConstFold.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ConstFold.java Thu Apr 21 13:37:01 2016 -0700
@@ -125,15 +125,15 @@
return syms.booleanType.constType(b2i(intValue(od) >= 0));
case lneg: // unary -
- return syms.longType.constType(new Long(-longValue(od)));
+ return syms.longType.constType(Long.valueOf(-longValue(od)));
case lxor: // ~
- return syms.longType.constType(new Long(~longValue(od)));
+ return syms.longType.constType(Long.valueOf(~longValue(od)));
case fneg: // unary -
- return syms.floatType.constType(new Float(-floatValue(od)));
+ return syms.floatType.constType(Float.valueOf(-floatValue(od)));
case dneg: // ~
- return syms.doubleType.constType(new Double(-doubleValue(od)));
+ return syms.doubleType.constType(Double.valueOf(-doubleValue(od)));
default:
return null;
@@ -216,37 +216,37 @@
case ladd:
return syms.longType.constType(
- new Long(longValue(l) + longValue(r)));
+ Long.valueOf(longValue(l) + longValue(r)));
case lsub:
return syms.longType.constType(
- new Long(longValue(l) - longValue(r)));
+ Long.valueOf(longValue(l) - longValue(r)));
case lmul:
return syms.longType.constType(
- new Long(longValue(l) * longValue(r)));
+ Long.valueOf(longValue(l) * longValue(r)));
case ldiv:
return syms.longType.constType(
- new Long(longValue(l) / longValue(r)));
+ Long.valueOf(longValue(l) / longValue(r)));
case lmod:
return syms.longType.constType(
- new Long(longValue(l) % longValue(r)));
+ Long.valueOf(longValue(l) % longValue(r)));
case land:
return syms.longType.constType(
- new Long(longValue(l) & longValue(r)));
+ Long.valueOf(longValue(l) & longValue(r)));
case lor:
return syms.longType.constType(
- new Long(longValue(l) | longValue(r)));
+ Long.valueOf(longValue(l) | longValue(r)));
case lxor:
return syms.longType.constType(
- new Long(longValue(l) ^ longValue(r)));
+ Long.valueOf(longValue(l) ^ longValue(r)));
case lshl: case lshll:
return syms.longType.constType(
- new Long(longValue(l) << intValue(r)));
+ Long.valueOf(longValue(l) << intValue(r)));
case lshr: case lshrl:
return syms.longType.constType(
- new Long(longValue(l) >> intValue(r)));
+ Long.valueOf(longValue(l) >> intValue(r)));
case lushr:
return syms.longType.constType(
- new Long(longValue(l) >>> intValue(r)));
+ Long.valueOf(longValue(l) >>> intValue(r)));
case lcmp:
if (longValue(l) < longValue(r))
return syms.intType.constType(minusOne);
@@ -256,19 +256,19 @@
return syms.intType.constType(zero);
case fadd:
return syms.floatType.constType(
- new Float(floatValue(l) + floatValue(r)));
+ Float.valueOf(floatValue(l) + floatValue(r)));
case fsub:
return syms.floatType.constType(
- new Float(floatValue(l) - floatValue(r)));
+ Float.valueOf(floatValue(l) - floatValue(r)));
case fmul:
return syms.floatType.constType(
- new Float(floatValue(l) * floatValue(r)));
+ Float.valueOf(floatValue(l) * floatValue(r)));
case fdiv:
return syms.floatType.constType(
- new Float(floatValue(l) / floatValue(r)));
+ Float.valueOf(floatValue(l) / floatValue(r)));
case fmod:
return syms.floatType.constType(
- new Float(floatValue(l) % floatValue(r)));
+ Float.valueOf(floatValue(l) % floatValue(r)));
case fcmpg: case fcmpl:
if (floatValue(l) < floatValue(r))
return syms.intType.constType(minusOne);
@@ -282,19 +282,19 @@
return syms.intType.constType(minusOne);
case dadd:
return syms.doubleType.constType(
- new Double(doubleValue(l) + doubleValue(r)));
+ Double.valueOf(doubleValue(l) + doubleValue(r)));
case dsub:
return syms.doubleType.constType(
- new Double(doubleValue(l) - doubleValue(r)));
+ Double.valueOf(doubleValue(l) - doubleValue(r)));
case dmul:
return syms.doubleType.constType(
- new Double(doubleValue(l) * doubleValue(r)));
+ Double.valueOf(doubleValue(l) * doubleValue(r)));
case ddiv:
return syms.doubleType.constType(
- new Double(doubleValue(l) / doubleValue(r)));
+ Double.valueOf(doubleValue(l) / doubleValue(r)));
case dmod:
return syms.doubleType.constType(
- new Double(doubleValue(l) % doubleValue(r)));
+ Double.valueOf(doubleValue(l) % doubleValue(r)));
case dcmpg: case dcmpl:
if (doubleValue(l) < doubleValue(r))
return syms.intType.constType(minusOne);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java Thu Apr 21 13:37:01 2016 -0700
@@ -86,6 +86,7 @@
private final TypeEnvs typeEnvs;
private final Name dollarAssertionsDisabled;
private final Name classDollar;
+ private final Name dollarCloseResource;
private final Types types;
private final boolean debugLower;
private final PkgInfo pkginfoOpt;
@@ -109,6 +110,8 @@
fromString(target.syntheticNameChar() + "assertionsDisabled");
classDollar = names.
fromString("class" + target.syntheticNameChar());
+ dollarCloseResource = names.
+ fromString(target.syntheticNameChar() + "closeResource");
types = Types.instance(context);
Options options = Options.instance(context);
@@ -1648,9 +1651,11 @@
ListBuffer<JCStatement> stats = new ListBuffer<>();
JCTree resource = resources.head;
JCExpression expr = null;
+ boolean resourceNonNull;
if (resource instanceof JCVariableDecl) {
JCVariableDecl var = (JCVariableDecl) resource;
expr = make.Ident(var.sym).setType(resource.type);
+ resourceNonNull = var.init != null && TreeInfo.skipParens(var.init).hasTag(NEWCLASS);
stats.add(var);
} else {
Assert.check(resource instanceof JCExpression);
@@ -1665,6 +1670,7 @@
JCVariableDecl syntheticTwrVarDecl =
make.VarDef(syntheticTwrVar, (JCExpression)resource);
expr = (JCExpression)make.Ident(syntheticTwrVar);
+ resourceNonNull = TreeInfo.skipParens(resource).hasTag(NEWCLASS);
stats.add(syntheticTwrVarDecl);
}
@@ -1694,7 +1700,7 @@
int oldPos = make.pos;
make.at(TreeInfo.endPos(block));
- JCBlock finallyClause = makeTwrFinallyClause(primaryException, expr);
+ JCBlock finallyClause = makeTwrFinallyClause(primaryException, expr, resourceNonNull);
make.at(oldPos);
JCTry outerTry = make.Try(makeTwrBlock(resources.tail, block,
finallyCanCompleteNormally, depth + 1),
@@ -1706,7 +1712,96 @@
return newBlock;
}
- private JCBlock makeTwrFinallyClause(Symbol primaryException, JCExpression resource) {
+ /**If the estimated number of copies the close resource code in a single class is above this
+ * threshold, generate and use a method for the close resource code, leading to smaller code.
+ * As generating a method has overhead on its own, generating the method for cases below the
+ * threshold could lead to an increase in code size.
+ */
+ public static final int USE_CLOSE_RESOURCE_METHOD_THRESHOLD = 4;
+
+ private JCBlock makeTwrFinallyClause(Symbol primaryException, JCExpression resource,
+ boolean resourceNonNull) {
+ MethodSymbol closeResource = (MethodSymbol)lookupSynthetic(dollarCloseResource,
+ currentClass.members());
+
+ if (closeResource == null && shouldUseCloseResourceMethod()) {
+ closeResource = new MethodSymbol(
+ PRIVATE | STATIC | SYNTHETIC,
+ dollarCloseResource,
+ new MethodType(
+ List.of(syms.throwableType, syms.autoCloseableType),
+ syms.voidType,
+ List.<Type>nil(),
+ syms.methodClass),
+ currentClass);
+ enterSynthetic(resource.pos(), closeResource, currentClass.members());
+
+ JCMethodDecl md = make.MethodDef(closeResource, null);
+ List<JCVariableDecl> params = md.getParameters();
+ md.body = make.Block(0, List.<JCStatement>of(makeTwrCloseStatement(params.get(0).sym,
+ make.Ident(params.get(1)))));
+
+ JCClassDecl currentClassDecl = classDef(currentClass);
+ currentClassDecl.defs = currentClassDecl.defs.prepend(md);
+ }
+
+ JCStatement closeStatement;
+
+ if (closeResource != null) {
+ //$closeResource(#primaryException, #resource)
+ closeStatement = make.Exec(make.Apply(List.<JCExpression>nil(),
+ make.Ident(closeResource),
+ List.of(make.Ident(primaryException),
+ resource)
+ ).setType(syms.voidType));
+ } else {
+ closeStatement = makeTwrCloseStatement(primaryException, resource);
+ }
+
+ JCStatement finallyStatement;
+
+ if (resourceNonNull) {
+ finallyStatement = closeStatement;
+ } else {
+ // if (#resource != null) { $closeResource(...); }
+ finallyStatement = make.If(makeNonNullCheck(resource),
+ closeStatement,
+ null);
+ }
+
+ return make.Block(0L,
+ List.<JCStatement>of(finallyStatement));
+ }
+ //where:
+ private boolean shouldUseCloseResourceMethod() {
+ class TryFinder extends TreeScanner {
+ int closeCount;
+ @Override
+ public void visitTry(JCTry tree) {
+ boolean empty = tree.body.stats.isEmpty();
+
+ for (JCTree r : tree.resources) {
+ closeCount += empty ? 1 : 2;
+ empty = false; //with multiple resources, only the innermost try can be empty.
+ }
+ super.visitTry(tree);
+ }
+ @Override
+ public void scan(JCTree tree) {
+ if (useCloseResourceMethod())
+ return;
+ super.scan(tree);
+ }
+ boolean useCloseResourceMethod() {
+ return closeCount >= USE_CLOSE_RESOURCE_METHOD_THRESHOLD;
+ }
+ }
+ TryFinder tryFinder = new TryFinder();
+ tryFinder.scan(classDef(currentClass));
+ return tryFinder.useCloseResourceMethod();
+ }
+
+ private JCStatement makeTwrCloseStatement(Symbol primaryException, JCExpression resource) {
// primaryException.addSuppressed(catchException);
VarSymbol catchException =
new VarSymbol(SYNTHETIC, make.paramName(2),
@@ -1731,11 +1826,7 @@
tryTree,
makeResourceCloseInvocation(resource));
- // if (#resource != null) { if (primaryException ... }
- return make.Block(0L,
- List.<JCStatement>of(make.If(makeNonNullCheck(resource),
- closeIfStatement,
- null)));
+ return closeIfStatement;
}
private JCStatement makeResourceCloseInvocation(JCExpression resource) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/FSInfo.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/FSInfo.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,27 @@
+/*
+ * Copyright (c) 2008, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
package com.sun.tools.javac.file;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu Apr 21 13:37:01 2016 -0700
@@ -457,13 +457,13 @@
poolObj[i] = getInt(index + 1);
break;
case CONSTANT_Float:
- poolObj[i] = new Float(getFloat(index + 1));
+ poolObj[i] = Float.valueOf(getFloat(index + 1));
break;
case CONSTANT_Long:
- poolObj[i] = new Long(getLong(index + 1));
+ poolObj[i] = Long.valueOf(getLong(index + 1));
break;
case CONSTANT_Double:
- poolObj[i] = new Double(getDouble(index + 1));
+ poolObj[i] = Double.valueOf(getDouble(index + 1));
break;
case CONSTANT_MethodHandle:
skipBytes(4);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Apr 21 13:37:01 2016 -0700
@@ -203,7 +203,7 @@
*/
void emitMinusOne(int tc) {
if (tc == LONGcode) {
- items.makeImmediateItem(syms.longType, new Long(-1)).load();
+ items.makeImmediateItem(syms.longType, Long.valueOf(-1)).load();
} else {
code.emitop0(iconst_m1);
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java Thu Apr 21 13:37:01 2016 -0700
@@ -686,7 +686,7 @@
try {
t = F.at(pos).Literal(
TypeTag.LONG,
- new Long(Convert.string2long(strval(prefix), token.radix())));
+ Long.valueOf(Convert.string2long(strval(prefix), token.radix())));
} catch (NumberFormatException ex) {
error(token.pos, "int.number.too.large", strval(prefix));
}
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/remote/RemoteAgent.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/remote/RemoteAgent.java Thu Apr 21 13:37:01 2016 -0700
@@ -113,7 +113,6 @@
}
Method doitMethod;
try {
- this.getClass().getModule().addReads(klass.getModule());
this.getClass().getModule().addExports(RemoteResolutionException.class.getPackage().getName(), klass.getModule());
doitMethod = klass.getDeclaredMethod(DOIT_METHOD_NAME, new Class<?>[0]);
doitMethod.setAccessible(true);
@@ -184,7 +183,6 @@
break;
}
try {
- this.getClass().getModule().addReads(klass.getModule());
Field var = klass.getDeclaredField(varname);
var.setAccessible(true);
Object res = var.get(null);
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java Thu Apr 21 13:37:01 2016 -0700
@@ -606,6 +606,7 @@
fluffmsg("jshell.msg.feedback.mode", mode.name);
} else {
fluffmsg("jshell.msg.see", "/help /set feedback");
+ printFeedbackModes();
}
return valid;
}
@@ -671,13 +672,17 @@
} else {
errorat("jshell.err.feedback.ambiguous.mode", umode);
}
- fluffmsg("jshell.msg.feedback.mode.following");
- modeMap.keySet().stream()
- .forEach(mk -> fluff(" %s", mk));
+ printFeedbackModes();
return null;
}
}
+ void printFeedbackModes() {
+ fluffmsg("jshell.msg.feedback.mode.following");
+ modeMap.keySet().stream()
+ .forEach(mk -> fluff(" %s", mk));
+ }
+
// Test if the format string is correctly
final String nextFormat() {
String format = at.next();
--- a/langtools/test/jdk/javadoc/tool/6964914/TestStdDoclet.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/jdk/javadoc/tool/6964914/TestStdDoclet.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -28,6 +28,7 @@
*/
import java.io.*;
+import java.util.*;
/**
* Dummy javadoc comment.
@@ -54,13 +55,21 @@
// run javadoc in separate process to ensure doclet executed under
// normal user conditions w.r.t. classloader
String thisClassName = TestStdDoclet.class.getName();
- Process p = new ProcessBuilder()
- .command(javadoc.getPath(),
- "-J-Xpatch:" + System.getProperty("jdk.launcher.patch.0", ""),
+ List<String> cmdArgs = new ArrayList<>();
+ cmdArgs.add(javadoc.getPath());
+ int i = 0;
+ String prop;
+ while ((prop = System.getProperty("jdk.launcher.patch." + (i++))) != null) {
+ cmdArgs.add("-J-Xpatch:" + prop);
+ }
+ cmdArgs.addAll(Arrays.asList(
"-classpath", ".", // insulates us from ambient classpath
"-Xdoclint:none",
"-package",
- new File(testSrc, thisClassName + ".java").getPath())
+ new File(testSrc, thisClassName + ".java").getPath()
+ ));
+ Process p = new ProcessBuilder()
+ .command(cmdArgs)
.redirectErrorStream(true)
.start();
--- a/langtools/test/jdk/javadoc/tool/6964914/TestUserDoclet.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/jdk/javadoc/tool/6964914/TestUserDoclet.java Thu Apr 21 13:37:01 2016 -0700
@@ -30,7 +30,10 @@
import java.io.*;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.List;
import java.util.Locale;
import java.util.Set;
@@ -63,12 +66,20 @@
// run javadoc in separate process to ensure doclet executed under
// normal user conditions w.r.t. classloader
String thisClassName = TestUserDoclet.class.getName();
- Process p = new ProcessBuilder()
- .command(javadoc.getPath(),
- "-J-Xpatch:" + System.getProperty("jdk.launcher.patch.0", ""),
+ List<String> cmdArgs = new ArrayList<>();
+ cmdArgs.add(javadoc.getPath());
+ int i = 0;
+ String prop;
+ while ((prop = System.getProperty("jdk.launcher.patch." + (i++))) != null) {
+ cmdArgs.add("-J-Xpatch:" + prop);
+ }
+ cmdArgs.addAll(Arrays.asList(
"-doclet", thisClassName,
"-docletpath", testClasses.getPath(),
- new File(testSrc, thisClassName + ".java").getPath())
+ new File(testSrc, thisClassName + ".java").getPath()
+ ));
+ Process p = new ProcessBuilder()
+ .command(cmdArgs)
.redirectErrorStream(true)
.start();
--- a/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/SampleApi.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/SampleApi.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -53,5 +53,8 @@
public Fault(String msg) {
super(msg);
}
+ public Fault(String msg, Throwable th) {
+ super(msg, th);
+ }
}
}
--- a/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/DocCommentGenerator.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/DocCommentGenerator.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -32,6 +32,8 @@
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.*;
import com.sun.tools.javac.util.List;
+import java.util.HashMap;
+import java.util.Map;
class DocCommentGenerator {
@@ -99,14 +101,25 @@
LITERAL("@literal", "Use < and > brackets instead of < and > escapes."),
CODE("@code", "(i) -> new Abc<Object>((i > 0) ? (i << 1) : 0)"),
LINK("@link", ""),
- VALUE("@value", "");
+ VALUE("@value", ""),
+ INDEX("@index", "", true);
String tagName;
String tagValue;
+ boolean counted;
+ Map<String, Integer> counters;
InlineTag(String tagName, String tagValue) {
+ this(tagName, tagValue, false);
+ }
+
+ InlineTag(String tagName, String tagValue, boolean counted) {
this.tagName = tagName;
this.tagValue = tagValue;
+ this.counted = counted;
+ if (counted) {
+ counters = new HashMap<>();
+ }
}
public String toString() {
@@ -114,9 +127,14 @@
}
public String value(String value) {
+ String name = ((tagValue.length() != 0) ? " " + tagValue : "")
+ + ((value.length() != 0) ? " " + value : "");
+ if (counted && !counters.containsKey(name)) {
+ counters.put(name, 0);
+ }
return "{" + tagName
- + ((tagValue.length() != 0) ? " " + tagValue : "")
- + ((value.length() != 0) ? " " + value : "")
+ + name
+ + (counted ? "_" + counters.put(name, counters.get(name) + 1) : "")
+ "}";
}
}
@@ -179,7 +197,8 @@
//
public String getPackageComment() {
- return Text.LOREMIPSUM
+ return InlineTag.INDEX.value("PackageCommentLabel") + " "
+ + Text.LOREMIPSUM
+ "\n <p>" + Text.LIEUROPANLINGUES
+ "\n" + Text.CODE
+ "\n" + LinkTag.nextLink()
@@ -192,7 +211,9 @@
static int serialValIdx = 0;
public String getBaseComment(JCClassDecl baseDecl, boolean toplevel) {
- String buildComment = Text.LIEUROPANLINGUES + "\n";
+ String buildComment = InlineTag.INDEX.value("BaseCommentLabel") + " ";
+
+ buildComment += Text.LIEUROPANLINGUES + "\n";
buildComment += "<p>It is possible to see inlined code:\n"
+ InlineTag.CODE
@@ -237,8 +258,9 @@
}
public String getConstComment() {
- String buildComment = Text.NOWISTHETIME + " " + Text.BROWNFOX + "\n";
+ String buildComment = InlineTag.INDEX.value("ConstCommentLabel") + " ";
+ buildComment += Text.NOWISTHETIME + " " + Text.BROWNFOX + "\n";
buildComment += LinkTag.nextLink() + "\n";
buildComment += LinkTag.nextSee() + "\n";
buildComment += Tag.SINCE + "\n";
@@ -249,8 +271,9 @@
public String getFieldComment(JCClassDecl baseDecl,
JCVariableDecl varDecl,
boolean isFxStyle) {
- String buildComment = Text.BROWNFOX + "<p>" + Text.NOWISTHETIME + "\n";
+ String buildComment = InlineTag.INDEX.value("FieldCommentLabel") + " ";
+ buildComment += Text.BROWNFOX + "<p>" + Text.NOWISTHETIME + "\n";
Set<Modifier> mods = varDecl.getModifiers().getFlags();
String varName = varDecl.getName().toString();
@@ -299,7 +322,9 @@
public String getMethodComment(JCClassDecl baseDecl,
JCMethodDecl methodDecl,
boolean isFxStyle) {
- String buildComment = Text.BROWNFOX + "\n<p>" + Text.THISPANGRAM + "\n";
+ String buildComment = InlineTag.INDEX.value("MethodCommentLabel") + " ";
+
+ buildComment += Text.BROWNFOX + "\n<p>" + Text.THISPANGRAM + "\n";
buildComment += "<p>" + LinkTag.nextLink() + "\n";
--- a/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/PackageGenerator.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/PackageGenerator.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -125,7 +125,7 @@
processTopLevel((Element)node);
}
} catch (ParserConfigurationException | SAXException | IOException e) {
- throw new Fault("Error parsing dataset " + dsName);
+ throw new Fault("Error parsing dataset " + dsName, e);
}
fx = false;
--- a/langtools/test/jdk/jshell/ToolFormatTest.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/jdk/jshell/ToolFormatTest.java Thu Apr 21 13:37:01 2016 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8148316 8148317 8151755 8152246
+ * @bug 8148316 8148317 8151755 8152246 8153551
* @summary Tests for output customization
* @library /tools/lib
* @modules jdk.compiler/com.sun.tools.javac.api
@@ -155,6 +155,12 @@
}
}
+ public void testShowFeedbackModes() {
+ test(
+ (a) -> assertCommandOutputContains(a, "/set feedback", "normal")
+ );
+ }
+
public void testSetNewModeQuiet() {
try {
test(
--- a/langtools/test/tools/javac/6520152/T.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/6520152/T.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * 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.
+ */
+
import java.io.Serializable;
public class T {
--- a/langtools/test/tools/javac/6520152/T6520152.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/6520152/T6520152.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * 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 6520152
--- a/langtools/test/tools/javac/6521805/T6521805e.out Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/6521805/T6521805e.out Thu Apr 21 13:37:01 2016 -0700
@@ -1,2 +1,2 @@
-Sub.java:8:11: compiler.err.synthetic.name.conflict: this$0, p.Inner
+Sub.java:10:11: compiler.err.synthetic.name.conflict: this$0, p.Inner
1 error
--- a/langtools/test/tools/javac/6521805/p/Outer.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/6521805/p/Outer.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,5 @@
+/* /nodynamiccopyright/ */
+
package p;
class Outer {
--- a/langtools/test/tools/javac/6521805/p/Sub.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/6521805/p/Sub.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,5 @@
+/* /nodynamiccopyright/ */
+
package p;
class Inner extends Outer.Super {
--- a/langtools/test/tools/javac/6547131/T.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/6547131/T.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * 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 6547131
--- a/langtools/test/tools/javac/6589361/T6589361.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/6589361/T6589361.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * 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 6589361
--- a/langtools/test/tools/javac/6668794/badSource/Test.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/6668794/badSource/Test.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,5 +1,5 @@
/*
- * @test /nodynamiccopyight/
+ * @test /nodynamiccopyright/
* @bug 6668794 6668796
* @summary javac puts localized text in raw diagnostics
* bad diagnostic "bad class file" given for source files
--- a/langtools/test/tools/javac/CaptureInSubtype.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/CaptureInSubtype.java Thu Apr 21 13:37:01 2016 -0700
@@ -33,7 +33,7 @@
public static class ShowFlaw extends SuperOfShowFlaw {
- static Flaw<Number> fn = new Flaw<Number>(new Integer(3));
+ static Flaw<Number> fn = new Flaw<Number>(Integer.valueOf(3));
Flaw<?> m(){return fn;}
}
--- a/langtools/test/tools/javac/OverrideChecks/T4721069.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/OverrideChecks/T4721069.java Thu Apr 21 13:37:01 2016 -0700
@@ -12,7 +12,7 @@
static class T {
static void f(I i) {
if (i == null) {
- Integer x = new Integer(2);
+ Integer x = Integer.valueOf(2);
} else {
I x = i;
x.getClass();
--- a/langtools/test/tools/javac/SerialWarn.java Thu Apr 21 12:57:16 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 4854628
- * @summary include Throwable subclasses in missing serialVersionUID warning
- * @author gafter
- *
- * @compile -Werror SerialWarn.java
- * @compile/fail/ref=SerialWarn.out -XDrawDiagnostics -Xlint:serial -Werror SerialWarn.java
- */
-
-class SerialWarn extends Throwable {}
--- a/langtools/test/tools/javac/SerialWarn.out Thu Apr 21 12:57:16 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-SerialWarn.java:11:1: compiler.warn.missing.SVUID: SerialWarn
-- compiler.err.warnings.and.werror
-1 error
-1 warning
--- a/langtools/test/tools/javac/T6554097.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/T6554097.java Thu Apr 21 13:37:01 2016 -0700
@@ -3,24 +3,27 @@
* @bug 6554097
* @summary "final" confuses at-SuppressWarnings
* @compile T6554097.java
- * @compile/fail/ref=T6554097.out -XDrawDiagnostics -Werror -Xlint:serial T6554097.java
+ * @compile/fail/ref=T6554097.out -XDrawDiagnostics -Werror -Xlint:rawtypes T6554097.java
*/
+import java.util.ArrayList;
+
class T6554097 {
- @SuppressWarnings("serial") final Throwable[] v1 = { new Throwable() {} };
- @SuppressWarnings("serial") Throwable[] v2 = { new Throwable() {} };
+
+ @SuppressWarnings("unchecked") final ArrayList[] v1 = { new ArrayList() {} };
+ @SuppressWarnings("unchecked") ArrayList[] v2 = { new ArrayList() {} };
public static void m1() throws Throwable {
- @SuppressWarnings("serial") final Throwable[] v3 = { new Throwable() {} };
- @SuppressWarnings("serial") Throwable[] v4 = { new Throwable() {} };
+ @SuppressWarnings("unchecked") final ArrayList[] v3 = { new ArrayList() {} };
+ @SuppressWarnings("unchecked") ArrayList[] v4 = { new ArrayList() {} };
}
- final Throwable[] v5 = { new Throwable() {} };
- Throwable[] v6 = { new Throwable() {} };
+ final ArrayList[] v5 = { new ArrayList() {} };
+ ArrayList[] v6 = { new ArrayList() {} };
public static void m2() throws Throwable {
- final Throwable[] v7 = { new Throwable() {} };
- Throwable[] v8 = { new Throwable() {} };
+ final ArrayList[] v7 = { new ArrayList() {} };
+ ArrayList[] v8 = { new ArrayList() {} };
}
}
--- a/langtools/test/tools/javac/T6554097.out Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/T6554097.out Thu Apr 21 13:37:01 2016 -0700
@@ -1,7 +1,19 @@
-T6554097.java:18:46: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6554097$5
-T6554097.java:19:46: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6554097$6
-T6554097.java:22:50: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6554097$7
-T6554097.java:23:54: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6554097$8
+T6554097.java:13:42: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:13:65: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:14:42: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:14:65: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:17:50: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:17:73: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:18:50: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:18:73: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:21:11: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:21:34: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:22:11: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:22:34: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:25:15: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:25:38: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:26:15: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6554097.java:26:38: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
- compiler.err.warnings.and.werror
1 error
-4 warnings
+16 warnings
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrAvoidNullCheck.java Thu Apr 21 13:37:01 2016 -0700
@@ -0,0 +1,125 @@
+/*
+ * 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 7020499
+ * @summary Verify that try-with-resources desugaring is not generating unnecessary null checks
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.code
+ * jdk.compiler/com.sun.tools.javac.comp
+ * jdk.compiler/com.sun.tools.javac.main
+ * jdk.compiler/com.sun.tools.javac.tree
+ * jdk.compiler/com.sun.tools.javac.util
+ * @build toolbox.ToolBox toolbox.JavacTask TwrAvoidNullCheck
+ * @run main TwrAvoidNullCheck
+ */
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.comp.AttrContext;
+import com.sun.tools.javac.comp.Env;
+import com.sun.tools.javac.comp.Lower;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCBinary;
+import com.sun.tools.javac.tree.TreeInfo;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.tree.TreeScanner;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Context.Factory;
+import com.sun.tools.javac.util.List;
+
+import toolbox.ToolBox;
+
+public class TwrAvoidNullCheck {
+ public static void main(String... args) throws IOException {
+ new TwrAvoidNullCheck().run();
+ }
+ void run() throws IOException {
+ run("new Test()", false);
+ run("null", true);
+ run("System.getProperty(\"test\") != null ? new Test() : null", true);
+ }
+ void run(String resourceSpecification, boolean expected) throws IOException {
+ String template = "public class Test implements AutoCloseable {\n" +
+ " void t() {\n" +
+ " try (Test resource = RESOURCE) { }\n" +
+ " }\n" +
+ " public void close() { }\n" +
+ "}\n";
+ String code = template.replace("RESOURCE", resourceSpecification);
+ Context ctx = new Context();
+ DumpLower.preRegister(ctx);
+ Iterable<ToolBox.JavaSource> files = Arrays.asList(new ToolBox.JavaSource(code));
+ JavacTask task = JavacTool.create().getTask(null, null, null, null, null, files, ctx);
+ task.call();
+
+ boolean hasNullCheck = ((DumpLower) DumpLower.instance(ctx)).hasNullCheck;
+
+ if (hasNullCheck != expected) {
+ throw new IllegalStateException("expected: " + expected +
+ "; actual: " + hasNullCheck +
+ "; code: " + code);
+ }
+ }
+
+ static class DumpLower extends Lower {
+
+ public static void preRegister(Context ctx) {
+ ctx.put(lowerKey, new Factory<Lower>() {
+ @Override
+ public Lower make(Context c) {
+ return new DumpLower(c);
+ }
+ });
+ }
+
+ public DumpLower(Context context) {
+ super(context);
+ }
+
+ boolean hasNullCheck;
+
+ @Override
+ public List<JCTree> translateTopLevelClass(Env<AttrContext> env, JCTree cdef, TreeMaker make) {
+ List<JCTree> result = super.translateTopLevelClass(env, cdef, make);
+
+ new TreeScanner() {
+ @Override
+ public void visitBinary(JCBinary tree) {
+ hasNullCheck |= tree.operator.getSimpleName().contentEquals("!=") &&
+ "resource".equals(String.valueOf(TreeInfo.name(tree.lhs))) &&
+ TreeInfo.isNull(tree.rhs);
+ super.visitBinary(tree);
+ }
+ }.scan(result);
+
+ return result;
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrClose.java Thu Apr 21 13:37:01 2016 -0700
@@ -0,0 +1,140 @@
+/*
+ * 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 7020499
+ * @summary Verify that the close resource code works properly in all cases
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.comp
+ * jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox TwrClose
+ * @run main TwrClose
+ */
+
+import javax.tools.JavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+import com.sun.tools.javac.comp.Lower;
+
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
+public class TwrClose {
+
+ public static void main(String... args) throws Exception {
+ for (int i = 1; i < Lower.USE_CLOSE_RESOURCE_METHOD_THRESHOLD * 2; i++) {
+ new TwrClose().compile(i);
+ }
+ }
+
+ ToolBox tb = new ToolBox();
+ JavaFileManager fm = ToolProvider.getSystemJavaCompiler()
+ .getStandardFileManager(null, null, null);
+
+ void compile(int trysCount) throws Exception {
+ StringBuilder testInvocations = new StringBuilder();
+ StringBuilder testMethods = new StringBuilder();
+
+ for (int i = 0; i < trysCount; i++) {
+ testInvocations.append(TEST_INVOCATIONS_TEMPLATE.replace("#N", Integer.toString(i)));
+ testMethods.append(TEST_METHOD_TEMPLATE.replace("#N", Integer.toString(i)));
+ }
+
+ String sourceCode = FILE_TEMPLATE.replace("#TEST_INVOCATIONS", testInvocations.toString())
+ .replace("#TEST_METHODS", testMethods.toString());
+
+ System.err.println("analyzing:");
+ System.err.println(sourceCode);
+
+ try (ToolBox.MemoryFileManager mfm = new ToolBox.MemoryFileManager()) {
+ new JavacTask(tb).fileManager(mfm)
+ .sources(sourceCode)
+ .run()
+ .writeAll();
+ ClassLoader cl = new ClassLoader(TwrClose.class.getClassLoader()) {
+ @Override
+ protected Class<?> findClass(String name) throws ClassNotFoundException {
+ byte[] data = mfm.getFileBytes(StandardLocation.CLASS_OUTPUT, name);
+ if (data != null) {
+ return defineClass(name, data, 0, data.length);
+ }
+ return super.findClass(name);
+ }
+ };
+
+ ((Runnable) cl.loadClass("Test").newInstance()).run();
+ }
+ }
+
+ final String TEST_INVOCATIONS_TEMPLATE =
+ " test#N(false, false, Arrays.asList(\"close\"));\n" +
+ " test#N(false, true, Arrays.asList(\"close\", \"close-exception\"));\n" +
+ " test#N(true, false, Arrays.asList(\"close\", \"inTwr\"));\n" +
+ " test#N(true, true, Arrays.asList(\"close\", \"inTwr\", \"close-exception\"));\n";
+
+ final String TEST_METHOD_TEMPLATE =
+ " private void test#N(boolean failInTwr, boolean failOnClose,\n" +
+ " List<String> expectedMessages) {\n" +
+ " List<String> messages = new ArrayList<>();\n" +
+ " try {\n" +
+ " try (CloseableImpl c = new CloseableImpl(messages, failOnClose)) {\n" +
+ " if (failInTwr)\n" +
+ " throw new IllegalStateException(\"inTwr\");\n" +
+ " }\n" +
+ " } catch (IllegalStateException ex) {\n" +
+ " messages.add(ex.getMessage());\n" +
+ " for (Throwable t : ex.getSuppressed()) {\n" +
+ " messages.add(t.getMessage());\n" +
+ " }\n" +
+ " }\n" +
+ " if (!expectedMessages.equals(messages))\n" +
+ " throw new AssertionError(\"Expected and actual messages differ; expectedMessages=\" +\n" +
+ " expectedMessages + \"; actual=\" + messages);\n" +
+ " }\n";
+
+ final String FILE_TEMPLATE =
+ "import java.util.*;\n" +
+ "public class Test implements Runnable {\n" +
+ " public void run() {\n" +
+ "#TEST_INVOCATIONS" +
+ " }\n" +
+ "#TEST_METHODS" +
+ " static class CloseableImpl implements AutoCloseable {\n" +
+ " private final List<String> messages;\n" +
+ " private final boolean failOnClose;\n" +
+ " public CloseableImpl(List<String> messages, boolean failOnClose) {\n" +
+ " this.messages = messages;\n" +
+ " this.failOnClose = failOnClose;\n" +
+ " }\n" +
+ " @Override\n" +
+ " public void close() {\n" +
+ " messages.add(\"close\");\n" +
+ " if (failOnClose)\n" +
+ " throw new IllegalStateException(\"close-exception\");\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrShareCloseCode.java Thu Apr 21 13:37:01 2016 -0700
@@ -0,0 +1,158 @@
+/*
+ * 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 7020499
+ * @summary Verify that the code that closes the resources is shared by among try-with-resources
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.code
+ * jdk.compiler/com.sun.tools.javac.comp
+ * jdk.compiler/com.sun.tools.javac.tree
+ * jdk.compiler/com.sun.tools.javac.util
+ * @build toolbox.ToolBox TwrShareCloseCode
+ * @run main TwrShareCloseCode
+ */
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.comp.AttrContext;
+import com.sun.tools.javac.comp.Env;
+import com.sun.tools.javac.comp.Lower;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
+import com.sun.tools.javac.tree.JCTree.JCMethodInvocation;
+import com.sun.tools.javac.tree.TreeInfo;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.tree.TreeScanner;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Context.Factory;
+import com.sun.tools.javac.util.List;
+
+import toolbox.ToolBox;
+
+public class TwrShareCloseCode {
+ public static void main(String... args) throws IOException {
+ new TwrShareCloseCode().run();
+ }
+
+ void run() throws IOException {
+ run("try (Test t1 = new Test()) { }", true);
+ run("try (Test t1 = new Test()) { }\n" +
+ "try (Test t2 = new Test()) { }", true);
+ run("try (Test t1 = new Test();\n" +
+ " Test t2 = new Test()) { }", true);
+ run("try (Test t1 = new Test()) { }\n" +
+ "try (Test t2 = new Test()) { }\n" +
+ "try (Test t3 = new Test()) { }", true);
+ run("try (Test t1 = new Test();\n" +
+ " Test t2 = new Test();\n" +
+ " Test t3 = new Test()) { }", false);
+ run("try (Test t1 = new Test()) { }\n" +
+ "try (Test t2 = new Test()) { }\n" +
+ "try (Test t3 = new Test()) { }\n" +
+ "try (Test t4 = new Test()) { }", false);
+
+ run("try (Test t1 = new Test()) { i++; }", true);
+ run("try (Test t1 = new Test()) { i++; }\n" +
+ "try (Test t2 = new Test()) { i++; }", false);
+
+ run("try (Test t1 = new Test(); Test t2 = new Test()) { i++; }", false);
+
+ run("try (Test t1 = new Test()) { i++; }\n" +
+ "try (Test t2 = new Test()) { }", true);
+
+ run("try (Test t1 = new Test()) { i++; }\n" +
+ "try (Test t2 = new Test()) { }\n" +
+ "try (Test t3 = new Test()) { }", false);
+
+ run("try (Test t1 = new Test()) { i++; }\n" +
+ "try (Test t2 = new Test()) { i++; }\n" +
+ "try (Test t3 = new Test()) { }", false);
+ }
+ void run(String trySpec, boolean expected) throws IOException {
+ String template = "public class Test implements AutoCloseable {\n" +
+ " void t(int i) {\n" +
+ " TRY\n" +
+ " }\n" +
+ " public void close() { }\n" +
+ "}\n";
+ String code = template.replace("TRY", trySpec);
+ Context ctx = new Context();
+ DumpLower.preRegister(ctx);
+ Iterable<ToolBox.JavaSource> files = Arrays.asList(new ToolBox.JavaSource(code));
+ JavacTask task = JavacTool.create().getTask(null, null, null, null, null, files, ctx);
+ task.call();
+ boolean actual = ((DumpLower) DumpLower.instance(ctx)).closeSeen;
+
+ if (expected != actual) {
+ throw new IllegalStateException("expected: " + expected + "; actual: " + actual + "; code:\n" + code);
+ }
+ }
+
+ static class DumpLower extends Lower {
+
+ public static void preRegister(Context ctx) {
+ ctx.put(lowerKey, new Factory<Lower>() {
+ @Override
+ public Lower make(Context c) {
+ return new DumpLower(c);
+ }
+ });
+ }
+
+ public DumpLower(Context context) {
+ super(context);
+ }
+
+ boolean closeSeen;
+
+ @Override
+ public List<JCTree> translateTopLevelClass(Env<AttrContext> env, JCTree cdef, TreeMaker make) {
+ List<JCTree> result = super.translateTopLevelClass(env, cdef, make);
+
+ new TreeScanner() {
+ @Override
+ public void visitMethodDef(JCMethodDecl tree) {
+ if (!tree.name.contentEquals("t"))
+ return;
+
+ super.visitMethodDef(tree);
+ }
+
+ @Override
+ public void visitApply(JCMethodInvocation tree) {
+ closeSeen |= TreeInfo.symbol(tree.meth).name.contentEquals("close");
+ super.visitApply(tree);
+ }
+ }.scan(result);
+
+ return result;
+ }
+
+ }
+}
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ResourceVariable.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ResourceVariable.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -36,9 +36,9 @@
public class ResourceVariable {
@TADescription(annotation = "TA", type = RESOURCE_VARIABLE,
- lvarOffset = {10}, lvarLength = {118}, lvarIndex = {1})
+ lvarOffset = {10}, lvarLength = {106}, lvarIndex = {1})
@TADescription(annotation = "TB", type = RESOURCE_VARIABLE,
- lvarOffset = {22}, lvarLength = {35}, lvarIndex = {3})
+ lvarOffset = {22}, lvarLength = {31}, lvarIndex = {3})
public String testResourceVariable() {
return
"public void f() throws IOException {" + lineSeparator() +
@@ -49,7 +49,7 @@
}
@TADescription(annotation = "RTAs", type = RESOURCE_VARIABLE,
- lvarOffset = {10}, lvarLength = {30}, lvarIndex = {1})
+ lvarOffset = {10}, lvarLength = {26}, lvarIndex = {1})
public String testRepeatedAnnotation1() {
return
"public void f() throws IOException {" + lineSeparator() +
@@ -58,7 +58,7 @@
}
@TADescription(annotation = "RTAs", type = RESOURCE_VARIABLE,
- lvarOffset = {10}, lvarLength = {30}, lvarIndex = {1})
+ lvarOffset = {10}, lvarLength = {26}, lvarIndex = {1})
public String testRepeatedAnnotation2() {
return
"public void f() throws IOException {" + lineSeparator() +
@@ -67,9 +67,9 @@
}
@TADescription(annotation = "TA", type = RESOURCE_VARIABLE,
- lvarOffset = {10}, lvarLength = {118}, lvarIndex = {1})
+ lvarOffset = {10}, lvarLength = {106}, lvarIndex = {1})
@TADescription(annotation = "TB", type = RESOURCE_VARIABLE,
- lvarOffset = {22}, lvarLength = {35}, lvarIndex = {3})
+ lvarOffset = {22}, lvarLength = {31}, lvarIndex = {3})
public String testSeveralVariablesInTryWithResources() {
return
"public void f() throws IOException {" + lineSeparator() +
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Test.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Test.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,25 @@
+/*
+ * 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.
+ */
import java.util.*;
import java.lang.annotation.*;
--- a/langtools/test/tools/javac/api/6731573/Erroneous.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/api/6731573/Erroneous.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,5 @@
+/* /nodynamiccopyright/ */
+
class A {
boolean b;
boolean b;
--- a/langtools/test/tools/javac/diags/examples/AnonymousClass.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/diags/examples/AnonymousClass.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,12 +22,15 @@
*/
// key: compiler.misc.anonymous.class
-// key: compiler.warn.missing.SVUID
-// options: -Xlint:serial
+// key: compiler.err.prob.found.req
+// key: compiler.misc.inconvertible.types
+// options: -Xlint:rawtypes
// run: simple
+import java.util.ArrayList;
+
class AnonymousClass {
- Exception m() {
- return new Exception() { };
+ Object m() {
+ return (ArrayList<String>) new ArrayList<Object>() { };
}
}
--- a/langtools/test/tools/javac/flow/T8062747.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/flow/T8062747.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * 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 8062747
--- a/langtools/test/tools/javac/flow/tests/TestCaseTry.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/flow/tests/TestCaseTry.java Thu Apr 21 13:37:01 2016 -0700
@@ -52,9 +52,9 @@
o = "";
}
- @AliveRange(varName="o", bytecodeStart=22, bytecodeLength=38)
- @AliveRange(varName="o", bytecodeStart=103, bytecodeLength=3)
- @AliveRange(varName="o", bytecodeStart=110, bytecodeLength=1)
+ @AliveRange(varName="o", bytecodeStart=22, bytecodeLength=13)
+ @AliveRange(varName="o", bytecodeStart=53, bytecodeLength=3)
+ @AliveRange(varName="o", bytecodeStart=60, bytecodeLength=1)
void m3() {
Object o;
try (BufferedReader br =
@@ -65,8 +65,8 @@
o = "";
}
- @AliveRange(varName="o", bytecodeStart=12, bytecodeLength=96)
- @AliveRange(varName="o", bytecodeStart=112, bytecodeLength=1)
+ @AliveRange(varName="o", bytecodeStart=12, bytecodeLength=46)
+ @AliveRange(varName="o", bytecodeStart=62, bytecodeLength=1)
void m4() {
String o;
try (BufferedReader br =
--- a/langtools/test/tools/javac/generics/Nonlinear.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/generics/Nonlinear.java Thu Apr 21 13:37:01 2016 -0700
@@ -22,7 +22,7 @@
// the program.
public static void main (String [] args) {
- Integer x = new Integer (5);
+ Integer x = Integer.valueOf(5);
String y = castit (x);
System.out.println (y);
}
--- a/langtools/test/tools/javac/generics/odersky/BadTest4.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/generics/odersky/BadTest4.java Thu Apr 21 13:37:01 2016 -0700
@@ -30,7 +30,7 @@
static <A> Cell<A> makeCell(A x) { return new Cell<A>(x); }
static <A> A id(A x) { return x; }
- static Integer i = new Integer(1);
+ static Integer i = Integer.valueOf(1);
static Number n = i;
public static void main(String[] args) {
--- a/langtools/test/tools/javac/jvm/6397652/com/test/Test$Test$Test.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/jvm/6397652/com/test/Test$Test$Test.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * Copyright (c) 2006, 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.
+ */
+
package com.test;
public class Test$Test$Test {
--- a/langtools/test/tools/javac/jvm/6397652/com/test/Test$Test.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/jvm/6397652/com/test/Test$Test.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * Copyright (c) 2006, 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.
+ */
+
package com.test;
public class Test$Test {
--- a/langtools/test/tools/javac/lambda/8074381/T8074381a.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/lambda/8074381/T8074381a.java Thu Apr 21 13:37:01 2016 -0700
@@ -13,6 +13,7 @@
boolean m(String s);
}
+ @SuppressWarnings("deprecation")
void testRaw() {
Sub s1 = c -> true;
Sub s2 = Boolean::new;
@@ -22,6 +23,7 @@
};
}
+ @SuppressWarnings("deprecation")
void testNonRaw() {
Sub<Integer> s1 = c -> true;
Sub<Integer> s2 = Boolean::new;
--- a/langtools/test/tools/javac/lambda/8074381/T8074381a.out Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/lambda/8074381/T8074381a.out Thu Apr 21 13:37:01 2016 -0700
@@ -1,4 +1,4 @@
-T8074381a.java:17:18: compiler.err.prob.found.req: (compiler.misc.no.suitable.functional.intf.inst: T8074381a.Sub)
T8074381a.java:18:18: compiler.err.prob.found.req: (compiler.misc.no.suitable.functional.intf.inst: T8074381a.Sub)
-T8074381a.java:19:28: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: T8074381a$1, m(java.lang.Object), T8074381a.Sup
+T8074381a.java:19:18: compiler.err.prob.found.req: (compiler.misc.no.suitable.functional.intf.inst: T8074381a.Sub)
+T8074381a.java:20:28: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: T8074381a$1, m(java.lang.Object), T8074381a.Sup
3 errors
--- a/langtools/test/tools/javac/lambda/TargetType27.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/lambda/TargetType27.java Thu Apr 21 13:37:01 2016 -0700
@@ -15,6 +15,6 @@
<A, R> F<A, R> m(F<A, R> f) { return null; }
void test() {
- m((String s1) -> (String s2) -> new Integer(1));
+ m((String s1) -> (String s2) -> Integer.valueOf(1));
}
}
--- a/langtools/test/tools/javac/lambda/badMemberRefBytecode/Main.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/lambda/badMemberRefBytecode/Main.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * 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.
+ */
+
import java.util.Collections;
public class Main {
@@ -6,4 +29,5 @@
Collections.<String>sort(null, String::compareTo);
}
+
}
--- a/langtools/test/tools/javac/lambda/badMemberRefBytecode/Use.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/lambda/badMemberRefBytecode/Use.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * 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.
+ */
+
public class Use {
private Main m;
}
--- a/langtools/test/tools/javac/lambda/lambdaExecution/TBlock.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/lambda/lambdaExecution/TBlock.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * 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.
+ */
+
/**
* Performs operations upon an input object which may modify that object and/or
* external state (other objects).
--- a/langtools/test/tools/javac/policy/test3/A.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/policy/test3/A.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,5 @@
+/* /nodynamiccopyright/ */
+
class A {
void m1() {
System.err.println("hello");
--- a/langtools/test/tools/javac/positions/T6253161.java Thu Apr 21 12:57:16 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 6253161
- * @summary Compiler will fail to find the correct location of serial warnings for anonymous inner classes
- * @author Seetharama Avadhanam
- * @compile -Xlint:serial -XDdev T6253161.java
- * @compile/ref=T6253161.out -Xlint:serial -XDdev -XDrawDiagnostics T6253161.java
- */
-import java.util.List;
-import java.util.ArrayList;
-
-public class T6253161 {
- @SuppressWarnings("unchecked")
- public void anonymousMethod(){
- List list = new ArrayList<String>(){
- static final long serialVersionUID = 1;
- List list = new ArrayList<Integer>();
- public List<Integer> getMyList(){
- final List floatList = new ArrayList<Float>(){
- List integerList = new ArrayList<Float>();
- public List<Float> getMyList(){
- for(int i=0;i<10;i++)
- integerList.add((int)((Float.parseFloat(i+""))+(1.11F)));
- return (List)(Object)integerList;
- }
- public void testMethods(){
- //...
- }
- }.getMyList();
- for(int i=0;i<10;i++)
- list.add((Float)(floatList.get(i)) * 11.232F * i);
- return list;
- }
- }.getMyList();
- }
-}
--- a/langtools/test/tools/javac/positions/T6253161.out Thu Apr 21 12:57:16 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-T6253161.java:19:62: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6253161$1$1
-1 warning
--- a/langtools/test/tools/javac/positions/T6253161a.java Thu Apr 21 12:57:16 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 6253161
- * @summary Compiler will fail to find the correct location of serial warnings for anonymous inner classes
- * @author Seetharama Avadhanam
- * @compile -Xlint:serial -XDdev T6253161a.java
- * @compile/ref=T6253161a.out -Xlint:serial -XDdev -XDrawDiagnostics T6253161a.java
- */
-import java.util.List;
-import java.util.ArrayList;
-
-public class T6253161a {
- @SuppressWarnings("unchecked")
- public void anonymousMethod(){
- List list = new ArrayList<String>(){
- static final long serialVersionUID = 1;
- List list = new ArrayList<Integer>();
- public List<Integer> getMyList(){
- final List floatList = new ArrayList<Float>(){
- // Blank ....
- };
- for(int i=0;i<10;i++)
- list.add((Float)(floatList.get(i)) * 11.232F * i);
- return list;
- }
- }.getMyList();
- }
-}
--- a/langtools/test/tools/javac/positions/T6253161a.out Thu Apr 21 12:57:16 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-T6253161a.java:19:62: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6253161a$1$1
-1 warning
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/serial/SerialWarn.java Thu Apr 21 13:37:01 2016 -0700
@@ -0,0 +1,11 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 4854628
+ * @summary include Throwable subclasses in missing serialVersionUID warning
+ * @author gafter
+ *
+ * @compile -Werror SerialWarn.java
+ * @compile/fail/ref=SerialWarn.out -XDrawDiagnostics -Xlint:serial -Werror SerialWarn.java
+ */
+
+class SerialWarn extends Throwable {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/serial/SerialWarn.out Thu Apr 21 13:37:01 2016 -0700
@@ -0,0 +1,4 @@
+SerialWarn.java:11:1: compiler.warn.missing.SVUID: SerialWarn
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/serial/SerialWarnAnon.java Thu Apr 21 13:37:01 2016 -0700
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7152104
+ * @summary Make sure no warning is emitted for anonymous classes
+ * without serialVersionUID
+ * @compile SerialWarn.java
+ * @compile -Werror -XDrawDiagnostics -Xlint:serial SerialWarnAnon.java
+ */
+
+class SerialWarnAnon {
+ interface SerialWarnAnonInterface extends java.io.Serializable { }
+ Object m() {
+ return new SerialWarnAnonInterface() { };
+ }
+}
--- a/langtools/test/tools/javac/synthesize/src/Double.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/synthesize/src/Double.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * Copyright (c) 2007, 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.
+ */
+
package java.lang;
public class Double extends Number
--- a/langtools/test/tools/javac/synthesize/src/Float.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/synthesize/src/Float.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * Copyright (c) 2007, 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.
+ */
+
package java.lang;
public class Float extends Number
--- a/langtools/test/tools/javac/warnings/6594914/Auxiliary.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/warnings/6594914/Auxiliary.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,5 @@
+/* /nodynamiccopyright/ */
+
import java.io.StringBufferInputStream;
public class Auxiliary {
--- a/langtools/test/tools/javac/warnings/6594914/ExplicitCompilation.out Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/warnings/6594914/ExplicitCompilation.out Thu Apr 21 13:37:01 2016 -0700
@@ -1,2 +1,2 @@
-Auxiliary.java:1:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
+Auxiliary.java:3:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
1 warning
--- a/langtools/test/tools/javac/warnings/6594914/ImplicitCompilation.out Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javac/warnings/6594914/ImplicitCompilation.out Thu Apr 21 13:37:01 2016 -0700
@@ -1,2 +1,2 @@
-Auxiliary.java:1:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
+Auxiliary.java:3:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
1 warning
--- a/langtools/test/tools/javadoc/6964914/TestStdDoclet.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javadoc/6964914/TestStdDoclet.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -28,6 +28,7 @@
*/
import java.io.*;
+import java.util.*;
/**
* Dummy javadoc comment.
@@ -54,13 +55,21 @@
// run javadoc in separate process to ensure doclet executed under
// normal user conditions w.r.t. classloader
String thisClassName = TestStdDoclet.class.getName();
- Process p = new ProcessBuilder()
- .command(javadoc.getPath(),
- "-J-Xpatch:" + System.getProperty("jdk.launcher.patch.0", ""),
+ List<String> cmdArgs = new ArrayList<>();
+ cmdArgs.add(javadoc.getPath());
+ int i = 0;
+ String prop;
+ while ((prop = System.getProperty("jdk.launcher.patch." + (i++))) != null) {
+ cmdArgs.add("-J-Xpatch:" + prop);
+ }
+ cmdArgs.addAll(Arrays.asList(
"-classpath", ".", // insulates us from ambient classpath
"-Xdoclint:none",
"-package",
- new File(testSrc, thisClassName + ".java").getPath())
+ new File(testSrc, thisClassName + ".java").getPath()
+ ));
+ Process p = new ProcessBuilder()
+ .command(cmdArgs)
.redirectErrorStream(true)
.start();
--- a/langtools/test/tools/javadoc/6964914/TestUserDoclet.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javadoc/6964914/TestUserDoclet.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -29,6 +29,8 @@
*/
import java.io.*;
+import java.util.*;
+
import com.sun.javadoc.Doclet;
import com.sun.javadoc.RootDoc;
@@ -55,12 +57,20 @@
// run javadoc in separate process to ensure doclet executed under
// normal user conditions w.r.t. classloader
String thisClassName = TestUserDoclet.class.getName();
- Process p = new ProcessBuilder()
- .command(javadoc.getPath(),
- "-J-Xpatch:" + System.getProperty("jdk.launcher.patch.0", ""),
+ List<String> cmdArgs = new ArrayList<>();
+ cmdArgs.add(javadoc.getPath());
+ int i = 0;
+ String prop;
+ while ((prop = System.getProperty("jdk.launcher.patch." + (i++))) != null) {
+ cmdArgs.add("-J-Xpatch:" + prop);
+ }
+ cmdArgs.addAll(Arrays.asList(
"-doclet", thisClassName,
"-docletpath", testClasses.getPath(),
- new File(testSrc, thisClassName + ".java").getPath())
+ new File(testSrc, thisClassName + ".java").getPath()
+ ));
+ Process p = new ProcessBuilder()
+ .command(cmdArgs)
.redirectErrorStream(true)
.start();
--- a/langtools/test/tools/javadoc/sampleapi/lib/sampleapi/SampleApi.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javadoc/sampleapi/lib/sampleapi/SampleApi.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -53,5 +53,8 @@
public Fault(String msg) {
super(msg);
}
+ public Fault(String msg, Throwable th) {
+ super(msg, th);
+ }
}
}
--- a/langtools/test/tools/javadoc/sampleapi/lib/sampleapi/generator/DocCommentGenerator.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javadoc/sampleapi/lib/sampleapi/generator/DocCommentGenerator.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -32,6 +32,8 @@
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.*;
import com.sun.tools.javac.util.List;
+import java.util.HashMap;
+import java.util.Map;
class DocCommentGenerator {
@@ -99,14 +101,25 @@
LITERAL("@literal", "Use < and > brackets instead of < and > escapes."),
CODE("@code", "(i) -> new Abc<Object>((i > 0) ? (i << 1) : 0)"),
LINK("@link", ""),
- VALUE("@value", "");
+ VALUE("@value", ""),
+ INDEX("@index", "", true);
String tagName;
String tagValue;
+ boolean counted;
+ Map<String, Integer> counters;
InlineTag(String tagName, String tagValue) {
+ this(tagName, tagValue, false);
+ }
+
+ InlineTag(String tagName, String tagValue, boolean counted) {
this.tagName = tagName;
this.tagValue = tagValue;
+ this.counted = counted;
+ if (counted) {
+ counters = new HashMap<>();
+ }
}
public String toString() {
@@ -114,9 +127,14 @@
}
public String value(String value) {
+ String name = ((tagValue.length() != 0) ? " " + tagValue : "")
+ + ((value.length() != 0) ? " " + value : "");
+ if (counted && !counters.containsKey(name)) {
+ counters.put(name, 0);
+ }
return "{" + tagName
- + ((tagValue.length() != 0) ? " " + tagValue : "")
- + ((value.length() != 0) ? " " + value : "")
+ + name
+ + (counted ? "_" + counters.put(name, counters.get(name) + 1) : "")
+ "}";
}
}
@@ -179,7 +197,8 @@
//
public String getPackageComment() {
- return Text.LOREMIPSUM
+ return InlineTag.INDEX.value("PackageCommentLabel") + " "
+ + Text.LOREMIPSUM
+ "\n <p>" + Text.LIEUROPANLINGUES
+ "\n" + Text.CODE
+ "\n" + LinkTag.nextLink()
@@ -192,7 +211,9 @@
static int serialValIdx = 0;
public String getBaseComment(JCClassDecl baseDecl, boolean toplevel) {
- String buildComment = Text.LIEUROPANLINGUES + "\n";
+ String buildComment = InlineTag.INDEX.value("BaseCommentLabel") + " ";
+
+ buildComment += Text.LIEUROPANLINGUES + "\n";
buildComment += "<p>It is possible to see inlined code:\n"
+ InlineTag.CODE
@@ -237,8 +258,9 @@
}
public String getConstComment() {
- String buildComment = Text.NOWISTHETIME + " " + Text.BROWNFOX + "\n";
+ String buildComment = InlineTag.INDEX.value("ConstCommentLabel") + " ";
+ buildComment += Text.NOWISTHETIME + " " + Text.BROWNFOX + "\n";
buildComment += LinkTag.nextLink() + "\n";
buildComment += LinkTag.nextSee() + "\n";
buildComment += Tag.SINCE + "\n";
@@ -249,8 +271,9 @@
public String getFieldComment(JCClassDecl baseDecl,
JCVariableDecl varDecl,
boolean isFxStyle) {
- String buildComment = Text.BROWNFOX + "<p>" + Text.NOWISTHETIME + "\n";
+ String buildComment = InlineTag.INDEX.value("FieldCommentLabel") + " ";
+ buildComment += Text.BROWNFOX + "<p>" + Text.NOWISTHETIME + "\n";
Set<Modifier> mods = varDecl.getModifiers().getFlags();
String varName = varDecl.getName().toString();
@@ -299,7 +322,9 @@
public String getMethodComment(JCClassDecl baseDecl,
JCMethodDecl methodDecl,
boolean isFxStyle) {
- String buildComment = Text.BROWNFOX + "\n<p>" + Text.THISPANGRAM + "\n";
+ String buildComment = InlineTag.INDEX.value("MethodCommentLabel") + " ";
+
+ buildComment += Text.BROWNFOX + "\n<p>" + Text.THISPANGRAM + "\n";
buildComment += "<p>" + LinkTag.nextLink() + "\n";
--- a/langtools/test/tools/javadoc/sampleapi/lib/sampleapi/generator/PackageGenerator.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javadoc/sampleapi/lib/sampleapi/generator/PackageGenerator.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -125,7 +125,7 @@
processTopLevel((Element)node);
}
} catch (ParserConfigurationException | SAXException | IOException e) {
- throw new Fault("Error parsing dataset " + dsName);
+ throw new Fault("Error parsing dataset " + dsName, e);
}
fx = false;
--- a/langtools/test/tools/javap/4111861/A.java Thu Apr 21 12:57:16 2016 -0700
+++ b/langtools/test/tools/javap/4111861/A.java Thu Apr 21 13:37:01 2016 -0700
@@ -1,3 +1,26 @@
+/*
+ * 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.
+ */
+
class A {
public static final int i = 42;
public static final boolean b = true;