--- a/langtools/make/tools/genstubs/GenStubs.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/make/tools/genstubs/GenStubs.java Wed May 29 16:59:36 2013 -0700
@@ -230,9 +230,9 @@
tree.typarams = translateTypeParams(tree.typarams);
tree.params = translateVarDefs(tree.params);
tree.thrown = translate(tree.thrown);
- if (tree.restype != null && tree.body != null) {
+ if (tree.body != null) {
if ((currClassMods & Flags.INTERFACE) != 0) {
- tree.mods.flags &= ~Flags.DEFAULT;
+ tree.mods.flags &= ~(Flags.DEFAULT | Flags.STATIC);
} else {
tree.mods.flags |= Flags.NATIVE;
}
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassFile.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassFile.java Wed May 29 16:59:36 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, 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,7 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.file.Path;
import static com.sun.tools.classfile.AccessFlags.*;
@@ -46,6 +47,11 @@
return read(file, new Attribute.Factory());
}
+ public static ClassFile read(Path path)
+ throws IOException, ConstantPoolException {
+ return read(path.toFile(), new Attribute.Factory());
+ }
+
public static ClassFile read(File file, Attribute.Factory attributeFactory)
throws IOException, ConstantPoolException {
FileInputStream in = new FileInputStream(file);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed May 29 16:59:36 2013 -0700
@@ -3732,7 +3732,7 @@
noteWarner);
return chk.checkMethod(owntype, sym, env, argtrees, argtypes, env.info.lastResolveVarargs(),
- noteWarner.hasNonSilentLint(LintCategory.UNCHECKED));
+ noteWarner.hasNonSilentLint(LintCategory.UNCHECKED), resultInfo.checkContext.inferenceContext());
} catch (Infer.InferenceException ex) {
//invalid target type - propagate exception outwards or report error
//depending on the current check context
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed May 29 16:59:36 2013 -0700
@@ -853,7 +853,8 @@
final List<JCExpression> argtrees,
List<Type> argtypes,
boolean useVarargs,
- boolean unchecked) {
+ boolean unchecked,
+ InferenceContext inferenceContext) {
// System.out.println("call : " + env.tree);
// System.out.println("method : " + owntype);
// System.out.println("actuals: " + argtypes);
@@ -917,7 +918,7 @@
argtype);
}
if (!((MethodSymbol)sym.baseSymbol()).isSignaturePolymorphic(types)) {
- TreeInfo.setVarargsElement(env.tree, types.elemtype(argtype));
+ setVarargsElement(env, types.elemtype(argtype), inferenceContext);
}
}
PolyKind pkind = (sym.type.hasTag(FORALL) &&
@@ -927,6 +928,17 @@
return owntype;
}
//where
+ private void setVarargsElement(final Env<AttrContext> env, final Type elemtype, InferenceContext inferenceContext) {
+ if (inferenceContext.free(elemtype)) {
+ inferenceContext.addFreeTypeListener(List.of(elemtype), new FreeTypeListener() {
+ public void typesInferred(InferenceContext inferenceContext) {
+ setVarargsElement(env, inferenceContext.asInstType(elemtype), inferenceContext);
+ }
+ });
+ }
+ TreeInfo.setVarargsElement(env.tree, elemtype);
+ }
+
private void assertConvertible(JCTree tree, Type actual, Type formal, Warner warn) {
if (types.isConvertible(actual, formal, warn))
return;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed May 29 16:59:36 2013 -0700
@@ -2002,7 +2002,7 @@
JCStatement rethrow;
if (target.hasInitCause()) {
// rethrow = "throw new NoClassDefFoundError().initCause(e);
- JCTree throwExpr =
+ JCExpression throwExpr =
makeCall(makeNewClass(syms.noClassDefFoundErrorType,
List.<JCExpression>nil()),
names.initCause,
@@ -2931,7 +2931,7 @@
}
result =
make.If(cond,
- make_at(detailPos).
+ make_at(tree).
Throw(makeNewClass(syms.assertionErrorType, exnArgs)),
null);
} else {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed May 29 16:59:36 2013 -0700
@@ -1343,7 +1343,7 @@
try {
Type mt = rawInstantiate(env, site, sym, null, argtypes, typeargtypes,
allowBoxing, useVarargs, types.noWarnings);
- if (!operator)
+ if (!operator || verboseResolutionMode.contains(VerboseResolutionMode.PREDEF))
currentResolutionContext.addApplicableCandidate(sym, mt);
} catch (InapplicableMethodException ex) {
if (!operator)
@@ -2500,17 +2500,21 @@
try {
currentResolutionContext = new MethodResolutionContext();
Name name = treeinfo.operatorName(optag);
- env.info.pendingResolutionPhase = currentResolutionContext.step = BASIC;
- Symbol sym = findMethod(env, syms.predefClass.type, name, argtypes,
- null, false, false, true);
- if (boxingEnabled && sym.kind >= WRONG_MTHS)
- env.info.pendingResolutionPhase = currentResolutionContext.step = BOX;
- sym = findMethod(env, syms.predefClass.type, name, argtypes,
- null, true, false, true);
- return accessMethod(sym, pos, env.enclClass.sym.type, name,
+ return lookupMethod(env, pos, syms.predefClass, currentResolutionContext,
+ new BasicLookupHelper(name, syms.predefClass.type, argtypes, null, BOX) {
+ @Override
+ Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
+ return findMethod(env, site, name, argtypes, typeargtypes,
+ phase.isBoxingRequired(),
+ phase.isVarargsRequired(), true);
+ }
+ @Override
+ Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) {
+ return accessMethod(sym, pos, env.enclClass.sym.type, name,
false, argtypes, null);
- }
- finally {
+ }
+ });
+ } finally {
currentResolutionContext = prevResolutionContext;
}
}
@@ -2673,7 +2677,11 @@
abstract class BasicLookupHelper extends LookupHelper {
BasicLookupHelper(Name name, Type site, List<Type> argtypes, List<Type> typeargtypes) {
- super(name, site, argtypes, typeargtypes, MethodResolutionPhase.VARARITY);
+ this(name, site, argtypes, typeargtypes, MethodResolutionPhase.VARARITY);
+ }
+
+ BasicLookupHelper(Name name, Type site, List<Type> argtypes, List<Type> typeargtypes, MethodResolutionPhase maxPhase) {
+ super(name, site, argtypes, typeargtypes, maxPhase);
}
@Override
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Wed May 29 16:59:36 2013 -0700
@@ -172,10 +172,13 @@
JCExpression retype(JCExpression tree, Type erasedType, Type target) {
// System.err.println("retype " + tree + " to " + erasedType);//DEBUG
if (!erasedType.isPrimitive()) {
- if (target != null && target.isPrimitive())
+ if (target != null && target.isPrimitive()) {
target = erasure(tree.type);
+ }
tree.type = erasedType;
- if (target != null) return coerce(tree, target);
+ if (target != null) {
+ return coerce(tree, target);
+ }
}
return tree;
}
@@ -686,8 +689,8 @@
public void visitAssign(JCAssign tree) {
tree.lhs = translate(tree.lhs, null);
tree.rhs = translate(tree.rhs, erasure(tree.lhs.type));
- tree.type = erasure(tree.type);
- result = tree;
+ tree.type = erasure(tree.lhs.type);
+ result = retype(tree, tree.type, pt);
}
public void visitAssignop(JCAssignOp tree) {
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed May 29 16:59:36 2013 -0700
@@ -1535,11 +1535,18 @@
outer: for (int lookahead = 0 ; ; lookahead++) {
TokenKind tk = S.token(lookahead).kind;
switch (tk) {
- case EXTENDS: case SUPER: case COMMA:
+ case COMMA:
type = true;
- case QUES: case DOT: case AMP:
+ case EXTENDS: case SUPER: case DOT: case AMP:
//skip
break;
+ case QUES:
+ if (peekToken(lookahead, EXTENDS) ||
+ peekToken(lookahead, SUPER)) {
+ //wildcards
+ type = true;
+ }
+ break;
case BYTE: case SHORT: case INT: case LONG: case FLOAT:
case DOUBLE: case BOOLEAN: case CHAR:
if (peekToken(lookahead, RPAREN)) {
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Wed May 29 16:59:36 2013 -0700
@@ -700,7 +700,7 @@
public List<JCTypeParameter> getTypeParameters() {
return typarams;
}
- public JCTree getExtendsClause() { return extending; }
+ public JCExpression getExtendsClause() { return extending; }
public List<JCExpression> getImplementsClause() {
return implementing;
}
@@ -1175,7 +1175,7 @@
return v.visitTry(this, d);
}
@Override
- public List<? extends JCTree> getResources() {
+ public List<JCTree> getResources() {
return resources;
}
@Override
@@ -1392,8 +1392,8 @@
*/
public static class JCThrow extends JCStatement implements ThrowTree {
public JCExpression expr;
- protected JCThrow(JCTree expr) {
- this.expr = (JCExpression)expr;
+ protected JCThrow(JCExpression expr) {
+ this.expr = expr;
}
@Override
public void accept(Visitor v) { v.visitThrow(this); }
@@ -2466,7 +2466,7 @@
JCBreak Break(Name label);
JCContinue Continue(Name label);
JCReturn Return(JCExpression expr);
- JCThrow Throw(JCTree expr);
+ JCThrow Throw(JCExpression expr);
JCAssert Assert(JCExpression cond, JCExpression detail);
JCMethodInvocation Apply(List<JCExpression> typeargs,
JCExpression fn,
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Wed May 29 16:59:36 2013 -0700
@@ -340,7 +340,7 @@
public JCTree visitThrow(ThrowTree node, P p) {
JCThrow t = (JCThrow) node;
- JCTree expr = copy(t.expr, p);
+ JCExpression expr = copy(t.expr, p);
return M.at(t.pos).Throw(expr);
}
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Wed May 29 16:59:36 2013 -0700
@@ -332,7 +332,7 @@
return tree;
}
- public JCThrow Throw(JCTree expr) {
+ public JCThrow Throw(JCExpression expr) {
JCThrow tree = new JCThrow(expr);
tree.pos = pos;
return tree;
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Convert.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Convert.java Wed May 29 16:59:36 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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,24 @@
/** Utility class for static conversion methods between numbers
* and strings in various formats.
*
+ * <p>Note regarding UTF-8.
+ * The JVMS defines its own version of the UTF-8 format so that it
+ * contains no zero bytes (modified UTF-8). This is not actually the same
+ * as Charset.forName("UTF-8").
+ *
+ * <p>
+ * See also:
+ * <ul>
+ * <li><a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.4.7">
+ * JVMS 4.4.7 </a></li>
+ * <li><a href="http://docs.oracle.com/javase/7/docs/api/java/io/DataInput.html#modified-utf-8">
+ java.io.DataInput: Modified UTF-8 </a></li>
+ <li><a href="https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8">
+ Modified UTF-8 (wikipedia) </a></li>
+ * </ul>
+ *
+ * The methods here support modified UTF-8.
+ *
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
--- a/langtools/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java Wed May 29 16:59:36 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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,8 +125,6 @@
System.arraycopy(cs, start, bytes, 0, len);
n = new NameImpl(this, bytes, index++);
- System.arraycopy(cs, start, n.bytes, 0, len);
-
HashEntry newEntry = new HashEntry(n);
if (previousNonNullTableEntry == null) { // We are not the first name with that hashCode.
--- a/langtools/src/share/classes/javax/lang/model/AnnotatedConstruct.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/javax/lang/model/AnnotatedConstruct.java Wed May 29 16:59:36 2013 -0700
@@ -39,35 +39,76 @@
* are on a <em>declaration</em>, whereas annotations on a type are on
* a specific <em>use</em> of a type name.
*
- * The terms <em>directly present</em> and <em>present</em> are used
+ * The terms <em>directly present</em>, <em>present</em>,
+ * <em>indirectly present</em>, and <em>associated </em> are used
* throughout this interface to describe precisely which annotations
- * are returned by methods:
+ * are returned by the methods defined herein.
*
- * <p>An annotation <i>A</i> is <em>directly present</em> on a
- * construct <i>E</i> if <i>E</i> is annotated, and:
+ * <p>In the definitions below, an annotation <i>A</i> has an
+ * annotation type <i>AT</i>. If <i>AT</i> is a repeatable annotation
+ * type, the type of the containing annotation is <i>ATC</i>.
+ *
+ * <p>Annotation <i>A</i> is <em>directly present</em> on a construct
+ * <i>C</i> if either:
*
* <ul>
*
- * <li> for an invocation of {@code getAnnotation(Class<T>)} or
- * {@code getAnnotationMirrors()}, <i>E</i>'s annotations contain <i>A</i>.
+ * <li><i>A</i> is explicitly or implicitly declared as applying to
+ * the source code representation of <i>C</i>.
+ *
+ * <p>Typically, if exactly one annotation of type <i>AT</i> appears in
+ * the source code of representation of <i>C</i>, then <i>A</i> is
+ * explicitly declared as applying to <i>C</i>.
*
- * <li> for an invocation of {@code getAnnotationsByType(Class<T>)},
- * <i>E</i>'s annotations either contain <i>A</i> or, if the type of
- * <i>A</i> is repeatable, contain exactly one annotation whose value
- * element contains <i>A</i> and whose type is the containing
- * annotation type of <i>A</i>'s type.
+ * If there are multiple annotations of type <i>AT</i> present on
+ * <i>C</i>, then if <i>AT</i> is repeatable annotation type, an
+ * annotation of type <i>ATC</i> is implicitly declared on <i>C</i>.
+ *
+ * <li> A representation of <i>A</i> appears in the executable output
+ * for <i>C</i>, such as the {@code RuntimeVisibleAnnotations} or
+ * {@code RuntimeVisibleParameterAnnotations} attributes of a class
+ * file.
*
* </ul>
*
- * <p>An annotation A is <em>present</em> on a construct E if either:
+ * <p>An annotation <i>A</i> is <em>present</em> on a
+ * construct <i>C</i> if either:
+ * <ul>
+ *
+ * <li><i>A</i> is directly present on <i>C</i>.
+ *
+ * <li>No annotation of type <i>AT</i> is directly present on
+ * <i>C</i>, and <i>C</i> is a class and <i>AT</i> is inheritable
+ * and <i>A</i> is present on the superclass of <i>C</i>.
+ *
+ * </ul>
+ *
+ * An annotation <i>A</i> is <em>indirectly present</em> on a construct
+ * <i>C</i> if both:
*
* <ul>
- * <li> <i>A</i> is <em>directly present</em> on <i>E</i>; or
+ *
+ * <li><i>AT</i> is a repeatable annotation type with a containing
+ * annotation type <i>ATC</i>.
+ *
+ * <li>An annotation of type <i>ATC</i> is directly present on
+ * <i>C</i> and <i>A</i> is an annotation included in the result of
+ * calling the {@code value} method of the directly present annotation
+ * of type <i>ATC</i>.
+ *
+ * </ul>
*
- * <li> <i>A</i> is not <em>directly present</em> on <i>E</i>, and
- * <i>E</i> is an element representing a class, and <i>A</i>'s type
- * is inheritable, and <i>A</i> is <em>present</em> on the element
- * representing the superclass of <i>E</i>.
+ * An annotation <i>A</i> is <em>associated</em> with a construct
+ * <i>C</i> if either:
+ *
+ * <ul>
+ *
+ * <li> <i>A</i> is directly or indirectly present on <i>C</i>.
+ *
+ * <li> No annotation of type <i>AT</i> is directly or indirectly
+ * present on <i>C</i>, and <i>C</i> is a class, and <i>AT</i> is
+ * inheritable, and <i>A</i> is associated with the superclass of
+ * <i>C</i>.
*
* </ul>
*
@@ -86,9 +127,8 @@
List<? extends AnnotationMirror> getAnnotationMirrors();
/**
- * Returns this construct's annotation of the
- * specified type if such an annotation is <em>present</em>, else {@code
- * null}.
+ * Returns this construct's annotation of the specified type if
+ * such an annotation is <em>present</em>, else {@code null}.
*
* <p> The annotation returned by this method could contain an element
* whose value is of type {@code Class}.
@@ -118,9 +158,8 @@
* @param <A> the annotation type
* @param annotationType the {@code Class} object corresponding to
* the annotation type
- * @return this element's or type use's annotation for the
- * specified annotation type if present on this element, else
- * {@code null}
+ * @return this construct's annotation for the specified
+ * annotation type if present, else {@code null}
*
* @see #getAnnotationMirrors()
* @see java.lang.reflect.AnnotatedElement#getAnnotation
@@ -134,10 +173,16 @@
<A extends Annotation> A getAnnotation(Class<A> annotationType);
/**
- * Returns annotations that are <em>present</em> on this construct.
+ * Returns annotations that are <em>associated</em> with this construct.
+ *
+ * If there are no annotations associated with this construct, the
+ * return value is an array of length 0.
*
- * If there are no annotations <em>present</em> on this construct,
- * the return value is an array of length 0.
+ * The order of annotations which are directly or indirectly
+ * present on a construct <i>C</i> is computed as if indirectly present
+ * annotations on <i>C</i> are directly present on <i>C</i> in place of their
+ * container annotation, in the order in which they appear in the
+ * value element of the container annotation.
*
* The difference between this method and {@link #getAnnotation(Class)}
* is that this method detects if its argument is a <em>repeatable
@@ -172,8 +217,8 @@
* @param <A> the annotation type
* @param annotationType the {@code Class} object corresponding to
* the annotation type
- * @return this element's annotations for the specified annotation
- * type if present on this element, else an empty array
+ * @return this construct's annotations for the specified annotation
+ * type if present on this construct, else an empty array
*
* @see #getAnnotationMirrors()
* @see #getAnnotation(java.lang.Class)
--- a/langtools/src/share/classes/javax/lang/model/util/Elements.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/classes/javax/lang/model/util/Elements.java Wed May 29 16:59:36 2013 -0700
@@ -143,12 +143,13 @@
List<? extends Element> getAllMembers(TypeElement type);
/**
- * Returns all annotations of an element, whether
- * inherited or directly present.
+ * Returns all annotations <i>present</i> on an element, whether
+ * directly present or present via inheritance.
*
* @param e the element being examined
* @return all annotations of the element
* @see Element#getAnnotationMirrors
+ * @see javax.lang.model.AnnotatedConstruct
*/
List<? extends AnnotationMirror> getAllAnnotationMirrors(Element e);
--- a/langtools/src/share/sample/language/model/CoreReflectionFactory.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/src/share/sample/language/model/CoreReflectionFactory.java Wed May 29 16:59:36 2013 -0700
@@ -439,15 +439,11 @@
ReflectionElement getGenericElement();
// Functionality specific to the specialization
-
- // Conceptually should have an override for getSource
- // returning GenericDeclaration, but GenericDeclaration
- // doesn't currently implement AnnotatedElement.
-// /**
-// * {@inheritDoc}
-// */
-// @Override
-// java.lang.reflect.GenericDeclaration getSource();
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ java.lang.reflect.TypeVariable<?> getSource();
}
/**
@@ -1296,8 +1292,8 @@
}
@Override
- public AnnotatedElement getSource() {
- return (AnnotatedElement)source;
+ public java.lang.reflect.TypeVariable<?> getSource() {
+ return sourceTypeVar;
}
protected java.lang.reflect.TypeVariable<?> getSourceTypeVar() {
--- a/langtools/test/tools/doclint/RunTest.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/test/tools/doclint/RunTest.java Wed May 29 16:59:36 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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,20 +22,13 @@
*/
/* @test
- * @bug 8004832
+ * @bug 8004832 8000103
* @summary Add new doclint package
- * @bug 8000103
* @summary Create doclint utility
*/
-import com.sun.tools.doclint.DocLint;
-import com.sun.tools.doclint.DocLint.BadArgs;
-import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FilterOutputStream;
import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.annotation.Annotation;
@@ -44,6 +37,9 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import com.sun.tools.doclint.DocLint;
+import com.sun.tools.doclint.DocLint.BadArgs;
+
/** javadoc error on toplevel: a & b. */
public class RunTest {
/** javadoc error on member: a < b */
--- a/langtools/test/tools/javac/5045412/Bar.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/test/tools/javac/5045412/Bar.java Wed May 29 16:59:36 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, 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
@@ -24,12 +24,6 @@
/**
* @test
* @bug 5045412 6627366
- * @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Bar.java
- */
-
-/**
- * @test
- * @bug 5045412 6627366
* @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Bar.java Foo.java
*/
--- a/langtools/test/tools/javac/5045412/Foo.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/test/tools/javac/5045412/Foo.java Wed May 29 16:59:36 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, 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
@@ -25,11 +25,6 @@
* @test
* @bug 5045412 6627366
* @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Foo.java
- */
-
-/**
- * @test
- * @bug 5045412 6627366
* @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Foo.java Bar.java
*/
--- a/langtools/test/tools/javac/HiddenAbstractMethod/Test Thu May 23 10:47:57 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-/*
- * @test
- * @bug 1240831
- * @summary Certain classes should have been reported as abstract, but
- * the compiler failed to detect this. This comes up when a
- * subclass declares a method with the same name as an
- * unimplemented, unaccessible method in a superclass. Even though
- * the method has the same name, it does not override.
- * @author turnidge
- *
- * @compile/fail -nowrite one/Parent.java two/Child.java
- */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/HiddenAbstractMethod/Test.java Wed May 29 16:59:36 2013 -0700
@@ -0,0 +1,12 @@
+/*
+ * @test
+ * @bug 1240831
+ * @summary Certain classes should have been reported as abstract, but
+ * the compiler failed to detect this. This comes up when a
+ * subclass declares a method with the same name as an
+ * unimplemented, unaccessible method in a superclass. Even though
+ * the method has the same name, it does not override.
+ * @author turnidge
+ *
+ * @compile/fail one/Parent.java two/Child.java
+ */
--- a/langtools/test/tools/javac/NonAmbiguousField/Test Thu May 23 10:47:57 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-/*
- * @test
- * @bug 4053724
- * @summary Certain non-ambiguous field references were reported by the
- * compiler as ambigous.
- * @author turnidge
- *
- * @compile -nowrite one/Parent.java two/Child.java
- * @compile -nowrite one/Parent2.java two/Child2.java
- */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/NonAmbiguousField/Test.java Wed May 29 16:59:36 2013 -0700
@@ -0,0 +1,10 @@
+/*
+ * @test
+ * @bug 4053724
+ * @summary Certain non-ambiguous field references were reported by the
+ * compiler as ambigous.
+ * @author turnidge
+ *
+ * @compile one/Parent.java two/Child.java
+ * @compile/fail one/Parent2.java two/Child2.java
+ */
--- a/langtools/test/tools/javac/NonAmbiguousField/two/Child2.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/test/tools/javac/NonAmbiguousField/two/Child2.java Wed May 29 16:59:36 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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,9 +28,7 @@
}
public class Child2 extends one.Parent2 implements I {
- class inner {
- void method() {
- System.out.println(i);
- }
+ void method() {
+ System.out.println(i);
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T6970173/DebugPointerAtBadPositionTest.java Wed May 29 16:59:36 2013 -0700
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2013, 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 6970173
+ * @summary Debug pointer at bad position
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main DebugPointerAtBadPositionTest
+ */
+
+import java.io.File;
+import java.nio.file.Paths;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.LineNumberTable_attribute;
+import com.sun.tools.classfile.Method;
+import com.sun.tools.javac.util.Assert;
+
+public class DebugPointerAtBadPositionTest {
+
+ static final String testSource =
+ "public class AssertionTest {\n" +
+ " void lookForThisMethod() {\n" +
+ " int i;\n" +
+ " i = 33;\n" +
+ " assert // line 5\n" +
+ " i < 89:\n" +
+ " i < 100; // line 7\n" +
+ " }\n" +
+ "}";
+
+ static final int[][] expectedLNT = {
+ {4, 0},
+ {5, 3},
+ {8, 34}
+ };
+
+ static final String methodToLookFor = "lookForThisMethod";
+ static final String seekMethodNotFoundMsg =
+ "The seek method was not found";
+ static final String foundLNTLengthDifferentThanExpMsg =
+ "The LineNumberTable found has a length different to the expected one";
+
+ public static void main(String[] args) throws Exception {
+ new DebugPointerAtBadPositionTest().run();
+ }
+
+ void run() throws Exception {
+ compileTestClass();
+ checkClassFile(new File(Paths.get(System.getProperty("user.dir"),
+ "AssertionTest.class").toUri()), methodToLookFor);
+ }
+
+ void compileTestClass() throws Exception {
+ ToolBox.JavaToolArgs javacSuccessArgs =
+ new ToolBox.JavaToolArgs().setSources(testSource);
+ ToolBox.javac(javacSuccessArgs);
+ }
+
+ void checkClassFile(final File cfile, String methodToFind) throws Exception {
+ ClassFile classFile = ClassFile.read(cfile);
+ boolean methodFound = false;
+ for (Method method : classFile.methods) {
+ if (method.getName(classFile.constant_pool).equals(methodToFind)) {
+ methodFound = true;
+ Code_attribute code = (Code_attribute) method.attributes.get("Code");
+ LineNumberTable_attribute lnt =
+ (LineNumberTable_attribute) code.attributes.get("LineNumberTable");
+ Assert.check(lnt.line_number_table_length == expectedLNT.length,
+ foundLNTLengthDifferentThanExpMsg);
+ int i = 0;
+ for (LineNumberTable_attribute.Entry entry: lnt.line_number_table) {
+ Assert.check(entry.line_number == expectedLNT[i][0] &&
+ entry.start_pc == expectedLNT[i][1],
+ "LNT entry at pos " + i + " differ from expected." +
+ "Found " + entry.line_number + ":" + entry.start_pc +
+ ". Expected " + expectedLNT[i][0] + ":" + expectedLNT[i][1]);
+ i++;
+ }
+ }
+ }
+ Assert.check(methodFound, seekMethodNotFoundMsg);
+ }
+
+ void error(String msg) {
+ throw new AssertionError(msg);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T7053059/VerifyErrorWithDoubleAssignmentTest.java Wed May 29 16:59:36 2013 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2013, 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 7053059
+ * @summary VerifyError with double Assignment using a Generic Member of a Superclass
+ * @run main VerifyErrorWithDoubleAssignmentTest
+ */
+
+public class VerifyErrorWithDoubleAssignmentTest {
+
+ static class A<D> {
+ D d;
+
+ D getD() {
+ return null;
+ }
+ }
+
+ static class B extends A<Integer> {
+ Integer y;
+ B() {
+ y = d = getD();
+ }
+ }
+
+ public static void main(String[] args) {
+ new B();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/8013180/QualifiedName.java Wed May 29 16:59:36 2013 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013, 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.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+/*
+ * @test
+ * @bug 8013180
+ * @summary Qualified type annotation name used to crash javac
+ * @compile QualifiedName.java
+ */
+
+public class QualifiedName {
+ @Target(ElementType.TYPE_USE) @interface TA { }
+ class E extends Exception { }
+
+ void m() throws @TA QualifiedName.@TA E { }
+}
--- a/langtools/test/tools/javac/diags/Example.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/test/tools/javac/diags/Example.java Wed May 29 16:59:36 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, 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
@@ -296,7 +296,10 @@
private Set<String> actualKeys;
private Set<String> declaredKeys;
- static File tempDir = new File(System.getProperty("java.io.tmpdir"));
+ static File tempDir = (System.getProperty("test.src") != null) ?
+ new File(System.getProperty("user.dir")):
+ new File(System.getProperty("java.io.tmpdir"));
+
static void setTempDir(File tempDir) {
Example.tempDir = tempDir;
}
--- a/langtools/test/tools/javac/lambda/MethodReferenceParserTest.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/test/tools/javac/lambda/MethodReferenceParserTest.java Wed May 29 16:59:36 2013 -0700
@@ -23,8 +23,7 @@
/*
* @test
- * @bug 7115052
- * @bug 8003280 8006694
+ * @bug 7115052 8003280 8006694
* @summary Add lambda tests
* Add parser support for method references
* temporarily workaround combo tests are causing time out in several platforms
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/TargetType73.java Wed May 29 16:59:36 2013 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2013, 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 8014494
+ * @summary javac crashes when varargs element of a method reference is inferred from the context
+ * @compile TargetType73.java
+ */
+import java.util.List;
+
+class TargetType73 {
+
+ interface Function<X,Y> {
+ Y m(X x);
+ }
+
+ static void test() {
+ m(TargetType73::g);
+ }
+
+ public static <T> List<T> g(T... a) {
+ return null;
+ }
+
+ public static <C> void m(Function<String, C> zipper) { }
+}
--- a/langtools/test/tools/javac/lambda/TestInvokeDynamic.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/test/tools/javac/lambda/TestInvokeDynamic.java Wed May 29 16:59:36 2013 -0700
@@ -23,8 +23,7 @@
/*
* @test
- * @bug 7194586
- * @bug 8003280 8006694 8010404
+ * @bug 7194586 8003280 8006694 8010404
* @summary Add lambda tests
* Add back-end support for invokedynamic
* temporarily workaround combo tests are causing time out in several platforms
@@ -36,6 +35,16 @@
// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
// see JDK-8006746
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Locale;
+
+import javax.tools.Diagnostic;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+
import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.util.TaskEvent;
@@ -63,16 +72,6 @@
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.Names;
-import java.io.File;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Locale;
-
-import javax.tools.Diagnostic;
-import javax.tools.JavaFileObject;
-import javax.tools.SimpleJavaFileObject;
-
import static com.sun.tools.javac.jvm.ClassFile.*;
public class TestInvokeDynamic
--- a/langtools/test/tools/javac/mandatoryWarnings/deprecated/Test.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/test/tools/javac/mandatoryWarnings/deprecated/Test.java Wed May 29 16:59:36 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, 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,109 +29,19 @@
* @bug 5047307
* @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test1.out -XDrawDiagnostics A.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test1.out -XDrawDiagnostics -nowarn A.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test1.out -XDrawDiagnostics -Xmaxwarns 1 A.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test2.out -XDrawDiagnostics A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test2.out -XDrawDiagnostics -nowarn A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test2.out -XDrawDiagnostics -Xmaxwarns 1 A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test3.out -XDrawDiagnostics -Xlint:deprecation A.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test3.out -XDrawDiagnostics -nowarn -Xlint:deprecation A.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test3b.out -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 1 A.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test4.out -XDrawDiagnostics -Xlint:deprecation A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test4.out -XDrawDiagnostics -nowarn -Xlint:deprecation A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test4b.out -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 1 A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test4c.out -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 2 A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test4d.out -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 3 A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test5.out -XDrawDiagnostics -Xlint:deprecation P.java Q.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test5b.out -XDrawDiagnostics -Xlint:deprecation -Xmaxwarns 2 P.java Q.java
*/
--- a/langtools/test/tools/javac/mandatoryWarnings/unchecked/Test.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/test/tools/javac/mandatoryWarnings/unchecked/Test.java Wed May 29 16:59:36 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, 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,95 +29,17 @@
* @bug 5047307
* @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test1.out -XDrawDiagnostics A.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test1.out -XDrawDiagnostics -nowarn A.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test1.out -XDrawDiagnostics -Xmaxwarns 1 A.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test2.out -XDrawDiagnostics A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test2.out -XDrawDiagnostics -nowarn A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test2.out -XDrawDiagnostics -Xmaxwarns 1 A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test3.out -XDrawDiagnostics -Xlint:unchecked A.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test3.out -XDrawDiagnostics -nowarn -Xlint:unchecked A.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test3b.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 1 A.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test4.out -XDrawDiagnostics -Xlint:unchecked A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test4.out -XDrawDiagnostics -nowarn -Xlint:unchecked A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test4b.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 1 A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test4c.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 2 A.java B.java
- */
-
-/*
- * @test
- * @bug 5047307
- * @summary javac -nowarn improperly suppresses JLS-mandated warnings
* @compile/ref=Test4d.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 3 A.java B.java
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/parser/8014643/T8014643.java Wed May 29 16:59:36 2013 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2013, 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 8014643
+ * @summary Parser regression in JDK 8 when compiling super.x
+ * @compile T8014643.java
+ */
+class T8014643 {
+
+ static class A {
+ int b = 1;
+ }
+
+ static class B extends A {
+ int b = 12;
+
+ int m() { return (super.b); }
+ }
+}
--- a/langtools/test/tools/javac/policy/test3/Test.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/test/tools/javac/policy/test3/Test.java Wed May 29 16:59:36 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, 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
@@ -123,47 +123,3 @@
int errors;
}
-
-
-
-
-
-
-
-
-
-
-
-
-// These tests test the ability of the compiler to continue in the face of
-// errors, accordining to the shouldStopPolicy
-
-/* @ test /nodynamiccopyright/
- * @bug 6813059
- * @summary
- * @compile/fail/ref=flow.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=FLOW Test.java
-
- * @compile/fail/ref=default.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy Test.java
- * @compile/fail/ref=enter.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=ENTER Test.java
- * @compile/fail/ref=attr.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=ATTR Test.java
- * @compile/fail/ref=transtypes.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=TRANSTYPES Test.java
- * @compile/fail/ref=lower.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=LOWER Test.java
- * @compile/fail/ref=generate.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=GENERATE Test.java
- */
-
-/*
-class Test {
- void m1() {
- System.err.println("hello");
- 0 // syntax error
- System.err.println("world");
- }
-
- void m2() {
- }
-}
-
-class Test2 {
-}
-*/
-
--- a/langtools/test/tools/javac/resolve/ResolveHarness.java Thu May 23 10:47:57 2013 -0700
+++ b/langtools/test/tools/javac/resolve/ResolveHarness.java Wed May 29 16:59:36 2013 -0700
@@ -43,6 +43,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import javax.annotation.processing.AbstractProcessor;
@@ -85,6 +86,7 @@
Set<String> declaredKeys = new HashSet<>();
List<Diagnostic<? extends JavaFileObject>> diags = new ArrayList<>();
List<ElementKey> seenCandidates = new ArrayList<>();
+ Map<String, String> predefTranslationMap = new HashMap<>();
protected ResolveHarness(JavaFileObject jfo) {
this.jfo = jfo;
@@ -93,12 +95,36 @@
new VerboseDeferredInferenceNoteProcessor(),
new ErrorProcessor()
};
+ predefTranslationMap.put("+", "_plus");
+ predefTranslationMap.put("-", "_minus");
+ predefTranslationMap.put("~", "_not");
+ predefTranslationMap.put("++", "_plusplus");
+ predefTranslationMap.put("--", "_minusminus");
+ predefTranslationMap.put("!", "_bang");
+ predefTranslationMap.put("*", "_mul");
+ predefTranslationMap.put("/", "_div");
+ predefTranslationMap.put("%", "_mod");
+ predefTranslationMap.put("&", "_and");
+ predefTranslationMap.put("|", "_or");
+ predefTranslationMap.put("^", "_xor");
+ predefTranslationMap.put("<<", "_lshift");
+ predefTranslationMap.put(">>", "_rshift");
+ predefTranslationMap.put("<<<", "_lshiftshift");
+ predefTranslationMap.put(">>>", "_rshiftshift");
+ predefTranslationMap.put("<", "_lt");
+ predefTranslationMap.put(">", "_gt");
+ predefTranslationMap.put("<=", "_lteq");
+ predefTranslationMap.put(">=", "_gteq");
+ predefTranslationMap.put("==", "_eq");
+ predefTranslationMap.put("!=", "_neq");
+ predefTranslationMap.put("&&", "_andand");
+ predefTranslationMap.put("||", "_oror");
}
protected void check() throws Exception {
String[] options = {
"-XDshouldStopPolicy=ATTR",
- "-XDverboseResolution=success,failure,applicable,inapplicable,deferred-inference"
+ "-XDverboseResolution=success,failure,applicable,inapplicable,deferred-inference,predef"
};
AbstractProcessor[] processors = { new ResolveCandidateFinder(), null };
@@ -223,7 +249,8 @@
@Override
void process(Diagnostic<? extends JavaFileObject> diagnostic) {
Element siteSym = getSiteSym(diagnostic);
- if (siteSym.getAnnotation(TraceResolve.class) == null) {
+ if (siteSym.getSimpleName().length() != 0 &&
+ siteSym.getAnnotation(TraceResolve.class) == null) {
return;
}
int candidateIdx = 0;
@@ -307,7 +334,7 @@
if (Arrays.asList(c.applicable()).contains(phase)) { //applicable
if (c.mostSpecific() != mostSpecific) {
- error("Invalid most specific value for method " + methodSym);
+ error("Invalid most specific value for method " + methodSym + " " + new ElementKey(methodSym).key);
}
MethodType mtype = getSig(diagnostic);
if (mtype != null) {
@@ -444,11 +471,21 @@
String computeKey(Element e) {
StringBuilder buf = new StringBuilder();
- while (e != null) {
+ if (predefTranslationMap.containsKey(e.getSimpleName().toString())) {
+ //predef element
+ buf.append("<predef>.");
+ String replacedName = predefTranslationMap.get(e.getSimpleName().toString());
+ buf.append(e.toString().replace(e.getSimpleName().toString(), replacedName));
+ } else if (e.getSimpleName().toString().startsWith("_")) {
+ buf.append("<predef>.");
buf.append(e.toString());
- e = e.getEnclosingElement();
+ } else {
+ while (e != null) {
+ buf.append(e.toString());
+ e = e.getEnclosingElement();
+ }
+ buf.append(jfo.getName());
}
- buf.append(jfo.getName());
return buf.toString();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/resolve/tests/PrimitiveBinopOverload.java Wed May 29 16:59:36 2013 -0700
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+@TraceResolve
+class PrimitiveBinopOverload {
+
+ @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+ int _plus(int x, int y) { return -1; }
+ @Candidate(applicable=Phase.BASIC)
+ long _plus(long x, long y) { return -1; }
+ @Candidate(applicable=Phase.BASIC)
+ float _plus(float x, float y) { return -1; }
+ @Candidate(applicable=Phase.BASIC)
+ double _plus(double x, double y) { return -1; }
+ //not a candidate
+ Object _plus(Object x, Object y) { return -1; }
+
+ @Candidate(applicable= { Phase.BASIC, Phase.BOX }, mostSpecific=true)
+ int _minus(int x, int y) { return -1; }
+ @Candidate(applicable= { Phase.BASIC, Phase.BOX })
+ long _minus(long x, long y) { return -1; }
+ @Candidate(applicable= { Phase.BASIC, Phase.BOX })
+ float _minus(float x, float y) { return -1; }
+ @Candidate(applicable= { Phase.BASIC, Phase.BOX })
+ double _minus(double x, double y) { return -1; }
+
+ @Candidate(applicable= { Phase.BASIC, Phase.BOX }, mostSpecific=true)
+ int _mul(int x, int y) { return -1; }
+ @Candidate(applicable= { Phase.BASIC, Phase.BOX })
+ long _mul(long x, long y) { return -1; }
+ @Candidate(applicable= { Phase.BASIC, Phase.BOX })
+ float _mul(float x, float y) { return -1; }
+ @Candidate(applicable= { Phase.BASIC, Phase.BOX })
+ double _mul(double x, double y) { return -1; }
+
+ @Candidate(applicable= { Phase.BASIC, Phase.BOX }, mostSpecific=true)
+ int _div(int x, int y) { return -1; }
+ @Candidate(applicable= { Phase.BASIC, Phase.BOX })
+ long _div(long x, long y) { return -1; }
+ @Candidate(applicable= { Phase.BASIC, Phase.BOX })
+ float _div(float x, float y) { return -1; }
+ @Candidate(applicable= { Phase.BASIC, Phase.BOX })
+ double _div(double x, double y) { return -1; }
+
+ {
+ int i1 = 1 + 1;
+ int i2 = 5 - new Integer(3);
+ int i3 = new Integer(5) * 3;
+ int i4 = new Integer(6) / new Integer(2);
+ }
+}