Mon, 03 Jun 2013 23:24:15 -0700
Merge
test/tools/javac/HiddenAbstractMethod/Test | file | annotate | diff | comparison | revisions | |
test/tools/javac/NonAmbiguousField/Test | file | annotate | diff | comparison | revisions |
1.1 --- a/make/tools/genstubs/GenStubs.java Thu May 30 10:58:32 2013 -0700 1.2 +++ b/make/tools/genstubs/GenStubs.java Mon Jun 03 23:24:15 2013 -0700 1.3 @@ -230,9 +230,9 @@ 1.4 tree.typarams = translateTypeParams(tree.typarams); 1.5 tree.params = translateVarDefs(tree.params); 1.6 tree.thrown = translate(tree.thrown); 1.7 - if (tree.restype != null && tree.body != null) { 1.8 + if (tree.body != null) { 1.9 if ((currClassMods & Flags.INTERFACE) != 0) { 1.10 - tree.mods.flags &= ~Flags.DEFAULT; 1.11 + tree.mods.flags &= ~(Flags.DEFAULT | Flags.STATIC); 1.12 } else { 1.13 tree.mods.flags |= Flags.NATIVE; 1.14 }
2.1 --- a/src/share/classes/com/sun/tools/classfile/ClassFile.java Thu May 30 10:58:32 2013 -0700 2.2 +++ b/src/share/classes/com/sun/tools/classfile/ClassFile.java Mon Jun 03 23:24:15 2013 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -29,6 +29,7 @@ 2.11 import java.io.FileInputStream; 2.12 import java.io.IOException; 2.13 import java.io.InputStream; 2.14 +import java.nio.file.Path; 2.15 2.16 import static com.sun.tools.classfile.AccessFlags.*; 2.17 2.18 @@ -46,6 +47,11 @@ 2.19 return read(file, new Attribute.Factory()); 2.20 } 2.21 2.22 + public static ClassFile read(Path path) 2.23 + throws IOException, ConstantPoolException { 2.24 + return read(path.toFile(), new Attribute.Factory()); 2.25 + } 2.26 + 2.27 public static ClassFile read(File file, Attribute.Factory attributeFactory) 2.28 throws IOException, ConstantPoolException { 2.29 FileInputStream in = new FileInputStream(file);
3.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu May 30 10:58:32 2013 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Jun 03 23:24:15 2013 -0700 3.3 @@ -3732,7 +3732,7 @@ 3.4 noteWarner); 3.5 3.6 return chk.checkMethod(owntype, sym, env, argtrees, argtypes, env.info.lastResolveVarargs(), 3.7 - noteWarner.hasNonSilentLint(LintCategory.UNCHECKED)); 3.8 + noteWarner.hasNonSilentLint(LintCategory.UNCHECKED), resultInfo.checkContext.inferenceContext()); 3.9 } catch (Infer.InferenceException ex) { 3.10 //invalid target type - propagate exception outwards or report error 3.11 //depending on the current check context
4.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Thu May 30 10:58:32 2013 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Mon Jun 03 23:24:15 2013 -0700 4.3 @@ -853,7 +853,8 @@ 4.4 final List<JCExpression> argtrees, 4.5 List<Type> argtypes, 4.6 boolean useVarargs, 4.7 - boolean unchecked) { 4.8 + boolean unchecked, 4.9 + InferenceContext inferenceContext) { 4.10 // System.out.println("call : " + env.tree); 4.11 // System.out.println("method : " + owntype); 4.12 // System.out.println("actuals: " + argtypes); 4.13 @@ -917,7 +918,7 @@ 4.14 argtype); 4.15 } 4.16 if (!((MethodSymbol)sym.baseSymbol()).isSignaturePolymorphic(types)) { 4.17 - TreeInfo.setVarargsElement(env.tree, types.elemtype(argtype)); 4.18 + setVarargsElement(env, types.elemtype(argtype), inferenceContext); 4.19 } 4.20 } 4.21 PolyKind pkind = (sym.type.hasTag(FORALL) && 4.22 @@ -927,6 +928,17 @@ 4.23 return owntype; 4.24 } 4.25 //where 4.26 + private void setVarargsElement(final Env<AttrContext> env, final Type elemtype, InferenceContext inferenceContext) { 4.27 + if (inferenceContext.free(elemtype)) { 4.28 + inferenceContext.addFreeTypeListener(List.of(elemtype), new FreeTypeListener() { 4.29 + public void typesInferred(InferenceContext inferenceContext) { 4.30 + setVarargsElement(env, inferenceContext.asInstType(elemtype), inferenceContext); 4.31 + } 4.32 + }); 4.33 + } 4.34 + TreeInfo.setVarargsElement(env.tree, elemtype); 4.35 + } 4.36 + 4.37 private void assertConvertible(JCTree tree, Type actual, Type formal, Warner warn) { 4.38 if (types.isConvertible(actual, formal, warn)) 4.39 return;
5.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu May 30 10:58:32 2013 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Mon Jun 03 23:24:15 2013 -0700 5.3 @@ -2002,7 +2002,7 @@ 5.4 JCStatement rethrow; 5.5 if (target.hasInitCause()) { 5.6 // rethrow = "throw new NoClassDefFoundError().initCause(e); 5.7 - JCTree throwExpr = 5.8 + JCExpression throwExpr = 5.9 makeCall(makeNewClass(syms.noClassDefFoundErrorType, 5.10 List.<JCExpression>nil()), 5.11 names.initCause, 5.12 @@ -2931,7 +2931,7 @@ 5.13 } 5.14 result = 5.15 make.If(cond, 5.16 - make_at(detailPos). 5.17 + make_at(tree). 5.18 Throw(makeNewClass(syms.assertionErrorType, exnArgs)), 5.19 null); 5.20 } else {
6.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu May 30 10:58:32 2013 -0700 6.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Jun 03 23:24:15 2013 -0700 6.3 @@ -1343,7 +1343,7 @@ 6.4 try { 6.5 Type mt = rawInstantiate(env, site, sym, null, argtypes, typeargtypes, 6.6 allowBoxing, useVarargs, types.noWarnings); 6.7 - if (!operator) 6.8 + if (!operator || verboseResolutionMode.contains(VerboseResolutionMode.PREDEF)) 6.9 currentResolutionContext.addApplicableCandidate(sym, mt); 6.10 } catch (InapplicableMethodException ex) { 6.11 if (!operator) 6.12 @@ -2500,17 +2500,21 @@ 6.13 try { 6.14 currentResolutionContext = new MethodResolutionContext(); 6.15 Name name = treeinfo.operatorName(optag); 6.16 - env.info.pendingResolutionPhase = currentResolutionContext.step = BASIC; 6.17 - Symbol sym = findMethod(env, syms.predefClass.type, name, argtypes, 6.18 - null, false, false, true); 6.19 - if (boxingEnabled && sym.kind >= WRONG_MTHS) 6.20 - env.info.pendingResolutionPhase = currentResolutionContext.step = BOX; 6.21 - sym = findMethod(env, syms.predefClass.type, name, argtypes, 6.22 - null, true, false, true); 6.23 - return accessMethod(sym, pos, env.enclClass.sym.type, name, 6.24 + return lookupMethod(env, pos, syms.predefClass, currentResolutionContext, 6.25 + new BasicLookupHelper(name, syms.predefClass.type, argtypes, null, BOX) { 6.26 + @Override 6.27 + Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) { 6.28 + return findMethod(env, site, name, argtypes, typeargtypes, 6.29 + phase.isBoxingRequired(), 6.30 + phase.isVarargsRequired(), true); 6.31 + } 6.32 + @Override 6.33 + Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) { 6.34 + return accessMethod(sym, pos, env.enclClass.sym.type, name, 6.35 false, argtypes, null); 6.36 - } 6.37 - finally { 6.38 + } 6.39 + }); 6.40 + } finally { 6.41 currentResolutionContext = prevResolutionContext; 6.42 } 6.43 } 6.44 @@ -2673,7 +2677,11 @@ 6.45 abstract class BasicLookupHelper extends LookupHelper { 6.46 6.47 BasicLookupHelper(Name name, Type site, List<Type> argtypes, List<Type> typeargtypes) { 6.48 - super(name, site, argtypes, typeargtypes, MethodResolutionPhase.VARARITY); 6.49 + this(name, site, argtypes, typeargtypes, MethodResolutionPhase.VARARITY); 6.50 + } 6.51 + 6.52 + BasicLookupHelper(Name name, Type site, List<Type> argtypes, List<Type> typeargtypes, MethodResolutionPhase maxPhase) { 6.53 + super(name, site, argtypes, typeargtypes, maxPhase); 6.54 } 6.55 6.56 @Override
7.1 --- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Thu May 30 10:58:32 2013 -0700 7.2 +++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Mon Jun 03 23:24:15 2013 -0700 7.3 @@ -172,10 +172,13 @@ 7.4 JCExpression retype(JCExpression tree, Type erasedType, Type target) { 7.5 // System.err.println("retype " + tree + " to " + erasedType);//DEBUG 7.6 if (!erasedType.isPrimitive()) { 7.7 - if (target != null && target.isPrimitive()) 7.8 + if (target != null && target.isPrimitive()) { 7.9 target = erasure(tree.type); 7.10 + } 7.11 tree.type = erasedType; 7.12 - if (target != null) return coerce(tree, target); 7.13 + if (target != null) { 7.14 + return coerce(tree, target); 7.15 + } 7.16 } 7.17 return tree; 7.18 } 7.19 @@ -686,8 +689,8 @@ 7.20 public void visitAssign(JCAssign tree) { 7.21 tree.lhs = translate(tree.lhs, null); 7.22 tree.rhs = translate(tree.rhs, erasure(tree.lhs.type)); 7.23 - tree.type = erasure(tree.type); 7.24 - result = tree; 7.25 + tree.type = erasure(tree.lhs.type); 7.26 + result = retype(tree, tree.type, pt); 7.27 } 7.28 7.29 public void visitAssignop(JCAssignOp tree) {
8.1 --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Thu May 30 10:58:32 2013 -0700 8.2 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Mon Jun 03 23:24:15 2013 -0700 8.3 @@ -1535,11 +1535,18 @@ 8.4 outer: for (int lookahead = 0 ; ; lookahead++) { 8.5 TokenKind tk = S.token(lookahead).kind; 8.6 switch (tk) { 8.7 - case EXTENDS: case SUPER: case COMMA: 8.8 + case COMMA: 8.9 type = true; 8.10 - case QUES: case DOT: case AMP: 8.11 + case EXTENDS: case SUPER: case DOT: case AMP: 8.12 //skip 8.13 break; 8.14 + case QUES: 8.15 + if (peekToken(lookahead, EXTENDS) || 8.16 + peekToken(lookahead, SUPER)) { 8.17 + //wildcards 8.18 + type = true; 8.19 + } 8.20 + break; 8.21 case BYTE: case SHORT: case INT: case LONG: case FLOAT: 8.22 case DOUBLE: case BOOLEAN: case CHAR: 8.23 if (peekToken(lookahead, RPAREN)) {
9.1 --- a/src/share/classes/com/sun/tools/javac/tree/JCTree.java Thu May 30 10:58:32 2013 -0700 9.2 +++ b/src/share/classes/com/sun/tools/javac/tree/JCTree.java Mon Jun 03 23:24:15 2013 -0700 9.3 @@ -700,7 +700,7 @@ 9.4 public List<JCTypeParameter> getTypeParameters() { 9.5 return typarams; 9.6 } 9.7 - public JCTree getExtendsClause() { return extending; } 9.8 + public JCExpression getExtendsClause() { return extending; } 9.9 public List<JCExpression> getImplementsClause() { 9.10 return implementing; 9.11 } 9.12 @@ -1175,7 +1175,7 @@ 9.13 return v.visitTry(this, d); 9.14 } 9.15 @Override 9.16 - public List<? extends JCTree> getResources() { 9.17 + public List<JCTree> getResources() { 9.18 return resources; 9.19 } 9.20 @Override 9.21 @@ -1392,8 +1392,8 @@ 9.22 */ 9.23 public static class JCThrow extends JCStatement implements ThrowTree { 9.24 public JCExpression expr; 9.25 - protected JCThrow(JCTree expr) { 9.26 - this.expr = (JCExpression)expr; 9.27 + protected JCThrow(JCExpression expr) { 9.28 + this.expr = expr; 9.29 } 9.30 @Override 9.31 public void accept(Visitor v) { v.visitThrow(this); } 9.32 @@ -2466,7 +2466,7 @@ 9.33 JCBreak Break(Name label); 9.34 JCContinue Continue(Name label); 9.35 JCReturn Return(JCExpression expr); 9.36 - JCThrow Throw(JCTree expr); 9.37 + JCThrow Throw(JCExpression expr); 9.38 JCAssert Assert(JCExpression cond, JCExpression detail); 9.39 JCMethodInvocation Apply(List<JCExpression> typeargs, 9.40 JCExpression fn,
10.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Thu May 30 10:58:32 2013 -0700 10.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Mon Jun 03 23:24:15 2013 -0700 10.3 @@ -340,7 +340,7 @@ 10.4 10.5 public JCTree visitThrow(ThrowTree node, P p) { 10.6 JCThrow t = (JCThrow) node; 10.7 - JCTree expr = copy(t.expr, p); 10.8 + JCExpression expr = copy(t.expr, p); 10.9 return M.at(t.pos).Throw(expr); 10.10 } 10.11
11.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Thu May 30 10:58:32 2013 -0700 11.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Mon Jun 03 23:24:15 2013 -0700 11.3 @@ -332,7 +332,7 @@ 11.4 return tree; 11.5 } 11.6 11.7 - public JCThrow Throw(JCTree expr) { 11.8 + public JCThrow Throw(JCExpression expr) { 11.9 JCThrow tree = new JCThrow(expr); 11.10 tree.pos = pos; 11.11 return tree;
12.1 --- a/src/share/classes/com/sun/tools/javac/util/Convert.java Thu May 30 10:58:32 2013 -0700 12.2 +++ b/src/share/classes/com/sun/tools/javac/util/Convert.java Mon Jun 03 23:24:15 2013 -0700 12.3 @@ -1,5 +1,5 @@ 12.4 /* 12.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 12.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 12.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.8 * 12.9 * This code is free software; you can redistribute it and/or modify it 12.10 @@ -28,6 +28,24 @@ 12.11 /** Utility class for static conversion methods between numbers 12.12 * and strings in various formats. 12.13 * 12.14 + * <p>Note regarding UTF-8. 12.15 + * The JVMS defines its own version of the UTF-8 format so that it 12.16 + * contains no zero bytes (modified UTF-8). This is not actually the same 12.17 + * as Charset.forName("UTF-8"). 12.18 + * 12.19 + * <p> 12.20 + * See also: 12.21 + * <ul> 12.22 + * <li><a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.4.7"> 12.23 + * JVMS 4.4.7 </a></li> 12.24 + * <li><a href="http://docs.oracle.com/javase/7/docs/api/java/io/DataInput.html#modified-utf-8"> 12.25 + java.io.DataInput: Modified UTF-8 </a></li> 12.26 + <li><a href="https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8"> 12.27 + Modified UTF-8 (wikipedia) </a></li> 12.28 + * </ul> 12.29 + * 12.30 + * The methods here support modified UTF-8. 12.31 + * 12.32 * <p><b>This is NOT part of any supported API. 12.33 * If you write code that depends on this, you do so at your own risk. 12.34 * This code and its internal interfaces are subject to change or
13.1 --- a/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java Thu May 30 10:58:32 2013 -0700 13.2 +++ b/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java Mon Jun 03 23:24:15 2013 -0700 13.3 @@ -1,5 +1,5 @@ 13.4 /* 13.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 13.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 13.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.8 * 13.9 * This code is free software; you can redistribute it and/or modify it 13.10 @@ -125,8 +125,6 @@ 13.11 System.arraycopy(cs, start, bytes, 0, len); 13.12 n = new NameImpl(this, bytes, index++); 13.13 13.14 - System.arraycopy(cs, start, n.bytes, 0, len); 13.15 - 13.16 HashEntry newEntry = new HashEntry(n); 13.17 13.18 if (previousNonNullTableEntry == null) { // We are not the first name with that hashCode.
14.1 --- a/src/share/classes/javax/lang/model/AnnotatedConstruct.java Thu May 30 10:58:32 2013 -0700 14.2 +++ b/src/share/classes/javax/lang/model/AnnotatedConstruct.java Mon Jun 03 23:24:15 2013 -0700 14.3 @@ -39,35 +39,76 @@ 14.4 * are on a <em>declaration</em>, whereas annotations on a type are on 14.5 * a specific <em>use</em> of a type name. 14.6 * 14.7 - * The terms <em>directly present</em> and <em>present</em> are used 14.8 + * The terms <em>directly present</em>, <em>present</em>, 14.9 + * <em>indirectly present</em>, and <em>associated </em> are used 14.10 * throughout this interface to describe precisely which annotations 14.11 - * are returned by methods: 14.12 + * are returned by the methods defined herein. 14.13 * 14.14 - * <p>An annotation <i>A</i> is <em>directly present</em> on a 14.15 - * construct <i>E</i> if <i>E</i> is annotated, and: 14.16 + * <p>In the definitions below, an annotation <i>A</i> has an 14.17 + * annotation type <i>AT</i>. If <i>AT</i> is a repeatable annotation 14.18 + * type, the type of the containing annotation is <i>ATC</i>. 14.19 + * 14.20 + * <p>Annotation <i>A</i> is <em>directly present</em> on a construct 14.21 + * <i>C</i> if either: 14.22 * 14.23 * <ul> 14.24 * 14.25 - * <li> for an invocation of {@code getAnnotation(Class<T>)} or 14.26 - * {@code getAnnotationMirrors()}, <i>E</i>'s annotations contain <i>A</i>. 14.27 + * <li><i>A</i> is explicitly or implicitly declared as applying to 14.28 + * the source code representation of <i>C</i>. 14.29 * 14.30 - * <li> for an invocation of {@code getAnnotationsByType(Class<T>)}, 14.31 - * <i>E</i>'s annotations either contain <i>A</i> or, if the type of 14.32 - * <i>A</i> is repeatable, contain exactly one annotation whose value 14.33 - * element contains <i>A</i> and whose type is the containing 14.34 - * annotation type of <i>A</i>'s type. 14.35 + * <p>Typically, if exactly one annotation of type <i>AT</i> appears in 14.36 + * the source code of representation of <i>C</i>, then <i>A</i> is 14.37 + * explicitly declared as applying to <i>C</i>. 14.38 + * 14.39 + * If there are multiple annotations of type <i>AT</i> present on 14.40 + * <i>C</i>, then if <i>AT</i> is repeatable annotation type, an 14.41 + * annotation of type <i>ATC</i> is implicitly declared on <i>C</i>. 14.42 + * 14.43 + * <li> A representation of <i>A</i> appears in the executable output 14.44 + * for <i>C</i>, such as the {@code RuntimeVisibleAnnotations} or 14.45 + * {@code RuntimeVisibleParameterAnnotations} attributes of a class 14.46 + * file. 14.47 * 14.48 * </ul> 14.49 * 14.50 - * <p>An annotation A is <em>present</em> on a construct E if either: 14.51 + * <p>An annotation <i>A</i> is <em>present</em> on a 14.52 + * construct <i>C</i> if either: 14.53 + * <ul> 14.54 + * 14.55 + * <li><i>A</i> is directly present on <i>C</i>. 14.56 + * 14.57 + * <li>No annotation of type <i>AT</i> is directly present on 14.58 + * <i>C</i>, and <i>C</i> is a class and <i>AT</i> is inheritable 14.59 + * and <i>A</i> is present on the superclass of <i>C</i>. 14.60 + * 14.61 + * </ul> 14.62 + * 14.63 + * An annotation <i>A</i> is <em>indirectly present</em> on a construct 14.64 + * <i>C</i> if both: 14.65 * 14.66 * <ul> 14.67 - * <li> <i>A</i> is <em>directly present</em> on <i>E</i>; or 14.68 * 14.69 - * <li> <i>A</i> is not <em>directly present</em> on <i>E</i>, and 14.70 - * <i>E</i> is an element representing a class, and <i>A</i>'s type 14.71 - * is inheritable, and <i>A</i> is <em>present</em> on the element 14.72 - * representing the superclass of <i>E</i>. 14.73 + * <li><i>AT</i> is a repeatable annotation type with a containing 14.74 + * annotation type <i>ATC</i>. 14.75 + * 14.76 + * <li>An annotation of type <i>ATC</i> is directly present on 14.77 + * <i>C</i> and <i>A</i> is an annotation included in the result of 14.78 + * calling the {@code value} method of the directly present annotation 14.79 + * of type <i>ATC</i>. 14.80 + * 14.81 + * </ul> 14.82 + * 14.83 + * An annotation <i>A</i> is <em>associated</em> with a construct 14.84 + * <i>C</i> if either: 14.85 + * 14.86 + * <ul> 14.87 + * 14.88 + * <li> <i>A</i> is directly or indirectly present on <i>C</i>. 14.89 + * 14.90 + * <li> No annotation of type <i>AT</i> is directly or indirectly 14.91 + * present on <i>C</i>, and <i>C</i> is a class, and <i>AT</i> is 14.92 + * inheritable, and <i>A</i> is associated with the superclass of 14.93 + * <i>C</i>. 14.94 * 14.95 * </ul> 14.96 * 14.97 @@ -86,9 +127,8 @@ 14.98 List<? extends AnnotationMirror> getAnnotationMirrors(); 14.99 14.100 /** 14.101 - * Returns this construct's annotation of the 14.102 - * specified type if such an annotation is <em>present</em>, else {@code 14.103 - * null}. 14.104 + * Returns this construct's annotation of the specified type if 14.105 + * such an annotation is <em>present</em>, else {@code null}. 14.106 * 14.107 * <p> The annotation returned by this method could contain an element 14.108 * whose value is of type {@code Class}. 14.109 @@ -118,9 +158,8 @@ 14.110 * @param <A> the annotation type 14.111 * @param annotationType the {@code Class} object corresponding to 14.112 * the annotation type 14.113 - * @return this element's or type use's annotation for the 14.114 - * specified annotation type if present on this element, else 14.115 - * {@code null} 14.116 + * @return this construct's annotation for the specified 14.117 + * annotation type if present, else {@code null} 14.118 * 14.119 * @see #getAnnotationMirrors() 14.120 * @see java.lang.reflect.AnnotatedElement#getAnnotation 14.121 @@ -134,10 +173,16 @@ 14.122 <A extends Annotation> A getAnnotation(Class<A> annotationType); 14.123 14.124 /** 14.125 - * Returns annotations that are <em>present</em> on this construct. 14.126 + * Returns annotations that are <em>associated</em> with this construct. 14.127 * 14.128 - * If there are no annotations <em>present</em> on this construct, 14.129 - * the return value is an array of length 0. 14.130 + * If there are no annotations associated with this construct, the 14.131 + * return value is an array of length 0. 14.132 + * 14.133 + * The order of annotations which are directly or indirectly 14.134 + * present on a construct <i>C</i> is computed as if indirectly present 14.135 + * annotations on <i>C</i> are directly present on <i>C</i> in place of their 14.136 + * container annotation, in the order in which they appear in the 14.137 + * value element of the container annotation. 14.138 * 14.139 * The difference between this method and {@link #getAnnotation(Class)} 14.140 * is that this method detects if its argument is a <em>repeatable 14.141 @@ -172,8 +217,8 @@ 14.142 * @param <A> the annotation type 14.143 * @param annotationType the {@code Class} object corresponding to 14.144 * the annotation type 14.145 - * @return this element's annotations for the specified annotation 14.146 - * type if present on this element, else an empty array 14.147 + * @return this construct's annotations for the specified annotation 14.148 + * type if present on this construct, else an empty array 14.149 * 14.150 * @see #getAnnotationMirrors() 14.151 * @see #getAnnotation(java.lang.Class)
15.1 --- a/src/share/classes/javax/lang/model/util/Elements.java Thu May 30 10:58:32 2013 -0700 15.2 +++ b/src/share/classes/javax/lang/model/util/Elements.java Mon Jun 03 23:24:15 2013 -0700 15.3 @@ -143,12 +143,13 @@ 15.4 List<? extends Element> getAllMembers(TypeElement type); 15.5 15.6 /** 15.7 - * Returns all annotations of an element, whether 15.8 - * inherited or directly present. 15.9 + * Returns all annotations <i>present</i> on an element, whether 15.10 + * directly present or present via inheritance. 15.11 * 15.12 * @param e the element being examined 15.13 * @return all annotations of the element 15.14 * @see Element#getAnnotationMirrors 15.15 + * @see javax.lang.model.AnnotatedConstruct 15.16 */ 15.17 List<? extends AnnotationMirror> getAllAnnotationMirrors(Element e); 15.18
16.1 --- a/src/share/sample/language/model/CoreReflectionFactory.java Thu May 30 10:58:32 2013 -0700 16.2 +++ b/src/share/sample/language/model/CoreReflectionFactory.java Mon Jun 03 23:24:15 2013 -0700 16.3 @@ -439,15 +439,11 @@ 16.4 ReflectionElement getGenericElement(); 16.5 16.6 // Functionality specific to the specialization 16.7 - 16.8 - // Conceptually should have an override for getSource 16.9 - // returning GenericDeclaration, but GenericDeclaration 16.10 - // doesn't currently implement AnnotatedElement. 16.11 -// /** 16.12 -// * {@inheritDoc} 16.13 -// */ 16.14 -// @Override 16.15 -// java.lang.reflect.GenericDeclaration getSource(); 16.16 + /** 16.17 + * {@inheritDoc} 16.18 + */ 16.19 + @Override 16.20 + java.lang.reflect.TypeVariable<?> getSource(); 16.21 } 16.22 16.23 /** 16.24 @@ -1296,8 +1292,8 @@ 16.25 } 16.26 16.27 @Override 16.28 - public AnnotatedElement getSource() { 16.29 - return (AnnotatedElement)source; 16.30 + public java.lang.reflect.TypeVariable<?> getSource() { 16.31 + return sourceTypeVar; 16.32 } 16.33 16.34 protected java.lang.reflect.TypeVariable<?> getSourceTypeVar() {
17.1 --- a/test/tools/doclint/RunTest.java Thu May 30 10:58:32 2013 -0700 17.2 +++ b/test/tools/doclint/RunTest.java Mon Jun 03 23:24:15 2013 -0700 17.3 @@ -1,5 +1,5 @@ 17.4 /* 17.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 17.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 17.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.8 * 17.9 * This code is free software; you can redistribute it and/or modify it 17.10 @@ -22,20 +22,13 @@ 17.11 */ 17.12 17.13 /* @test 17.14 - * @bug 8004832 17.15 + * @bug 8004832 8000103 17.16 * @summary Add new doclint package 17.17 - * @bug 8000103 17.18 * @summary Create doclint utility 17.19 */ 17.20 17.21 -import com.sun.tools.doclint.DocLint; 17.22 -import com.sun.tools.doclint.DocLint.BadArgs; 17.23 -import java.io.ByteArrayOutputStream; 17.24 import java.io.File; 17.25 -import java.io.FilterOutputStream; 17.26 import java.io.IOException; 17.27 -import java.io.OutputStream; 17.28 -import java.io.PrintStream; 17.29 import java.io.PrintWriter; 17.30 import java.io.StringWriter; 17.31 import java.lang.annotation.Annotation; 17.32 @@ -44,6 +37,9 @@ 17.33 import java.lang.reflect.InvocationTargetException; 17.34 import java.lang.reflect.Method; 17.35 17.36 +import com.sun.tools.doclint.DocLint; 17.37 +import com.sun.tools.doclint.DocLint.BadArgs; 17.38 + 17.39 /** javadoc error on toplevel: a & b. */ 17.40 public class RunTest { 17.41 /** javadoc error on member: a < b */
18.1 --- a/test/tools/javac/5045412/Bar.java Thu May 30 10:58:32 2013 -0700 18.2 +++ b/test/tools/javac/5045412/Bar.java Mon Jun 03 23:24:15 2013 -0700 18.3 @@ -1,5 +1,5 @@ 18.4 /* 18.5 - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. 18.6 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 * 18.9 * This code is free software; you can redistribute it and/or modify it 18.10 @@ -24,12 +24,6 @@ 18.11 /** 18.12 * @test 18.13 * @bug 5045412 6627366 18.14 - * @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Bar.java 18.15 - */ 18.16 - 18.17 -/** 18.18 - * @test 18.19 - * @bug 5045412 6627366 18.20 * @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Bar.java Foo.java 18.21 */ 18.22
19.1 --- a/test/tools/javac/5045412/Foo.java Thu May 30 10:58:32 2013 -0700 19.2 +++ b/test/tools/javac/5045412/Foo.java Mon Jun 03 23:24:15 2013 -0700 19.3 @@ -1,5 +1,5 @@ 19.4 /* 19.5 - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. 19.6 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 19.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.8 * 19.9 * This code is free software; you can redistribute it and/or modify it 19.10 @@ -25,11 +25,6 @@ 19.11 * @test 19.12 * @bug 5045412 6627366 19.13 * @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Foo.java 19.14 - */ 19.15 - 19.16 -/** 19.17 - * @test 19.18 - * @bug 5045412 6627366 19.19 * @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Foo.java Bar.java 19.20 */ 19.21
20.1 --- a/test/tools/javac/HiddenAbstractMethod/Test Thu May 30 10:58:32 2013 -0700 20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 20.3 @@ -1,12 +0,0 @@ 20.4 -/* 20.5 - * @test 20.6 - * @bug 1240831 20.7 - * @summary Certain classes should have been reported as abstract, but 20.8 - * the compiler failed to detect this. This comes up when a 20.9 - * subclass declares a method with the same name as an 20.10 - * unimplemented, unaccessible method in a superclass. Even though 20.11 - * the method has the same name, it does not override. 20.12 - * @author turnidge 20.13 - * 20.14 - * @compile/fail -nowrite one/Parent.java two/Child.java 20.15 - */
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/test/tools/javac/HiddenAbstractMethod/Test.java Mon Jun 03 23:24:15 2013 -0700 21.3 @@ -0,0 +1,12 @@ 21.4 +/* 21.5 + * @test 21.6 + * @bug 1240831 21.7 + * @summary Certain classes should have been reported as abstract, but 21.8 + * the compiler failed to detect this. This comes up when a 21.9 + * subclass declares a method with the same name as an 21.10 + * unimplemented, unaccessible method in a superclass. Even though 21.11 + * the method has the same name, it does not override. 21.12 + * @author turnidge 21.13 + * 21.14 + * @compile/fail one/Parent.java two/Child.java 21.15 + */
22.1 --- a/test/tools/javac/NonAmbiguousField/Test Thu May 30 10:58:32 2013 -0700 22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 22.3 @@ -1,10 +0,0 @@ 22.4 -/* 22.5 - * @test 22.6 - * @bug 4053724 22.7 - * @summary Certain non-ambiguous field references were reported by the 22.8 - * compiler as ambigous. 22.9 - * @author turnidge 22.10 - * 22.11 - * @compile -nowrite one/Parent.java two/Child.java 22.12 - * @compile -nowrite one/Parent2.java two/Child2.java 22.13 - */
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/test/tools/javac/NonAmbiguousField/Test.java Mon Jun 03 23:24:15 2013 -0700 23.3 @@ -0,0 +1,10 @@ 23.4 +/* 23.5 + * @test 23.6 + * @bug 4053724 23.7 + * @summary Certain non-ambiguous field references were reported by the 23.8 + * compiler as ambigous. 23.9 + * @author turnidge 23.10 + * 23.11 + * @compile one/Parent.java two/Child.java 23.12 + * @compile/fail one/Parent2.java two/Child2.java 23.13 + */
24.1 --- a/test/tools/javac/NonAmbiguousField/two/Child2.java Thu May 30 10:58:32 2013 -0700 24.2 +++ b/test/tools/javac/NonAmbiguousField/two/Child2.java Mon Jun 03 23:24:15 2013 -0700 24.3 @@ -1,5 +1,5 @@ 24.4 /* 24.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. 24.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 24.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.8 * 24.9 * This code is free software; you can redistribute it and/or modify it 24.10 @@ -28,9 +28,7 @@ 24.11 } 24.12 24.13 public class Child2 extends one.Parent2 implements I { 24.14 - class inner { 24.15 - void method() { 24.16 - System.out.println(i); 24.17 - } 24.18 + void method() { 24.19 + System.out.println(i); 24.20 } 24.21 }
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 25.2 +++ b/test/tools/javac/T6970173/DebugPointerAtBadPositionTest.java Mon Jun 03 23:24:15 2013 -0700 25.3 @@ -0,0 +1,112 @@ 25.4 +/* 25.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 25.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.7 + * 25.8 + * This code is free software; you can redistribute it and/or modify it 25.9 + * under the terms of the GNU General Public License version 2 only, as 25.10 + * published by the Free Software Foundation. 25.11 + * 25.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 25.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 25.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25.15 + * version 2 for more details (a copy is included in the LICENSE file that 25.16 + * accompanied this code). 25.17 + * 25.18 + * You should have received a copy of the GNU General Public License version 25.19 + * 2 along with this work; if not, write to the Free Software Foundation, 25.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25.21 + * 25.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 25.23 + * or visit www.oracle.com if you need additional information or have any 25.24 + * questions. 25.25 + */ 25.26 + 25.27 +/* 25.28 + * @test 25.29 + * @bug 6970173 25.30 + * @summary Debug pointer at bad position 25.31 + * @library /tools/javac/lib 25.32 + * @build ToolBox 25.33 + * @run main DebugPointerAtBadPositionTest 25.34 + */ 25.35 + 25.36 +import java.io.File; 25.37 +import java.nio.file.Paths; 25.38 + 25.39 +import com.sun.tools.classfile.ClassFile; 25.40 +import com.sun.tools.classfile.Code_attribute; 25.41 +import com.sun.tools.classfile.LineNumberTable_attribute; 25.42 +import com.sun.tools.classfile.Method; 25.43 +import com.sun.tools.javac.util.Assert; 25.44 + 25.45 +public class DebugPointerAtBadPositionTest { 25.46 + 25.47 + static final String testSource = 25.48 + "public class AssertionTest {\n" + 25.49 + " void lookForThisMethod() {\n" + 25.50 + " int i;\n" + 25.51 + " i = 33;\n" + 25.52 + " assert // line 5\n" + 25.53 + " i < 89:\n" + 25.54 + " i < 100; // line 7\n" + 25.55 + " }\n" + 25.56 + "}"; 25.57 + 25.58 + static final int[][] expectedLNT = { 25.59 + {4, 0}, 25.60 + {5, 3}, 25.61 + {8, 34} 25.62 + }; 25.63 + 25.64 + static final String methodToLookFor = "lookForThisMethod"; 25.65 + static final String seekMethodNotFoundMsg = 25.66 + "The seek method was not found"; 25.67 + static final String foundLNTLengthDifferentThanExpMsg = 25.68 + "The LineNumberTable found has a length different to the expected one"; 25.69 + 25.70 + public static void main(String[] args) throws Exception { 25.71 + new DebugPointerAtBadPositionTest().run(); 25.72 + } 25.73 + 25.74 + void run() throws Exception { 25.75 + compileTestClass(); 25.76 + checkClassFile(new File(Paths.get(System.getProperty("user.dir"), 25.77 + "AssertionTest.class").toUri()), methodToLookFor); 25.78 + } 25.79 + 25.80 + void compileTestClass() throws Exception { 25.81 + ToolBox.JavaToolArgs javacSuccessArgs = 25.82 + new ToolBox.JavaToolArgs().setSources(testSource); 25.83 + ToolBox.javac(javacSuccessArgs); 25.84 + } 25.85 + 25.86 + void checkClassFile(final File cfile, String methodToFind) throws Exception { 25.87 + ClassFile classFile = ClassFile.read(cfile); 25.88 + boolean methodFound = false; 25.89 + for (Method method : classFile.methods) { 25.90 + if (method.getName(classFile.constant_pool).equals(methodToFind)) { 25.91 + methodFound = true; 25.92 + Code_attribute code = (Code_attribute) method.attributes.get("Code"); 25.93 + LineNumberTable_attribute lnt = 25.94 + (LineNumberTable_attribute) code.attributes.get("LineNumberTable"); 25.95 + Assert.check(lnt.line_number_table_length == expectedLNT.length, 25.96 + foundLNTLengthDifferentThanExpMsg); 25.97 + int i = 0; 25.98 + for (LineNumberTable_attribute.Entry entry: lnt.line_number_table) { 25.99 + Assert.check(entry.line_number == expectedLNT[i][0] && 25.100 + entry.start_pc == expectedLNT[i][1], 25.101 + "LNT entry at pos " + i + " differ from expected." + 25.102 + "Found " + entry.line_number + ":" + entry.start_pc + 25.103 + ". Expected " + expectedLNT[i][0] + ":" + expectedLNT[i][1]); 25.104 + i++; 25.105 + } 25.106 + } 25.107 + } 25.108 + Assert.check(methodFound, seekMethodNotFoundMsg); 25.109 + } 25.110 + 25.111 + void error(String msg) { 25.112 + throw new AssertionError(msg); 25.113 + } 25.114 + 25.115 +}
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 26.2 +++ b/test/tools/javac/T7053059/VerifyErrorWithDoubleAssignmentTest.java Mon Jun 03 23:24:15 2013 -0700 26.3 @@ -0,0 +1,51 @@ 26.4 +/* 26.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 26.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.7 + * 26.8 + * This code is free software; you can redistribute it and/or modify it 26.9 + * under the terms of the GNU General Public License version 2 only, as 26.10 + * published by the Free Software Foundation. 26.11 + * 26.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 26.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 26.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26.15 + * version 2 for more details (a copy is included in the LICENSE file that 26.16 + * accompanied this code). 26.17 + * 26.18 + * You should have received a copy of the GNU General Public License version 26.19 + * 2 along with this work; if not, write to the Free Software Foundation, 26.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26.21 + * 26.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 26.23 + * or visit www.oracle.com if you need additional information or have any 26.24 + * questions. 26.25 + */ 26.26 + 26.27 +/* 26.28 + * @test 26.29 + * @bug 7053059 26.30 + * @summary VerifyError with double Assignment using a Generic Member of a Superclass 26.31 + * @run main VerifyErrorWithDoubleAssignmentTest 26.32 + */ 26.33 + 26.34 +public class VerifyErrorWithDoubleAssignmentTest { 26.35 + 26.36 + static class A<D> { 26.37 + D d; 26.38 + 26.39 + D getD() { 26.40 + return null; 26.41 + } 26.42 + } 26.43 + 26.44 + static class B extends A<Integer> { 26.45 + Integer y; 26.46 + B() { 26.47 + y = d = getD(); 26.48 + } 26.49 + } 26.50 + 26.51 + public static void main(String[] args) { 26.52 + new B(); 26.53 + } 26.54 +}
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 27.2 +++ b/test/tools/javac/annotations/typeAnnotations/8013180/QualifiedName.java Mon Jun 03 23:24:15 2013 -0700 27.3 @@ -0,0 +1,39 @@ 27.4 +/* 27.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 27.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 27.7 + * 27.8 + * This code is free software; you can redistribute it and/or modify it 27.9 + * under the terms of the GNU General Public License version 2 only, as 27.10 + * published by the Free Software Foundation. 27.11 + * 27.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 27.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 27.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27.15 + * version 2 for more details (a copy is included in the LICENSE file that 27.16 + * accompanied this code). 27.17 + * 27.18 + * You should have received a copy of the GNU General Public License version 27.19 + * 2 along with this work; if not, write to the Free Software Foundation, 27.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27.21 + * 27.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 27.23 + * or visit www.oracle.com if you need additional information or have any 27.24 + * questions. 27.25 + */ 27.26 + 27.27 +import java.lang.annotation.ElementType; 27.28 +import java.lang.annotation.Target; 27.29 + 27.30 +/* 27.31 + * @test 27.32 + * @bug 8013180 27.33 + * @summary Qualified type annotation name used to crash javac 27.34 + * @compile QualifiedName.java 27.35 + */ 27.36 + 27.37 +public class QualifiedName { 27.38 + @Target(ElementType.TYPE_USE) @interface TA { } 27.39 + class E extends Exception { } 27.40 + 27.41 + void m() throws @TA QualifiedName.@TA E { } 27.42 +}
28.1 --- a/test/tools/javac/diags/Example.java Thu May 30 10:58:32 2013 -0700 28.2 +++ b/test/tools/javac/diags/Example.java Mon Jun 03 23:24:15 2013 -0700 28.3 @@ -1,5 +1,5 @@ 28.4 /* 28.5 - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 28.6 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 28.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.8 * 28.9 * This code is free software; you can redistribute it and/or modify it 28.10 @@ -296,7 +296,10 @@ 28.11 private Set<String> actualKeys; 28.12 private Set<String> declaredKeys; 28.13 28.14 - static File tempDir = new File(System.getProperty("java.io.tmpdir")); 28.15 + static File tempDir = (System.getProperty("test.src") != null) ? 28.16 + new File(System.getProperty("user.dir")): 28.17 + new File(System.getProperty("java.io.tmpdir")); 28.18 + 28.19 static void setTempDir(File tempDir) { 28.20 Example.tempDir = tempDir; 28.21 }
29.1 --- a/test/tools/javac/lambda/MethodReferenceParserTest.java Thu May 30 10:58:32 2013 -0700 29.2 +++ b/test/tools/javac/lambda/MethodReferenceParserTest.java Mon Jun 03 23:24:15 2013 -0700 29.3 @@ -23,8 +23,7 @@ 29.4 29.5 /* 29.6 * @test 29.7 - * @bug 7115052 29.8 - * @bug 8003280 8006694 29.9 + * @bug 7115052 8003280 8006694 29.10 * @summary Add lambda tests 29.11 * Add parser support for method references 29.12 * temporarily workaround combo tests are causing time out in several platforms
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 30.2 +++ b/test/tools/javac/lambda/TargetType73.java Mon Jun 03 23:24:15 2013 -0700 30.3 @@ -0,0 +1,47 @@ 30.4 +/* 30.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 30.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 30.7 + * 30.8 + * This code is free software; you can redistribute it and/or modify it 30.9 + * under the terms of the GNU General Public License version 2 only, as 30.10 + * published by the Free Software Foundation. 30.11 + * 30.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 30.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 30.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 30.15 + * version 2 for more details (a copy is included in the LICENSE file that 30.16 + * accompanied this code). 30.17 + * 30.18 + * You should have received a copy of the GNU General Public License version 30.19 + * 2 along with this work; if not, write to the Free Software Foundation, 30.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 30.21 + * 30.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 30.23 + * or visit www.oracle.com if you need additional information or have any 30.24 + * questions. 30.25 + */ 30.26 + 30.27 +/* 30.28 + * @test 30.29 + * @bug 8014494 30.30 + * @summary javac crashes when varargs element of a method reference is inferred from the context 30.31 + * @compile TargetType73.java 30.32 + */ 30.33 +import java.util.List; 30.34 + 30.35 +class TargetType73 { 30.36 + 30.37 + interface Function<X,Y> { 30.38 + Y m(X x); 30.39 + } 30.40 + 30.41 + static void test() { 30.42 + m(TargetType73::g); 30.43 + } 30.44 + 30.45 + public static <T> List<T> g(T... a) { 30.46 + return null; 30.47 + } 30.48 + 30.49 + public static <C> void m(Function<String, C> zipper) { } 30.50 +}
31.1 --- a/test/tools/javac/lambda/TestInvokeDynamic.java Thu May 30 10:58:32 2013 -0700 31.2 +++ b/test/tools/javac/lambda/TestInvokeDynamic.java Mon Jun 03 23:24:15 2013 -0700 31.3 @@ -23,8 +23,7 @@ 31.4 31.5 /* 31.6 * @test 31.7 - * @bug 7194586 31.8 - * @bug 8003280 8006694 8010404 31.9 + * @bug 7194586 8003280 8006694 8010404 31.10 * @summary Add lambda tests 31.11 * Add back-end support for invokedynamic 31.12 * temporarily workaround combo tests are causing time out in several platforms 31.13 @@ -36,6 +35,16 @@ 31.14 // use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047) 31.15 // see JDK-8006746 31.16 31.17 +import java.io.File; 31.18 +import java.net.URI; 31.19 +import java.util.ArrayList; 31.20 +import java.util.Arrays; 31.21 +import java.util.Locale; 31.22 + 31.23 +import javax.tools.Diagnostic; 31.24 +import javax.tools.JavaFileObject; 31.25 +import javax.tools.SimpleJavaFileObject; 31.26 + 31.27 import com.sun.source.tree.MethodInvocationTree; 31.28 import com.sun.source.tree.MethodTree; 31.29 import com.sun.source.util.TaskEvent; 31.30 @@ -63,16 +72,6 @@ 31.31 import com.sun.tools.javac.util.Context; 31.32 import com.sun.tools.javac.util.Names; 31.33 31.34 -import java.io.File; 31.35 -import java.net.URI; 31.36 -import java.util.ArrayList; 31.37 -import java.util.Arrays; 31.38 -import java.util.Locale; 31.39 - 31.40 -import javax.tools.Diagnostic; 31.41 -import javax.tools.JavaFileObject; 31.42 -import javax.tools.SimpleJavaFileObject; 31.43 - 31.44 import static com.sun.tools.javac.jvm.ClassFile.*; 31.45 31.46 public class TestInvokeDynamic
32.1 --- a/test/tools/javac/mandatoryWarnings/deprecated/Test.java Thu May 30 10:58:32 2013 -0700 32.2 +++ b/test/tools/javac/mandatoryWarnings/deprecated/Test.java Mon Jun 03 23:24:15 2013 -0700 32.3 @@ -1,5 +1,5 @@ 32.4 /* 32.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 32.6 + * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. 32.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 32.8 * 32.9 * This code is free software; you can redistribute it and/or modify it 32.10 @@ -29,109 +29,19 @@ 32.11 * @bug 5047307 32.12 * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.13 * @compile/ref=Test1.out -XDrawDiagnostics A.java 32.14 - */ 32.15 - 32.16 -/* 32.17 - * @test 32.18 - * @bug 5047307 32.19 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.20 * @compile/ref=Test1.out -XDrawDiagnostics -nowarn A.java 32.21 - */ 32.22 - 32.23 -/* 32.24 - * @test 32.25 - * @bug 5047307 32.26 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.27 * @compile/ref=Test1.out -XDrawDiagnostics -Xmaxwarns 1 A.java 32.28 - */ 32.29 - 32.30 -/* 32.31 - * @test 32.32 - * @bug 5047307 32.33 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.34 * @compile/ref=Test2.out -XDrawDiagnostics A.java B.java 32.35 - */ 32.36 - 32.37 -/* 32.38 - * @test 32.39 - * @bug 5047307 32.40 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.41 * @compile/ref=Test2.out -XDrawDiagnostics -nowarn A.java B.java 32.42 - */ 32.43 - 32.44 -/* 32.45 - * @test 32.46 - * @bug 5047307 32.47 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.48 * @compile/ref=Test2.out -XDrawDiagnostics -Xmaxwarns 1 A.java B.java 32.49 - */ 32.50 - 32.51 -/* 32.52 - * @test 32.53 - * @bug 5047307 32.54 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.55 * @compile/ref=Test3.out -XDrawDiagnostics -Xlint:deprecation A.java 32.56 - */ 32.57 - 32.58 -/* 32.59 - * @test 32.60 - * @bug 5047307 32.61 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.62 * @compile/ref=Test3.out -XDrawDiagnostics -nowarn -Xlint:deprecation A.java 32.63 - */ 32.64 - 32.65 -/* 32.66 - * @test 32.67 - * @bug 5047307 32.68 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.69 * @compile/ref=Test3b.out -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 1 A.java 32.70 - */ 32.71 - 32.72 -/* 32.73 - * @test 32.74 - * @bug 5047307 32.75 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.76 * @compile/ref=Test4.out -XDrawDiagnostics -Xlint:deprecation A.java B.java 32.77 - */ 32.78 - 32.79 -/* 32.80 - * @test 32.81 - * @bug 5047307 32.82 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.83 * @compile/ref=Test4.out -XDrawDiagnostics -nowarn -Xlint:deprecation A.java B.java 32.84 - */ 32.85 - 32.86 -/* 32.87 - * @test 32.88 - * @bug 5047307 32.89 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.90 * @compile/ref=Test4b.out -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 1 A.java B.java 32.91 - */ 32.92 - 32.93 -/* 32.94 - * @test 32.95 - * @bug 5047307 32.96 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.97 * @compile/ref=Test4c.out -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 2 A.java B.java 32.98 - */ 32.99 - 32.100 -/* 32.101 - * @test 32.102 - * @bug 5047307 32.103 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.104 * @compile/ref=Test4d.out -XDrawDiagnostics -nowarn -Xlint:deprecation -Xmaxwarns 3 A.java B.java 32.105 - */ 32.106 - 32.107 -/* 32.108 - * @test 32.109 - * @bug 5047307 32.110 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.111 * @compile/ref=Test5.out -XDrawDiagnostics -Xlint:deprecation P.java Q.java 32.112 - */ 32.113 - 32.114 -/* 32.115 - * @test 32.116 - * @bug 5047307 32.117 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 32.118 * @compile/ref=Test5b.out -XDrawDiagnostics -Xlint:deprecation -Xmaxwarns 2 P.java Q.java 32.119 */
33.1 --- a/test/tools/javac/mandatoryWarnings/unchecked/Test.java Thu May 30 10:58:32 2013 -0700 33.2 +++ b/test/tools/javac/mandatoryWarnings/unchecked/Test.java Mon Jun 03 23:24:15 2013 -0700 33.3 @@ -1,5 +1,5 @@ 33.4 /* 33.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 33.6 + * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. 33.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 33.8 * 33.9 * This code is free software; you can redistribute it and/or modify it 33.10 @@ -29,95 +29,17 @@ 33.11 * @bug 5047307 33.12 * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.13 * @compile/ref=Test1.out -XDrawDiagnostics A.java 33.14 - */ 33.15 - 33.16 -/* 33.17 - * @test 33.18 - * @bug 5047307 33.19 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.20 * @compile/ref=Test1.out -XDrawDiagnostics -nowarn A.java 33.21 - */ 33.22 - 33.23 -/* 33.24 - * @test 33.25 - * @bug 5047307 33.26 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.27 * @compile/ref=Test1.out -XDrawDiagnostics -Xmaxwarns 1 A.java 33.28 - */ 33.29 - 33.30 -/* 33.31 - * @test 33.32 - * @bug 5047307 33.33 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.34 * @compile/ref=Test2.out -XDrawDiagnostics A.java B.java 33.35 - */ 33.36 - 33.37 -/* 33.38 - * @test 33.39 - * @bug 5047307 33.40 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.41 * @compile/ref=Test2.out -XDrawDiagnostics -nowarn A.java B.java 33.42 - */ 33.43 - 33.44 -/* 33.45 - * @test 33.46 - * @bug 5047307 33.47 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.48 * @compile/ref=Test2.out -XDrawDiagnostics -Xmaxwarns 1 A.java B.java 33.49 - */ 33.50 - 33.51 -/* 33.52 - * @test 33.53 - * @bug 5047307 33.54 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.55 * @compile/ref=Test3.out -XDrawDiagnostics -Xlint:unchecked A.java 33.56 - */ 33.57 - 33.58 -/* 33.59 - * @test 33.60 - * @bug 5047307 33.61 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.62 * @compile/ref=Test3.out -XDrawDiagnostics -nowarn -Xlint:unchecked A.java 33.63 - */ 33.64 - 33.65 -/* 33.66 - * @test 33.67 - * @bug 5047307 33.68 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.69 * @compile/ref=Test3b.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 1 A.java 33.70 - */ 33.71 - 33.72 -/* 33.73 - * @test 33.74 - * @bug 5047307 33.75 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.76 * @compile/ref=Test4.out -XDrawDiagnostics -Xlint:unchecked A.java B.java 33.77 - */ 33.78 - 33.79 -/* 33.80 - * @test 33.81 - * @bug 5047307 33.82 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.83 * @compile/ref=Test4.out -XDrawDiagnostics -nowarn -Xlint:unchecked A.java B.java 33.84 - */ 33.85 - 33.86 -/* 33.87 - * @test 33.88 - * @bug 5047307 33.89 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.90 * @compile/ref=Test4b.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 1 A.java B.java 33.91 - */ 33.92 - 33.93 -/* 33.94 - * @test 33.95 - * @bug 5047307 33.96 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.97 * @compile/ref=Test4c.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 2 A.java B.java 33.98 - */ 33.99 - 33.100 -/* 33.101 - * @test 33.102 - * @bug 5047307 33.103 - * @summary javac -nowarn improperly suppresses JLS-mandated warnings 33.104 * @compile/ref=Test4d.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 3 A.java B.java 33.105 */
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 34.2 +++ b/test/tools/javac/parser/8014643/T8014643.java Mon Jun 03 23:24:15 2013 -0700 34.3 @@ -0,0 +1,41 @@ 34.4 +/* 34.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 34.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 34.7 + * 34.8 + * This code is free software; you can redistribute it and/or modify it 34.9 + * under the terms of the GNU General Public License version 2 only, as 34.10 + * published by the Free Software Foundation. 34.11 + * 34.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 34.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 34.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 34.15 + * version 2 for more details (a copy is included in the LICENSE file that 34.16 + * accompanied this code). 34.17 + * 34.18 + * You should have received a copy of the GNU General Public License version 34.19 + * 2 along with this work; if not, write to the Free Software Foundation, 34.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 34.21 + * 34.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 34.23 + * or visit www.oracle.com if you need additional information or have any 34.24 + * questions. 34.25 + */ 34.26 + 34.27 +/* 34.28 + * @test 34.29 + * @bug 8014643 34.30 + * @summary Parser regression in JDK 8 when compiling super.x 34.31 + * @compile T8014643.java 34.32 + */ 34.33 +class T8014643 { 34.34 + 34.35 + static class A { 34.36 + int b = 1; 34.37 + } 34.38 + 34.39 + static class B extends A { 34.40 + int b = 12; 34.41 + 34.42 + int m() { return (super.b); } 34.43 + } 34.44 +}
35.1 --- a/test/tools/javac/policy/test3/Test.java Thu May 30 10:58:32 2013 -0700 35.2 +++ b/test/tools/javac/policy/test3/Test.java Mon Jun 03 23:24:15 2013 -0700 35.3 @@ -1,5 +1,5 @@ 35.4 /* 35.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 35.6 + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 35.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 35.8 * 35.9 * This code is free software; you can redistribute it and/or modify it 35.10 @@ -123,47 +123,3 @@ 35.11 35.12 int errors; 35.13 } 35.14 - 35.15 - 35.16 - 35.17 - 35.18 - 35.19 - 35.20 - 35.21 - 35.22 - 35.23 - 35.24 - 35.25 - 35.26 -// These tests test the ability of the compiler to continue in the face of 35.27 -// errors, accordining to the shouldStopPolicy 35.28 - 35.29 -/* @ test /nodynamiccopyright/ 35.30 - * @bug 6813059 35.31 - * @summary 35.32 - * @compile/fail/ref=flow.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=FLOW Test.java 35.33 - 35.34 - * @compile/fail/ref=default.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy Test.java 35.35 - * @compile/fail/ref=enter.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=ENTER Test.java 35.36 - * @compile/fail/ref=attr.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=ATTR Test.java 35.37 - * @compile/fail/ref=transtypes.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=TRANSTYPES Test.java 35.38 - * @compile/fail/ref=lower.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=LOWER Test.java 35.39 - * @compile/fail/ref=generate.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=GENERATE Test.java 35.40 - */ 35.41 - 35.42 -/* 35.43 -class Test { 35.44 - void m1() { 35.45 - System.err.println("hello"); 35.46 - 0 // syntax error 35.47 - System.err.println("world"); 35.48 - } 35.49 - 35.50 - void m2() { 35.51 - } 35.52 -} 35.53 - 35.54 -class Test2 { 35.55 -} 35.56 -*/ 35.57 -
36.1 --- a/test/tools/javac/resolve/ResolveHarness.java Thu May 30 10:58:32 2013 -0700 36.2 +++ b/test/tools/javac/resolve/ResolveHarness.java Mon Jun 03 23:24:15 2013 -0700 36.3 @@ -43,6 +43,7 @@ 36.4 import java.util.HashMap; 36.5 import java.util.HashSet; 36.6 import java.util.List; 36.7 +import java.util.Locale; 36.8 import java.util.Map; 36.9 36.10 import javax.annotation.processing.AbstractProcessor; 36.11 @@ -85,6 +86,7 @@ 36.12 Set<String> declaredKeys = new HashSet<>(); 36.13 List<Diagnostic<? extends JavaFileObject>> diags = new ArrayList<>(); 36.14 List<ElementKey> seenCandidates = new ArrayList<>(); 36.15 + Map<String, String> predefTranslationMap = new HashMap<>(); 36.16 36.17 protected ResolveHarness(JavaFileObject jfo) { 36.18 this.jfo = jfo; 36.19 @@ -93,12 +95,36 @@ 36.20 new VerboseDeferredInferenceNoteProcessor(), 36.21 new ErrorProcessor() 36.22 }; 36.23 + predefTranslationMap.put("+", "_plus"); 36.24 + predefTranslationMap.put("-", "_minus"); 36.25 + predefTranslationMap.put("~", "_not"); 36.26 + predefTranslationMap.put("++", "_plusplus"); 36.27 + predefTranslationMap.put("--", "_minusminus"); 36.28 + predefTranslationMap.put("!", "_bang"); 36.29 + predefTranslationMap.put("*", "_mul"); 36.30 + predefTranslationMap.put("/", "_div"); 36.31 + predefTranslationMap.put("%", "_mod"); 36.32 + predefTranslationMap.put("&", "_and"); 36.33 + predefTranslationMap.put("|", "_or"); 36.34 + predefTranslationMap.put("^", "_xor"); 36.35 + predefTranslationMap.put("<<", "_lshift"); 36.36 + predefTranslationMap.put(">>", "_rshift"); 36.37 + predefTranslationMap.put("<<<", "_lshiftshift"); 36.38 + predefTranslationMap.put(">>>", "_rshiftshift"); 36.39 + predefTranslationMap.put("<", "_lt"); 36.40 + predefTranslationMap.put(">", "_gt"); 36.41 + predefTranslationMap.put("<=", "_lteq"); 36.42 + predefTranslationMap.put(">=", "_gteq"); 36.43 + predefTranslationMap.put("==", "_eq"); 36.44 + predefTranslationMap.put("!=", "_neq"); 36.45 + predefTranslationMap.put("&&", "_andand"); 36.46 + predefTranslationMap.put("||", "_oror"); 36.47 } 36.48 36.49 protected void check() throws Exception { 36.50 String[] options = { 36.51 "-XDshouldStopPolicy=ATTR", 36.52 - "-XDverboseResolution=success,failure,applicable,inapplicable,deferred-inference" 36.53 + "-XDverboseResolution=success,failure,applicable,inapplicable,deferred-inference,predef" 36.54 }; 36.55 36.56 AbstractProcessor[] processors = { new ResolveCandidateFinder(), null }; 36.57 @@ -223,7 +249,8 @@ 36.58 @Override 36.59 void process(Diagnostic<? extends JavaFileObject> diagnostic) { 36.60 Element siteSym = getSiteSym(diagnostic); 36.61 - if (siteSym.getAnnotation(TraceResolve.class) == null) { 36.62 + if (siteSym.getSimpleName().length() != 0 && 36.63 + siteSym.getAnnotation(TraceResolve.class) == null) { 36.64 return; 36.65 } 36.66 int candidateIdx = 0; 36.67 @@ -307,7 +334,7 @@ 36.68 36.69 if (Arrays.asList(c.applicable()).contains(phase)) { //applicable 36.70 if (c.mostSpecific() != mostSpecific) { 36.71 - error("Invalid most specific value for method " + methodSym); 36.72 + error("Invalid most specific value for method " + methodSym + " " + new ElementKey(methodSym).key); 36.73 } 36.74 MethodType mtype = getSig(diagnostic); 36.75 if (mtype != null) { 36.76 @@ -444,11 +471,21 @@ 36.77 36.78 String computeKey(Element e) { 36.79 StringBuilder buf = new StringBuilder(); 36.80 - while (e != null) { 36.81 + if (predefTranslationMap.containsKey(e.getSimpleName().toString())) { 36.82 + //predef element 36.83 + buf.append("<predef>."); 36.84 + String replacedName = predefTranslationMap.get(e.getSimpleName().toString()); 36.85 + buf.append(e.toString().replace(e.getSimpleName().toString(), replacedName)); 36.86 + } else if (e.getSimpleName().toString().startsWith("_")) { 36.87 + buf.append("<predef>."); 36.88 buf.append(e.toString()); 36.89 - e = e.getEnclosingElement(); 36.90 + } else { 36.91 + while (e != null) { 36.92 + buf.append(e.toString()); 36.93 + e = e.getEnclosingElement(); 36.94 + } 36.95 + buf.append(jfo.getName()); 36.96 } 36.97 - buf.append(jfo.getName()); 36.98 return buf.toString(); 36.99 } 36.100
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 37.2 +++ b/test/tools/javac/resolve/tests/PrimitiveBinopOverload.java Mon Jun 03 23:24:15 2013 -0700 37.3 @@ -0,0 +1,71 @@ 37.4 +/* 37.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 37.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 37.7 + * 37.8 + * This code is free software; you can redistribute it and/or modify it 37.9 + * under the terms of the GNU General Public License version 2 only, as 37.10 + * published by the Free Software Foundation. 37.11 + * 37.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 37.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 37.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 37.15 + * version 2 for more details (a copy is included in the LICENSE file that 37.16 + * accompanied this code). 37.17 + * 37.18 + * You should have received a copy of the GNU General Public License version 37.19 + * 2 along with this work; if not, write to the Free Software Foundation, 37.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 37.21 + * 37.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 37.23 + * or visit www.oracle.com if you need additional information or have any 37.24 + * questions. 37.25 + */ 37.26 + 37.27 +@TraceResolve 37.28 +class PrimitiveBinopOverload { 37.29 + 37.30 + @Candidate(applicable=Phase.BASIC, mostSpecific=true) 37.31 + int _plus(int x, int y) { return -1; } 37.32 + @Candidate(applicable=Phase.BASIC) 37.33 + long _plus(long x, long y) { return -1; } 37.34 + @Candidate(applicable=Phase.BASIC) 37.35 + float _plus(float x, float y) { return -1; } 37.36 + @Candidate(applicable=Phase.BASIC) 37.37 + double _plus(double x, double y) { return -1; } 37.38 + //not a candidate 37.39 + Object _plus(Object x, Object y) { return -1; } 37.40 + 37.41 + @Candidate(applicable= { Phase.BASIC, Phase.BOX }, mostSpecific=true) 37.42 + int _minus(int x, int y) { return -1; } 37.43 + @Candidate(applicable= { Phase.BASIC, Phase.BOX }) 37.44 + long _minus(long x, long y) { return -1; } 37.45 + @Candidate(applicable= { Phase.BASIC, Phase.BOX }) 37.46 + float _minus(float x, float y) { return -1; } 37.47 + @Candidate(applicable= { Phase.BASIC, Phase.BOX }) 37.48 + double _minus(double x, double y) { return -1; } 37.49 + 37.50 + @Candidate(applicable= { Phase.BASIC, Phase.BOX }, mostSpecific=true) 37.51 + int _mul(int x, int y) { return -1; } 37.52 + @Candidate(applicable= { Phase.BASIC, Phase.BOX }) 37.53 + long _mul(long x, long y) { return -1; } 37.54 + @Candidate(applicable= { Phase.BASIC, Phase.BOX }) 37.55 + float _mul(float x, float y) { return -1; } 37.56 + @Candidate(applicable= { Phase.BASIC, Phase.BOX }) 37.57 + double _mul(double x, double y) { return -1; } 37.58 + 37.59 + @Candidate(applicable= { Phase.BASIC, Phase.BOX }, mostSpecific=true) 37.60 + int _div(int x, int y) { return -1; } 37.61 + @Candidate(applicable= { Phase.BASIC, Phase.BOX }) 37.62 + long _div(long x, long y) { return -1; } 37.63 + @Candidate(applicable= { Phase.BASIC, Phase.BOX }) 37.64 + float _div(float x, float y) { return -1; } 37.65 + @Candidate(applicable= { Phase.BASIC, Phase.BOX }) 37.66 + double _div(double x, double y) { return -1; } 37.67 + 37.68 + { 37.69 + int i1 = 1 + 1; 37.70 + int i2 = 5 - new Integer(3); 37.71 + int i3 = new Integer(5) * 3; 37.72 + int i4 = new Integer(6) / new Integer(2); 37.73 + } 37.74 +}