Merge
This commit is contained in:
commit
4bfe14cab9
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,12 +28,7 @@ package javax.tools;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static java.util.logging.Level.*;
|
||||
|
||||
/**
|
||||
* Provides methods for locating tool providers, for example,
|
||||
@ -45,47 +40,6 @@ import static java.util.logging.Level.*;
|
||||
*/
|
||||
public class ToolProvider {
|
||||
|
||||
private static final String propertyName = "sun.tools.ToolProvider";
|
||||
private static final String loggerName = "javax.tools";
|
||||
|
||||
/*
|
||||
* Define the system property "sun.tools.ToolProvider" to enable
|
||||
* debugging:
|
||||
*
|
||||
* java ... -Dsun.tools.ToolProvider ...
|
||||
*/
|
||||
static <T> T trace(Level level, Object reason) {
|
||||
// NOTE: do not make this method private as it affects stack traces
|
||||
try {
|
||||
if (System.getProperty(propertyName) != null) {
|
||||
StackTraceElement[] st = Thread.currentThread().getStackTrace();
|
||||
String method = "???";
|
||||
String cls = ToolProvider.class.getName();
|
||||
if (st.length > 2) {
|
||||
StackTraceElement frame = st[2];
|
||||
method = String.format((Locale)null, "%s(%s:%s)",
|
||||
frame.getMethodName(),
|
||||
frame.getFileName(),
|
||||
frame.getLineNumber());
|
||||
cls = frame.getClassName();
|
||||
}
|
||||
Logger logger = Logger.getLogger(loggerName);
|
||||
if (reason instanceof Throwable) {
|
||||
logger.logp(level, cls, method,
|
||||
reason.getClass().getName(), (Throwable)reason);
|
||||
} else {
|
||||
logger.logp(level, cls, method, String.valueOf(reason));
|
||||
}
|
||||
}
|
||||
} catch (SecurityException ex) {
|
||||
System.err.format((Locale)null, "%s: %s; %s%n",
|
||||
ToolProvider.class.getName(),
|
||||
reason,
|
||||
ex.getLocalizedMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final String systemJavaCompilerName
|
||||
= "com.sun.tools.javac.api.JavacTool";
|
||||
|
||||
@ -153,7 +107,7 @@ public class ToolProvider {
|
||||
try {
|
||||
return c.asSubclass(clazz).newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException | RuntimeException | Error e) {
|
||||
return trace(WARNING, e);
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,7 +118,7 @@ public class ToolProvider {
|
||||
try {
|
||||
c = Class.forName(name, false, ClassLoader.getSystemClassLoader());
|
||||
} catch (ClassNotFoundException | RuntimeException | Error e) {
|
||||
return trace(WARNING, e);
|
||||
throw new Error(e);
|
||||
}
|
||||
toolClasses.put(name, new WeakReference<>(c));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2016, 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
|
||||
@ -155,8 +155,6 @@ public class Attr extends JCTree.Visitor {
|
||||
allowDefaultMethods = source.allowDefaultMethods();
|
||||
allowStaticInterfaceMethods = source.allowStaticInterfaceMethods();
|
||||
sourceName = source.name;
|
||||
relax = (options.isSet("-retrofit") ||
|
||||
options.isSet("-relax"));
|
||||
useBeforeDeclarationWarning = options.isSet("useBeforeDeclarationWarning");
|
||||
|
||||
statInfo = new ResultInfo(KindSelector.NIL, Type.noType);
|
||||
@ -168,10 +166,6 @@ public class Attr extends JCTree.Visitor {
|
||||
recoveryInfo = new RecoveryInfo(deferredAttr.emptyDeferredAttrContext);
|
||||
}
|
||||
|
||||
/** Switch: relax some constraints for retrofit mode.
|
||||
*/
|
||||
boolean relax;
|
||||
|
||||
/** Switch: support target-typing inference
|
||||
*/
|
||||
boolean allowPoly;
|
||||
@ -1025,8 +1019,7 @@ public class Attr extends JCTree.Visitor {
|
||||
log.error(tree.pos(),
|
||||
"default.allowed.in.intf.annotation.member");
|
||||
}
|
||||
if (isDefaultMethod || (tree.sym.flags() & (ABSTRACT | NATIVE)) == 0 &&
|
||||
!relax)
|
||||
if (isDefaultMethod || (tree.sym.flags() & (ABSTRACT | NATIVE)) == 0)
|
||||
log.error(tree.pos(), "missing.meth.body.or.decl.abstract");
|
||||
} else if ((tree.sym.flags() & (ABSTRACT|DEFAULT|PRIVATE)) == ABSTRACT) {
|
||||
if ((owner.flags() & INTERFACE) != 0) {
|
||||
@ -4384,8 +4377,7 @@ public class Attr extends JCTree.Visitor {
|
||||
// If this is a non-abstract class, check that it has no abstract
|
||||
// methods or unimplemented methods of an implemented interface.
|
||||
if ((c.flags() & (ABSTRACT | INTERFACE)) == 0) {
|
||||
if (!relax)
|
||||
chk.checkAllDefined(tree.pos(), c);
|
||||
chk.checkAllDefined(tree.pos(), c);
|
||||
}
|
||||
|
||||
if ((c.flags() & ANNOTATION) != 0) {
|
||||
|
@ -81,8 +81,6 @@ public class Check {
|
||||
private final Types types;
|
||||
private final TypeAnnotations typeAnnotations;
|
||||
private final JCDiagnostic.Factory diags;
|
||||
private boolean warnOnSyntheticConflicts;
|
||||
private boolean suppressAbortOnBadClassFile;
|
||||
private final JavaFileManager fileManager;
|
||||
private final Source source;
|
||||
private final Profile profile;
|
||||
@ -130,8 +128,6 @@ public class Check {
|
||||
allowStrictMethodClashCheck = source.allowStrictMethodClashCheck();
|
||||
allowPrivateSafeVarargs = source.allowPrivateSafeVarargs();
|
||||
allowDiamondWithAnonymousClassCreation = source.allowDiamondWithAnonymousClassCreation();
|
||||
warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
|
||||
suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
|
||||
warnOnAccessToSensitiveMembers = options.isSet("warnOnAccessToSensitiveMembers");
|
||||
|
||||
Target target = Target.instance(context);
|
||||
@ -269,8 +265,7 @@ public class Check {
|
||||
*/
|
||||
public Type completionError(DiagnosticPosition pos, CompletionFailure ex) {
|
||||
log.error(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE, pos, "cant.access", ex.sym, ex.getDetailValue());
|
||||
if (ex instanceof ClassFinder.BadClassFile
|
||||
&& !suppressAbortOnBadClassFile) throw new Abort();
|
||||
if (ex instanceof ClassFinder.BadClassFile) throw new Abort();
|
||||
else return syms.errType;
|
||||
}
|
||||
|
||||
@ -2632,12 +2627,7 @@ public class Check {
|
||||
*/
|
||||
private void syntheticError(DiagnosticPosition pos, Symbol sym) {
|
||||
if (!sym.type.isErroneous()) {
|
||||
if (warnOnSyntheticConflicts) {
|
||||
log.warning(pos, "synthetic.name.conflict", sym, sym.location());
|
||||
}
|
||||
else {
|
||||
log.error(pos, "synthetic.name.conflict", sym, sym.location());
|
||||
}
|
||||
log.error(pos, "synthetic.name.conflict", sym, sym.location());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2016, 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
|
||||
@ -44,9 +44,11 @@ import com.sun.tools.javac.comp.Infer.GraphSolver.InferenceGraph.Node;
|
||||
import com.sun.tools.javac.comp.Resolve.InapplicableMethodException;
|
||||
import com.sun.tools.javac.comp.Resolve.VerboseResolutionMode;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -353,9 +355,9 @@ public class Infer {
|
||||
rsContext.attrMode(),
|
||||
rsContext.step,
|
||||
round);
|
||||
File dotFile = new File(dependenciesFolder, filename);
|
||||
try (FileWriter fw = new FileWriter(dotFile)) {
|
||||
fw.append(graph);
|
||||
Path dotFile = Paths.get(dependenciesFolder, filename);
|
||||
try (Writer w = Files.newBufferedWriter(dotFile)) {
|
||||
w.append(graph);
|
||||
}
|
||||
round++;
|
||||
}
|
||||
|
@ -267,7 +267,14 @@ public abstract class BaseFileManager implements JavaFileManager {
|
||||
* @return true if successful, and false otherwise
|
||||
*/
|
||||
public boolean handleOption(Option option, String value) {
|
||||
return locations.handleOption(option, value);
|
||||
switch (option) {
|
||||
case ENCODING:
|
||||
encodingName = value;
|
||||
return true;
|
||||
|
||||
default:
|
||||
return locations.handleOption(option, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -285,6 +292,7 @@ public abstract class BaseFileManager implements JavaFileManager {
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Encoding">
|
||||
private String encodingName;
|
||||
private String defaultEncodingName;
|
||||
private String getDefaultEncodingName() {
|
||||
if (defaultEncodingName == null) {
|
||||
@ -295,11 +303,7 @@ public abstract class BaseFileManager implements JavaFileManager {
|
||||
}
|
||||
|
||||
public String getEncodingName() {
|
||||
String encName = options.get(Option.ENCODING);
|
||||
if (encName == null)
|
||||
return getDefaultEncodingName();
|
||||
else
|
||||
return encName;
|
||||
return (encodingName != null) ? encodingName : getDefaultEncodingName();
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
|
@ -425,7 +425,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
if (container.endsWith("bootmodules.jimage")) {
|
||||
System.err.println("Warning: reference to bootmodules.jimage replaced by jrt:");
|
||||
container = Locations.JRT_MARKER_FILE;
|
||||
} else if (container.getFileName().toString().endsWith(".jimage")) {
|
||||
} else if (container.getNameCount() > 0 && container.getFileName().toString().endsWith(".jimage")) {
|
||||
System.err.println("Warning: reference to " + container + " ignored");
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2016, 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
|
||||
@ -72,18 +72,6 @@ public class ClassWriter extends ClassFile {
|
||||
*/
|
||||
private boolean verbose;
|
||||
|
||||
/** Switch: scramble private field names.
|
||||
*/
|
||||
private boolean scramble;
|
||||
|
||||
/** Switch: scramble all field names.
|
||||
*/
|
||||
private boolean scrambleAll;
|
||||
|
||||
/** Switch: retrofit mode.
|
||||
*/
|
||||
private boolean retrofit;
|
||||
|
||||
/** Switch: emit source file attribute.
|
||||
*/
|
||||
private boolean emitSourceFile;
|
||||
@ -184,9 +172,6 @@ public class ClassWriter extends ClassFile {
|
||||
signatureGen = new CWSignatureGenerator(types);
|
||||
|
||||
verbose = options.isSet(VERBOSE);
|
||||
scramble = options.isSet("-scramble");
|
||||
scrambleAll = options.isSet("-scrambleAll");
|
||||
retrofit = options.isSet("-retrofit");
|
||||
genCrt = options.isSet(XJCOV);
|
||||
debugstackmap = options.isSet("debugstackmap");
|
||||
|
||||
@ -491,26 +476,11 @@ public class ClassWriter extends ClassFile {
|
||||
putChar(poolbuf, poolCountIdx, pool.pp);
|
||||
}
|
||||
|
||||
/** Given a field, return its name.
|
||||
*/
|
||||
Name fieldName(Symbol sym) {
|
||||
if (scramble && (sym.flags() & PRIVATE) != 0 ||
|
||||
scrambleAll && (sym.flags() & (PROTECTED | PUBLIC)) == 0)
|
||||
return names.fromString("_$" + sym.name.getIndex());
|
||||
else
|
||||
return sym.name;
|
||||
}
|
||||
|
||||
/** Given a symbol, return its name-and-type.
|
||||
*/
|
||||
NameAndType nameType(Symbol sym) {
|
||||
return new NameAndType(fieldName(sym),
|
||||
retrofit
|
||||
? sym.erasure(types)
|
||||
: sym.externalType(types), types);
|
||||
// if we retrofit, then the NameAndType has been read in as is
|
||||
// and no change is necessary. If we compile normally, the
|
||||
// NameAndType is generated from a symbol reference, and the
|
||||
return new NameAndType(sym.name, sym.externalType(types), types);
|
||||
// the NameAndType is generated from a symbol reference, and the
|
||||
// adjustment of adding an additional this$n parameter needs to be made.
|
||||
}
|
||||
|
||||
@ -1055,10 +1025,10 @@ public class ClassWriter extends ClassFile {
|
||||
databuf.appendChar(flags);
|
||||
if (dumpFieldModifiers) {
|
||||
PrintWriter pw = log.getWriter(Log.WriterKind.ERROR);
|
||||
pw.println("FIELD " + fieldName(v));
|
||||
pw.println("FIELD " + v.name);
|
||||
pw.println("---" + flagNames(v.flags()));
|
||||
}
|
||||
databuf.appendChar(pool.put(fieldName(v)));
|
||||
databuf.appendChar(pool.put(v.name));
|
||||
databuf.appendChar(pool.put(typeSig(v.erasure(types))));
|
||||
int acountIdx = beginAttrs();
|
||||
int acount = 0;
|
||||
@ -1079,10 +1049,10 @@ public class ClassWriter extends ClassFile {
|
||||
databuf.appendChar(flags);
|
||||
if (dumpMethodModifiers) {
|
||||
PrintWriter pw = log.getWriter(Log.WriterKind.ERROR);
|
||||
pw.println("METHOD " + fieldName(m));
|
||||
pw.println("METHOD " + m.name);
|
||||
pw.println("---" + flagNames(m.flags()));
|
||||
}
|
||||
databuf.appendChar(pool.put(fieldName(m)));
|
||||
databuf.appendChar(pool.put(m.name));
|
||||
databuf.appendChar(pool.put(typeSig(m.externalType(types))));
|
||||
int acountIdx = beginAttrs();
|
||||
int acount = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2016, 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
|
||||
@ -120,25 +120,11 @@ public class Gen extends JCTree.Visitor {
|
||||
: options.isSet(G_CUSTOM, "vars");
|
||||
genCrt = options.isSet(XJCOV);
|
||||
debugCode = options.isSet("debugcode");
|
||||
allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic");
|
||||
allowBetterNullChecks = target.hasObjects();
|
||||
pool = new Pool(types);
|
||||
|
||||
// ignore cldc because we cannot have both stackmap formats
|
||||
this.stackMap = StackMapFormat.JSR202;
|
||||
|
||||
// by default, avoid jsr's for simple finalizers
|
||||
int setjsrlimit = 50;
|
||||
String jsrlimitString = options.get("jsrlimit");
|
||||
if (jsrlimitString != null) {
|
||||
try {
|
||||
setjsrlimit = Integer.parseInt(jsrlimitString);
|
||||
} catch (NumberFormatException ex) {
|
||||
// ignore ill-formed numbers for jsrlimit
|
||||
}
|
||||
}
|
||||
this.jsrlimit = setjsrlimit;
|
||||
this.useJsrLocally = false; // reset in visitTry
|
||||
annotate = Annotate.instance(context);
|
||||
}
|
||||
|
||||
@ -148,19 +134,8 @@ public class Gen extends JCTree.Visitor {
|
||||
private final boolean varDebugInfo;
|
||||
private final boolean genCrt;
|
||||
private final boolean debugCode;
|
||||
private final boolean allowInvokedynamic;
|
||||
private final boolean allowBetterNullChecks;
|
||||
|
||||
/** Default limit of (approximate) size of finalizer to inline.
|
||||
* Zero means always use jsr. 100 or greater means never use
|
||||
* jsr.
|
||||
*/
|
||||
private final int jsrlimit;
|
||||
|
||||
/** True if jsr is used.
|
||||
*/
|
||||
private boolean useJsrLocally;
|
||||
|
||||
/** Code buffer, set by genMethod.
|
||||
*/
|
||||
private Code code;
|
||||
@ -1339,31 +1314,11 @@ public class Gen extends JCTree.Visitor {
|
||||
// in a new environment which calls the finally block if there is one.
|
||||
final Env<GenContext> tryEnv = env.dup(tree, new GenContext());
|
||||
final Env<GenContext> oldEnv = env;
|
||||
if (!useJsrLocally) {
|
||||
useJsrLocally =
|
||||
(stackMap == StackMapFormat.NONE) &&
|
||||
(jsrlimit <= 0 ||
|
||||
jsrlimit < 100 &&
|
||||
estimateCodeComplexity(tree.finalizer)>jsrlimit);
|
||||
}
|
||||
tryEnv.info.finalize = new GenFinalizer() {
|
||||
void gen() {
|
||||
if (useJsrLocally) {
|
||||
if (tree.finalizer != null) {
|
||||
Code.State jsrState = code.state.dup();
|
||||
jsrState.push(Code.jsrReturnValue);
|
||||
tryEnv.info.cont =
|
||||
new Chain(code.emitJump(jsr),
|
||||
tryEnv.info.cont,
|
||||
jsrState);
|
||||
}
|
||||
Assert.check(tryEnv.info.gaps.length() % 2 == 0);
|
||||
tryEnv.info.gaps.append(code.curCP());
|
||||
} else {
|
||||
Assert.check(tryEnv.info.gaps.length() % 2 == 0);
|
||||
tryEnv.info.gaps.append(code.curCP());
|
||||
genLast();
|
||||
}
|
||||
Assert.check(tryEnv.info.gaps.length() % 2 == 0);
|
||||
tryEnv.info.gaps.append(code.curCP());
|
||||
genLast();
|
||||
}
|
||||
void genLast() {
|
||||
if (tree.finalizer != null)
|
||||
@ -1568,93 +1523,6 @@ public class Gen extends JCTree.Visitor {
|
||||
}
|
||||
}
|
||||
|
||||
/** Very roughly estimate the number of instructions needed for
|
||||
* the given tree.
|
||||
*/
|
||||
int estimateCodeComplexity(JCTree tree) {
|
||||
if (tree == null) return 0;
|
||||
class ComplexityScanner extends TreeScanner {
|
||||
int complexity = 0;
|
||||
public void scan(JCTree tree) {
|
||||
if (complexity > jsrlimit) return;
|
||||
super.scan(tree);
|
||||
}
|
||||
public void visitClassDef(JCClassDecl tree) {}
|
||||
public void visitDoLoop(JCDoWhileLoop tree)
|
||||
{ super.visitDoLoop(tree); complexity++; }
|
||||
public void visitWhileLoop(JCWhileLoop tree)
|
||||
{ super.visitWhileLoop(tree); complexity++; }
|
||||
public void visitForLoop(JCForLoop tree)
|
||||
{ super.visitForLoop(tree); complexity++; }
|
||||
public void visitSwitch(JCSwitch tree)
|
||||
{ super.visitSwitch(tree); complexity+=5; }
|
||||
public void visitCase(JCCase tree)
|
||||
{ super.visitCase(tree); complexity++; }
|
||||
public void visitSynchronized(JCSynchronized tree)
|
||||
{ super.visitSynchronized(tree); complexity+=6; }
|
||||
public void visitTry(JCTry tree)
|
||||
{ super.visitTry(tree);
|
||||
if (tree.finalizer != null) complexity+=6; }
|
||||
public void visitCatch(JCCatch tree)
|
||||
{ super.visitCatch(tree); complexity+=2; }
|
||||
public void visitConditional(JCConditional tree)
|
||||
{ super.visitConditional(tree); complexity+=2; }
|
||||
public void visitIf(JCIf tree)
|
||||
{ super.visitIf(tree); complexity+=2; }
|
||||
// note: for break, continue, and return we don't take unwind() into account.
|
||||
public void visitBreak(JCBreak tree)
|
||||
{ super.visitBreak(tree); complexity+=1; }
|
||||
public void visitContinue(JCContinue tree)
|
||||
{ super.visitContinue(tree); complexity+=1; }
|
||||
public void visitReturn(JCReturn tree)
|
||||
{ super.visitReturn(tree); complexity+=1; }
|
||||
public void visitThrow(JCThrow tree)
|
||||
{ super.visitThrow(tree); complexity+=1; }
|
||||
public void visitAssert(JCAssert tree)
|
||||
{ super.visitAssert(tree); complexity+=5; }
|
||||
public void visitApply(JCMethodInvocation tree)
|
||||
{ super.visitApply(tree); complexity+=2; }
|
||||
public void visitNewClass(JCNewClass tree)
|
||||
{ scan(tree.encl); scan(tree.args); complexity+=2; }
|
||||
public void visitNewArray(JCNewArray tree)
|
||||
{ super.visitNewArray(tree); complexity+=5; }
|
||||
public void visitAssign(JCAssign tree)
|
||||
{ super.visitAssign(tree); complexity+=1; }
|
||||
public void visitAssignop(JCAssignOp tree)
|
||||
{ super.visitAssignop(tree); complexity+=2; }
|
||||
public void visitUnary(JCUnary tree)
|
||||
{ complexity+=1;
|
||||
if (tree.type.constValue() == null) super.visitUnary(tree); }
|
||||
public void visitBinary(JCBinary tree)
|
||||
{ complexity+=1;
|
||||
if (tree.type.constValue() == null) super.visitBinary(tree); }
|
||||
public void visitTypeTest(JCInstanceOf tree)
|
||||
{ super.visitTypeTest(tree); complexity+=1; }
|
||||
public void visitIndexed(JCArrayAccess tree)
|
||||
{ super.visitIndexed(tree); complexity+=1; }
|
||||
public void visitSelect(JCFieldAccess tree)
|
||||
{ super.visitSelect(tree);
|
||||
if (tree.sym.kind == VAR) complexity+=1; }
|
||||
public void visitIdent(JCIdent tree) {
|
||||
if (tree.sym.kind == VAR) {
|
||||
complexity+=1;
|
||||
if (tree.type.constValue() == null &&
|
||||
tree.sym.owner.kind == TYP)
|
||||
complexity+=1;
|
||||
}
|
||||
}
|
||||
public void visitLiteral(JCLiteral tree)
|
||||
{ complexity+=1; }
|
||||
public void visitTree(JCTree tree) {}
|
||||
public void visitWildcard(JCWildcard tree) {
|
||||
throw new AssertionError(this.getClass().getName());
|
||||
}
|
||||
}
|
||||
ComplexityScanner scanner = new ComplexityScanner();
|
||||
tree.accept(scanner);
|
||||
return scanner.complexity;
|
||||
}
|
||||
|
||||
public void visitIf(JCIf tree) {
|
||||
int limit = code.nextreg;
|
||||
Chain thenExit = null;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,9 +25,10 @@
|
||||
|
||||
package com.sun.tools.javac.main;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
@ -73,7 +74,7 @@ public class Arguments {
|
||||
|
||||
private String ownName;
|
||||
private Set<String> classNames;
|
||||
private Set<File> files;
|
||||
private Set<Path> files;
|
||||
private Map<Option, String> deferredFileManagerOptions;
|
||||
private Set<JavaFileObject> fileObjects;
|
||||
private final Options options;
|
||||
@ -153,8 +154,8 @@ public class Arguments {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFile(File f) {
|
||||
files.add(f);
|
||||
public void addFile(Path p) {
|
||||
files.add(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -252,7 +253,7 @@ public class Arguments {
|
||||
} else {
|
||||
fileObjects = new LinkedHashSet<>();
|
||||
JavacFileManager jfm = (JavacFileManager) getFileManager();
|
||||
for (JavaFileObject fo: jfm.getJavaFileObjectsFromFiles(files))
|
||||
for (JavaFileObject fo: jfm.getJavaFileObjectsFromPaths(files))
|
||||
fileObjects.add(fo);
|
||||
}
|
||||
}
|
||||
@ -583,8 +584,8 @@ public class Arguments {
|
||||
if (value == null) {
|
||||
return true;
|
||||
}
|
||||
File file = new File(value);
|
||||
if (file.exists() && !file.isDirectory()) {
|
||||
Path file = Paths.get(value);
|
||||
if (Files.exists(file) && !Files.isDirectory(file)) {
|
||||
error("err.file.not.directory", value);
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2016, 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
|
||||
@ -27,9 +27,10 @@ package com.sun.tools.javac.main;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.FileReader;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.StreamTokenizer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import com.sun.tools.javac.util.ListBuffer;
|
||||
|
||||
/**
|
||||
@ -73,7 +74,7 @@ public class CommandLine {
|
||||
private static void loadCmdFile(String name, ListBuffer<String> args)
|
||||
throws IOException
|
||||
{
|
||||
try (Reader r = new BufferedReader(new FileReader(name))) {
|
||||
try (Reader r = Files.newBufferedReader(Paths.get(name))) {
|
||||
StreamTokenizer st = new StreamTokenizer(r);
|
||||
st.resetSyntax();
|
||||
st.wordChars(' ', 255);
|
||||
|
@ -389,10 +389,6 @@ public class JavaCompiler {
|
||||
|
||||
verbose = options.isSet(VERBOSE);
|
||||
sourceOutput = options.isSet(PRINTSOURCE); // used to be -s
|
||||
stubOutput = options.isSet("-stubs");
|
||||
relax = options.isSet("-relax");
|
||||
printFlat = options.isSet("-printflat");
|
||||
encoding = options.get(ENCODING);
|
||||
lineDebugInfo = options.isUnset(G_CUSTOM) ||
|
||||
options.isSet(G_CUSTOM, "lines");
|
||||
genEndPos = options.isSet(XJCOV) ||
|
||||
@ -447,21 +443,6 @@ public class JavaCompiler {
|
||||
*/
|
||||
public boolean sourceOutput;
|
||||
|
||||
/** Emit stub source files rather than class files.
|
||||
*/
|
||||
public boolean stubOutput;
|
||||
|
||||
/** Switch: relax some constraints for producing the jsr14 prototype.
|
||||
*/
|
||||
boolean relax;
|
||||
|
||||
/** Debug switch: Emit Java sources after inner class flattening.
|
||||
*/
|
||||
public boolean printFlat;
|
||||
|
||||
/** The encoding to be used for source input.
|
||||
*/
|
||||
public String encoding;
|
||||
|
||||
/** Generate code with the LineNumberTable attribute for debugging
|
||||
*/
|
||||
@ -611,7 +592,7 @@ public class JavaCompiler {
|
||||
// where
|
||||
public boolean keepComments = false;
|
||||
protected boolean keepComments() {
|
||||
return keepComments || sourceOutput || stubOutput;
|
||||
return keepComments || sourceOutput;
|
||||
}
|
||||
|
||||
|
||||
@ -676,30 +657,6 @@ public class JavaCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
/** Emit plain Java source for a class.
|
||||
* @param env The attribution environment of the outermost class
|
||||
* containing this class.
|
||||
* @param cdef The class definition to be printed.
|
||||
*/
|
||||
JavaFileObject printSource(Env<AttrContext> env, JCClassDecl cdef) throws IOException {
|
||||
JavaFileObject outFile
|
||||
= fileManager.getJavaFileForOutput(CLASS_OUTPUT,
|
||||
cdef.sym.flatname.toString(),
|
||||
JavaFileObject.Kind.SOURCE,
|
||||
null);
|
||||
if (inputFiles.contains(outFile)) {
|
||||
log.error(cdef.pos(), "source.cant.overwrite.input.file", outFile);
|
||||
return null;
|
||||
} else {
|
||||
try (BufferedWriter out = new BufferedWriter(outFile.openWriter())) {
|
||||
new Pretty(out, true).printUnit(env.toplevel, cdef);
|
||||
if (verbose)
|
||||
log.printVerbose("wrote.file", outFile);
|
||||
}
|
||||
return outFile;
|
||||
}
|
||||
}
|
||||
|
||||
/** Generate code and emit a class file for a given class
|
||||
* @param env The attribution environment of the outermost class
|
||||
* containing this class.
|
||||
@ -720,6 +677,30 @@ public class JavaCompiler {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Emit plain Java source for a class.
|
||||
* @param env The attribution environment of the outermost class
|
||||
* containing this class.
|
||||
* @param cdef The class definition to be printed.
|
||||
*/
|
||||
JavaFileObject printSource(Env<AttrContext> env, JCClassDecl cdef) throws IOException {
|
||||
JavaFileObject outFile
|
||||
= fileManager.getJavaFileForOutput(CLASS_OUTPUT,
|
||||
cdef.sym.flatname.toString(),
|
||||
JavaFileObject.Kind.SOURCE,
|
||||
null);
|
||||
if (inputFiles.contains(outFile)) {
|
||||
log.error(cdef.pos(), "source.cant.overwrite.input.file", outFile);
|
||||
return null;
|
||||
} else {
|
||||
try (BufferedWriter out = new BufferedWriter(outFile.openWriter())) {
|
||||
new Pretty(out, true).printUnit(env.toplevel, cdef);
|
||||
if (verbose)
|
||||
log.printVerbose("wrote.file", outFile);
|
||||
}
|
||||
return outFile;
|
||||
}
|
||||
}
|
||||
|
||||
/** Compile a source file that has been accessed by the class finder.
|
||||
* @param c The class the source file of which needs to be compiled.
|
||||
*/
|
||||
@ -897,12 +878,6 @@ public class JavaCompiler {
|
||||
throw new AssertionError("attempt to reuse JavaCompiler");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set needRootClasses to true, in JavaCompiler subclass constructor
|
||||
* that want to collect public apis of classes supplied on the command line.
|
||||
*/
|
||||
protected boolean needRootClasses = false;
|
||||
|
||||
/**
|
||||
* The list of classes explicitly supplied on the command line for compilation.
|
||||
* Not always populated.
|
||||
@ -966,7 +941,7 @@ public class JavaCompiler {
|
||||
// If generating source, or if tracking public apis,
|
||||
// then remember the classes declared in
|
||||
// the original compilation units listed on the command line.
|
||||
if (needRootClasses || sourceOutput || stubOutput) {
|
||||
if (sourceOutput) {
|
||||
ListBuffer<JCClassDecl> cdefs = new ListBuffer<>();
|
||||
for (JCCompilationUnit unit : roots) {
|
||||
for (List<JCTree> defs = unit.defs;
|
||||
@ -1275,11 +1250,6 @@ public class JavaCompiler {
|
||||
if (shouldStop(CompileState.FLOW))
|
||||
return;
|
||||
|
||||
if (relax) {
|
||||
results.add(env);
|
||||
return;
|
||||
}
|
||||
|
||||
if (verboseCompilePolicy)
|
||||
printNote("[flow " + env.enclClass.sym + "]");
|
||||
JavaFileObject prev = log.useSource(
|
||||
@ -1419,9 +1389,9 @@ public class JavaCompiler {
|
||||
TreeMaker localMake = make.forToplevel(env.toplevel);
|
||||
|
||||
if (env.tree.hasTag(JCTree.Tag.PACKAGEDEF)) {
|
||||
if (!(stubOutput || sourceOutput || printFlat)) {
|
||||
if (!(sourceOutput)) {
|
||||
if (shouldStop(CompileState.LOWER))
|
||||
return;
|
||||
return;
|
||||
List<JCTree> pdef = lower.translateTopLevelClass(env, env.tree, localMake);
|
||||
if (pdef.head != null) {
|
||||
Assert.check(pdef.tail.isEmpty());
|
||||
@ -1431,19 +1401,6 @@ public class JavaCompiler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (stubOutput) {
|
||||
//emit stub Java source file, only for compilation
|
||||
//units enumerated explicitly on the command line
|
||||
JCClassDecl cdef = (JCClassDecl)env.tree;
|
||||
if (untranslated instanceof JCClassDecl &&
|
||||
rootClasses.contains((JCClassDecl)untranslated) &&
|
||||
((cdef.mods.flags & (Flags.PROTECTED|Flags.PUBLIC)) != 0 ||
|
||||
cdef.sym.packge().getQualifiedName() == names.java_lang)) {
|
||||
results.add(new Pair<>(env, removeMethodBodies(cdef)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldStop(CompileState.TRANSTYPES))
|
||||
return;
|
||||
|
||||
@ -1504,16 +1461,12 @@ public class JavaCompiler {
|
||||
if (shouldStop(CompileState.GENERATE))
|
||||
return;
|
||||
|
||||
boolean usePrintSource = (stubOutput || sourceOutput || printFlat);
|
||||
|
||||
for (Pair<Env<AttrContext>, JCClassDecl> x: queue) {
|
||||
Env<AttrContext> env = x.fst;
|
||||
JCClassDecl cdef = x.snd;
|
||||
|
||||
if (verboseCompilePolicy) {
|
||||
printNote("[generate "
|
||||
+ (usePrintSource ? " source" : "code")
|
||||
+ " " + cdef.sym + "]");
|
||||
printNote("[generate " + (sourceOutput ? " source" : "code") + " " + cdef.sym + "]");
|
||||
}
|
||||
|
||||
if (!taskListener.isEmpty()) {
|
||||
@ -1526,9 +1479,9 @@ public class JavaCompiler {
|
||||
env.toplevel.sourcefile);
|
||||
try {
|
||||
JavaFileObject file;
|
||||
if (usePrintSource)
|
||||
if (sourceOutput) {
|
||||
file = printSource(env, cdef);
|
||||
else {
|
||||
} else {
|
||||
if (fileManager.hasLocation(StandardLocation.NATIVE_HEADER_OUTPUT)
|
||||
&& jniWriter.needsHeader(cdef.sym)) {
|
||||
jniWriter.write(cdef.sym);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,9 +25,11 @@
|
||||
|
||||
package com.sun.tools.javac.main;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.LinkedHashMap;
|
||||
@ -238,13 +240,7 @@ public enum Option {
|
||||
|
||||
IMPLICIT("-implicit:", "opt.implicit", STANDARD, BASIC, ONEOF, "none", "class"),
|
||||
|
||||
ENCODING("-encoding", "opt.arg.encoding", "opt.encoding", STANDARD, FILEMANAGER) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option, String operand) {
|
||||
return super.process(helper, option, operand);
|
||||
}
|
||||
|
||||
},
|
||||
ENCODING("-encoding", "opt.arg.encoding", "opt.encoding", STANDARD, FILEMANAGER),
|
||||
|
||||
SOURCE("-source", "opt.arg.release", "opt.source", STANDARD, BASIC) {
|
||||
@Override
|
||||
@ -537,16 +533,16 @@ public enum Option {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
if (option.endsWith(".java") ) {
|
||||
File f = new File(option);
|
||||
if (!f.exists()) {
|
||||
helper.error("err.file.not.found", f);
|
||||
Path p = Paths.get(option);
|
||||
if (!Files.exists(p)) {
|
||||
helper.error("err.file.not.found", p);
|
||||
return true;
|
||||
}
|
||||
if (!f.isFile()) {
|
||||
helper.error("err.file.not.file", f);
|
||||
if (!Files.isRegularFile(p)) {
|
||||
helper.error("err.file.not.file", p);
|
||||
return true;
|
||||
}
|
||||
helper.addFile(f);
|
||||
helper.addFile(p);
|
||||
} else {
|
||||
helper.addClassName(option);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,9 +25,10 @@
|
||||
|
||||
package com.sun.tools.javac.main;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
import com.sun.tools.javac.util.Log;
|
||||
import com.sun.tools.javac.util.Log.PrefixKind;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Helper object to be used by {@link Option#process}, providing access to
|
||||
@ -63,7 +64,7 @@ public abstract class OptionHelper {
|
||||
abstract void error(String key, Object... args);
|
||||
|
||||
/** Record a file to be compiled. */
|
||||
abstract void addFile(File f);
|
||||
abstract void addFile(Path p);
|
||||
|
||||
/** Record the name of a class for annotation processing. */
|
||||
abstract void addClassName(String s);
|
||||
@ -112,8 +113,8 @@ public abstract class OptionHelper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFile(File f) {
|
||||
throw new IllegalArgumentException(f.getPath());
|
||||
public void addFile(Path p) {
|
||||
throw new IllegalArgumentException(p.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -981,10 +981,6 @@ compiler.err.string.const.req=\
|
||||
compiler.err.synthetic.name.conflict=\
|
||||
the symbol {0} conflicts with a compiler-synthesized symbol in {1}
|
||||
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.warn.synthetic.name.conflict=\
|
||||
the symbol {0} conflicts with a compiler-synthesized symbol in {1}
|
||||
|
||||
compiler.err.throws.not.allowed.in.intf.annotation=\
|
||||
throws clause not allowed in @interface members
|
||||
|
||||
@ -1334,16 +1330,6 @@ compiler.misc.verbose.total=\
|
||||
compiler.misc.verbose.wrote.file=\
|
||||
[wrote {0}]
|
||||
|
||||
## extra output when using -verbose (Retro)
|
||||
compiler.misc.verbose.retro=\
|
||||
[retrofitting {0}]
|
||||
|
||||
compiler.misc.verbose.retro.with=\
|
||||
\tretrofitting {0} with {1}
|
||||
|
||||
compiler.misc.verbose.retro.with.list=\
|
||||
\tretrofitting {0} with type parameters {1}, supertype {2}, interfaces {3}
|
||||
|
||||
## extra output when using -verbose (code/ClassReader)
|
||||
# 0: string
|
||||
compiler.misc.verbose.loading=\
|
||||
|
@ -124,20 +124,12 @@ javac.opt.nogj=\
|
||||
Don't accept generics in the language
|
||||
javac.opt.moreinfo=\
|
||||
Print extended information for type variables
|
||||
javac.opt.printflat=\
|
||||
Print abstract syntax tree after inner class conversion
|
||||
javac.opt.printsearch=\
|
||||
Print information where classfiles are searched
|
||||
javac.opt.prompt=\
|
||||
Stop after each error
|
||||
javac.opt.retrofit=\
|
||||
Retrofit existing classfiles with generic types
|
||||
javac.opt.s=\
|
||||
Emit java sources instead of classfiles
|
||||
javac.opt.scramble=\
|
||||
Scramble private identifiers in bytecode
|
||||
javac.opt.scrambleall=\
|
||||
Scramble package visible identifiers in bytecode
|
||||
javac.opt.version=\
|
||||
Version information
|
||||
javac.opt.arg.pathname=\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2016, 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
|
||||
@ -170,12 +170,6 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
|
||||
}
|
||||
},
|
||||
|
||||
new HiddenOption(false, "-stubs") {
|
||||
void process(JavahTask task, String opt, String arg) {
|
||||
// ignored; for backwards compatibility
|
||||
}
|
||||
},
|
||||
|
||||
new Option(false, "-v", "-verbose") {
|
||||
void process(JavahTask task, String opt, String arg) {
|
||||
task.verbose = true;
|
||||
@ -454,8 +448,6 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
|
||||
if (llni)
|
||||
g = new LLNI(doubleAlign, util);
|
||||
else {
|
||||
// if (stubs)
|
||||
// throw new BadArgs("jni.no.stubs");
|
||||
g = new JNI(util);
|
||||
}
|
||||
|
||||
|
@ -22,15 +22,17 @@
|
||||
|
||||
# Tiered testing definitions
|
||||
|
||||
# All langtools tests are tier 1.
|
||||
# (Nearly) all langtools tests are tier 1.
|
||||
tier1 = \
|
||||
com \
|
||||
jdk \
|
||||
lib \
|
||||
tools
|
||||
tools \
|
||||
-jdk/jshell/ToolReloadTest.java
|
||||
|
||||
# No langtools tests are tier 2.
|
||||
tier2 =
|
||||
# (Almost) no langtools tests are tier 2.
|
||||
tier2 = \
|
||||
jdk/jshell/ToolReloadTest.java
|
||||
|
||||
# No langtools tests are tier 3 either.
|
||||
tier3 =
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key intermittent
|
||||
* @bug 8081845 8147898
|
||||
* @summary Tests for /reload in JShell tool
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2016, 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,13 +31,7 @@
|
||||
*
|
||||
* @clean foo.package-info
|
||||
*
|
||||
* @compile -XD-printflat package-info.java
|
||||
* @run main/othervm T6257443 -no foo/package-info.class
|
||||
*
|
||||
* @compile -XD-stubs package-info.java
|
||||
* @run main/othervm T6257443 -no foo/package-info.class
|
||||
*
|
||||
* @compile -XD-printsource package-info.java
|
||||
* @compile -printsource package-info.java
|
||||
* @run main/othervm T6257443 -no foo/package-info.class
|
||||
*/
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6521805
|
||||
* @summary Regression: JDK5/JDK6 javac allows write access to outer class reference
|
||||
* @author mcimadamore
|
||||
*
|
||||
* @compile/fail/ref=T6521805a_1.out T6521805a.java -XDrawDiagnostics
|
||||
* @compile/ref=T6521805a_2.out T6521805a.java -XDwarnOnSyntheticConflicts -XDrawDiagnostics
|
||||
*/
|
||||
|
||||
class T6521805a {
|
||||
|
||||
static class Outer {
|
||||
T6521805a this$0 = null;
|
||||
}
|
||||
|
||||
public class Inner extends Outer {
|
||||
public void foo() {
|
||||
this$0 = new T6521805a();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
T6521805a.java:17:12: compiler.err.synthetic.name.conflict: this$0, T6521805a.Outer
|
||||
1 error
|
@ -1,2 +0,0 @@
|
||||
T6521805a.java:17:12: compiler.warn.synthetic.name.conflict: this$0, T6521805a.Outer
|
||||
1 warning
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2016, 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
|
||||
@ -61,8 +61,6 @@ public class EventsBalancedTest {
|
||||
|
||||
test(null, Arrays.asList(a, b));
|
||||
test(null, Arrays.asList(b, a));
|
||||
test(Arrays.asList("-XD-relax"), Arrays.asList(a, b));
|
||||
test(Arrays.asList("-XD-relax"), Arrays.asList(b, a));
|
||||
|
||||
for (CompileState stop : CompileState.values()) {
|
||||
test(Arrays.asList("-XDshouldStopPolicyIfNoError=" + stop,
|
||||
|
@ -231,22 +231,15 @@ public class CheckResourceKeys {
|
||||
"compiler.err.type.var.more.than.once.in.result", // UNUSED
|
||||
"compiler.misc.non.denotable.type", // UNUSED
|
||||
"compiler.misc.unnamed.package", // should be required, CR 6964147
|
||||
"compiler.misc.verbose.retro", // UNUSED
|
||||
"compiler.misc.verbose.retro.with", // UNUSED
|
||||
"compiler.misc.verbose.retro.with.list", // UNUSED
|
||||
"compiler.warn.proc.type.already.exists", // TODO in JavacFiler
|
||||
"javac.err.invalid.arg", // UNUSED ??
|
||||
"javac.opt.arg.class", // UNUSED ??
|
||||
"javac.opt.arg.pathname", // UNUSED ??
|
||||
"javac.opt.moreinfo", // option commented out
|
||||
"javac.opt.nogj", // UNUSED
|
||||
"javac.opt.printflat", // option commented out
|
||||
"javac.opt.printsearch", // option commented out
|
||||
"javac.opt.prompt", // option commented out
|
||||
"javac.opt.retrofit", // UNUSED
|
||||
"javac.opt.s", // option commented out
|
||||
"javac.opt.scramble", // option commented out
|
||||
"javac.opt.scrambleall" // option commented out
|
||||
"javac.opt.s" // option commented out
|
||||
));
|
||||
|
||||
/**
|
||||
|
@ -86,9 +86,6 @@ compiler.misc.unable.to.access.file # ClassFile
|
||||
compiler.misc.undecl.type.var # ClassReader
|
||||
compiler.misc.unicode.str.not.supported # ClassReader
|
||||
compiler.misc.malformed.vararg.method # ClassReader
|
||||
compiler.misc.verbose.retro # UNUSED
|
||||
compiler.misc.verbose.retro.with # UNUSED
|
||||
compiler.misc.verbose.retro.with.list # UNUSED
|
||||
compiler.misc.version.not.available # JavaCompiler; implies build error
|
||||
compiler.misc.where.description.captured
|
||||
compiler.misc.where.typevar.1
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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,14 +21,10 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
// key: compiler.warn.synthetic.name.conflict
|
||||
// options: -XDwarnOnSyntheticConflicts
|
||||
/*
|
||||
* @test
|
||||
* @compile -sourcepath / T8150475.java
|
||||
*/
|
||||
|
||||
class WarnSyntheticNameConflict {
|
||||
class T8150475 { }
|
||||
|
||||
static class Outer {
|
||||
WarnSyntheticNameConflict this$0 = null;
|
||||
}
|
||||
|
||||
public class Inner extends Outer { }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user