Merge
This commit is contained in:
commit
9c5e38248f
@ -230,9 +230,9 @@ public class GenStubs {
|
|||||||
tree.typarams = translateTypeParams(tree.typarams);
|
tree.typarams = translateTypeParams(tree.typarams);
|
||||||
tree.params = translateVarDefs(tree.params);
|
tree.params = translateVarDefs(tree.params);
|
||||||
tree.thrown = translate(tree.thrown);
|
tree.thrown = translate(tree.thrown);
|
||||||
if (tree.restype != null && tree.body != null) {
|
if (tree.body != null) {
|
||||||
if ((currClassMods & Flags.INTERFACE) != 0) {
|
if ((currClassMods & Flags.INTERFACE) != 0) {
|
||||||
tree.mods.flags &= ~Flags.DEFAULT;
|
tree.mods.flags &= ~(Flags.DEFAULT | Flags.STATIC);
|
||||||
} else {
|
} else {
|
||||||
tree.mods.flags |= Flags.NATIVE;
|
tree.mods.flags |= Flags.NATIVE;
|
||||||
}
|
}
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,6 +29,7 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import static com.sun.tools.classfile.AccessFlags.*;
|
import static com.sun.tools.classfile.AccessFlags.*;
|
||||||
|
|
||||||
@ -46,6 +47,11 @@ public class ClassFile {
|
|||||||
return read(file, new Attribute.Factory());
|
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)
|
public static ClassFile read(File file, Attribute.Factory attributeFactory)
|
||||||
throws IOException, ConstantPoolException {
|
throws IOException, ConstantPoolException {
|
||||||
FileInputStream in = new FileInputStream(file);
|
FileInputStream in = new FileInputStream(file);
|
||||||
|
@ -3732,7 +3732,7 @@ public class Attr extends JCTree.Visitor {
|
|||||||
noteWarner);
|
noteWarner);
|
||||||
|
|
||||||
return chk.checkMethod(owntype, sym, env, argtrees, argtypes, env.info.lastResolveVarargs(),
|
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) {
|
} catch (Infer.InferenceException ex) {
|
||||||
//invalid target type - propagate exception outwards or report error
|
//invalid target type - propagate exception outwards or report error
|
||||||
//depending on the current check context
|
//depending on the current check context
|
||||||
|
@ -853,7 +853,8 @@ public class Check {
|
|||||||
final List<JCExpression> argtrees,
|
final List<JCExpression> argtrees,
|
||||||
List<Type> argtypes,
|
List<Type> argtypes,
|
||||||
boolean useVarargs,
|
boolean useVarargs,
|
||||||
boolean unchecked) {
|
boolean unchecked,
|
||||||
|
InferenceContext inferenceContext) {
|
||||||
// System.out.println("call : " + env.tree);
|
// System.out.println("call : " + env.tree);
|
||||||
// System.out.println("method : " + owntype);
|
// System.out.println("method : " + owntype);
|
||||||
// System.out.println("actuals: " + argtypes);
|
// System.out.println("actuals: " + argtypes);
|
||||||
@ -917,7 +918,7 @@ public class Check {
|
|||||||
argtype);
|
argtype);
|
||||||
}
|
}
|
||||||
if (!((MethodSymbol)sym.baseSymbol()).isSignaturePolymorphic(types)) {
|
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) &&
|
PolyKind pkind = (sym.type.hasTag(FORALL) &&
|
||||||
@ -927,6 +928,17 @@ public class Check {
|
|||||||
return owntype;
|
return owntype;
|
||||||
}
|
}
|
||||||
//where
|
//where
|
||||||
|
private void setVarargsElement(final Env<AttrContext> env, final Type elemtype, InferenceContext inferenceContext) {
|
||||||
|
if (inferenceContext.free(elemtype)) {
|
||||||
|
inferenceContext.addFreeTypeListener(List.of(elemtype), new FreeTypeListener() {
|
||||||
|
public void typesInferred(InferenceContext inferenceContext) {
|
||||||
|
setVarargsElement(env, inferenceContext.asInstType(elemtype), inferenceContext);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
TreeInfo.setVarargsElement(env.tree, elemtype);
|
||||||
|
}
|
||||||
|
|
||||||
private void assertConvertible(JCTree tree, Type actual, Type formal, Warner warn) {
|
private void assertConvertible(JCTree tree, Type actual, Type formal, Warner warn) {
|
||||||
if (types.isConvertible(actual, formal, warn))
|
if (types.isConvertible(actual, formal, warn))
|
||||||
return;
|
return;
|
||||||
|
@ -2002,7 +2002,7 @@ public class Lower extends TreeTranslator {
|
|||||||
JCStatement rethrow;
|
JCStatement rethrow;
|
||||||
if (target.hasInitCause()) {
|
if (target.hasInitCause()) {
|
||||||
// rethrow = "throw new NoClassDefFoundError().initCause(e);
|
// rethrow = "throw new NoClassDefFoundError().initCause(e);
|
||||||
JCTree throwExpr =
|
JCExpression throwExpr =
|
||||||
makeCall(makeNewClass(syms.noClassDefFoundErrorType,
|
makeCall(makeNewClass(syms.noClassDefFoundErrorType,
|
||||||
List.<JCExpression>nil()),
|
List.<JCExpression>nil()),
|
||||||
names.initCause,
|
names.initCause,
|
||||||
@ -2931,7 +2931,7 @@ public class Lower extends TreeTranslator {
|
|||||||
}
|
}
|
||||||
result =
|
result =
|
||||||
make.If(cond,
|
make.If(cond,
|
||||||
make_at(detailPos).
|
make_at(tree).
|
||||||
Throw(makeNewClass(syms.assertionErrorType, exnArgs)),
|
Throw(makeNewClass(syms.assertionErrorType, exnArgs)),
|
||||||
null);
|
null);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1343,7 +1343,7 @@ public class Resolve {
|
|||||||
try {
|
try {
|
||||||
Type mt = rawInstantiate(env, site, sym, null, argtypes, typeargtypes,
|
Type mt = rawInstantiate(env, site, sym, null, argtypes, typeargtypes,
|
||||||
allowBoxing, useVarargs, types.noWarnings);
|
allowBoxing, useVarargs, types.noWarnings);
|
||||||
if (!operator)
|
if (!operator || verboseResolutionMode.contains(VerboseResolutionMode.PREDEF))
|
||||||
currentResolutionContext.addApplicableCandidate(sym, mt);
|
currentResolutionContext.addApplicableCandidate(sym, mt);
|
||||||
} catch (InapplicableMethodException ex) {
|
} catch (InapplicableMethodException ex) {
|
||||||
if (!operator)
|
if (!operator)
|
||||||
@ -2500,17 +2500,21 @@ public class Resolve {
|
|||||||
try {
|
try {
|
||||||
currentResolutionContext = new MethodResolutionContext();
|
currentResolutionContext = new MethodResolutionContext();
|
||||||
Name name = treeinfo.operatorName(optag);
|
Name name = treeinfo.operatorName(optag);
|
||||||
env.info.pendingResolutionPhase = currentResolutionContext.step = BASIC;
|
return lookupMethod(env, pos, syms.predefClass, currentResolutionContext,
|
||||||
Symbol sym = findMethod(env, syms.predefClass.type, name, argtypes,
|
new BasicLookupHelper(name, syms.predefClass.type, argtypes, null, BOX) {
|
||||||
null, false, false, true);
|
@Override
|
||||||
if (boxingEnabled && sym.kind >= WRONG_MTHS)
|
Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
|
||||||
env.info.pendingResolutionPhase = currentResolutionContext.step = BOX;
|
return findMethod(env, site, name, argtypes, typeargtypes,
|
||||||
sym = findMethod(env, syms.predefClass.type, name, argtypes,
|
phase.isBoxingRequired(),
|
||||||
null, true, false, true);
|
phase.isVarargsRequired(), true);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) {
|
||||||
return accessMethod(sym, pos, env.enclClass.sym.type, name,
|
return accessMethod(sym, pos, env.enclClass.sym.type, name,
|
||||||
false, argtypes, null);
|
false, argtypes, null);
|
||||||
}
|
}
|
||||||
finally {
|
});
|
||||||
|
} finally {
|
||||||
currentResolutionContext = prevResolutionContext;
|
currentResolutionContext = prevResolutionContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2673,7 +2677,11 @@ public class Resolve {
|
|||||||
abstract class BasicLookupHelper extends LookupHelper {
|
abstract class BasicLookupHelper extends LookupHelper {
|
||||||
|
|
||||||
BasicLookupHelper(Name name, Type site, List<Type> argtypes, List<Type> typeargtypes) {
|
BasicLookupHelper(Name name, Type site, List<Type> argtypes, List<Type> typeargtypes) {
|
||||||
super(name, site, argtypes, typeargtypes, MethodResolutionPhase.VARARITY);
|
this(name, site, argtypes, typeargtypes, MethodResolutionPhase.VARARITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
BasicLookupHelper(Name name, Type site, List<Type> argtypes, List<Type> typeargtypes, MethodResolutionPhase maxPhase) {
|
||||||
|
super(name, site, argtypes, typeargtypes, maxPhase);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -172,10 +172,13 @@ public class TransTypes extends TreeTranslator {
|
|||||||
JCExpression retype(JCExpression tree, Type erasedType, Type target) {
|
JCExpression retype(JCExpression tree, Type erasedType, Type target) {
|
||||||
// System.err.println("retype " + tree + " to " + erasedType);//DEBUG
|
// System.err.println("retype " + tree + " to " + erasedType);//DEBUG
|
||||||
if (!erasedType.isPrimitive()) {
|
if (!erasedType.isPrimitive()) {
|
||||||
if (target != null && target.isPrimitive())
|
if (target != null && target.isPrimitive()) {
|
||||||
target = erasure(tree.type);
|
target = erasure(tree.type);
|
||||||
|
}
|
||||||
tree.type = erasedType;
|
tree.type = erasedType;
|
||||||
if (target != null) return coerce(tree, target);
|
if (target != null) {
|
||||||
|
return coerce(tree, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
@ -686,8 +689,8 @@ public class TransTypes extends TreeTranslator {
|
|||||||
public void visitAssign(JCAssign tree) {
|
public void visitAssign(JCAssign tree) {
|
||||||
tree.lhs = translate(tree.lhs, null);
|
tree.lhs = translate(tree.lhs, null);
|
||||||
tree.rhs = translate(tree.rhs, erasure(tree.lhs.type));
|
tree.rhs = translate(tree.rhs, erasure(tree.lhs.type));
|
||||||
tree.type = erasure(tree.type);
|
tree.type = erasure(tree.lhs.type);
|
||||||
result = tree;
|
result = retype(tree, tree.type, pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitAssignop(JCAssignOp tree) {
|
public void visitAssignop(JCAssignOp tree) {
|
||||||
|
@ -1535,11 +1535,18 @@ public class JavacParser implements Parser {
|
|||||||
outer: for (int lookahead = 0 ; ; lookahead++) {
|
outer: for (int lookahead = 0 ; ; lookahead++) {
|
||||||
TokenKind tk = S.token(lookahead).kind;
|
TokenKind tk = S.token(lookahead).kind;
|
||||||
switch (tk) {
|
switch (tk) {
|
||||||
case EXTENDS: case SUPER: case COMMA:
|
case COMMA:
|
||||||
type = true;
|
type = true;
|
||||||
case QUES: case DOT: case AMP:
|
case EXTENDS: case SUPER: case DOT: case AMP:
|
||||||
//skip
|
//skip
|
||||||
break;
|
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 BYTE: case SHORT: case INT: case LONG: case FLOAT:
|
||||||
case DOUBLE: case BOOLEAN: case CHAR:
|
case DOUBLE: case BOOLEAN: case CHAR:
|
||||||
if (peekToken(lookahead, RPAREN)) {
|
if (peekToken(lookahead, RPAREN)) {
|
||||||
|
@ -700,7 +700,7 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
|
|||||||
public List<JCTypeParameter> getTypeParameters() {
|
public List<JCTypeParameter> getTypeParameters() {
|
||||||
return typarams;
|
return typarams;
|
||||||
}
|
}
|
||||||
public JCTree getExtendsClause() { return extending; }
|
public JCExpression getExtendsClause() { return extending; }
|
||||||
public List<JCExpression> getImplementsClause() {
|
public List<JCExpression> getImplementsClause() {
|
||||||
return implementing;
|
return implementing;
|
||||||
}
|
}
|
||||||
@ -1175,7 +1175,7 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
|
|||||||
return v.visitTry(this, d);
|
return v.visitTry(this, d);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public List<? extends JCTree> getResources() {
|
public List<JCTree> getResources() {
|
||||||
return resources;
|
return resources;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@ -1392,8 +1392,8 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
|
|||||||
*/
|
*/
|
||||||
public static class JCThrow extends JCStatement implements ThrowTree {
|
public static class JCThrow extends JCStatement implements ThrowTree {
|
||||||
public JCExpression expr;
|
public JCExpression expr;
|
||||||
protected JCThrow(JCTree expr) {
|
protected JCThrow(JCExpression expr) {
|
||||||
this.expr = (JCExpression)expr;
|
this.expr = expr;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void accept(Visitor v) { v.visitThrow(this); }
|
public void accept(Visitor v) { v.visitThrow(this); }
|
||||||
@ -2466,7 +2466,7 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
|
|||||||
JCBreak Break(Name label);
|
JCBreak Break(Name label);
|
||||||
JCContinue Continue(Name label);
|
JCContinue Continue(Name label);
|
||||||
JCReturn Return(JCExpression expr);
|
JCReturn Return(JCExpression expr);
|
||||||
JCThrow Throw(JCTree expr);
|
JCThrow Throw(JCExpression expr);
|
||||||
JCAssert Assert(JCExpression cond, JCExpression detail);
|
JCAssert Assert(JCExpression cond, JCExpression detail);
|
||||||
JCMethodInvocation Apply(List<JCExpression> typeargs,
|
JCMethodInvocation Apply(List<JCExpression> typeargs,
|
||||||
JCExpression fn,
|
JCExpression fn,
|
||||||
|
@ -340,7 +340,7 @@ public class TreeCopier<P> implements TreeVisitor<JCTree,P> {
|
|||||||
|
|
||||||
public JCTree visitThrow(ThrowTree node, P p) {
|
public JCTree visitThrow(ThrowTree node, P p) {
|
||||||
JCThrow t = (JCThrow) node;
|
JCThrow t = (JCThrow) node;
|
||||||
JCTree expr = copy(t.expr, p);
|
JCExpression expr = copy(t.expr, p);
|
||||||
return M.at(t.pos).Throw(expr);
|
return M.at(t.pos).Throw(expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ public class TreeMaker implements JCTree.Factory {
|
|||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JCThrow Throw(JCTree expr) {
|
public JCThrow Throw(JCExpression expr) {
|
||||||
JCThrow tree = new JCThrow(expr);
|
JCThrow tree = new JCThrow(expr);
|
||||||
tree.pos = pos;
|
tree.pos = pos;
|
||||||
return tree;
|
return tree;
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,6 +28,24 @@ package com.sun.tools.javac.util;
|
|||||||
/** Utility class for static conversion methods between numbers
|
/** Utility class for static conversion methods between numbers
|
||||||
* and strings in various formats.
|
* and strings in various formats.
|
||||||
*
|
*
|
||||||
|
* <p>Note regarding UTF-8.
|
||||||
|
* The JVMS defines its own version of the UTF-8 format so that it
|
||||||
|
* contains no zero bytes (modified UTF-8). This is not actually the same
|
||||||
|
* as Charset.forName("UTF-8").
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* See also:
|
||||||
|
* <ul>
|
||||||
|
* <li><a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.4.7">
|
||||||
|
* JVMS 4.4.7 </a></li>
|
||||||
|
* <li><a href="http://docs.oracle.com/javase/7/docs/api/java/io/DataInput.html#modified-utf-8">
|
||||||
|
java.io.DataInput: Modified UTF-8 </a></li>
|
||||||
|
<li><a href="https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8">
|
||||||
|
Modified UTF-8 (wikipedia) </a></li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* The methods here support modified UTF-8.
|
||||||
|
*
|
||||||
* <p><b>This is NOT part of any supported API.
|
* <p><b>This is NOT part of any supported API.
|
||||||
* If you write code that depends on this, you do so at your own risk.
|
* 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
|
* This code and its internal interfaces are subject to change or
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -125,8 +125,6 @@ public class UnsharedNameTable extends Name.Table {
|
|||||||
System.arraycopy(cs, start, bytes, 0, len);
|
System.arraycopy(cs, start, bytes, 0, len);
|
||||||
n = new NameImpl(this, bytes, index++);
|
n = new NameImpl(this, bytes, index++);
|
||||||
|
|
||||||
System.arraycopy(cs, start, n.bytes, 0, len);
|
|
||||||
|
|
||||||
HashEntry newEntry = new HashEntry(n);
|
HashEntry newEntry = new HashEntry(n);
|
||||||
|
|
||||||
if (previousNonNullTableEntry == null) { // We are not the first name with that hashCode.
|
if (previousNonNullTableEntry == null) { // We are not the first name with that hashCode.
|
||||||
|
@ -39,35 +39,76 @@ import javax.lang.model.type.*;
|
|||||||
* are on a <em>declaration</em>, whereas annotations on a type are on
|
* are on a <em>declaration</em>, whereas annotations on a type are on
|
||||||
* a specific <em>use</em> of a type name.
|
* a specific <em>use</em> of a type name.
|
||||||
*
|
*
|
||||||
* The terms <em>directly present</em> and <em>present</em> are used
|
* The terms <em>directly present</em>, <em>present</em>,
|
||||||
|
* <em>indirectly present</em>, and <em>associated </em> are used
|
||||||
* throughout this interface to describe precisely which annotations
|
* throughout this interface to describe precisely which annotations
|
||||||
* are returned by methods:
|
* are returned by the methods defined herein.
|
||||||
*
|
*
|
||||||
* <p>An annotation <i>A</i> is <em>directly present</em> on a
|
* <p>In the definitions below, an annotation <i>A</i> has an
|
||||||
* construct <i>E</i> if <i>E</i> is annotated, and:
|
* annotation type <i>AT</i>. If <i>AT</i> is a repeatable annotation
|
||||||
|
* type, the type of the containing annotation is <i>ATC</i>.
|
||||||
|
*
|
||||||
|
* <p>Annotation <i>A</i> is <em>directly present</em> on a construct
|
||||||
|
* <i>C</i> if either:
|
||||||
*
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
*
|
*
|
||||||
* <li> for an invocation of {@code getAnnotation(Class<T>)} or
|
* <li><i>A</i> is explicitly or implicitly declared as applying to
|
||||||
* {@code getAnnotationMirrors()}, <i>E</i>'s annotations contain <i>A</i>.
|
* the source code representation of <i>C</i>.
|
||||||
*
|
*
|
||||||
* <li> for an invocation of {@code getAnnotationsByType(Class<T>)},
|
* <p>Typically, if exactly one annotation of type <i>AT</i> appears in
|
||||||
* <i>E</i>'s annotations either contain <i>A</i> or, if the type of
|
* the source code of representation of <i>C</i>, then <i>A</i> is
|
||||||
* <i>A</i> is repeatable, contain exactly one annotation whose value
|
* explicitly declared as applying to <i>C</i>.
|
||||||
* element contains <i>A</i> and whose type is the containing
|
*
|
||||||
* annotation type of <i>A</i>'s type.
|
* If there are multiple annotations of type <i>AT</i> present on
|
||||||
|
* <i>C</i>, then if <i>AT</i> is repeatable annotation type, an
|
||||||
|
* annotation of type <i>ATC</i> is implicitly declared on <i>C</i>.
|
||||||
|
*
|
||||||
|
* <li> A representation of <i>A</i> appears in the executable output
|
||||||
|
* for <i>C</i>, such as the {@code RuntimeVisibleAnnotations} or
|
||||||
|
* {@code RuntimeVisibleParameterAnnotations} attributes of a class
|
||||||
|
* file.
|
||||||
*
|
*
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <p>An annotation A is <em>present</em> on a construct E if either:
|
* <p>An annotation <i>A</i> is <em>present</em> on a
|
||||||
|
* construct <i>C</i> if either:
|
||||||
|
* <ul>
|
||||||
|
*
|
||||||
|
* <li><i>A</i> is directly present on <i>C</i>.
|
||||||
|
*
|
||||||
|
* <li>No annotation of type <i>AT</i> is directly present on
|
||||||
|
* <i>C</i>, and <i>C</i> is a class and <i>AT</i> is inheritable
|
||||||
|
* and <i>A</i> is present on the superclass of <i>C</i>.
|
||||||
|
*
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* An annotation <i>A</i> is <em>indirectly present</em> on a construct
|
||||||
|
* <i>C</i> if both:
|
||||||
*
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li> <i>A</i> is <em>directly present</em> on <i>E</i>; or
|
|
||||||
*
|
*
|
||||||
* <li> <i>A</i> is not <em>directly present</em> on <i>E</i>, and
|
* <li><i>AT</i> is a repeatable annotation type with a containing
|
||||||
* <i>E</i> is an element representing a class, and <i>A</i>'s type
|
* annotation type <i>ATC</i>.
|
||||||
* is inheritable, and <i>A</i> is <em>present</em> on the element
|
*
|
||||||
* representing the superclass of <i>E</i>.
|
* <li>An annotation of type <i>ATC</i> is directly present on
|
||||||
|
* <i>C</i> and <i>A</i> is an annotation included in the result of
|
||||||
|
* calling the {@code value} method of the directly present annotation
|
||||||
|
* of type <i>ATC</i>.
|
||||||
|
*
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* An annotation <i>A</i> is <em>associated</em> with a construct
|
||||||
|
* <i>C</i> if either:
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
*
|
||||||
|
* <li> <i>A</i> is directly or indirectly present on <i>C</i>.
|
||||||
|
*
|
||||||
|
* <li> No annotation of type <i>AT</i> is directly or indirectly
|
||||||
|
* present on <i>C</i>, and <i>C</i> is a class, and <i>AT</i> is
|
||||||
|
* inheritable, and <i>A</i> is associated with the superclass of
|
||||||
|
* <i>C</i>.
|
||||||
*
|
*
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
@ -86,9 +127,8 @@ public interface AnnotatedConstruct {
|
|||||||
List<? extends AnnotationMirror> getAnnotationMirrors();
|
List<? extends AnnotationMirror> getAnnotationMirrors();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns this construct's annotation of the
|
* Returns this construct's annotation of the specified type if
|
||||||
* specified type if such an annotation is <em>present</em>, else {@code
|
* such an annotation is <em>present</em>, else {@code null}.
|
||||||
* null}.
|
|
||||||
*
|
*
|
||||||
* <p> The annotation returned by this method could contain an element
|
* <p> The annotation returned by this method could contain an element
|
||||||
* whose value is of type {@code Class}.
|
* whose value is of type {@code Class}.
|
||||||
@ -118,9 +158,8 @@ public interface AnnotatedConstruct {
|
|||||||
* @param <A> the annotation type
|
* @param <A> the annotation type
|
||||||
* @param annotationType the {@code Class} object corresponding to
|
* @param annotationType the {@code Class} object corresponding to
|
||||||
* the annotation type
|
* the annotation type
|
||||||
* @return this element's or type use's annotation for the
|
* @return this construct's annotation for the specified
|
||||||
* specified annotation type if present on this element, else
|
* annotation type if present, else {@code null}
|
||||||
* {@code null}
|
|
||||||
*
|
*
|
||||||
* @see #getAnnotationMirrors()
|
* @see #getAnnotationMirrors()
|
||||||
* @see java.lang.reflect.AnnotatedElement#getAnnotation
|
* @see java.lang.reflect.AnnotatedElement#getAnnotation
|
||||||
@ -134,10 +173,16 @@ public interface AnnotatedConstruct {
|
|||||||
<A extends Annotation> A getAnnotation(Class<A> annotationType);
|
<A extends Annotation> A getAnnotation(Class<A> annotationType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns annotations that are <em>present</em> on this construct.
|
* Returns annotations that are <em>associated</em> with this construct.
|
||||||
*
|
*
|
||||||
* If there are no annotations <em>present</em> on this construct,
|
* If there are no annotations associated with this construct, the
|
||||||
* the return value is an array of length 0.
|
* return value is an array of length 0.
|
||||||
|
*
|
||||||
|
* The order of annotations which are directly or indirectly
|
||||||
|
* present on a construct <i>C</i> is computed as if indirectly present
|
||||||
|
* annotations on <i>C</i> are directly present on <i>C</i> in place of their
|
||||||
|
* container annotation, in the order in which they appear in the
|
||||||
|
* value element of the container annotation.
|
||||||
*
|
*
|
||||||
* The difference between this method and {@link #getAnnotation(Class)}
|
* The difference between this method and {@link #getAnnotation(Class)}
|
||||||
* is that this method detects if its argument is a <em>repeatable
|
* is that this method detects if its argument is a <em>repeatable
|
||||||
@ -172,8 +217,8 @@ public interface AnnotatedConstruct {
|
|||||||
* @param <A> the annotation type
|
* @param <A> the annotation type
|
||||||
* @param annotationType the {@code Class} object corresponding to
|
* @param annotationType the {@code Class} object corresponding to
|
||||||
* the annotation type
|
* the annotation type
|
||||||
* @return this element's annotations for the specified annotation
|
* @return this construct's annotations for the specified annotation
|
||||||
* type if present on this element, else an empty array
|
* type if present on this construct, else an empty array
|
||||||
*
|
*
|
||||||
* @see #getAnnotationMirrors()
|
* @see #getAnnotationMirrors()
|
||||||
* @see #getAnnotation(java.lang.Class)
|
* @see #getAnnotation(java.lang.Class)
|
||||||
|
@ -143,12 +143,13 @@ public interface Elements {
|
|||||||
List<? extends Element> getAllMembers(TypeElement type);
|
List<? extends Element> getAllMembers(TypeElement type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all annotations of an element, whether
|
* Returns all annotations <i>present</i> on an element, whether
|
||||||
* inherited or directly present.
|
* directly present or present via inheritance.
|
||||||
*
|
*
|
||||||
* @param e the element being examined
|
* @param e the element being examined
|
||||||
* @return all annotations of the element
|
* @return all annotations of the element
|
||||||
* @see Element#getAnnotationMirrors
|
* @see Element#getAnnotationMirrors
|
||||||
|
* @see javax.lang.model.AnnotatedConstruct
|
||||||
*/
|
*/
|
||||||
List<? extends AnnotationMirror> getAllAnnotationMirrors(Element e);
|
List<? extends AnnotationMirror> getAllAnnotationMirrors(Element e);
|
||||||
|
|
||||||
|
@ -439,15 +439,11 @@ public class CoreReflectionFactory {
|
|||||||
ReflectionElement getGenericElement();
|
ReflectionElement getGenericElement();
|
||||||
|
|
||||||
// Functionality specific to the specialization
|
// Functionality specific to the specialization
|
||||||
|
/**
|
||||||
// Conceptually should have an override for getSource
|
* {@inheritDoc}
|
||||||
// returning GenericDeclaration, but GenericDeclaration
|
*/
|
||||||
// doesn't currently implement AnnotatedElement.
|
@Override
|
||||||
// /**
|
java.lang.reflect.TypeVariable<?> getSource();
|
||||||
// * {@inheritDoc}
|
|
||||||
// */
|
|
||||||
// @Override
|
|
||||||
// java.lang.reflect.GenericDeclaration getSource();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1296,8 +1292,8 @@ public class CoreReflectionFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AnnotatedElement getSource() {
|
public java.lang.reflect.TypeVariable<?> getSource() {
|
||||||
return (AnnotatedElement)source;
|
return sourceTypeVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected java.lang.reflect.TypeVariable<?> getSourceTypeVar() {
|
protected java.lang.reflect.TypeVariable<?> getSourceTypeVar() {
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -22,20 +22,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* @test
|
/* @test
|
||||||
* @bug 8004832
|
* @bug 8004832 8000103
|
||||||
* @summary Add new doclint package
|
* @summary Add new doclint package
|
||||||
* @bug 8000103
|
|
||||||
* @summary Create doclint utility
|
* @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.File;
|
||||||
import java.io.FilterOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.PrintStream;
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
@ -44,6 +37,9 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import com.sun.tools.doclint.DocLint;
|
||||||
|
import com.sun.tools.doclint.DocLint.BadArgs;
|
||||||
|
|
||||||
/** javadoc error on toplevel: a & b. */
|
/** javadoc error on toplevel: a & b. */
|
||||||
public class RunTest {
|
public class RunTest {
|
||||||
/** javadoc error on member: a < b */
|
/** javadoc error on member: a < b */
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -21,12 +21,6 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @test
|
|
||||||
* @bug 5045412 6627366
|
|
||||||
* @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Bar.java
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 5045412 6627366
|
* @bug 5045412 6627366
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,11 +25,6 @@
|
|||||||
* @test
|
* @test
|
||||||
* @bug 5045412 6627366
|
* @bug 5045412 6627366
|
||||||
* @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Foo.java
|
* @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Foo.java
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @test
|
|
||||||
* @bug 5045412 6627366
|
|
||||||
* @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Foo.java Bar.java
|
* @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Foo.java Bar.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -8,5 +8,5 @@
|
|||||||
* the method has the same name, it does not override.
|
* the method has the same name, it does not override.
|
||||||
* @author turnidge
|
* @author turnidge
|
||||||
*
|
*
|
||||||
* @compile/fail -nowrite one/Parent.java two/Child.java
|
* @compile/fail one/Parent.java two/Child.java
|
||||||
*/
|
*/
|
@ -5,6 +5,6 @@
|
|||||||
* compiler as ambigous.
|
* compiler as ambigous.
|
||||||
* @author turnidge
|
* @author turnidge
|
||||||
*
|
*
|
||||||
* @compile -nowrite one/Parent.java two/Child.java
|
* @compile one/Parent.java two/Child.java
|
||||||
* @compile -nowrite one/Parent2.java two/Child2.java
|
* @compile/fail one/Parent2.java two/Child2.java
|
||||||
*/
|
*/
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,9 +28,7 @@ interface I {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class Child2 extends one.Parent2 implements I {
|
public class Child2 extends one.Parent2 implements I {
|
||||||
class inner {
|
|
||||||
void method() {
|
void method() {
|
||||||
System.out.println(i);
|
System.out.println(i);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 7053059
|
||||||
|
* @summary VerifyError with double Assignment using a Generic Member of a Superclass
|
||||||
|
* @run main VerifyErrorWithDoubleAssignmentTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class VerifyErrorWithDoubleAssignmentTest {
|
||||||
|
|
||||||
|
static class A<D> {
|
||||||
|
D d;
|
||||||
|
|
||||||
|
D getD() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class B extends A<Integer> {
|
||||||
|
Integer y;
|
||||||
|
B() {
|
||||||
|
y = d = getD();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new B();
|
||||||
|
}
|
||||||
|
}
|
@ -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 { }
|
||||||
|
}
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -296,7 +296,10 @@ class Example implements Comparable<Example> {
|
|||||||
private Set<String> actualKeys;
|
private Set<String> actualKeys;
|
||||||
private Set<String> declaredKeys;
|
private Set<String> declaredKeys;
|
||||||
|
|
||||||
static File tempDir = new File(System.getProperty("java.io.tmpdir"));
|
static File tempDir = (System.getProperty("test.src") != null) ?
|
||||||
|
new File(System.getProperty("user.dir")):
|
||||||
|
new File(System.getProperty("java.io.tmpdir"));
|
||||||
|
|
||||||
static void setTempDir(File tempDir) {
|
static void setTempDir(File tempDir) {
|
||||||
Example.tempDir = tempDir;
|
Example.tempDir = tempDir;
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 7115052
|
* @bug 7115052 8003280 8006694
|
||||||
* @bug 8003280 8006694
|
|
||||||
* @summary Add lambda tests
|
* @summary Add lambda tests
|
||||||
* Add parser support for method references
|
* Add parser support for method references
|
||||||
* temporarily workaround combo tests are causing time out in several platforms
|
* temporarily workaround combo tests are causing time out in several platforms
|
||||||
|
47
langtools/test/tools/javac/lambda/TargetType73.java
Normal file
47
langtools/test/tools/javac/lambda/TargetType73.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8014494
|
||||||
|
* @summary javac crashes when varargs element of a method reference is inferred from the context
|
||||||
|
* @compile TargetType73.java
|
||||||
|
*/
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class TargetType73 {
|
||||||
|
|
||||||
|
interface Function<X,Y> {
|
||||||
|
Y m(X x);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test() {
|
||||||
|
m(TargetType73::g);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> List<T> g(T... a) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <C> void m(Function<String, C> zipper) { }
|
||||||
|
}
|
@ -23,8 +23,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 7194586
|
* @bug 7194586 8003280 8006694 8010404
|
||||||
* @bug 8003280 8006694 8010404
|
|
||||||
* @summary Add lambda tests
|
* @summary Add lambda tests
|
||||||
* Add back-end support for invokedynamic
|
* Add back-end support for invokedynamic
|
||||||
* temporarily workaround combo tests are causing time out in several platforms
|
* temporarily workaround combo tests are causing time out in several platforms
|
||||||
@ -36,6 +35,16 @@
|
|||||||
// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
|
// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
|
||||||
// see JDK-8006746
|
// 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.MethodInvocationTree;
|
||||||
import com.sun.source.tree.MethodTree;
|
import com.sun.source.tree.MethodTree;
|
||||||
import com.sun.source.util.TaskEvent;
|
import com.sun.source.util.TaskEvent;
|
||||||
@ -63,16 +72,6 @@ import com.sun.tools.javac.tree.JCTree.JCIdent;
|
|||||||
import com.sun.tools.javac.util.Context;
|
import com.sun.tools.javac.util.Context;
|
||||||
import com.sun.tools.javac.util.Names;
|
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.*;
|
import static com.sun.tools.javac.jvm.ClassFile.*;
|
||||||
|
|
||||||
public class TestInvokeDynamic
|
public class TestInvokeDynamic
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,109 +29,19 @@
|
|||||||
* @bug 5047307
|
* @bug 5047307
|
||||||
* @summary javac -nowarn improperly suppresses JLS-mandated warnings
|
* @summary javac -nowarn improperly suppresses JLS-mandated warnings
|
||||||
* @compile/ref=Test1.out -XDrawDiagnostics A.java
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @compile/ref=Test5b.out -XDrawDiagnostics -Xlint:deprecation -Xmaxwarns 2 P.java Q.java
|
||||||
*/
|
*/
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,95 +29,17 @@
|
|||||||
* @bug 5047307
|
* @bug 5047307
|
||||||
* @summary javac -nowarn improperly suppresses JLS-mandated warnings
|
* @summary javac -nowarn improperly suppresses JLS-mandated warnings
|
||||||
* @compile/ref=Test1.out -XDrawDiagnostics A.java
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @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
|
* @compile/ref=Test4d.out -XDrawDiagnostics -nowarn -Xlint:unchecked -Xmaxwarns 3 A.java B.java
|
||||||
*/
|
*/
|
||||||
|
41
langtools/test/tools/javac/parser/8014643/T8014643.java
Normal file
41
langtools/test/tools/javac/parser/8014643/T8014643.java
Normal file
@ -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); }
|
||||||
|
}
|
||||||
|
}
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -123,47 +123,3 @@ public class Test {
|
|||||||
|
|
||||||
int errors;
|
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 {
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.processing.AbstractProcessor;
|
import javax.annotation.processing.AbstractProcessor;
|
||||||
@ -85,6 +86,7 @@ public class ResolveHarness implements javax.tools.DiagnosticListener<JavaFileOb
|
|||||||
Set<String> declaredKeys = new HashSet<>();
|
Set<String> declaredKeys = new HashSet<>();
|
||||||
List<Diagnostic<? extends JavaFileObject>> diags = new ArrayList<>();
|
List<Diagnostic<? extends JavaFileObject>> diags = new ArrayList<>();
|
||||||
List<ElementKey> seenCandidates = new ArrayList<>();
|
List<ElementKey> seenCandidates = new ArrayList<>();
|
||||||
|
Map<String, String> predefTranslationMap = new HashMap<>();
|
||||||
|
|
||||||
protected ResolveHarness(JavaFileObject jfo) {
|
protected ResolveHarness(JavaFileObject jfo) {
|
||||||
this.jfo = jfo;
|
this.jfo = jfo;
|
||||||
@ -93,12 +95,36 @@ public class ResolveHarness implements javax.tools.DiagnosticListener<JavaFileOb
|
|||||||
new VerboseDeferredInferenceNoteProcessor(),
|
new VerboseDeferredInferenceNoteProcessor(),
|
||||||
new ErrorProcessor()
|
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 {
|
protected void check() throws Exception {
|
||||||
String[] options = {
|
String[] options = {
|
||||||
"-XDshouldStopPolicy=ATTR",
|
"-XDshouldStopPolicy=ATTR",
|
||||||
"-XDverboseResolution=success,failure,applicable,inapplicable,deferred-inference"
|
"-XDverboseResolution=success,failure,applicable,inapplicable,deferred-inference,predef"
|
||||||
};
|
};
|
||||||
|
|
||||||
AbstractProcessor[] processors = { new ResolveCandidateFinder(), null };
|
AbstractProcessor[] processors = { new ResolveCandidateFinder(), null };
|
||||||
@ -223,7 +249,8 @@ public class ResolveHarness implements javax.tools.DiagnosticListener<JavaFileOb
|
|||||||
@Override
|
@Override
|
||||||
void process(Diagnostic<? extends JavaFileObject> diagnostic) {
|
void process(Diagnostic<? extends JavaFileObject> diagnostic) {
|
||||||
Element siteSym = getSiteSym(diagnostic);
|
Element siteSym = getSiteSym(diagnostic);
|
||||||
if (siteSym.getAnnotation(TraceResolve.class) == null) {
|
if (siteSym.getSimpleName().length() != 0 &&
|
||||||
|
siteSym.getAnnotation(TraceResolve.class) == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int candidateIdx = 0;
|
int candidateIdx = 0;
|
||||||
@ -307,7 +334,7 @@ public class ResolveHarness implements javax.tools.DiagnosticListener<JavaFileOb
|
|||||||
|
|
||||||
if (Arrays.asList(c.applicable()).contains(phase)) { //applicable
|
if (Arrays.asList(c.applicable()).contains(phase)) { //applicable
|
||||||
if (c.mostSpecific() != mostSpecific) {
|
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);
|
MethodType mtype = getSig(diagnostic);
|
||||||
if (mtype != null) {
|
if (mtype != null) {
|
||||||
@ -444,11 +471,21 @@ public class ResolveHarness implements javax.tools.DiagnosticListener<JavaFileOb
|
|||||||
|
|
||||||
String computeKey(Element e) {
|
String computeKey(Element e) {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
|
if (predefTranslationMap.containsKey(e.getSimpleName().toString())) {
|
||||||
|
//predef element
|
||||||
|
buf.append("<predef>.");
|
||||||
|
String replacedName = predefTranslationMap.get(e.getSimpleName().toString());
|
||||||
|
buf.append(e.toString().replace(e.getSimpleName().toString(), replacedName));
|
||||||
|
} else if (e.getSimpleName().toString().startsWith("_")) {
|
||||||
|
buf.append("<predef>.");
|
||||||
|
buf.append(e.toString());
|
||||||
|
} else {
|
||||||
while (e != null) {
|
while (e != null) {
|
||||||
buf.append(e.toString());
|
buf.append(e.toString());
|
||||||
e = e.getEnclosingElement();
|
e = e.getEnclosingElement();
|
||||||
}
|
}
|
||||||
buf.append(jfo.getName());
|
buf.append(jfo.getName());
|
||||||
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user