This commit is contained in:
Lana Steuck 2013-08-23 14:17:49 -07:00
commit 83b39d45ac
74 changed files with 1311 additions and 419 deletions
langtools
src/share/classes
test

@ -25,7 +25,7 @@
package com.sun.source.tree;
import java.util.List;
import com.sun.tools.javac.util.List;
/**
* A tree node for an expression to create a new instance of an array.
@ -48,4 +48,6 @@ public interface NewArrayTree extends ExpressionTree {
Tree getType();
List<? extends ExpressionTree> getDimensions();
List<? extends ExpressionTree> getInitializers();
List<? extends AnnotationTree> getAnnotations();
List<? extends List<? extends AnnotationTree>> getDimAnnotations();
}

@ -285,6 +285,10 @@ public class TreeScanner<R,P> implements TreeVisitor<R,P> {
R r = scan(node.getType(), p);
r = scanAndReduce(node.getDimensions(), p, r);
r = scanAndReduce(node.getInitializers(), p, r);
r = scanAndReduce(node.getAnnotations(), p, r);
for (Iterable< ? extends Tree> dimAnno : node.getDimAnnotations()) {
r = scanAndReduce(dimAnno, p, r);
}
return r;
}

@ -159,10 +159,7 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
body.addContent(div);
if (configuration.showProfiles) {
Content profileSummary = configuration.getResource("doclet.Profiles");
Content profilesTableSummary = configuration.getResource("doclet.Member_Table_Summary",
configuration.getResource("doclet.Profile_Summary"),
configuration.getResource("doclet.profiles"));
addProfilesList(profileSummary, profilesTableSummary, body);
addProfilesList(profileSummary, body);
}
addPackagesList(packages, text, tableSummary, body);
}
@ -214,10 +211,8 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
* Do nothing. This will be overridden.
*
* @param profileSummary the profile summary heading
* @param profilesTableSummary the profiles table summary information
* @param body the content tree to which the profiles list will be added
*/
protected void addProfilesList(Content profileSummary, Content profilesTableSummary,
Content body) {
protected void addProfilesList(Content profileSummary, Content body) {
}
}

@ -25,8 +25,16 @@
package com.sun.tools.doclets.formats.html;
import java.io.*;
import java.util.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*;
@ -95,7 +103,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
super(configuration, filename);
this.classdoc = classdoc;
if (mapper.classToPackageAnnotations.containsKey(classdoc.qualifiedName()))
pkgToPackageAnnotations = new HashSet<PackageDoc>(mapper.classToPackageAnnotations.get(classdoc.qualifiedName()));
pkgToPackageAnnotations = new TreeSet<PackageDoc>(mapper.classToPackageAnnotations.get(classdoc.qualifiedName()));
configuration.currentcd = classdoc;
this.pkgSet = new TreeSet<PackageDoc>();
this.pkgToClassTypeParameter = pkgDivide(mapper.classToClassTypeParam);

@ -109,7 +109,7 @@ public class LinkFactoryImpl extends LinkFactory {
}
}
// Can't link so just write label.
link.addContent(label.toString());
link.addContent(label);
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
link.addContent(getTypeParameterLinks(linkInfo));
}

@ -123,15 +123,20 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
/**
* {@inheritDoc}
*/
protected void addProfilesList(Content profileSummary, String profilesTableSummary,
Content body) {
Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, profilesTableSummary,
getTableCaption(profileSummary));
table.addContent(getSummaryTableHeader(profileTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
addProfilesList(tbody);
table.addContent(tbody);
Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
protected void addProfilesList(Content profileSummary, Content body) {
Content h2 = HtmlTree.HEADING(HtmlTag.H2, profileSummary);
Content profilesDiv = HtmlTree.DIV(h2);
Content ul = new HtmlTree(HtmlTag.UL);
String profileName;
for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
profileName = Profile.lookup(i).name;
Content profileLinkContent = getTargetProfileLink("classFrame",
new StringContent(profileName), profileName);
Content li = HtmlTree.LI(profileLinkContent);
ul.addContent(li);
}
profilesDiv.addContent(ul);
Content div = HtmlTree.DIV(HtmlStyle.contentContainer, profilesDiv);
body.addContent(div);
}
@ -150,31 +155,6 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
body.addContent(div);
}
/**
* Adds list of profiles in the index table. Generate link to each profile.
*
* @param tbody the documentation tree to which the list will be added
*/
protected void addProfilesList(Content tbody) {
for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
String profileName = Profile.lookup(i).name;
Content profileLinkContent = getTargetProfileLink("classFrame",
new StringContent(profileName), profileName);
Content tdProfile = HtmlTree.TD(HtmlStyle.colFirst, profileLinkContent);
HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
tdSummary.addStyle(HtmlStyle.colLast);
tdSummary.addContent(getSpace());
HtmlTree tr = HtmlTree.TR(tdProfile);
tr.addContent(tdSummary);
if (i % 2 == 0) {
tr.addStyle(HtmlStyle.altColor);
} else {
tr.addStyle(HtmlStyle.rowColor);
}
tbody.addContent(tr);
}
}
/**
* Adds list of packages in the index table. Generate link to each package.
*

@ -25,6 +25,8 @@
package com.sun.tools.doclets.formats.html.markup;
import java.util.Locale;
/**
* Enum representing HTML tags.
*
@ -115,7 +117,7 @@ public enum HtmlTag {
HtmlTag(BlockType blockType, EndTag endTag ) {
this.blockType = blockType;
this.endTag = endTag;
this.value = name().toLowerCase();
this.value = name().toLowerCase(Locale.US);
}
/**

@ -70,6 +70,7 @@ public class StringContent extends Content {
* DocletAbortException because it
* is not supported.
*/
@Override
public void addContent(Content content) {
throw new DocletAbortException();
}
@ -80,6 +81,7 @@ public class StringContent extends Content {
*
* @param strContent string content to be added
*/
@Override
public void addContent(String strContent) {
appendChars(strContent);
}
@ -87,10 +89,12 @@ public class StringContent extends Content {
/**
* {@inheritDoc}
*/
@Override
public boolean isEmpty() {
return (stringContent.length() == 0);
}
@Override
public int charCount() {
return RawHtml.charCount(stringContent.toString());
}
@ -98,6 +102,7 @@ public class StringContent extends Content {
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return stringContent.toString();
}

@ -176,25 +176,32 @@ doclet.Value=Value
doclet.0_and_1={0} and {1}
#Documentation for Enums
doclet.enum_values_doc=\n\
doclet.enum_values_doc.main=\n\
Returns an array containing the constants of this enum type, in\n\
the order they are declared. This method may be used to iterate\n\
over the constants as follows:\n\
<pre>\n\
for ({0} c : {0}.values())\n\
&nbsp; System.out.println(c);\n\
</pre>\n\
@return an array containing the constants of this enum type, in\n\
the order they are declared
</pre>
doclet.enum_valueof_doc=\n\
doclet.enum_values_doc.return=\n\
an array containing the constants of this enum type, in the order they are declared
doclet.enum_valueof_doc.main=\n\
Returns the enum constant of this type with the specified name.\n\
The string must match <i>exactly</i> an identifier used to declare an\n\
enum constant in this type. (Extraneous whitespace characters are \n\
not permitted.)\n\
\n\
@param name the name of the enum constant to be returned.\n\
@return the enum constant with the specified name\n\
@throws IllegalArgumentException if this enum type has no constant\n\
with the specified name\n\
@throws NullPointerException if the argument is null
not permitted.)
doclet.enum_valueof_doc.param_name=\
the name of the enum constant to be returned.
doclet.enum_valueof_doc.return=\
the enum constant with the specified name
doclet.enum_valueof_doc.throws_ila=\
if this enum type has no constant with the specified name
doclet.enum_valueof_doc.throws_npe=\
if the argument is null

@ -667,16 +667,28 @@ public class Util {
for (int j = 0; j < methods.length; j++) {
MethodDoc currentMethod = methods[j];
if (currentMethod.name().equals("values") &&
currentMethod.parameters().length == 0) {
currentMethod.setRawCommentText(
configuration.getText("doclet.enum_values_doc", classDoc.name()));
currentMethod.parameters().length == 0) {
StringBuilder sb = new StringBuilder();
sb.append(configuration.getText("doclet.enum_values_doc.main", classDoc.name()));
sb.append("\n@return ");
sb.append(configuration.getText("doclet.enum_values_doc.return"));
currentMethod.setRawCommentText(sb.toString());
} else if (currentMethod.name().equals("valueOf") &&
currentMethod.parameters().length == 1) {
currentMethod.parameters().length == 1) {
Type paramType = currentMethod.parameters()[0].type();
if (paramType != null &&
paramType.qualifiedTypeName().equals(String.class.getName())) {
currentMethod.setRawCommentText(
configuration.getText("doclet.enum_valueof_doc"));
paramType.qualifiedTypeName().equals(String.class.getName())) {
StringBuilder sb = new StringBuilder();
sb.append(configuration.getText("doclet.enum_valueof_doc.main", classDoc.name()));
sb.append("\n@param name ");
sb.append(configuration.getText("doclet.enum_valueof_doc.param_name"));
sb.append("\n@return ");
sb.append(configuration.getText("doclet.enum_valueof_doc.return"));
sb.append("\n@throws IllegalArgumentException ");
sb.append(configuration.getText("doclet.enum_valueof_doc.throws_ila"));
sb.append("\n@throws NullPointerException ");
sb.append(configuration.getText("doclet.enum_valueof_doc.throws_npe"));
currentMethod.setRawCommentText(sb.toString());
}
}
}

@ -30,6 +30,7 @@ import java.util.Collections;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.lang.model.element.Name;
@ -345,7 +346,7 @@ public enum HtmlTag {
WIDTH;
public String getText() {
return name().toLowerCase();
return toLowerCase(name());
}
static final Map<String,Attr> index = new HashMap<String,Attr>();
@ -424,11 +425,11 @@ public enum HtmlTag {
}
public String getText() {
return name().toLowerCase();
return toLowerCase(name());
}
public Attr getAttr(Name attrName) {
return Attr.index.get(attrName.toString().toLowerCase());
return Attr.index.get(toLowerCase(attrName.toString()));
}
public AttrKind getAttrKind(Name attrName) {
@ -450,6 +451,10 @@ public enum HtmlTag {
}
static HtmlTag get(Name tagName) {
return index.get(tagName.toString().toLowerCase());
return index.get(toLowerCase(tagName.toString()));
}
private static String toLowerCase(String s) {
return s.toLowerCase(Locale.US);
}
}

@ -340,6 +340,14 @@ public abstract class Attribute implements AnnotationValue {
}
}
public static class UnresolvedClass extends Error {
public Type classType;
public UnresolvedClass(Type type, Type classType) {
super(type);
this.classType = classType;
}
}
/** A visitor type for dynamic dispatch on the kind of attribute value. */
public static interface Visitor {
void visitConstant(Attribute.Constant value);

@ -199,7 +199,7 @@ public class Scope {
}
public void enter(Symbol sym, Scope s) {
enter(sym, s, s);
enter(sym, s, s, false);
}
/**
@ -207,7 +207,7 @@ public class Scope {
* given scope `s' accessed through `origin'. The last two
* arguments are only used in import scopes.
*/
public void enter(Symbol sym, Scope s, Scope origin) {
public void enter(Symbol sym, Scope s, Scope origin, boolean staticallyImported) {
Assert.check(shared == 0);
if (nelems * 3 >= hashMask * 2)
dble();
@ -217,7 +217,7 @@ public class Scope {
old = sentinel;
nelems++;
}
Entry e = makeEntry(sym, old, elems, s, origin);
Entry e = makeEntry(sym, old, elems, s, origin, staticallyImported);
table[hash] = e;
elems = e;
@ -227,7 +227,7 @@ public class Scope {
}
}
Entry makeEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope, Scope origin) {
Entry makeEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope, Scope origin, boolean staticallyImported) {
return new Entry(sym, shadowed, sibling, scope);
}
@ -499,6 +499,10 @@ public class Scope {
else return shadowed.next(sf);
}
public boolean isStaticallyImported() {
return false;
}
public Scope getOrigin() {
// The origin is only recorded for import scopes. For all
// other scope entries, the "enclosing" type is available
@ -517,20 +521,19 @@ public class Scope {
}
@Override
Entry makeEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope, Scope origin) {
return new ImportEntry(sym, shadowed, sibling, scope, origin);
}
Entry makeEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope,
final Scope origin, final boolean staticallyImported) {
return new Entry(sym, shadowed, sibling, scope) {
@Override
public Scope getOrigin() {
return origin;
}
static class ImportEntry extends Entry {
private Scope origin;
ImportEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope, Scope origin) {
super(sym, shadowed, sibling, scope);
this.origin = origin;
}
@Override
public Scope getOrigin() { return origin; }
@Override
public boolean isStaticallyImported() {
return staticallyImported;
}
};
}
}
@ -724,7 +727,7 @@ public class Scope {
}
@Override
public void enter(Symbol sym, Scope s, Scope origin) {
public void enter(Symbol sym, Scope s, Scope origin, boolean staticallyImported) {
throw new UnsupportedOperationException();
}

@ -463,26 +463,34 @@ public abstract class Symbol implements Element {
return false;
}
/** Check for hiding. Note that this doesn't handle multiple
* (interface) inheritance. */
private boolean hiddenIn(ClassSymbol clazz, Types types) {
if (kind == MTH && (flags() & STATIC) == 0) return false;
while (true) {
if (owner == clazz) return false;
Scope.Entry e = clazz.members().lookup(name);
while (e.scope != null) {
if (e.sym == this) return false;
if (e.sym.kind == kind &&
Symbol sym = hiddenInInternal(clazz, types);
return sym != null && sym != this;
}
private Symbol hiddenInInternal(ClassSymbol c, Types types) {
Scope.Entry e = c.members().lookup(name);
while (e.scope != null) {
if (e.sym.kind == kind &&
(kind != MTH ||
(e.sym.flags() & STATIC) != 0 &&
types.isSubSignature(e.sym.type, type)))
return true;
e = e.next();
(e.sym.flags() & STATIC) != 0 &&
types.isSubSignature(e.sym.type, type))) {
return e.sym;
}
Type superType = types.supertype(clazz.type);
if (!superType.hasTag(CLASS)) return false;
clazz = (ClassSymbol)superType.tsym;
e = e.next();
}
List<Symbol> hiddenSyms = List.nil();
for (Type st : types.interfaces(c.type).prepend(types.supertype(c.type))) {
if (st != null && (st.hasTag(CLASS))) {
Symbol sym = hiddenInInternal((ClassSymbol)st.tsym, types);
if (sym != null) {
hiddenSyms = hiddenSyms.prepend(hiddenInInternal((ClassSymbol)st.tsym, types));
}
}
}
return hiddenSyms.contains(this) ?
this :
(hiddenSyms.isEmpty() ? null : hiddenSyms.head);
}
/** Is this symbol inherited into a given class?

@ -1161,7 +1161,7 @@ public abstract class Type implements TypeMirror {
}
public boolean contains(Type elem) {
return elem == this || contains(argtypes, elem) || restype.contains(elem);
return elem == this || contains(argtypes, elem) || restype.contains(elem) || contains(thrown, elem);
}
public MethodType asMethodType() { return this; }
@ -1525,7 +1525,7 @@ public abstract class Type implements TypeMirror {
}
protected void addBound(InferenceBound ib, Type bound, Types types, boolean update) {
Type bound2 = toTypeVarMap.apply(bound);
Type bound2 = toTypeVarMap.apply(bound).baseType();
List<Type> prevBounds = bounds.get(ib);
for (Type b : prevBounds) {
//check for redundancy - use strict version of isSameType on tvars

@ -332,8 +332,20 @@ public class Annotate {
}
if (expected.tsym == syms.classType.tsym) {
Type result = attr.attribExpr(tree, env, expected);
if (result.isErroneous())
return new Attribute.Error(expected);
if (result.isErroneous()) {
// Does it look like a class literal?
if (TreeInfo.name(tree) == names._class) {
Name n = (((JCFieldAccess) tree).selected).type.tsym.flatName();
return new Attribute.UnresolvedClass(expected,
types.createErrorType(n,
syms.unknownSymbol, syms.classType));
} else {
return new Attribute.Error(expected);
}
}
// Class literals look like field accesses of a field named class
// at the tree level
if (TreeInfo.name(tree) != names._class) {
log.error(tree.pos(), "annotation.value.must.be.class.literal");
return new Attribute.Error(expected);

@ -398,7 +398,7 @@ public class Attr extends JCTree.Visitor {
@Override
public Symbol visitMemberSelect(MemberSelectTree node, Env<AttrContext> env) {
Symbol site = visit(node.getExpression(), env);
if (site.kind == ERR)
if (site.kind == ERR || site.kind == ABSENT_TYP)
return site;
Name name = (Name)node.getIdentifier();
if (site.kind == PCK) {
@ -2395,7 +2395,7 @@ public class Attr extends JCTree.Visitor {
ResultInfo bodyResultInfo = lambdaType.getReturnType() == Type.recoveryType ?
recoveryInfo :
new LambdaResultInfo(lambdaType.getReturnType(), funcContext);
new ResultInfo(VAL, lambdaType.getReturnType(), funcContext);
localEnv.info.returnResult = bodyResultInfo;
Log.DeferredDiagnosticHandler lambdaDeferredHandler = new Log.DeferredDiagnosticHandler(log);
@ -2602,35 +2602,12 @@ public class Attr extends JCTree.Visitor {
}
}
class LambdaResultInfo extends ResultInfo {
LambdaResultInfo(Type pt, CheckContext checkContext) {
super(VAL, pt, checkContext);
}
@Override
protected Type check(DiagnosticPosition pos, Type found) {
return super.check(pos, found.baseType());
}
@Override
protected ResultInfo dup(CheckContext newContext) {
return new LambdaResultInfo(pt, newContext);
}
@Override
protected ResultInfo dup(Type newPt) {
return new LambdaResultInfo(newPt, checkContext);
}
}
/**
* Lambda compatibility. Check that given return types, thrown types, parameter types
* are compatible with the expected functional interface descriptor. This means that:
* (i) parameter types must be identical to those of the target descriptor; (ii) return
* types must be compatible with the return type of the expected descriptor;
* (iii) thrown types must be 'included' in the thrown types list of the expected
* descriptor.
* (iii) finish inference of thrown types if required.
*/
private void checkLambdaCompatible(JCLambda tree, Type descriptor, CheckContext checkContext, boolean speculativeAttr) {
Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType());
@ -2652,9 +2629,7 @@ public class Attr extends JCTree.Visitor {
if (!speculativeAttr) {
List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes());
if (chk.unhandled(tree.inferredThrownTypes == null ? List.<Type>nil() : tree.inferredThrownTypes, thrownTypes).nonEmpty()) {
log.error(tree, "incompatible.thrown.types.in.lambda", tree.inferredThrownTypes);
}
chk.unhandled(tree.inferredThrownTypes == null ? List.<Type>nil() : tree.inferredThrownTypes, thrownTypes);
}
}

@ -875,19 +875,23 @@ public class Check {
}
Type owntype = mtype;
List<Type> formals = owntype.getParameterTypes();
List<Type> nonInferred = sym.type.getParameterTypes();
if (nonInferred.length() != formals.length()) nonInferred = formals;
Type last = useVarargs ? formals.last() : null;
if (sym.name == names.init &&
sym.owner == syms.enumSym)
formals = formals.tail.tail;
if (sym.name == names.init && sym.owner == syms.enumSym) {
formals = formals.tail.tail;
nonInferred = nonInferred.tail.tail;
}
List<JCExpression> args = argtrees;
if (args != null) {
//this is null when type-checking a method reference
while (formals.head != last) {
JCTree arg = args.head;
Warner warn = convertWarner(arg.pos(), arg.type, formals.head);
Warner warn = convertWarner(arg.pos(), arg.type, nonInferred.head);
assertConvertible(arg, arg.type, formals.head, warn);
args = args.tail;
formals = formals.tail;
nonInferred = nonInferred.tail;
}
if (useVarargs) {
Type varArg = types.elemtype(last);
@ -903,17 +907,17 @@ public class Check {
Type varParam = owntype.getParameterTypes().last();
Type lastArg = argtypes.last();
if (types.isSubtypeUnchecked(lastArg, types.elemtype(varParam)) &&
!types.isSameType(types.erasure(varParam), types.erasure(lastArg)))
!types.isSameType(types.erasure(varParam), types.erasure(lastArg)))
log.warning(argtrees.last().pos(), "inexact.non-varargs.call",
types.elemtype(varParam), varParam);
types.elemtype(varParam), varParam);
}
}
if (useVarargs) {
Type argtype = owntype.getParameterTypes().last();
if (!types.isReifiable(argtype) &&
(!allowSimplifiedVarargs ||
sym.attribute(syms.trustMeType.tsym) == null ||
!isTrustMeAllowedOnMethod(sym))) {
(!allowSimplifiedVarargs ||
sym.attribute(syms.trustMeType.tsym) == null ||
!isTrustMeAllowedOnMethod(sym))) {
warnUnchecked(env.tree.pos(),
"unchecked.generic.array.creation",
argtype);
@ -929,15 +933,15 @@ public class Check {
return owntype;
}
//where
private void assertConvertible(JCTree tree, Type actual, Type formal, Warner warn) {
if (types.isConvertible(actual, formal, warn))
return;
private void assertConvertible(JCTree tree, Type actual, Type formal, Warner warn) {
if (types.isConvertible(actual, formal, warn))
return;
if (formal.isCompound()
&& types.isSubtype(actual, types.supertype(formal))
&& types.isSubtypeUnchecked(actual, types.interfaces(formal), warn))
return;
}
if (formal.isCompound()
&& types.isSubtype(actual, types.supertype(formal))
&& types.isSubtypeUnchecked(actual, types.interfaces(formal), warn))
return;
}
/**
* Check that type 't' is a valid instantiation of a generic class
@ -1747,7 +1751,7 @@ public class Check {
if (!sup.hasTag(CLASS)) return;
for (Type t1 = sup;
t1.tsym.type.isParameterized();
t1.hasTag(CLASS) && t1.tsym.type.isParameterized();
t1 = types.supertype(t1)) {
for (Scope.Entry e1 = t1.tsym.members().elems;
e1 != null;
@ -3329,14 +3333,15 @@ public class Check {
boolean isClassDecl = e.scope == s;
if ((isClassDecl || sym != e.sym) &&
sym.kind == e.sym.kind &&
sym.name != names.error) {
sym.name != names.error &&
(!staticImport || !e.isStaticallyImported())) {
if (!e.sym.type.isErroneous()) {
String what = e.sym.toString();
if (!isClassDecl) {
if (staticImport)
log.error(pos, "already.defined.static.single.import", what);
else
log.error(pos, "already.defined.single.import", what);
log.error(pos, "already.defined.single.import", what);
}
else if (sym != e.sym)
log.error(pos, "already.defined.this.unit", what);

@ -291,7 +291,7 @@ public class Enter extends JCTree.Visitor {
if (tree.packageAnnotations.nonEmpty() || pkginfoOpt == PkgInfo.ALWAYS) {
if (isPkgInfo) {
addEnv = true;
} else {
} else if (tree.packageAnnotations.nonEmpty()){
log.error(tree.packageAnnotations.head.pos(),
"pkg.annotations.sb.in.package-info.java");
}

@ -224,7 +224,7 @@ public class Flow {
}
try {
new AliveAnalyzer().analyzeTree(env, that, make);
new FlowAnalyzer().analyzeTree(env, that, make);
new LambdaFlowAnalyzer().analyzeTree(env, that, make);
} finally {
if (!speculative) {
log.popDiagnosticHandler(diagHandler);
@ -1259,12 +1259,24 @@ public class Flow {
ListBuffer<FlowPendingExit> prevPending = pendingExits;
try {
pendingExits = ListBuffer.lb();
caught = List.of(syms.throwableType); //inhibit exception checking
caught = tree.getDescriptorType(types).getThrownTypes();
thrown = List.nil();
scan(tree.body);
tree.inferredThrownTypes = thrown;
}
finally {
List<FlowPendingExit> exits = pendingExits.toList();
pendingExits = new ListBuffer<FlowPendingExit>();
while (exits.nonEmpty()) {
FlowPendingExit exit = exits.head;
exits = exits.tail;
if (exit.thrown == null) {
Assert.check(exit.tree.hasTag(RETURN));
} else {
// uncaught throws will be reported later
pendingExits.append(exit);
}
}
errorUncaught();
} finally {
pendingExits = prevPending;
caught = prevCaught;
thrown = prevThrown;
@ -1302,6 +1314,33 @@ public class Flow {
}
}
/**
* Specialized pass that performs inference of thrown types for lambdas.
*/
class LambdaFlowAnalyzer extends FlowAnalyzer {
@Override
public void visitLambda(JCLambda tree) {
if (tree.type != null &&
tree.type.isErroneous()) {
return;
}
List<Type> prevCaught = caught;
List<Type> prevThrown = thrown;
ListBuffer<FlowPendingExit> prevPending = pendingExits;
try {
pendingExits = ListBuffer.lb();
caught = List.of(syms.throwableType);
thrown = List.nil();
scan(tree.body);
tree.inferredThrownTypes = thrown;
} finally {
pendingExits = prevPending;
caught = prevCaught;
thrown = prevThrown;
}
}
}
/**
* This pass implements (i) definite assignment analysis, which ensures that
* each variable is assigned when used and (ii) definite unassignment analysis,

@ -473,7 +473,7 @@ public class LambdaToMethod extends TreeTranslator {
//non-void to non-void conversion:
// return (TYPE)BODY;
JCExpression retExpr = transTypes.coerce(attrEnv, expr, restype);
return make.Block(0, List.<JCStatement>of(make.Return(retExpr)));
return make.at(retExpr).Block(0, List.<JCStatement>of(make.Return(retExpr)));
}
}

@ -356,22 +356,44 @@ public class Lower extends TreeTranslator {
}
}
ClassSymbol ownerToCopyFreeVarsFrom(ClassSymbol c) {
if (!c.isLocal()) {
return null;
}
Symbol currentOwner = c.owner;
while ((currentOwner.owner.kind & TYP) != 0 && currentOwner.isLocal()) {
currentOwner = currentOwner.owner;
}
if ((currentOwner.owner.kind & (VAR | MTH)) != 0 && c.isSubClass(currentOwner, types)) {
return (ClassSymbol)currentOwner;
}
return null;
}
/** Return the variables accessed from within a local class, which
* are declared in the local class' owner.
* (in reverse order of first access).
*/
List<VarSymbol> freevars(ClassSymbol c) {
List<VarSymbol> fvs = freevarCache.get(c);
if (fvs != null) {
return fvs;
}
if ((c.owner.kind & (VAR | MTH)) != 0) {
List<VarSymbol> fvs = freevarCache.get(c);
if (fvs == null) {
FreeVarCollector collector = new FreeVarCollector(c);
collector.scan(classDef(c));
fvs = collector.fvs;
freevarCache.put(c, fvs);
}
FreeVarCollector collector = new FreeVarCollector(c);
collector.scan(classDef(c));
fvs = collector.fvs;
freevarCache.put(c, fvs);
return fvs;
} else {
return List.nil();
ClassSymbol owner = ownerToCopyFreeVarsFrom(c);
if (owner != null) {
fvs = freevarCache.get(owner);
freevarCache.put(c, fvs);
return fvs;
} else {
return List.nil();
}
}
}
@ -1046,7 +1068,7 @@ public class Lower extends TreeTranslator {
boolean needsPrivateAccess(Symbol sym) {
if ((sym.flags() & PRIVATE) == 0 || sym.owner == currentClass) {
return false;
} else if (sym.name == names.init && (sym.owner.owner.kind & (VAR | MTH)) != 0) {
} else if (sym.name == names.init && sym.owner.isLocal()) {
// private constructor in local class: relax protection
sym.flags_field &= ~PRIVATE;
return false;
@ -2448,6 +2470,7 @@ public class Lower extends TreeTranslator {
tree.name = Convert.shortName(currentClass.flatName());
// Add this$n and free variables proxy definitions to class.
for (List<JCVariableDecl> l = fvdefs; l.nonEmpty(); l = l.tail) {
tree.defs = tree.defs.prepend(l.head);
enterSynthetic(tree.pos(), l.head.sym, currentClass.members());
@ -2670,8 +2693,7 @@ public class Lower extends TreeTranslator {
//where
private void visitMethodDefInternal(JCMethodDecl tree) {
if (tree.name == names.init &&
(currentClass.isInner() ||
(currentClass.owner.kind & (VAR | MTH)) != 0)) {
(currentClass.isInner() || currentClass.isLocal())) {
// We are seeing a constructor of an inner class.
MethodSymbol m = tree.sym;
@ -2818,7 +2840,7 @@ public class Lower extends TreeTranslator {
// If created class is local, add free variables after
// explicit constructor arguments.
if ((c.owner.kind & (VAR | MTH)) != 0) {
if (c.isLocal()) {
tree.args = tree.args.appendList(loadFreevars(tree.pos(), freevars(c)));
}
@ -2837,7 +2859,7 @@ public class Lower extends TreeTranslator {
if (tree.encl != null) {
thisArg = attr.makeNullCheck(translate(tree.encl));
thisArg.type = tree.encl.type;
} else if ((c.owner.kind & (MTH | VAR)) != 0) {
} else if (c.isLocal()) {
// local class
thisArg = makeThis(tree.pos(), c.type.getEnclosingType().tsym);
} else {
@ -2966,7 +2988,7 @@ public class Lower extends TreeTranslator {
// If we are calling a constructor of a local class, add
// free variables after explicit constructor arguments.
ClassSymbol c = (ClassSymbol)constructor.owner;
if ((c.owner.kind & (VAR | MTH)) != 0) {
if (c.isLocal()) {
tree.args = tree.args.appendList(loadFreevars(tree.pos(), freevars(c)));
}
@ -2994,7 +3016,7 @@ public class Lower extends TreeTranslator {
makeNullCheck(translate(((JCFieldAccess) tree.meth).selected));
tree.meth = make.Ident(constructor);
((JCIdent) tree.meth).name = methName;
} else if ((c.owner.kind & (MTH | VAR)) != 0 || methName == names._this){
} else if (c.isLocal() || methName == names._this){
// local class or this() call
thisArg = makeThis(tree.meth.pos(), c.type.getEnclosingType().tsym);
} else {
@ -3436,7 +3458,7 @@ public class Lower extends TreeTranslator {
eType,
List.<Type>nil());
VarSymbol itvar = new VarSymbol(0, names.fromString("i" + target.syntheticNameChar()),
types.erasure(iterator.type.getReturnType()),
types.erasure(types.asSuper(iterator.type.getReturnType(), syms.iteratorType.tsym)),
currentMethodSym);
JCStatement init = make.

@ -189,7 +189,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
staticImportAccessible(sym, packge) &&
sym.isMemberOf(origin, types) &&
!toScope.includes(sym))
toScope.enter(sym, fromScope, origin.members());
toScope.enter(sym, fromScope, origin.members(), true);
}
}
}.importFrom(tsym);
@ -217,7 +217,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
staticImportAccessible(sym, packge) &&
!toScope.includes(sym) &&
sym.isMemberOf(origin, types)) {
toScope.enter(sym, fromScope, origin.members());
toScope.enter(sym, fromScope, origin.members(), true);
}
}
}
@ -283,7 +283,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
staticImportAccessible(sym, packge) &&
sym.isMemberOf(origin, types) &&
chk.checkUniqueStaticImport(pos, sym, toScope))
toScope.enter(sym, sym.owner.members(), origin.members());
toScope.enter(sym, sym.owner.members(), origin.members(), true);
}
}
}.importFrom(tsym);
@ -313,9 +313,9 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
staticImportAccessible(sym, packge) &&
sym.isMemberOf(origin, types)) {
found = true;
if (sym.kind == MTH ||
sym.kind != TYP && chk.checkUniqueStaticImport(pos, sym, toScope))
toScope.enter(sym, sym.owner.members(), origin.members());
if (sym.kind != TYP) {
toScope.enter(sym, sym.owner.members(), origin.members(), true);
}
}
}
}

@ -1344,32 +1344,23 @@ public class Resolve {
if (bestSoFar.exists())
return bestSoFar;
Scope.Entry e = env.toplevel.namedImportScope.lookup(name);
for (; e.scope != null; e = e.next()) {
sym = e.sym;
Type origin = e.getOrigin().owner.type;
if (sym.kind == VAR) {
if (e.sym.owner.type != origin)
sym = sym.clone(e.getOrigin().owner);
return isAccessible(env, origin, sym)
? sym : new AccessError(env, origin, sym);
}
}
Symbol origin = null;
e = env.toplevel.starImportScope.lookup(name);
for (; e.scope != null; e = e.next()) {
sym = e.sym;
if (sym.kind != VAR)
continue;
// invariant: sym.kind == VAR
if (bestSoFar.kind < AMBIGUOUS && sym.owner != bestSoFar.owner)
return new AmbiguityError(bestSoFar, sym);
else if (bestSoFar.kind >= VAR) {
origin = e.getOrigin().owner;
bestSoFar = isAccessible(env, origin.type, sym)
? sym : new AccessError(env, origin.type, sym);
for (Scope sc : new Scope[] { env.toplevel.namedImportScope, env.toplevel.starImportScope }) {
Scope.Entry e = sc.lookup(name);
for (; e.scope != null; e = e.next()) {
sym = e.sym;
if (sym.kind != VAR)
continue;
// invariant: sym.kind == VAR
if (bestSoFar.kind < AMBIGUOUS && sym.owner != bestSoFar.owner)
return new AmbiguityError(bestSoFar, sym);
else if (bestSoFar.kind >= VAR) {
origin = e.getOrigin().owner;
bestSoFar = isAccessible(env, origin.type, sym)
? sym : new AccessError(env, origin.type, sym);
}
}
if (bestSoFar.exists()) break;
}
if (bestSoFar.kind == VAR && bestSoFar.owner.type != origin.type)
return bestSoFar.clone(origin);

@ -363,6 +363,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
throw new Abort();
}
source = Source.instance(context);
Target target = Target.instance(context);
attr = Attr.instance(context);
chk = Check.instance(context);
gen = Gen.instance(context);
@ -403,6 +404,8 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
}
}
checkForObsoleteOptions(target);
verboseCompilePolicy = options.isSet("verboseCompilePolicy");
if (attrParseOnly)
@ -432,6 +435,26 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
log.setDiagnosticFormatter(RichDiagnosticFormatter.instance(context));
}
private void checkForObsoleteOptions(Target target) {
// Unless lint checking on options is disabled, check for
// obsolete source and target options.
boolean obsoleteOptionFound = false;
if (options.isUnset(XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option)) {
if (source.compareTo(Source.JDK1_5) <= 0) {
log.warning(LintCategory.OPTIONS, "option.obsolete.source", source.name);
obsoleteOptionFound = true;
}
if (target.compareTo(Target.JDK1_5) <= 0) {
log.warning(LintCategory.OPTIONS, "option.obsolete.target", source.name);
obsoleteOptionFound = true;
}
if (obsoleteOptionFound)
log.warning(LintCategory.OPTIONS, "option.obsolete.suppression");
}
}
/* Switches:
*/

@ -262,6 +262,11 @@ public class Main {
}
}
if (options.get(PROFILE) != null && options.get(BOOTCLASSPATH) != null) {
error("err.profile.bootclasspath.conflict");
return null;
}
if (this.classnames != null && classNames != null) {
this.classnames.addAll(Arrays.asList(classNames));
}

@ -244,7 +244,10 @@ public class AnnotationProxyMaker {
}
public void visitError(Attribute.Error e) {
value = null; // indicates a type mismatch
if (e instanceof Attribute.UnresolvedClass)
value = new MirroredTypeExceptionProxy(((Attribute.UnresolvedClass)e).classType);
else
value = null; // indicates a type mismatch
}

@ -732,10 +732,6 @@ compiler.misc.incompatible.ret.type.in.mref=\
bad return type in method reference\n\
{0}
# 0: list of type
compiler.err.incompatible.thrown.types.in.lambda=\
incompatible thrown types {0} in lambda expression
# 0: list of type
compiler.err.incompatible.thrown.types.in.mref=\
incompatible thrown types {0} in method reference
@ -1444,6 +1440,17 @@ compiler.warn.static.not.qualified.by.type=\
compiler.warn.source.no.bootclasspath=\
bootstrap class path not set in conjunction with -source {0}
# 0: string
compiler.warn.option.obsolete.source=\
source value {0} is obsolete and will be removed in a future release
# 0: string
compiler.warn.option.obsolete.target=\
target value {0} is obsolete and will be removed in a future release
compiler.warn.option.obsolete.suppression=\
To suppress warnings about obsolete options, use -Xlint:-options.
# 0: name, 1: number, 2: number, 3: number, 4: number
compiler.warn.future.attr=\
{0} attribute introduced in version {1}.{2} class files is ignored in version {3}.{4} class files

@ -185,6 +185,8 @@ javac.err.invalid.A.key=\
key in annotation processor option ''{0}'' is not a dot-separated sequence of identifiers
javac.err.invalid.flag=\
invalid flag: {0}
javac.err.profile.bootclasspath.conflict=\
profile and bootclasspath options cannot be used together
javac.err.invalid.profile=\
invalid profile: {0}
javac.err.invalid.target=\

@ -645,7 +645,7 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
public List<Type> targets;
public Type getDescriptorType(Types types) {
return types.findDescriptorType(targets.head);
return targets.nonEmpty() ? types.findDescriptorType(targets.head) : types.createErrorType(null);
}
}
@ -1571,6 +1571,16 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
public Tag getTag() {
return NEWARRAY;
}
@Override
public List<JCAnnotation> getAnnotations() {
return annotations;
}
@Override
public List<List<JCAnnotation>> getDimAnnotations() {
return dimAnnotations;
}
}
/**

@ -269,6 +269,8 @@ public class Start extends ToolOption.Helper {
setDocletInvoker(docletClass, fileManager, argv);
compOpts = Options.instance(context);
// Make sure no obsolete source/target messages are reported
compOpts.put("-Xlint:-options", "-Xlint:-options");
// Parse arguments
for (int i = 0 ; i < argv.length ; i++) {

@ -808,7 +808,10 @@ public class JavacState
// Create a set of filenames with full paths.
for (Source s : now.sources().values()) {
calculatedSources.add(s.file().getPath());
// Don't include link only sources when comparing sources to compile
if (!s.isLinkedOnly()) {
calculatedSources.add(s.file().getPath());
}
}
// Read in the file and create another set of filenames with full paths.
try {

@ -249,16 +249,19 @@ public class Main {
return -1;
}
// Find all source files allowable for linking.
// Create a map of all source files that are available for linking. Both -src and
// -sourcepath point to such files. It is possible to specify multiple
// -sourcepath options to enable different filtering rules. If the
// filters are the same for multiple sourcepaths, they may be concatenated
// using :(;). Before sending the list of sourcepaths to javac, they are
// all concatenated. The list created here is used by the SmartFileWrapper to
// make sure only the correct sources are actually available.
// We might find more modules here as well.
Map<String,Source> sources_to_link_to = new HashMap<String,Source>();
// Always reuse -src for linking as well! This means that we might
// get two -sourcepath on the commandline after the rewrite, which is
// fine. We can have as many as we like. You need to have separate -src/-sourcepath/-classpath
// if you need different filtering rules for different roots. If you have the same filtering
// rules for all sourcepath roots, you can concatenate them using :(;) as before.
rewriteOptions(args, "-src", "-sourcepath");
findFiles(args, "-src", Util.set(".java"), sources_to_link_to, modules, current_module, true);
findFiles(args, "-sourcepath", Util.set(".java"), sources_to_link_to, modules, current_module, true);
// Rewrite the -src option to make it through to the javac instances.
rewriteOptions(args, "-src", "-sourcepath");
// Find all class files allowable for linking.
// And pickup knowledge of all modules found here.

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -251,8 +251,8 @@ public interface JavaCompiler extends Tool, OptionChecker {
* occurred in a user supplied component. The
* {@linkplain Throwable#getCause() cause} will be the error in
* user code.
* @throws IllegalArgumentException if any of the given
* compilation units are of other kind than
* @throws IllegalArgumentException if any of the options are invalid,
* or if any of the given compilation units are of other kind than
* {@linkplain JavaFileObject.Kind#SOURCE source}
*/
CompilationTask getTask(Writer out,

@ -23,7 +23,7 @@
/*
* @test
* @bug 8006124 8009684
* @bug 8006124 8009684 8016921
* @summary Test javadoc support for profiles.
* @author Bhavesh Patel
* @library ../lib/
@ -33,7 +33,7 @@
public class TestProfiles extends JavadocTester {
//Test information.
private static final String BUG_ID = "8006124-8009684";
private static final String BUG_ID = "8006124-8009684-8016921";
private static final String PROFILE_BUG_ID = BUG_ID + "-1";
private static final String PACKAGE_BUG_ID = BUG_ID + "-2";
//Javadoc arguments.
@ -105,6 +105,14 @@ public class TestProfiles extends JavadocTester {
{PROFILE_BUG_ID + FS + "index.html",
"<frame src=\"overview-frame.html\" name=\"packageListFrame\" " +
"title=\"All Packages\">"
},
//Test for "overview-summary.html" showing the profile list.
{PROFILE_BUG_ID + FS + "overview-summary.html",
"<ul>" + NL +"<li><a href=\"compact1-summary.html\" target=\"classFrame\">" +
"compact1</a></li>" + NL + "<li><a href=\"compact2-summary.html\" " +
"target=\"classFrame\">compact2</a></li>" + NL + "<li><a href=\"" +
"compact3-summary.html\" target=\"classFrame\">compact3</a></li>" + NL +
"</ul>"
}
};
private static final String[][] PROFILES_NEGATED_TEST = {
@ -159,6 +167,13 @@ public class TestProfiles extends JavadocTester {
},
{PACKAGE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
"<div class=\"subTitle\">compact1, compact2, compact3</div>"
},
{PACKAGE_BUG_ID + FS + "overview-summary.html",
"<ul>" + NL +"<li><a href=\"compact1-summary.html\" target=\"classFrame\">" +
"compact1</a></li>" + NL + "<li><a href=\"compact2-summary.html\" " +
"target=\"classFrame\">compact2</a></li>" + NL + "<li><a href=\"" +
"compact3-summary.html\" target=\"classFrame\">compact3</a></li>" + NL +
"</ul>"
}
};

@ -0,0 +1,80 @@
/*
* Copyright (c) 2002, 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 8017191
* @summary Javadoc is confused by at-link to imported classes outside of the set of generated packages
* @author jjg
* @library ../lib/
* @build JavadocTester TestSeeTag
* @run main TestSeeTag
*/
public class TestSeeTag extends JavadocTester {
//Test information.
private static final String BUG_ID = "8017191";
private static final String OUTPUT_DIR = BUG_ID;
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
};
//Input for string search tests.
private static final String[][] TEST = {
{ OUTPUT_DIR + FS + "pkg" + FS + "Test.html",
"<code>List</code>"
}
};
private static final String[][] NEGATED_TEST = {
{ OUTPUT_DIR + FS + "pkg" + FS + "Test.html",
"&lt;code&gt;List&lt;/code&gt;"
}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestSeeTag tester = new TestSeeTag();
run(tester, ARGS, TEST, NEGATED_TEST);
tester.printSummary();
}
/**
* {@inheritDoc}
*/
public String getBugId() {
return BUG_ID;
}
/**
* {@inheritDoc}
*/
public String getBugName() {
return getClass().getName();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* 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
@ -21,12 +21,9 @@
* questions.
*/
// key: compiler.err.incompatible.thrown.types.in.lambda
package pkg;
import java.util.List;
class IncompatibleThrownTypesInLambda {
interface SAM {
void m();
}
/** @see List */
public class Test { }
SAM s = ()-> { throw new Exception(); };
}

@ -1,2 +1,2 @@
Test.java:9:1: compiler.err.already.defined.static.single.import: f
Test.java:15:9: compiler.err.ref.ambiguous: f, kindname.variable, f, p1.A1, kindname.variable, f, p2.A2
1 error

@ -1,5 +1,5 @@
T6758789b.java:16:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a
T6758789b.java:16:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<java.lang.Object>
T6758789b.java:16:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X>
- compiler.err.warnings.and.werror
1 error
2 warnings

@ -0,0 +1,14 @@
/**
* @test /nodynamiccopyright/
* @bug 7182350
* @summary verify correct output of -Xlint:unchecked on methods with unchecked conversations in parameters
* @compile/ref=T7182350.out -XDrawDiagnostics -Xlint:unchecked T7182350.java
*/
import java.util.*;
class T7182350 {
public static void quicksort(Vector vector, Comparator compare) {
Collections.sort(vector,compare);
}
}

@ -0,0 +1,4 @@
T7182350.java:12:25: compiler.warn.unchecked.meth.invocation.applied: kindname.method, sort, java.util.List<T>,java.util.Comparator<? super T>, java.util.Vector,java.util.Comparator, kindname.class, java.util.Collections
T7182350.java:12:26: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.Vector, java.util.List<T>
T7182350.java:12:33: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.Comparator, java.util.Comparator<? super T>
3 warnings

@ -0,0 +1,66 @@
/*
* 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8009640
* @summary -profile <compact> does not work when -bootclasspath specified
* @library /tools/javac/lib
* @build ToolBox
* @run main CheckRejectProfileBCPOptionsIfUsedTogetherTest
*/
import com.sun.tools.javac.util.Assert;
import java.util.ArrayList;
import java.util.List;
public class CheckRejectProfileBCPOptionsIfUsedTogetherTest {
private static final String TestSrc =
"public class Test {\n" +
" javax.swing.JButton b;\n" +
"}";
public static void main(String args[]) throws Exception {
List<String> errOutput = new ArrayList<>();
String testJDK = ToolBox.jdkUnderTest;
ToolBox.createJavaFileFromSource(TestSrc);
ToolBox.AnyToolArgs javacParams =
new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
.appendArgs(ToolBox.javacBinary)
.appendArgs(ToolBox.testToolVMOpts)
.appendArgs("-profile", "compact1", "-bootclasspath",
testJDK + "/jre/lib/rt.jar", "Test.java")
.setErrOutput(errOutput);
ToolBox.executeCommand(javacParams);
Assert.check(errOutput.get(0).startsWith(
"javac: profile and bootclasspath options cannot be used together"),
"Incorrect javac error output");
}
}

@ -0,0 +1,85 @@
/*
* 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8013394
* @summary compile of iterator use fails with error "defined in an inaccessible class or interface"
* @library /tools/javac/lib
* @build ToolBox
* @run main CompileErrorWithIteratorTest
*/
public class CompileErrorWithIteratorTest {
private static final String TestCollectionSrc =
"package pkg;\n" +
"import java.util.Iterator;\n" +
"import java.util.NoSuchElementException;\n" +
"public class TestCollection<E> implements Iterable<E> {\n" +
" public testCollectionIterator iterator() {\n" +
" return new testCollectionIterator();\n" +
" }\n" +
" class testCollectionIterator implements Iterator<E> {\n" +
" public boolean hasNext() { return true; }\n" +
" public E next() throws NoSuchElementException\n" +
" {\n" +
" return null;\n" +
" }\n" +
" public void remove() {}\n" +
" }\n" +
"}";
private static final String TestSrc =
"import pkg.TestCollection;\n" +
"\n" +
"public class Test {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" TestCollection<String> tc1 = new TestCollection<String>();\n" +
" for (String s : tc1) {\n" +
" System.out.println(s);\n" +
" }\n" +
" }\n" +
"}";
public static void main(String args[]) throws Exception {
new CompileErrorWithIteratorTest().run();
}
void run() throws Exception {
compile();
}
void compile() throws Exception {
ToolBox.JavaToolArgs javacParams =
new ToolBox.JavaToolArgs()
.setSources(TestCollectionSrc, TestSrc);
ToolBox.javac(javacParams);
}
}

@ -0,0 +1,111 @@
/*
* 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8019486
* @summary javac, generates erroneous LVT for a test case with lambda code
* @library /tools/javac/lib
* @build ToolBox
* @run main WrongLVTForLambdaTest
*/
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 WrongLVTForLambdaTest {
static final String testSource =
/* 01 */ "import java.util.List;\n" +
/* 02 */ "import java.util.Arrays;\n" +
/* 03 */ "import java.util.stream.Collectors;\n" +
/* 04 */ "\n" +
/* 05 */ "public class Foo {\n" +
/* 06 */ " void bar(int value) {\n" +
/* 07 */ " final List<Integer> numbers = Arrays.asList(1, 2, 3);\n" +
/* 08 */ " final List<Integer> numbersPlusOne = \n" +
/* 09 */ " numbers.stream().map(number -> number / 1).collect(Collectors.toList());\n" +
/* 10 */ " }\n" +
/* 11 */ "}";
static final int[][] expectedLNT = {
// {line-number, start-pc},
{9, 0}, //number -> number / 1
};
static final String methodToLookFor = "lambda$0";
public static void main(String[] args) throws Exception {
new WrongLVTForLambdaTest().run();
}
void run() throws Exception {
compileTestClass();
checkClassFile(new File(Paths.get(System.getProperty("user.dir"),
"Foo.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,
"The LineNumberTable found has a length different to the expected one");
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, "The seek method was not found");
}
void error(String msg) {
throw new AssertionError(msg);
}
}

@ -0,0 +1,73 @@
/*
* 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 8022053
* @summary 8022053: javac generates unverifiable initializer for nested subclass of local class
* @run main UnverifiableInitForNestedLocalClassTest
*/
public class UnverifiableInitForNestedLocalClassTest {
public static void main(final String[] args) {
test("test");
}
static void test(final String arg) {
final String inlined = " inlined ";
class LocalClass {
String m() {
return "LocalClass " + arg + inlined;
}
class SubClass extends LocalClass {
@Override
String m() {
return "SubClass " + arg + inlined;
}
}
class SubSubClass extends SubClass {
@Override
String m() {
return "SubSubClass " + arg + inlined;
}
}
class AnotherLocal {
class AnotherSub extends LocalClass {
@Override
String m() {
return "AnotherSub " + arg + inlined;
}
}
}
}
System.out.println(new LocalClass().m());
System.out.println(new LocalClass().new SubClass().m());
System.out.println(new LocalClass().new SubSubClass().m());
System.out.println(new LocalClass().new AnotherLocal().new AnotherSub().m());
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,8 +23,10 @@
/*
* @test
* @bug 6960424
* @summary new option -Xpkginfo for better control of when package-info.class is generated
* @bug 6960424 8022161
* @summary new option -Xpkginfo for better control of when package-info.class
* is generated, also ensures no failures if package-info.java is
* not available.
*/
import java.io.*;
@ -43,8 +45,11 @@ public class TestPkgInfo {
public static void main(String... args) throws Exception {
new TestPkgInfo().run(args);
}
public void run(String... args) throws Exception {
testPositive();
testNoExceptions();
}
public void testPositive(String... args) throws Exception {
boolean[] booleanValues = { false, true };
for (OptKind ok: OptKind.values()) {
for (boolean sr: booleanValues) {
@ -65,6 +70,32 @@ public class TestPkgInfo {
throw new Exception(errors + " errors occurred");
}
/** this should throw no exceptions **/
void testNoExceptions() throws Exception {
count++;
System.err.println("Test " + count + ": ALWAYS nofile");
StringBuilder sb = new StringBuilder();
sb.append("package test; class Hello{}");
// test specific tmp directory
File tmpDir = new File("tmp.test" + count);
File classesDir = new File(tmpDir, "classes");
classesDir.mkdirs();
File javafile = new File(new File(tmpDir, "src"), "Hello.java");
writeFile(javafile, sb.toString());
// build up list of options and files to be compiled
List<String> opts = new ArrayList<>();
List<File> files = new ArrayList<>();
opts.add("-d");
opts.add(classesDir.getPath());
opts.add("-Xpkginfo:always");
files.add(javafile);
compile(opts, files);
}
void test(OptKind ok, boolean sr, boolean cr, boolean rr) throws Exception {
count++;
System.err.println("Test " + count + ": ok:" + ok + " sr:" + sr + " cr:" + cr + " rr:" + rr);
@ -91,15 +122,15 @@ public class TestPkgInfo {
writeFile(pkginfo_java, sb.toString());
// build up list of options and files to be compiled
List<String> opts = new ArrayList<String>();
List<File> files = new ArrayList<File>();
List<String> opts = new ArrayList<>();
List<File> files = new ArrayList<>();
opts.add("-d");
opts.add(classesDir.getPath());
if (ok.opt != null)
opts.add(ok.opt);
//opts.add("-verbose");
files.add(pkginfo_java);
files.add(pkginfo_java);
compile(opts, files);
@ -134,7 +165,7 @@ public class TestPkgInfo {
/** Compile files with options provided. */
void compile(List<String> opts, List<File> files) throws Exception {
System.err.println("javac: " + opts + " " + files);
List<String> args = new ArrayList<String>();
List<String> args = new ArrayList<>();
args.addAll(opts);
for (File f: files)
args.add(f.getPath());

@ -1,138 +0,0 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @ignore 8007517: DefaultMethodRegressionTests.java fail in TL
* @bug 8003639
* @summary convert lambda testng tests to jtreg and add them
* @run testng DefaultMethodRegressionTests
*/
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
/**
* This set of classes/interfaces (K/I/C) is specially designed to expose a
* bug in the JVM where it did not find some overloaded methods in some
* specific situations. (fixed by hotspot changeset ffb9316fd9ed)
*/
interface K {
int bbb(Long l);
}
interface I extends K {
default void aaa() {}
default void aab() {}
default void aac() {}
default int bbb(Integer i) { return 22; }
default int bbb(Float f) { return 33; }
default int bbb(Long l) { return 44; }
default int bbb(Double d) { return 55; }
default int bbb(String s) { return 66; }
default void caa() {}
default void cab() {}
default void cac() {}
}
class C implements I {}
public class DefaultMethodRegressionTests {
@Test(groups = "vm")
public void testLostOverloadedMethod() {
C c = new C();
assertEquals(c.bbb(new Integer(1)), 22);
assertEquals(c.bbb(new Float(1.1)), 33);
assertEquals(c.bbb(new Long(1L)), 44);
assertEquals(c.bbb(new Double(0.01)), 55);
assertEquals(c.bbb(new String("")), 66);
}
// Test to ensure that the inference verifier accepts older classfiles
// with classes that implement interfaces with defaults.
@Test(groups = "vm")
public void testInferenceVerifier() {
// interface I { int m() default { return 99; } }
byte I_bytes[] = {
(byte)0xca, (byte)0xfe, (byte)0xba, (byte)0xbe, 0x00, 0x00, 0x00, 0x33,
0x00, 0x08, 0x07, 0x00, 0x06, 0x07, 0x00, 0x07,
0x01, 0x00, 0x03, 0x66, 0x6f, 0x6f, 0x01, 0x00,
0x03, 0x28, 0x29, 0x49, 0x01, 0x00, 0x04, 0x43,
0x6f, 0x64, 0x65, 0x01, 0x00, 0x01, 0x49, 0x01,
0x00, 0x10, 0x6a, 0x61, 0x76, 0x61, 0x2f, 0x6c,
0x61, 0x6e, 0x67, 0x2f, 0x4f, 0x62, 0x6a, 0x65,
0x63, 0x74, 0x06, 0x00, 0x00, 0x01, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x01,
0x00, 0x03, 0x00, 0x04, 0x00, 0x01, 0x00, 0x05,
0x00, 0x00, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x01,
0x00, 0x00, 0x00, 0x03, 0x10, 0x63, (byte)0xac, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00
};
// public class C implements I {} /* -target 1.5 */
byte C_bytes[] = {
(byte)0xca, (byte)0xfe, (byte)0xba, (byte)0xbe, 0x00, 0x00, 0x00, 0x31,
0x00, 0x0c, 0x0a, 0x00, 0x03, 0x00, 0x08, 0x07,
0x00, 0x09, 0x07, 0x00, 0x0a, 0x07, 0x00, 0x0b,
0x01, 0x00, 0x06, 0x3c, 0x69, 0x6e, 0x69, 0x74,
0x3e, 0x01, 0x00, 0x03, 0x28, 0x29, 0x56, 0x01,
0x00, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x0c, 0x00,
0x05, 0x00, 0x06, 0x01, 0x00, 0x01, 0x43, 0x01,
0x00, 0x10, 0x6a, 0x61, 0x76, 0x61, 0x2f, 0x6c,
0x61, 0x6e, 0x67, 0x2f, 0x4f, 0x62, 0x6a, 0x65,
0x63, 0x74, 0x01, 0x00, 0x01, 0x49, 0x00, 0x21,
0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04,
0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x05,
0x00, 0x06, 0x00, 0x01, 0x00, 0x07, 0x00, 0x00,
0x00, 0x11, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
0x00, 0x05, 0x2a, (byte)0xb7, 0x00, 0x01, (byte)0xb1, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00
};
ClassLoader cl = new ClassLoader() {
protected Class<?> findClass(String name) {
if (name.equals("I")) {
return defineClass("I", I_bytes, 0, I_bytes.length);
} else if (name.equals("C")) {
return defineClass("C", C_bytes, 0, C_bytes.length);
} else {
return null;
}
}
};
try {
Class.forName("C", true, cl);
} catch (Exception e) {
// unmodified verifier will throw VerifyError
fail("No exception should be thrown");
}
}
}

@ -23,5 +23,5 @@
// key: compiler.err.already.defined.static.single.import
import static p.E1.A;
import p.E1.A;
import static p.E2.A;

@ -23,4 +23,6 @@
package p;
public enum E1 { A, B, C}
public class E1 {
public static class A { }
}

@ -23,4 +23,6 @@
package p;
public enum E2 { A, B, C }
public class E2 {
public static class A { }
}

@ -0,0 +1,32 @@
/*
* 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.
*/
// key: compiler.warn.option.obsolete.source
// key: compiler.warn.option.obsolete.target
// key: compiler.warn.option.obsolete.suppression
// key: compiler.warn.source.no.bootclasspath
// options: -source 1.5 -target 1.5
class ObsoleteSourceAndTarget {
public static void foo() {;}
}

@ -1,13 +1,13 @@
T7015430.java:42:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:42:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:51:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:51:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:51:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:69:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:69:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:78:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:78:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:78:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:105:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:105:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:105:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:114:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:114:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:42:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception

@ -1,15 +1,15 @@
T7015430.java:42:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:42:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:42:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:51:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:51:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:51:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:69:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:69:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:69:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:78:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:78:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:78:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:105:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:105:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:105:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:114:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:114:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:114:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:130:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
1 error
12 warnings

@ -1,6 +1,6 @@
T7151802.java:14:31: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get1, Z, T7151802.Foo, kindname.class, T7151802
T7151802.java:22:30: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get3, T7151802.Foo<Z>, T7151802.Foo, kindname.class, T7151802
T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.Object>
T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<Z>
T7151802.java:30:36: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get5, compiler.misc.no.args, compiler.misc.no.args, kindname.class, T7151802
T7151802.java:38:31: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get7, T7151802.Foo<java.lang.String>, T7151802.Foo, kindname.class, T7151802
T7151802.java:38:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.String>

@ -1,10 +1,11 @@
/*
* @test /nodynamiccopyright/
* @bug 8016640
* @bug 8016640 8022508
* @summary compiler hangs if the generics arity of a base class is wrong
* @compile/fail/ref=T8016640.out -XDrawDiagnostics T8016640.java
*/
class T8016640 {
static class Foo<X,Y> { }
static class BadFoo<T> extends Foo<T> { }
static class SubBadFoo<T> extends BadFoo<T> { }
}

@ -1,3 +1,3 @@
T6718364.java:13:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6718364.X<T>,T, T6718364.X<T6718364.X<java.lang.Integer>>,T6718364.X, kindname.class, T6718364
T6718364.java:13:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6718364.X, T6718364.X<java.lang.Integer>
T6718364.java:13:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6718364.X, T
2 warnings

@ -1,5 +1,5 @@
T7177306a.java:13:33: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, java.util.List<E>, java.util.List, kindname.class, T7177306a
T7177306a.java:13:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List<java.lang.Object>
T7177306a.java:13:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List<E>
T7177306a.java:13:33: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7177306a, T7177306a<java.lang.Object>
- compiler.err.warnings.and.werror
1 error

@ -0,0 +1,26 @@
/*
* @test /nodynamiccopyright/
* @bug 8021567
* @summary Javac doesn't report "java: reference to method is ambiguous" any more
* @compile/fail/ref=T8021567.out -XDrawDiagnostics T8021567.java
*/
class T8021567 {
interface I_int { int m(); }
interface I_char { char m(); }
interface I_byte { byte m(); }
void m(I_byte b) { }
void m(I_char b) { }
void m(I_int b) { }
void test() {
m(() -> 1); //ambiguous
m(() -> 256); //ok - only method(I_int) applicable
m(() -> { int i = 1; return i; }); //ok - only method(I_int) applicable
m(() -> { int i = 256; return i; }); //ok - only method(I_int) applicable
}
}

@ -0,0 +1,2 @@
T8021567.java:21:9: compiler.err.ref.ambiguous: m, kindname.method, m(T8021567.I_byte), T8021567, kindname.method, m(T8021567.I_char), T8021567
1 error

@ -0,0 +1,45 @@
/*
* 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 8021567
* @summary Javac doesn't report "java: reference to method is ambiguous" any more
*/
public class T8021567b {
interface SAM {
int m();
}
public static void main(String argv[]) {
test();
}
static boolean test() {
final int i = 0;
SAM s = () -> i;
return (s.m() == 0);
}
}

@ -0,0 +1,61 @@
/*
* 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 8015809
* @summary Producing individual errors for uncaught undeclared exceptions inside lambda expressions, instead of one error for whole lambda
* @compile/fail/ref=ExceptionsInLambda.out -XDrawDiagnostics ExceptionsInLambda.java
*/
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.InputStream;
import java.io.Reader;
public class ExceptionsInLambda {
public static void main(Runnable p, File f) {
main(() -> {
StringBuilder sb = new StringBuilder();
Reader in = new FileReader(f);
int r;
while ((r = in.read()) != (-1)) {
sb.append((char) r);
}
}, f);
doOpen(() -> new FileInputStream(f));
}
public static InputStream doOpen(Open open) {
return open.open();
}
public interface Open {
public InputStream open();
}
}

@ -0,0 +1,4 @@
ExceptionsInLambda.java:43:25: compiler.err.unreported.exception.need.to.catch.or.throw: java.io.FileNotFoundException
ExceptionsInLambda.java:46:32: compiler.err.unreported.exception.need.to.catch.or.throw: java.io.IOException
ExceptionsInLambda.java:51:22: compiler.err.unreported.exception.need.to.catch.or.throw: java.io.FileNotFoundException
3 errors

@ -1,6 +1,5 @@
TargetType21.java:28:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM2), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
TargetType21.java:28:14: compiler.err.incompatible.thrown.types.in.lambda: java.lang.Exception
TargetType21.java:29:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM2), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
TargetType21.java:30:13: compiler.err.prob.found.req: (compiler.misc.cyclic.inference: A)
TargetType21.java:31:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM1), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
5 errors
4 errors

@ -34,15 +34,15 @@ import java.util.stream.*;
class TargetType59 {
<T, R> Collector<T, R> m(Supplier<? extends R> supplier, BiConsumer<R, T> accumulator) {
<T, R> Collector<T, String, R> m(Supplier<? extends R> supplier, BiConsumer<R, T> accumulator) {
return null;
}
<T, C extends Collection<T>> Collector<T,C> test1(Supplier<C> collectionFactory) {
<T, C extends Collection<T>> Collector<T, String, C> test1(Supplier<C> collectionFactory) {
return m(collectionFactory, Collection::add);
}
Collector<String, StringBuilder> test2(Supplier<StringBuilder> sb) {
Collector<String, String, StringBuilder> test2(Supplier<StringBuilder> sb) {
return m(sb, StringBuilder::append);
}
}

@ -38,8 +38,8 @@ class TargetType61 {
return g(classifier, TreeMap::new, m(HashSet::new));
}
<R> Collector<Integer, R> m(Supplier<R> s) { return null; }
<R> Collector<Integer, String, R> m(Supplier<R> s) { return null; }
<T, K, D, M extends Map<K, D>>
Collector<T, M> g(Function<T, K> classifier, Supplier<M> mapFactory, Collector<T, D> downstream) { return null; }
Collector<T, String, M> g(Function<T, K> classifier, Supplier<M> mapFactory, Collector<T, String, D> downstream) { return null; }
}

@ -0,0 +1,100 @@
/*
* 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.*;
import java.util.*;
import javax.annotation.processing.*;
import javax.lang.model.element.*;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.MirroredTypeException;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeKind;
import javax.tools.*;
import com.sun.tools.javac.util.Assert;
import com.sun.tools.javac.code.Symbol;
import static com.sun.tools.javac.code.Symbol.TypeSymbol;
public class Processor extends JavacTestingAbstractProcessor {
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (Element e : roundEnv.getElementsAnnotatedWith(A.class)) {
A rtg = e.getAnnotation(A.class);
try {
rtg.a();
Assert.check(false); //Should not reach here
} catch (MirroredTypeException ex) {
TypeMirror tm = ex.getTypeMirror();
Assert.check(tm.getKind() == TypeKind.ERROR);
TypeElement elm = (TypeElement)((DeclaredType)tm).asElement();
Assert.check(elm.getQualifiedName().toString().
endsWith("some.path.to.SomeUnknownClass$Inner"));
TypeSymbol sym = (TypeSymbol)elm;
Assert.check(sym.name.contentEquals("some.path.to.SomeUnknownClass$Inner"));
}
}
for (Element e : roundEnv.getElementsAnnotatedWith(B.class)) {
B rtg = e.getAnnotation(B.class);
try {
rtg.a();
Assert.check(false); //Should not reach here
} catch (MirroredTypeException ex) {
TypeMirror tm = ex.getTypeMirror();
Assert.check(tm.getKind() == TypeKind.ERROR);
TypeElement elm = (TypeElement)((DeclaredType)tm).asElement();
Assert.check(elm.getQualifiedName().toString().
endsWith("SomeUnknownClass"));
TypeSymbol sym = (TypeSymbol)elm;
Assert.check(sym.name.contentEquals("SomeUnknownClass"));
}
}
for (Element e : roundEnv.getElementsAnnotatedWith(C.class)) {
C rtg = e.getAnnotation(C.class);
try {
rtg.a();
Assert.check(false); //Should not reach here
} catch (AnnotationTypeMismatchException ex) {
;
}
}
return true;
}
@interface A {
Class<?> a();
}
@interface B {
Class<?> a();
}
@interface C {
Class<?> a();
}
}

@ -0,0 +1,17 @@
/*
* @test /nodynamiccopyright/
* @bug 8019243
* @summary AnnotationTypeMismatchException instead of MirroredTypeException
* @library /tools/javac/lib
* @build JavacTestingAbstractProcessor Processor
* @compile/fail/ref=Source.out -XDrawDiagnostics -processor Processor Source.java
*/
@Processor.A(a=some.path.to.SomeUnknownClass$Inner.class)
class Source1{}
@Processor.B(a=SomeUnknownClass.class)
class Source2{}
@Processor.C(a=SomeUnknownClass.clas) // this is not a class literal
class Source3{}

@ -0,0 +1,4 @@
Source.java:10:28: compiler.err.doesnt.exist: some.path.to
Source.java:13:16: compiler.err.cant.resolve: kindname.class, SomeUnknownClass, ,
Source.java:16:16: compiler.err.cant.resolve: kindname.variable, SomeUnknownClass, ,
3 errors

@ -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 7071377
* @summary verify if erroneous class names are rejected
* @library /tools/javac/lib
* @build TestClassNames JavacTestingAbstractProcessor CompileFail
* @run main CompileFail ERROR -processor TestClassNames TestClassNames.x.y
* @run main CompileFail ERROR -processor TestClassNames x.y.TestClassNames
* @run main CompileFail ERROR -processor NoClass NoClass.x.y
*/
import java.util.Set;
import javax.annotation.processing.*;
import javax.lang.model.element.*;
/**
* No-op processor; should not be run.
*/
public class TestClassNames extends JavacTestingAbstractProcessor {
public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnvironment) {
return true;
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,7 +31,6 @@
import java.io.File;
import java.util.*;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.PackageElement;
@ -60,7 +59,10 @@ public class Main {
static Elements elements;
public static void main(String[] args) throws Exception {
if (haveAltRt()) {
System.out.println("Warning: alt-rt.jar detected, test skipped");
return;
}
JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
fm.setLocation(CLASS_PATH, Collections.<File>emptyList());
@ -123,4 +125,23 @@ public class Main {
if (nestedClasses < 3000)
throw new AssertionError("Too few nested classes in PLATFORM_CLASS_PATH ;-)");
}
/*
* If -XX:+AggressiveOpts has been used to test, the option currently
* instructs the VM to prepend alt-rt.jar onto the bootclasspath. This
* overrides the default TreeMap implemation in rt.jar causing symbol
* resolution problems (caused by inconsistent inner class), although
* alt-rt.jar is being eliminated, we have this sanity check to detect this
* case and skip the test.
*/
static boolean haveAltRt() {
String bootClassPath = System.getProperty("sun.boot.class.path");
for (String cp : bootClassPath.split(File.pathSeparator)) {
if (cp.endsWith("alt-rt.jar")) {
System.err.println("Warning: detected alt-rt.jar in "
+ "sun.boot.class.path");
return true;
}
}
return false;
}
}

@ -0,0 +1,26 @@
/*
* @test /nodynamiccopyright/
* @bug 6537020
* @summary JCK tests: a compile-time error should be given in case of ambiguously imported fields (types, methods)
*
* @compile/fail/ref=T6537020.out -XDrawDiagnostics T6537020.java
*/
package p;
import static p.T6537020.C.s;
class T6537020 {
static class A {
static String s;
}
interface B {
String s = "";
}
static class C extends A implements B { }
Object o = s;
}

@ -0,0 +1,2 @@
T6537020.java:25:16: compiler.err.ref.ambiguous: s, kindname.variable, s, p.T6537020.B, kindname.variable, s, p.T6537020.A
1 error

@ -140,13 +140,6 @@ public class SourceTreeScannerTest extends AbstractTreeScannerTest {
// not part of public API
continue;
}
if (JCTree.JCNewArray.class.isAssignableFrom(tree.getClass())
&& (f.getName().equals("annotations")
|| f.getName().equals("dimAnnotations"))) {
// these fields are incorrectly missing from the public API
// (CR 6983297)
continue;
}
try {
//System.err.println("FIELD: " + f.getName());
reflectiveScan(f.get(tree));

@ -82,11 +82,13 @@ class SJavac {
compileWithOverrideSource();
compileWithInvisibleSources();
compileCircularSources();
compileExcludingDependency();
delete(gensrc);
delete(gensrc2);
delete(gensrc3);
delete(bin);
delete(headers);
}
void initialCompile() throws Exception {
@ -381,6 +383,33 @@ class SJavac {
delete(bin);
}
/**
* Tests compiling class A that depends on class B without compiling class B
* @throws Exception If test fails
*/
void compileExcludingDependency() throws Exception {
System.out.println("\nVerify that excluding classes from compilation but not from linking works.");
System.out.println("---------------------------------------------------------------------------");
delete(gensrc);
delete(bin);
previous_bin_state = collectState(bin);
populate(gensrc,
"alfa/A.java",
"package alfa; public class A { beta.B b; }",
"beta/B.java",
"package beta; public class B { }");
compile("-x", "beta", "-src", "gensrc", "-x", "alfa", "-sourcepath", "gensrc",
"-d", "bin", "--server:portfile=testserver,background=false");
Map<String,Long> new_bin_state = collectState(bin);
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
"bin/alfa/A.class",
"bin/javac_state");
}
void removeFrom(Path dir, String... args) throws IOException {
for (String filename : args) {
Path p = dir.resolve(filename);
@ -405,7 +434,7 @@ class SJavac {
}
}
void delete(Path root) throws IOException {
void delete(final Path root) throws IOException {
if (!Files.exists(root)) return;
Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
@Override