# HG changeset patch # User lana # Date 1370327055 25200 # Node ID 2c5a568ee36eb2d9471483b7a310c49ed545db55 # Parent 023e9a614d2651ad945e99a8ef31cc07b3e7a458# Parent 18943a1b7a474c747d486735ecb0f780a753d806 Merge diff -r 023e9a614d26 -r 2c5a568ee36e make/tools/genstubs/GenStubs.java --- a/make/tools/genstubs/GenStubs.java Thu May 30 10:58:32 2013 -0700 +++ b/make/tools/genstubs/GenStubs.java Mon Jun 03 23:24:15 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; } diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/com/sun/tools/classfile/ClassFile.java --- a/src/share/classes/com/sun/tools/classfile/ClassFile.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/com/sun/tools/classfile/ClassFile.java Mon Jun 03 23:24:15 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); diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Jun 03 23:24:15 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 diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/com/sun/tools/javac/comp/Check.java --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Mon Jun 03 23:24:15 2013 -0700 @@ -853,7 +853,8 @@ final List argtrees, List 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 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; diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/com/sun/tools/javac/comp/Lower.java --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Mon Jun 03 23:24:15 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.nil()), names.initCause, @@ -2931,7 +2931,7 @@ } result = make.If(cond, - make_at(detailPos). + make_at(tree). Throw(makeNewClass(syms.assertionErrorType, exnArgs)), null); } else { diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/com/sun/tools/javac/comp/Resolve.java --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Jun 03 23:24:15 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 env, MethodResolutionPhase phase) { + return findMethod(env, site, name, argtypes, typeargtypes, + phase.isBoxingRequired(), + phase.isVarargsRequired(), true); + } + @Override + Symbol access(Env 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 argtypes, List typeargtypes) { - super(name, site, argtypes, typeargtypes, MethodResolutionPhase.VARARITY); + this(name, site, argtypes, typeargtypes, MethodResolutionPhase.VARARITY); + } + + BasicLookupHelper(Name name, Type site, List argtypes, List typeargtypes, MethodResolutionPhase maxPhase) { + super(name, site, argtypes, typeargtypes, maxPhase); } @Override diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/com/sun/tools/javac/comp/TransTypes.java --- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Mon Jun 03 23:24:15 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) { diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/com/sun/tools/javac/parser/JavacParser.java --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Mon Jun 03 23:24:15 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)) { diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/com/sun/tools/javac/tree/JCTree.java --- a/src/share/classes/com/sun/tools/javac/tree/JCTree.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/tree/JCTree.java Mon Jun 03 23:24:15 2013 -0700 @@ -700,7 +700,7 @@ public List getTypeParameters() { return typarams; } - public JCTree getExtendsClause() { return extending; } + public JCExpression getExtendsClause() { return extending; } public List getImplementsClause() { return implementing; } @@ -1175,7 +1175,7 @@ return v.visitTry(this, d); } @Override - public List getResources() { + public List 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 typeargs, JCExpression fn, diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/com/sun/tools/javac/tree/TreeCopier.java --- a/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Mon Jun 03 23:24:15 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); } diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/com/sun/tools/javac/tree/TreeMaker.java --- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Mon Jun 03 23:24:15 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; diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/com/sun/tools/javac/util/Convert.java --- a/src/share/classes/com/sun/tools/javac/util/Convert.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/util/Convert.java Mon Jun 03 23:24:15 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. * + *

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"). + * + *

+ * See also: + *

+ * + * The methods here support modified UTF-8. + * *

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 diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java --- a/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java Mon Jun 03 23:24:15 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. diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/javax/lang/model/AnnotatedConstruct.java --- a/src/share/classes/javax/lang/model/AnnotatedConstruct.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/javax/lang/model/AnnotatedConstruct.java Mon Jun 03 23:24:15 2013 -0700 @@ -39,35 +39,76 @@ * are on a declaration, whereas annotations on a type are on * a specific use of a type name. * - * The terms directly present and present are used + * The terms directly present, present, + * indirectly present, and associated are used * throughout this interface to describe precisely which annotations - * are returned by methods: + * are returned by the methods defined herein. * - *

An annotation A is directly present on a - * construct E if E is annotated, and: + *

In the definitions below, an annotation A has an + * annotation type AT. If AT is a repeatable annotation + * type, the type of the containing annotation is ATC. + * + *

Annotation A is directly present on a construct + * C if either: * *

    * - *
  • for an invocation of {@code getAnnotation(Class)} or - * {@code getAnnotationMirrors()}, E's annotations contain A. + *
  • A is explicitly or implicitly declared as applying to + * the source code representation of C. * - *
  • for an invocation of {@code getAnnotationsByType(Class)}, - * E's annotations either contain A or, if the type of - * A is repeatable, contain exactly one annotation whose value - * element contains A and whose type is the containing - * annotation type of A's type. + *

    Typically, if exactly one annotation of type AT appears in + * the source code of representation of C, then A is + * explicitly declared as applying to C. + * + * If there are multiple annotations of type AT present on + * C, then if AT is repeatable annotation type, an + * annotation of type ATC is implicitly declared on C. + * + *

  • A representation of A appears in the executable output + * for C, such as the {@code RuntimeVisibleAnnotations} or + * {@code RuntimeVisibleParameterAnnotations} attributes of a class + * file. * *
* - *

An annotation A is present on a construct E if either: + *

An annotation A is present on a + * construct C if either: + *

    + * + *
  • A is directly present on C. + * + *
  • No annotation of type AT is directly present on + * C, and C is a class and AT is inheritable + * and A is present on the superclass of C. + * + *
+ * + * An annotation A is indirectly present on a construct + * C if both: * *
    - *
  • A is directly present on E; or * - *
  • A is not directly present on E, and - * E is an element representing a class, and A's type - * is inheritable, and A is present on the element - * representing the superclass of E. + *
  • AT is a repeatable annotation type with a containing + * annotation type ATC. + * + *
  • An annotation of type ATC is directly present on + * C and A is an annotation included in the result of + * calling the {@code value} method of the directly present annotation + * of type ATC. + * + *
+ * + * An annotation A is associated with a construct + * C if either: + * + *
    + * + *
  • A is directly or indirectly present on C. + * + *
  • No annotation of type AT is directly or indirectly + * present on C, and C is a class, and AT is + * inheritable, and A is associated with the superclass of + * C. * *
* @@ -86,9 +127,8 @@ List getAnnotationMirrors(); /** - * Returns this construct's annotation of the - * specified type if such an annotation is present, else {@code - * null}. + * Returns this construct's annotation of the specified type if + * such an annotation is present, else {@code null}. * *

The annotation returned by this method could contain an element * whose value is of type {@code Class}. @@ -118,9 +158,8 @@ * @param 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 getAnnotation(Class annotationType); /** - * Returns annotations that are present on this construct. + * Returns annotations that are associated with this construct. * - * If there are no annotations present on this construct, - * the return value is an array of length 0. + * If there are no annotations associated with this construct, the + * return value is an array of length 0. + * + * The order of annotations which are directly or indirectly + * present on a construct C is computed as if indirectly present + * annotations on C are directly present on C 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 repeatable @@ -172,8 +217,8 @@ * @param 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) diff -r 023e9a614d26 -r 2c5a568ee36e src/share/classes/javax/lang/model/util/Elements.java --- a/src/share/classes/javax/lang/model/util/Elements.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/classes/javax/lang/model/util/Elements.java Mon Jun 03 23:24:15 2013 -0700 @@ -143,12 +143,13 @@ List getAllMembers(TypeElement type); /** - * Returns all annotations of an element, whether - * inherited or directly present. + * Returns all annotations present 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 getAllAnnotationMirrors(Element e); diff -r 023e9a614d26 -r 2c5a568ee36e src/share/sample/language/model/CoreReflectionFactory.java --- a/src/share/sample/language/model/CoreReflectionFactory.java Thu May 30 10:58:32 2013 -0700 +++ b/src/share/sample/language/model/CoreReflectionFactory.java Mon Jun 03 23:24:15 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() { diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/doclint/RunTest.java --- a/test/tools/doclint/RunTest.java Thu May 30 10:58:32 2013 -0700 +++ b/test/tools/doclint/RunTest.java Mon Jun 03 23:24:15 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 */ diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/5045412/Bar.java --- a/test/tools/javac/5045412/Bar.java Thu May 30 10:58:32 2013 -0700 +++ b/test/tools/javac/5045412/Bar.java Mon Jun 03 23:24:15 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 */ diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/5045412/Foo.java --- a/test/tools/javac/5045412/Foo.java Thu May 30 10:58:32 2013 -0700 +++ b/test/tools/javac/5045412/Foo.java Mon Jun 03 23:24:15 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 */ diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/HiddenAbstractMethod/Test --- a/test/tools/javac/HiddenAbstractMethod/Test Thu May 30 10:58:32 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 - */ diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/HiddenAbstractMethod/Test.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/HiddenAbstractMethod/Test.java Mon Jun 03 23:24:15 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 + */ diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/NonAmbiguousField/Test --- a/test/tools/javac/NonAmbiguousField/Test Thu May 30 10:58:32 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 - */ diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/NonAmbiguousField/Test.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/NonAmbiguousField/Test.java Mon Jun 03 23:24:15 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 + */ diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/NonAmbiguousField/two/Child2.java --- a/test/tools/javac/NonAmbiguousField/two/Child2.java Thu May 30 10:58:32 2013 -0700 +++ b/test/tools/javac/NonAmbiguousField/two/Child2.java Mon Jun 03 23:24:15 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); } } diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/T6970173/DebugPointerAtBadPositionTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/T6970173/DebugPointerAtBadPositionTest.java Mon Jun 03 23:24:15 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); + } + +} diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/T7053059/VerifyErrorWithDoubleAssignmentTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/T7053059/VerifyErrorWithDoubleAssignmentTest.java Mon Jun 03 23:24:15 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 getD() { + return null; + } + } + + static class B extends A { + Integer y; + B() { + y = d = getD(); + } + } + + public static void main(String[] args) { + new B(); + } +} diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/annotations/typeAnnotations/8013180/QualifiedName.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/annotations/typeAnnotations/8013180/QualifiedName.java Mon Jun 03 23:24:15 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 { } +} diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/diags/Example.java --- a/test/tools/javac/diags/Example.java Thu May 30 10:58:32 2013 -0700 +++ b/test/tools/javac/diags/Example.java Mon Jun 03 23:24:15 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 actualKeys; private Set 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; } diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/lambda/MethodReferenceParserTest.java --- a/test/tools/javac/lambda/MethodReferenceParserTest.java Thu May 30 10:58:32 2013 -0700 +++ b/test/tools/javac/lambda/MethodReferenceParserTest.java Mon Jun 03 23:24:15 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 diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/lambda/TargetType73.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/TargetType73.java Mon Jun 03 23:24:15 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 { + Y m(X x); + } + + static void test() { + m(TargetType73::g); + } + + public static List g(T... a) { + return null; + } + + public static void m(Function zipper) { } +} diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/lambda/TestInvokeDynamic.java --- a/test/tools/javac/lambda/TestInvokeDynamic.java Thu May 30 10:58:32 2013 -0700 +++ b/test/tools/javac/lambda/TestInvokeDynamic.java Mon Jun 03 23:24:15 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 diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/mandatoryWarnings/deprecated/Test.java --- a/test/tools/javac/mandatoryWarnings/deprecated/Test.java Thu May 30 10:58:32 2013 -0700 +++ b/test/tools/javac/mandatoryWarnings/deprecated/Test.java Mon Jun 03 23:24:15 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 */ diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/mandatoryWarnings/unchecked/Test.java --- a/test/tools/javac/mandatoryWarnings/unchecked/Test.java Thu May 30 10:58:32 2013 -0700 +++ b/test/tools/javac/mandatoryWarnings/unchecked/Test.java Mon Jun 03 23:24:15 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 */ diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/parser/8014643/T8014643.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/parser/8014643/T8014643.java Mon Jun 03 23:24:15 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); } + } +} diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/policy/test3/Test.java --- a/test/tools/javac/policy/test3/Test.java Thu May 30 10:58:32 2013 -0700 +++ b/test/tools/javac/policy/test3/Test.java Mon Jun 03 23:24:15 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 { -} -*/ - diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/resolve/ResolveHarness.java --- a/test/tools/javac/resolve/ResolveHarness.java Thu May 30 10:58:32 2013 -0700 +++ b/test/tools/javac/resolve/ResolveHarness.java Mon Jun 03 23:24:15 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 declaredKeys = new HashSet<>(); List> diags = new ArrayList<>(); List seenCandidates = new ArrayList<>(); + Map 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 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("."); + String replacedName = predefTranslationMap.get(e.getSimpleName().toString()); + buf.append(e.toString().replace(e.getSimpleName().toString(), replacedName)); + } else if (e.getSimpleName().toString().startsWith("_")) { + buf.append("."); 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(); } diff -r 023e9a614d26 -r 2c5a568ee36e test/tools/javac/resolve/tests/PrimitiveBinopOverload.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/resolve/tests/PrimitiveBinopOverload.java Mon Jun 03 23:24:15 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); + } +}