8149600: javac, remove unused options, step 2
Reviewed-by: jjg, mcimadamore
This commit is contained in:
parent
886c549879
commit
0698afcea9
@ -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,7 +4377,6 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -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,14 +2627,9 @@ 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Check that class c does not implement directly or indirectly
|
||||
* the same parameterized interface with two different argument lists.
|
||||
|
@ -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,32 +1314,12 @@ 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();
|
||||
}
|
||||
}
|
||||
void genLast() {
|
||||
if (tree.finalizer != null)
|
||||
genStat(tree.finalizer, oldEnv, CRT_BLOCK);
|
||||
@ -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;
|
||||
|
@ -389,9 +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");
|
||||
@ -447,18 +444,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;
|
||||
@ -611,7 +596,7 @@ public class JavaCompiler {
|
||||
// where
|
||||
public boolean keepComments = false;
|
||||
protected boolean keepComments() {
|
||||
return keepComments || sourceOutput || stubOutput;
|
||||
return keepComments || sourceOutput;
|
||||
}
|
||||
|
||||
|
||||
@ -676,6 +661,26 @@ public class JavaCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
/** Generate code and emit a class file for a given class
|
||||
* @param env The attribution environment of the outermost class
|
||||
* containing this class.
|
||||
* @param cdef The class definition from which code is generated.
|
||||
*/
|
||||
JavaFileObject genCode(Env<AttrContext> env, JCClassDecl cdef) throws IOException {
|
||||
try {
|
||||
if (gen.genClass(env, cdef) && (errorCount() == 0))
|
||||
return writer.writeClass(cdef.sym);
|
||||
} catch (ClassWriter.PoolOverflow ex) {
|
||||
log.error(cdef.pos(), "limit.pool");
|
||||
} catch (ClassWriter.StringOverflow ex) {
|
||||
log.error(cdef.pos(), "limit.string.overflow",
|
||||
ex.value.substring(0, 20));
|
||||
} catch (CompletionFailure ex) {
|
||||
chk.completionError(cdef.pos(), ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Emit plain Java source for a class.
|
||||
* @param env The attribution environment of the outermost class
|
||||
* containing this class.
|
||||
@ -700,26 +705,6 @@ public class JavaCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
/** Generate code and emit a class file for a given class
|
||||
* @param env The attribution environment of the outermost class
|
||||
* containing this class.
|
||||
* @param cdef The class definition from which code is generated.
|
||||
*/
|
||||
JavaFileObject genCode(Env<AttrContext> env, JCClassDecl cdef) throws IOException {
|
||||
try {
|
||||
if (gen.genClass(env, cdef) && (errorCount() == 0))
|
||||
return writer.writeClass(cdef.sym);
|
||||
} catch (ClassWriter.PoolOverflow ex) {
|
||||
log.error(cdef.pos(), "limit.pool");
|
||||
} catch (ClassWriter.StringOverflow ex) {
|
||||
log.error(cdef.pos(), "limit.string.overflow",
|
||||
ex.value.substring(0, 20));
|
||||
} catch (CompletionFailure ex) {
|
||||
chk.completionError(cdef.pos(), ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** 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 +882,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 +945,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 +1254,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,7 +1393,7 @@ 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;
|
||||
List<JCTree> pdef = lower.translateTopLevelClass(env, env.tree, localMake);
|
||||
@ -1431,19 +1405,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 +1465,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 +1483,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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 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.synthetic.name.conflict
|
||||
// options: -XDwarnOnSyntheticConflicts
|
||||
|
||||
class WarnSyntheticNameConflict {
|
||||
|
||||
static class Outer {
|
||||
WarnSyntheticNameConflict this$0 = null;
|
||||
}
|
||||
|
||||
public class Inner extends Outer { }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user