mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
6396503: javac should not require assertions enabled
Reviewed-by: mcimadamore
This commit is contained in:
parent
43e78a8d44
commit
e2ed68fb2f
35 changed files with 346 additions and 243 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -43,12 +43,6 @@ import java.lang.reflect.*;
|
||||||
*/
|
*/
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
static {
|
|
||||||
ClassLoader loader = Main.class.getClassLoader();
|
|
||||||
if (loader != null)
|
|
||||||
loader.setPackageAssertionStatus("com.sun.tools.javac", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Unsupported command line interface.
|
/** Unsupported command line interface.
|
||||||
* @param args The command line parameters.
|
* @param args The command line parameters.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -240,8 +240,7 @@ public abstract class Attribute implements AnnotationValue {
|
||||||
public VarSymbol value;
|
public VarSymbol value;
|
||||||
public Enum(Type type, VarSymbol value) {
|
public Enum(Type type, VarSymbol value) {
|
||||||
super(type);
|
super(type);
|
||||||
assert value != null;
|
this.value = Assert.checkNonNull(value);
|
||||||
this.value = value;
|
|
||||||
}
|
}
|
||||||
public void accept(Visitor v) { v.visitEnum(this); }
|
public void accept(Visitor v) { v.visitEnum(this); }
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -133,7 +133,7 @@ public class Scope {
|
||||||
*/
|
*/
|
||||||
private Scope(Scope next, Symbol owner, Entry[] table, ScopeCounter scopeCounter) {
|
private Scope(Scope next, Symbol owner, Entry[] table, ScopeCounter scopeCounter) {
|
||||||
this.next = next;
|
this.next = next;
|
||||||
assert emptyScope == null || owner != null;
|
Assert.check(emptyScope == null || owner != null);
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.table = table;
|
this.table = table;
|
||||||
this.hashMask = table.length - 1;
|
this.hashMask = table.length - 1;
|
||||||
|
@ -191,16 +191,16 @@ public class Scope {
|
||||||
* with next.
|
* with next.
|
||||||
*/
|
*/
|
||||||
public Scope leave() {
|
public Scope leave() {
|
||||||
assert shared == 0;
|
Assert.check(shared == 0);
|
||||||
if (table != next.table) return next;
|
if (table != next.table) return next;
|
||||||
while (elems != null) {
|
while (elems != null) {
|
||||||
int hash = getIndex(elems.sym.name);
|
int hash = getIndex(elems.sym.name);
|
||||||
Entry e = table[hash];
|
Entry e = table[hash];
|
||||||
assert e == elems : elems.sym;
|
Assert.check(e == elems, elems.sym);
|
||||||
table[hash] = elems.shadowed;
|
table[hash] = elems.shadowed;
|
||||||
elems = elems.sibling;
|
elems = elems.sibling;
|
||||||
}
|
}
|
||||||
assert next.shared > 0;
|
Assert.check(next.shared > 0);
|
||||||
next.shared--;
|
next.shared--;
|
||||||
next.nelems = nelems;
|
next.nelems = nelems;
|
||||||
// System.out.println("====> leaving scope " + this.hashCode() + " owned by " + this.owner + " to " + next.hashCode());
|
// System.out.println("====> leaving scope " + this.hashCode() + " owned by " + this.owner + " to " + next.hashCode());
|
||||||
|
@ -211,12 +211,12 @@ public class Scope {
|
||||||
/** Double size of hash table.
|
/** Double size of hash table.
|
||||||
*/
|
*/
|
||||||
private void dble() {
|
private void dble() {
|
||||||
assert shared == 0;
|
Assert.check(shared == 0);
|
||||||
Entry[] oldtable = table;
|
Entry[] oldtable = table;
|
||||||
Entry[] newtable = new Entry[oldtable.length * 2];
|
Entry[] newtable = new Entry[oldtable.length * 2];
|
||||||
for (Scope s = this; s != null; s = s.next) {
|
for (Scope s = this; s != null; s = s.next) {
|
||||||
if (s.table == oldtable) {
|
if (s.table == oldtable) {
|
||||||
assert s == this || s.shared != 0;
|
Assert.check(s == this || s.shared != 0);
|
||||||
s.table = newtable;
|
s.table = newtable;
|
||||||
s.hashMask = newtable.length - 1;
|
s.hashMask = newtable.length - 1;
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ public class Scope {
|
||||||
/** Enter symbol sym in this scope.
|
/** Enter symbol sym in this scope.
|
||||||
*/
|
*/
|
||||||
public void enter(Symbol sym) {
|
public void enter(Symbol sym) {
|
||||||
assert shared == 0;
|
Assert.check(shared == 0);
|
||||||
enter(sym, this);
|
enter(sym, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ public class Scope {
|
||||||
* arguments are only used in import scopes.
|
* 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) {
|
||||||
assert shared == 0;
|
Assert.check(shared == 0);
|
||||||
if (nelems * 3 >= hashMask * 2)
|
if (nelems * 3 >= hashMask * 2)
|
||||||
dble();
|
dble();
|
||||||
int hash = getIndex(sym.name);
|
int hash = getIndex(sym.name);
|
||||||
|
@ -274,7 +274,7 @@ public class Scope {
|
||||||
* attribute tells us that the class isn't a package member.
|
* attribute tells us that the class isn't a package member.
|
||||||
*/
|
*/
|
||||||
public void remove(Symbol sym) {
|
public void remove(Symbol sym) {
|
||||||
assert shared == 0;
|
Assert.check(shared == 0);
|
||||||
Entry e = lookup(sym.name);
|
Entry e = lookup(sym.name);
|
||||||
if (e.scope == null) return;
|
if (e.scope == null) return;
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ public class Scope {
|
||||||
/** Enter symbol sym in this scope if not already there.
|
/** Enter symbol sym in this scope if not already there.
|
||||||
*/
|
*/
|
||||||
public void enterIfAbsent(Symbol sym) {
|
public void enterIfAbsent(Symbol sym) {
|
||||||
assert shared == 0;
|
Assert.check(shared == 0);
|
||||||
Entry e = lookup(sym.name);
|
Entry e = lookup(sym.name);
|
||||||
while (e.scope == this && e.sym.kind != sym.kind) e = e.next();
|
while (e.scope == this && e.sym.kind != sym.kind) e = e.next();
|
||||||
if (e.scope != this) enter(sym);
|
if (e.scope != this) enter(sym);
|
||||||
|
|
|
@ -81,8 +81,7 @@ public abstract class Symbol implements Element {
|
||||||
* method to make sure that the class symbol is loaded.
|
* method to make sure that the class symbol is loaded.
|
||||||
*/
|
*/
|
||||||
public List<Attribute.Compound> getAnnotationMirrors() {
|
public List<Attribute.Compound> getAnnotationMirrors() {
|
||||||
assert attributes_field != null;
|
return Assert.checkNonNull(attributes_field);
|
||||||
return attributes_field;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Fetch a particular annotation from a symbol. */
|
/** Fetch a particular annotation from a symbol. */
|
||||||
|
@ -596,7 +595,7 @@ public abstract class Symbol implements Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
|
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
|
||||||
assert type.tag == TYPEVAR; // else override will be invoked
|
Assert.check(type.tag == TYPEVAR); // else override will be invoked
|
||||||
return v.visitTypeParameter(this, p);
|
return v.visitTypeParameter(this, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,8 +669,7 @@ public abstract class Symbol implements Element {
|
||||||
if (attributes_field.isEmpty())
|
if (attributes_field.isEmpty())
|
||||||
attributes_field = package_info.attributes_field;
|
attributes_field = package_info.attributes_field;
|
||||||
}
|
}
|
||||||
assert attributes_field != null;
|
return Assert.checkNonNull(attributes_field);
|
||||||
return attributes_field;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A package "exists" if a type or package that exists has
|
/** A package "exists" if a type or package that exists has
|
||||||
|
@ -768,8 +766,7 @@ public abstract class Symbol implements Element {
|
||||||
|
|
||||||
public List<Attribute.Compound> getAnnotationMirrors() {
|
public List<Attribute.Compound> getAnnotationMirrors() {
|
||||||
if (completer != null) complete();
|
if (completer != null) complete();
|
||||||
assert attributes_field != null;
|
return Assert.checkNonNull(attributes_field);
|
||||||
return attributes_field;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Type erasure(Types types) {
|
public Type erasure(Types types) {
|
||||||
|
@ -1020,7 +1017,7 @@ public abstract class Symbol implements Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(Object data) {
|
public void setData(Object data) {
|
||||||
assert !(data instanceof Env<?>) : this;
|
Assert.check(!(data instanceof Env<?>), this);
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1052,7 +1049,7 @@ public abstract class Symbol implements Element {
|
||||||
*/
|
*/
|
||||||
public MethodSymbol(long flags, Name name, Type type, Symbol owner) {
|
public MethodSymbol(long flags, Name name, Type type, Symbol owner) {
|
||||||
super(MTH, flags, name, type, owner);
|
super(MTH, flags, name, type, owner);
|
||||||
assert owner.type.tag != TYPEVAR : owner + "." + name;
|
if (owner.type.tag == TYPEVAR) Assert.error(owner + "." + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Clone this symbol with new owner.
|
/** Clone this symbol with new owner.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -138,7 +138,7 @@ public class Type implements PrimitiveType {
|
||||||
*/
|
*/
|
||||||
public Type constType(Object constValue) {
|
public Type constType(Object constValue) {
|
||||||
final Object value = constValue;
|
final Object value = constValue;
|
||||||
assert tag <= BOOLEAN;
|
Assert.check(tag <= BOOLEAN);
|
||||||
return new Type(tag, tsym) {
|
return new Type(tag, tsym) {
|
||||||
@Override
|
@Override
|
||||||
public Object constValue() {
|
public Object constValue() {
|
||||||
|
@ -202,13 +202,13 @@ public class Type implements PrimitiveType {
|
||||||
* The constant value of this type, converted to String
|
* The constant value of this type, converted to String
|
||||||
*/
|
*/
|
||||||
public String stringValue() {
|
public String stringValue() {
|
||||||
assert constValue() != null;
|
Object cv = Assert.checkNonNull(constValue());
|
||||||
if (tag == BOOLEAN)
|
if (tag == BOOLEAN)
|
||||||
return ((Integer) constValue()).intValue() == 0 ? "false" : "true";
|
return ((Integer) cv).intValue() == 0 ? "false" : "true";
|
||||||
else if (tag == CHAR)
|
else if (tag == CHAR)
|
||||||
return String.valueOf((char) ((Integer) constValue()).intValue());
|
return String.valueOf((char) ((Integer) cv).intValue());
|
||||||
else
|
else
|
||||||
return constValue().toString();
|
return cv.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -428,9 +428,8 @@ public class Type implements PrimitiveType {
|
||||||
|
|
||||||
public WildcardType(Type type, BoundKind kind, TypeSymbol tsym) {
|
public WildcardType(Type type, BoundKind kind, TypeSymbol tsym) {
|
||||||
super(WILDCARD, tsym);
|
super(WILDCARD, tsym);
|
||||||
assert(type != null);
|
this.type = Assert.checkNonNull(type);
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.type = type;
|
|
||||||
}
|
}
|
||||||
public WildcardType(WildcardType t, TypeVar bound) {
|
public WildcardType(WildcardType t, TypeVar bound) {
|
||||||
this(t.type, t.kind, t.tsym, bound);
|
this(t.type, t.kind, t.tsym, bound);
|
||||||
|
@ -1021,9 +1020,8 @@ public class Type implements PrimitiveType {
|
||||||
Type lower,
|
Type lower,
|
||||||
WildcardType wildcard) {
|
WildcardType wildcard) {
|
||||||
super(name, owner, lower);
|
super(name, owner, lower);
|
||||||
assert lower != null;
|
this.lower = Assert.checkNonNull(lower);
|
||||||
this.bound = upper;
|
this.bound = upper;
|
||||||
this.lower = lower;
|
|
||||||
this.wildcard = wildcard;
|
this.wildcard = wildcard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -1061,8 +1061,9 @@ public class Types {
|
||||||
highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);
|
highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);
|
||||||
}
|
}
|
||||||
if (highSub != null) {
|
if (highSub != null) {
|
||||||
assert a.tsym == highSub.tsym && a.tsym == lowSub.tsym
|
if (!(a.tsym == highSub.tsym && a.tsym == lowSub.tsym)) {
|
||||||
: a.tsym + " != " + highSub.tsym + " != " + lowSub.tsym;
|
Assert.error(a.tsym + " != " + highSub.tsym + " != " + lowSub.tsym);
|
||||||
|
}
|
||||||
if (!disjointTypes(aHigh.allparams(), highSub.allparams())
|
if (!disjointTypes(aHigh.allparams(), highSub.allparams())
|
||||||
&& !disjointTypes(aHigh.allparams(), lowSub.allparams())
|
&& !disjointTypes(aHigh.allparams(), lowSub.allparams())
|
||||||
&& !disjointTypes(aLow.allparams(), highSub.allparams())
|
&& !disjointTypes(aLow.allparams(), highSub.allparams())
|
||||||
|
@ -1703,9 +1704,9 @@ public class Types {
|
||||||
bt.supertype_field = bounds.head;
|
bt.supertype_field = bounds.head;
|
||||||
bt.interfaces_field = bounds.tail;
|
bt.interfaces_field = bounds.tail;
|
||||||
}
|
}
|
||||||
assert bt.supertype_field.tsym.completer != null
|
Assert.check(bt.supertype_field.tsym.completer != null
|
||||||
|| !bt.supertype_field.isInterface()
|
|| !bt.supertype_field.isInterface(),
|
||||||
: bt.supertype_field;
|
bt.supertype_field);
|
||||||
return bt;
|
return bt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1834,7 +1835,7 @@ public class Types {
|
||||||
// t.interfaces_field is null after
|
// t.interfaces_field is null after
|
||||||
// completion, we can assume that t is not the
|
// completion, we can assume that t is not the
|
||||||
// type of a class/interface declaration.
|
// type of a class/interface declaration.
|
||||||
assert t != t.tsym.type : t.toString();
|
Assert.check(t != t.tsym.type, t);
|
||||||
List<Type> actuals = t.allparams();
|
List<Type> actuals = t.allparams();
|
||||||
List<Type> formals = t.tsym.type.allparams();
|
List<Type> formals = t.tsym.type.allparams();
|
||||||
if (t.hasErasedSupertypes()) {
|
if (t.hasErasedSupertypes()) {
|
||||||
|
@ -2646,7 +2647,7 @@ public class Types {
|
||||||
act2 = act2.tail;
|
act2 = act2.tail;
|
||||||
typarams = typarams.tail;
|
typarams = typarams.tail;
|
||||||
}
|
}
|
||||||
assert(act1.isEmpty() && act2.isEmpty() && typarams.isEmpty());
|
Assert.check(act1.isEmpty() && act2.isEmpty() && typarams.isEmpty());
|
||||||
return new ClassType(class1.getEnclosingType(), merged.toList(), class1.tsym);
|
return new ClassType(class1.getEnclosingType(), merged.toList(), class1.tsym);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2758,7 +2759,7 @@ public class Types {
|
||||||
// calculate lub(A, B)
|
// calculate lub(A, B)
|
||||||
while (ts.head.tag != CLASS && ts.head.tag != TYPEVAR)
|
while (ts.head.tag != CLASS && ts.head.tag != TYPEVAR)
|
||||||
ts = ts.tail;
|
ts = ts.tail;
|
||||||
assert !ts.isEmpty();
|
Assert.check(!ts.isEmpty());
|
||||||
List<Type> cl = closure(ts.head);
|
List<Type> cl = closure(ts.head);
|
||||||
for (Type t : ts.tail) {
|
for (Type t : ts.tail) {
|
||||||
if (t.tag == CLASS || t.tag == TYPEVAR)
|
if (t.tag == CLASS || t.tag == TYPEVAR)
|
||||||
|
@ -3138,7 +3139,7 @@ public class Types {
|
||||||
boolean reverse = false;
|
boolean reverse = false;
|
||||||
Type target = to;
|
Type target = to;
|
||||||
if ((to.tsym.flags() & INTERFACE) == 0) {
|
if ((to.tsym.flags() & INTERFACE) == 0) {
|
||||||
assert (from.tsym.flags() & INTERFACE) != 0;
|
Assert.check((from.tsym.flags() & INTERFACE) != 0);
|
||||||
reverse = true;
|
reverse = true;
|
||||||
to = from;
|
to = from;
|
||||||
from = target;
|
from = target;
|
||||||
|
@ -3173,12 +3174,12 @@ public class Types {
|
||||||
boolean reverse = false;
|
boolean reverse = false;
|
||||||
Type target = to;
|
Type target = to;
|
||||||
if ((to.tsym.flags() & INTERFACE) == 0) {
|
if ((to.tsym.flags() & INTERFACE) == 0) {
|
||||||
assert (from.tsym.flags() & INTERFACE) != 0;
|
Assert.check((from.tsym.flags() & INTERFACE) != 0);
|
||||||
reverse = true;
|
reverse = true;
|
||||||
to = from;
|
to = from;
|
||||||
from = target;
|
from = target;
|
||||||
}
|
}
|
||||||
assert (from.tsym.flags() & FINAL) != 0;
|
Assert.check((from.tsym.flags() & FINAL) != 0);
|
||||||
Type t1 = asSuper(from, to.tsym);
|
Type t1 = asSuper(from, to.tsym);
|
||||||
if (t1 == null) return false;
|
if (t1 == null) return false;
|
||||||
Type t2 = to;
|
Type t2 = to;
|
||||||
|
|
|
@ -563,7 +563,7 @@ public class Attr extends JCTree.Visitor {
|
||||||
if (bound != null && bound.tsym instanceof ClassSymbol) {
|
if (bound != null && bound.tsym instanceof ClassSymbol) {
|
||||||
ClassSymbol c = (ClassSymbol)bound.tsym;
|
ClassSymbol c = (ClassSymbol)bound.tsym;
|
||||||
if ((c.flags_field & COMPOUND) != 0) {
|
if ((c.flags_field & COMPOUND) != 0) {
|
||||||
assert (c.flags_field & UNATTRIBUTED) != 0 : c;
|
Assert.check((c.flags_field & UNATTRIBUTED) != 0, c);
|
||||||
attribClass(typaram.pos(), c);
|
attribClass(typaram.pos(), c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1434,7 +1434,7 @@ public class Attr extends JCTree.Visitor {
|
||||||
localEnv.info.varArgs = false;
|
localEnv.info.varArgs = false;
|
||||||
Type mtype = attribExpr(tree.meth, localEnv, mpt);
|
Type mtype = attribExpr(tree.meth, localEnv, mpt);
|
||||||
if (localEnv.info.varArgs)
|
if (localEnv.info.varArgs)
|
||||||
assert mtype.isErroneous() || tree.varargsElement != null;
|
Assert.check(mtype.isErroneous() || tree.varargsElement != null);
|
||||||
|
|
||||||
// Compute the result type.
|
// Compute the result type.
|
||||||
Type restype = mtype.getReturnType();
|
Type restype = mtype.getReturnType();
|
||||||
|
@ -1667,7 +1667,7 @@ public class Attr extends JCTree.Visitor {
|
||||||
typeargtypes,
|
typeargtypes,
|
||||||
localEnv.info.varArgs);
|
localEnv.info.varArgs);
|
||||||
if (localEnv.info.varArgs)
|
if (localEnv.info.varArgs)
|
||||||
assert tree.constructorType.isErroneous() || tree.varargsElement != null;
|
Assert.check(tree.constructorType.isErroneous() || tree.varargsElement != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cdef != null) {
|
if (cdef != null) {
|
||||||
|
@ -1727,7 +1727,7 @@ public class Attr extends JCTree.Visitor {
|
||||||
Symbol sym = rs.resolveConstructor(
|
Symbol sym = rs.resolveConstructor(
|
||||||
tree.pos(), localEnv, clazztype, argtypes,
|
tree.pos(), localEnv, clazztype, argtypes,
|
||||||
typeargtypes, true, tree.varargsElement != null);
|
typeargtypes, true, tree.varargsElement != null);
|
||||||
assert sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous();
|
Assert.check(sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous());
|
||||||
tree.constructor = sym;
|
tree.constructor = sym;
|
||||||
if (tree.constructor.kind > ERRONEOUS) {
|
if (tree.constructor.kind > ERRONEOUS) {
|
||||||
tree.constructorType = syms.errType;
|
tree.constructorType = syms.errType;
|
||||||
|
@ -2961,7 +2961,7 @@ public class Attr extends JCTree.Visitor {
|
||||||
extending, implementing, List.<JCTree>nil());
|
extending, implementing, List.<JCTree>nil());
|
||||||
|
|
||||||
ClassSymbol c = (ClassSymbol)a.getUpperBound().tsym;
|
ClassSymbol c = (ClassSymbol)a.getUpperBound().tsym;
|
||||||
assert (c.flags() & COMPOUND) != 0;
|
Assert.check((c.flags() & COMPOUND) != 0);
|
||||||
cd.sym = c;
|
cd.sym = c;
|
||||||
c.sourcefile = env.toplevel.sourcefile;
|
c.sourcefile = env.toplevel.sourcefile;
|
||||||
|
|
||||||
|
@ -3093,7 +3093,7 @@ public class Attr extends JCTree.Visitor {
|
||||||
/** Finish the attribution of a class. */
|
/** Finish the attribution of a class. */
|
||||||
private void attribClassBody(Env<AttrContext> env, ClassSymbol c) {
|
private void attribClassBody(Env<AttrContext> env, ClassSymbol c) {
|
||||||
JCClassDecl tree = (JCClassDecl)env.tree;
|
JCClassDecl tree = (JCClassDecl)env.tree;
|
||||||
assert c == tree.sym;
|
Assert.check(c == tree.sym);
|
||||||
|
|
||||||
// Validate annotations
|
// Validate annotations
|
||||||
chk.validateAnnotations(tree.mods.annotations, c);
|
chk.validateAnnotations(tree.mods.annotations, c);
|
||||||
|
@ -3134,12 +3134,9 @@ public class Attr extends JCTree.Visitor {
|
||||||
|
|
||||||
tree.type = c.type;
|
tree.type = c.type;
|
||||||
|
|
||||||
boolean assertsEnabled = false;
|
for (List<JCTypeParameter> l = tree.typarams;
|
||||||
assert assertsEnabled = true;
|
l.nonEmpty(); l = l.tail) {
|
||||||
if (assertsEnabled) {
|
Assert.checkNonNull(env.info.scope.lookup(l.head.name).scope);
|
||||||
for (List<JCTypeParameter> l = tree.typarams;
|
|
||||||
l.nonEmpty(); l = l.tail)
|
|
||||||
assert env.info.scope.lookup(l.head.name).scope != null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that a generic class doesn't extend Throwable
|
// Check that a generic class doesn't extend Throwable
|
||||||
|
|
|
@ -2397,7 +2397,7 @@ public class Check {
|
||||||
*/
|
*/
|
||||||
void checkNonCyclicElements(JCClassDecl tree) {
|
void checkNonCyclicElements(JCClassDecl tree) {
|
||||||
if ((tree.sym.flags_field & ANNOTATION) == 0) return;
|
if ((tree.sym.flags_field & ANNOTATION) == 0) return;
|
||||||
assert (tree.sym.flags_field & LOCKED) == 0;
|
Assert.check((tree.sym.flags_field & LOCKED) == 0);
|
||||||
try {
|
try {
|
||||||
tree.sym.flags_field |= LOCKED;
|
tree.sym.flags_field |= LOCKED;
|
||||||
for (JCTree def : tree.defs) {
|
for (JCTree def : tree.defs) {
|
||||||
|
|
|
@ -708,7 +708,7 @@ public class Flow extends TreeScanner {
|
||||||
|
|
||||||
lint = lint.augment(tree.sym.attributes_field);
|
lint = lint.augment(tree.sym.attributes_field);
|
||||||
|
|
||||||
assert pendingExits.isEmpty();
|
Assert.check(pendingExits.isEmpty());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean isInitialConstructor =
|
boolean isInitialConstructor =
|
||||||
|
@ -746,7 +746,7 @@ public class Flow extends TreeScanner {
|
||||||
PendingExit exit = exits.head;
|
PendingExit exit = exits.head;
|
||||||
exits = exits.tail;
|
exits = exits.tail;
|
||||||
if (exit.thrown == null) {
|
if (exit.thrown == null) {
|
||||||
assert exit.tree.getTag() == JCTree.RETURN;
|
Assert.check(exit.tree.getTag() == JCTree.RETURN);
|
||||||
if (isInitialConstructor) {
|
if (isInitialConstructor) {
|
||||||
inits = exit.inits;
|
inits = exit.inits;
|
||||||
for (int i = firstadr; i < nextadr; i++)
|
for (int i = firstadr; i < nextadr; i++)
|
||||||
|
|
|
@ -1057,7 +1057,7 @@ public class Lower extends TreeTranslator {
|
||||||
}
|
}
|
||||||
// Otherwise replace the variable by its proxy.
|
// Otherwise replace the variable by its proxy.
|
||||||
sym = proxies.lookup(proxyName(sym.name)).sym;
|
sym = proxies.lookup(proxyName(sym.name)).sym;
|
||||||
assert sym != null && (sym.flags_field & FINAL) != 0;
|
Assert.check(sym != null && (sym.flags_field & FINAL) != 0);
|
||||||
tree = make.at(tree.pos).Ident(sym);
|
tree = make.at(tree.pos).Ident(sym);
|
||||||
}
|
}
|
||||||
JCExpression base = (tree.getTag() == JCTree.SELECT) ? ((JCFieldAccess) tree).selected : null;
|
JCExpression base = (tree.getTag() == JCTree.SELECT) ? ((JCFieldAccess) tree).selected : null;
|
||||||
|
@ -1208,7 +1208,7 @@ public class Lower extends TreeTranslator {
|
||||||
*/
|
*/
|
||||||
void makeAccessible(Symbol sym) {
|
void makeAccessible(Symbol sym) {
|
||||||
JCClassDecl cdef = classDef(sym.owner.enclClass());
|
JCClassDecl cdef = classDef(sym.owner.enclClass());
|
||||||
assert cdef != null : "class def not found: " + sym + " in " + sym.owner;
|
if (cdef == null) Assert.error("class def not found: " + sym + " in " + sym.owner);
|
||||||
if (sym.name == names.init) {
|
if (sym.name == names.init) {
|
||||||
cdef.defs = cdef.defs.prepend(
|
cdef.defs = cdef.defs.prepend(
|
||||||
accessConstructorDef(cdef.pos, sym, accessConstrs.get(sym)));
|
accessConstructorDef(cdef.pos, sym, accessConstrs.get(sym)));
|
||||||
|
@ -1458,7 +1458,7 @@ public class Lower extends TreeTranslator {
|
||||||
expr = make.Ident(var.sym).setType(resource.type);
|
expr = make.Ident(var.sym).setType(resource.type);
|
||||||
stats.add(var);
|
stats.add(var);
|
||||||
} else {
|
} else {
|
||||||
assert resource instanceof JCExpression;
|
Assert.check(resource instanceof JCExpression);
|
||||||
VarSymbol syntheticTwrVar =
|
VarSymbol syntheticTwrVar =
|
||||||
new VarSymbol(SYNTHETIC | FINAL,
|
new VarSymbol(SYNTHETIC | FINAL,
|
||||||
makeSyntheticName(names.fromString("twrVar" +
|
makeSyntheticName(names.fromString("twrVar" +
|
||||||
|
@ -1552,7 +1552,7 @@ public class Lower extends TreeTranslator {
|
||||||
List<VarSymbol> ots = outerThisStack;
|
List<VarSymbol> ots = outerThisStack;
|
||||||
if (ots.isEmpty()) {
|
if (ots.isEmpty()) {
|
||||||
log.error(pos, "no.encl.instance.of.type.in.scope", c);
|
log.error(pos, "no.encl.instance.of.type.in.scope", c);
|
||||||
assert false;
|
Assert.error();
|
||||||
return makeNull();
|
return makeNull();
|
||||||
}
|
}
|
||||||
VarSymbol ot = ots.head;
|
VarSymbol ot = ots.head;
|
||||||
|
@ -1565,14 +1565,14 @@ public class Lower extends TreeTranslator {
|
||||||
log.error(pos,
|
log.error(pos,
|
||||||
"no.encl.instance.of.type.in.scope",
|
"no.encl.instance.of.type.in.scope",
|
||||||
c);
|
c);
|
||||||
assert false; // should have been caught in Attr
|
Assert.error(); // should have been caught in Attr
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
ot = ots.head;
|
ot = ots.head;
|
||||||
} while (ot.owner != otc);
|
} while (ot.owner != otc);
|
||||||
if (otc.owner.kind != PCK && !otc.hasOuterInstance()) {
|
if (otc.owner.kind != PCK && !otc.hasOuterInstance()) {
|
||||||
chk.earlyRefError(pos, c);
|
chk.earlyRefError(pos, c);
|
||||||
assert false; // should have been caught in Attr
|
Assert.error(); // should have been caught in Attr
|
||||||
return makeNull();
|
return makeNull();
|
||||||
}
|
}
|
||||||
tree = access(make.at(pos).Select(tree, ot));
|
tree = access(make.at(pos).Select(tree, ot));
|
||||||
|
@ -1610,7 +1610,7 @@ public class Lower extends TreeTranslator {
|
||||||
List<VarSymbol> ots = outerThisStack;
|
List<VarSymbol> ots = outerThisStack;
|
||||||
if (ots.isEmpty()) {
|
if (ots.isEmpty()) {
|
||||||
log.error(pos, "no.encl.instance.of.type.in.scope", c);
|
log.error(pos, "no.encl.instance.of.type.in.scope", c);
|
||||||
assert false;
|
Assert.error();
|
||||||
return makeNull();
|
return makeNull();
|
||||||
}
|
}
|
||||||
VarSymbol ot = ots.head;
|
VarSymbol ot = ots.head;
|
||||||
|
@ -1623,7 +1623,7 @@ public class Lower extends TreeTranslator {
|
||||||
log.error(pos,
|
log.error(pos,
|
||||||
"no.encl.instance.of.type.in.scope",
|
"no.encl.instance.of.type.in.scope",
|
||||||
c);
|
c);
|
||||||
assert false;
|
Assert.error();
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
ot = ots.head;
|
ot = ots.head;
|
||||||
|
@ -1640,9 +1640,9 @@ public class Lower extends TreeTranslator {
|
||||||
JCStatement initField(int pos, Name name) {
|
JCStatement initField(int pos, Name name) {
|
||||||
Scope.Entry e = proxies.lookup(name);
|
Scope.Entry e = proxies.lookup(name);
|
||||||
Symbol rhs = e.sym;
|
Symbol rhs = e.sym;
|
||||||
assert rhs.owner.kind == MTH;
|
Assert.check(rhs.owner.kind == MTH);
|
||||||
Symbol lhs = e.next().sym;
|
Symbol lhs = e.next().sym;
|
||||||
assert rhs.owner.owner == lhs.owner;
|
Assert.check(rhs.owner.owner == lhs.owner);
|
||||||
make.at(pos);
|
make.at(pos);
|
||||||
return
|
return
|
||||||
make.Exec(
|
make.Exec(
|
||||||
|
@ -1655,9 +1655,9 @@ public class Lower extends TreeTranslator {
|
||||||
*/
|
*/
|
||||||
JCStatement initOuterThis(int pos) {
|
JCStatement initOuterThis(int pos) {
|
||||||
VarSymbol rhs = outerThisStack.head;
|
VarSymbol rhs = outerThisStack.head;
|
||||||
assert rhs.owner.kind == MTH;
|
Assert.check(rhs.owner.kind == MTH);
|
||||||
VarSymbol lhs = outerThisStack.tail.head;
|
VarSymbol lhs = outerThisStack.tail.head;
|
||||||
assert rhs.owner.owner == lhs.owner;
|
Assert.check(rhs.owner.owner == lhs.owner);
|
||||||
make.at(pos);
|
make.at(pos);
|
||||||
return
|
return
|
||||||
make.Exec(
|
make.Exec(
|
||||||
|
@ -1856,7 +1856,7 @@ public class Lower extends TreeTranslator {
|
||||||
// where
|
// where
|
||||||
/** Create an attributed tree of the form left.name(). */
|
/** Create an attributed tree of the form left.name(). */
|
||||||
private JCMethodInvocation makeCall(JCExpression left, Name name, List<JCExpression> args) {
|
private JCMethodInvocation makeCall(JCExpression left, Name name, List<JCExpression> args) {
|
||||||
assert left.type != null;
|
Assert.checkNonNull(left.type);
|
||||||
Symbol funcsym = lookupMethod(make_pos, name, left.type,
|
Symbol funcsym = lookupMethod(make_pos, name, left.type,
|
||||||
TreeInfo.types(args));
|
TreeInfo.types(args));
|
||||||
return make.App(make.Select(left, funcsym), args);
|
return make.App(make.Select(left, funcsym), args);
|
||||||
|
@ -2399,7 +2399,7 @@ public class Lower extends TreeTranslator {
|
||||||
names.valueOf,
|
names.valueOf,
|
||||||
tree.sym.type,
|
tree.sym.type,
|
||||||
List.of(syms.stringType));
|
List.of(syms.stringType));
|
||||||
assert (valueOfSym.flags() & STATIC) != 0;
|
Assert.check((valueOfSym.flags() & STATIC) != 0);
|
||||||
VarSymbol nameArgSym = valueOfSym.params.head;
|
VarSymbol nameArgSym = valueOfSym.params.head;
|
||||||
JCIdent nameVal = make.Ident(nameArgSym);
|
JCIdent nameVal = make.Ident(nameArgSym);
|
||||||
JCStatement enum_ValueOf =
|
JCStatement enum_ValueOf =
|
||||||
|
@ -3416,7 +3416,7 @@ public class Lower extends TreeTranslator {
|
||||||
if (expression != null) { // expression for a "default" case is null
|
if (expression != null) { // expression for a "default" case is null
|
||||||
String labelExpr = (String) expression.type.constValue();
|
String labelExpr = (String) expression.type.constValue();
|
||||||
Integer mapping = caseLabelToPosition.put(labelExpr, casePosition);
|
Integer mapping = caseLabelToPosition.put(labelExpr, casePosition);
|
||||||
assert mapping == null;
|
Assert.checkNull(mapping);
|
||||||
int hashCode = labelExpr.hashCode();
|
int hashCode = labelExpr.hashCode();
|
||||||
|
|
||||||
Set<String> stringSet = hashToString.get(hashCode);
|
Set<String> stringSet = hashToString.get(hashCode);
|
||||||
|
@ -3426,7 +3426,7 @@ public class Lower extends TreeTranslator {
|
||||||
hashToString.put(hashCode, stringSet);
|
hashToString.put(hashCode, stringSet);
|
||||||
} else {
|
} else {
|
||||||
boolean added = stringSet.add(labelExpr);
|
boolean added = stringSet.add(labelExpr);
|
||||||
assert added;
|
Assert.check(added);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
casePosition++;
|
casePosition++;
|
||||||
|
@ -3478,7 +3478,7 @@ public class Lower extends TreeTranslator {
|
||||||
for(Map.Entry<Integer, Set<String>> entry : hashToString.entrySet()) {
|
for(Map.Entry<Integer, Set<String>> entry : hashToString.entrySet()) {
|
||||||
int hashCode = entry.getKey();
|
int hashCode = entry.getKey();
|
||||||
Set<String> stringsWithHashCode = entry.getValue();
|
Set<String> stringsWithHashCode = entry.getValue();
|
||||||
assert stringsWithHashCode.size() >= 1;
|
Assert.check(stringsWithHashCode.size() >= 1);
|
||||||
|
|
||||||
JCStatement elsepart = null;
|
JCStatement elsepart = null;
|
||||||
for(String caseLabel : stringsWithHashCode ) {
|
for(String caseLabel : stringsWithHashCode ) {
|
||||||
|
@ -3692,8 +3692,7 @@ public class Lower extends TreeTranslator {
|
||||||
cdef.type,
|
cdef.type,
|
||||||
List.<Type>nil());
|
List.<Type>nil());
|
||||||
|
|
||||||
assert(ordinalSym != null);
|
Assert.check(ordinalSym instanceof MethodSymbol);
|
||||||
assert(ordinalSym instanceof MethodSymbol);
|
|
||||||
|
|
||||||
JCStatement ret = make.Return(make.Ident(ordinalSymbol));
|
JCStatement ret = make.Return(make.Ident(ordinalSymbol));
|
||||||
cdef.defs = cdef.defs.append(make.MethodDef((MethodSymbol)ordinalSym,
|
cdef.defs = cdef.defs.append(make.MethodDef((MethodSymbol)ordinalSym,
|
||||||
|
@ -3709,8 +3708,7 @@ public class Lower extends TreeTranslator {
|
||||||
cdef.type,
|
cdef.type,
|
||||||
List.<Type>nil());
|
List.<Type>nil());
|
||||||
|
|
||||||
assert(nameSym != null);
|
Assert.check(nameSym instanceof MethodSymbol);
|
||||||
assert(nameSym instanceof MethodSymbol);
|
|
||||||
|
|
||||||
JCStatement ret = make.Return(make.Ident(nameSymbol));
|
JCStatement ret = make.Return(make.Ident(nameSymbol));
|
||||||
|
|
||||||
|
@ -3761,8 +3759,7 @@ public class Lower extends TreeTranslator {
|
||||||
cdef.type,
|
cdef.type,
|
||||||
List.of(cdef.sym.type));
|
List.of(cdef.sym.type));
|
||||||
|
|
||||||
assert(compareToSym != null);
|
Assert.check(compareToSym instanceof MethodSymbol);
|
||||||
assert(compareToSym instanceof MethodSymbol);
|
|
||||||
|
|
||||||
JCMethodDecl compareToDecl = (JCMethodDecl) TreeInfo.declarationFor(compareToSym, cdef);
|
JCMethodDecl compareToDecl = (JCMethodDecl) TreeInfo.declarationFor(compareToSym, cdef);
|
||||||
|
|
||||||
|
|
|
@ -581,8 +581,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
|
||||||
JCVariableDecl lastParam = null;
|
JCVariableDecl lastParam = null;
|
||||||
for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
|
for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
|
||||||
JCVariableDecl param = lastParam = l.head;
|
JCVariableDecl param = lastParam = l.head;
|
||||||
assert param.sym != null;
|
params.append(Assert.checkNonNull(param.sym));
|
||||||
params.append(param.sym);
|
|
||||||
}
|
}
|
||||||
m.params = params.toList();
|
m.params = params.toList();
|
||||||
|
|
||||||
|
@ -699,7 +698,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
Type attribImportType(JCTree tree, Env<AttrContext> env) {
|
Type attribImportType(JCTree tree, Env<AttrContext> env) {
|
||||||
assert completionEnabled;
|
Assert.check(completionEnabled);
|
||||||
try {
|
try {
|
||||||
// To prevent deep recursion, suppress completion of some
|
// To prevent deep recursion, suppress completion of some
|
||||||
// types.
|
// types.
|
||||||
|
@ -725,7 +724,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
|
||||||
return "annotate " + annotations + " onto " + s + " in " + s.owner;
|
return "annotate " + annotations + " onto " + s + " in " + s.owner;
|
||||||
}
|
}
|
||||||
public void enterAnnotation() {
|
public void enterAnnotation() {
|
||||||
assert s.kind == PCK || s.attributes_field == null;
|
Assert.check(s.kind == PCK || s.attributes_field == null);
|
||||||
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
|
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
|
||||||
try {
|
try {
|
||||||
if (s.attributes_field != null &&
|
if (s.attributes_field != null &&
|
||||||
|
@ -836,7 +835,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
|
||||||
// Suppress some (recursive) MemberEnter invocations
|
// Suppress some (recursive) MemberEnter invocations
|
||||||
if (!completionEnabled) {
|
if (!completionEnabled) {
|
||||||
// Re-install same completer for next time around and return.
|
// Re-install same completer for next time around and return.
|
||||||
assert (sym.flags() & Flags.COMPOUND) == 0;
|
Assert.check((sym.flags() & Flags.COMPOUND) == 0);
|
||||||
sym.completer = this;
|
sym.completer = this;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -679,7 +679,7 @@ public class Resolve {
|
||||||
boolean operator) {
|
boolean operator) {
|
||||||
if (sym.kind == ERR) return bestSoFar;
|
if (sym.kind == ERR) return bestSoFar;
|
||||||
if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar;
|
if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar;
|
||||||
assert sym.kind < AMBIGUOUS;
|
Assert.check(sym.kind < AMBIGUOUS);
|
||||||
try {
|
try {
|
||||||
rawInstantiate(env, site, sym, argtypes, typeargtypes,
|
rawInstantiate(env, site, sym, argtypes, typeargtypes,
|
||||||
allowBoxing, useVarargs, Warner.noWarnings);
|
allowBoxing, useVarargs, Warner.noWarnings);
|
||||||
|
|
|
@ -180,7 +180,7 @@ public class TransTypes extends TreeTranslator {
|
||||||
parameters = parameters.tail;
|
parameters = parameters.tail;
|
||||||
}
|
}
|
||||||
Type parameter = parameters.head;
|
Type parameter = parameters.head;
|
||||||
assert varargsElement != null || args.length() == 1;
|
Assert.check(varargsElement != null || args.length() == 1);
|
||||||
if (varargsElement != null) {
|
if (varargsElement != null) {
|
||||||
while (args.nonEmpty()) {
|
while (args.nonEmpty()) {
|
||||||
args.head = translate(args.head, varargsElement);
|
args.head = translate(args.head, varargsElement);
|
||||||
|
@ -594,7 +594,7 @@ public class TransTypes extends TreeTranslator {
|
||||||
if (tree.varargsElement != null)
|
if (tree.varargsElement != null)
|
||||||
tree.varargsElement = types.erasure(tree.varargsElement);
|
tree.varargsElement = types.erasure(tree.varargsElement);
|
||||||
else
|
else
|
||||||
assert tree.args.length() == argtypes.length();
|
Assert.check(tree.args.length() == argtypes.length());
|
||||||
tree.args = translateArgs(tree.args, argtypes, tree.varargsElement);
|
tree.args = translateArgs(tree.args, argtypes, tree.varargsElement);
|
||||||
|
|
||||||
// Insert casts of method invocation results as needed.
|
// Insert casts of method invocation results as needed.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -42,6 +42,7 @@ import java.nio.charset.CharsetDecoder;
|
||||||
import com.sun.tools.javac.file.JavacFileManager.Archive;
|
import com.sun.tools.javac.file.JavacFileManager.Archive;
|
||||||
import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
|
import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
|
||||||
import com.sun.tools.javac.file.RelativePath.RelativeFile;
|
import com.sun.tools.javac.file.RelativePath.RelativeFile;
|
||||||
|
import com.sun.tools.javac.util.Assert;
|
||||||
import com.sun.tools.javac.util.List;
|
import com.sun.tools.javac.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,7 +147,7 @@ public class ZipFileIndexArchive implements Archive {
|
||||||
@Override
|
@Override
|
||||||
public InputStream openInputStream() throws IOException {
|
public InputStream openInputStream() throws IOException {
|
||||||
if (inputStream == null) {
|
if (inputStream == null) {
|
||||||
assert entry != null; // see constructor
|
Assert.checkNonNull(entry); // see constructor
|
||||||
inputStream = new ByteArrayInputStream(zfIndex.read(entry));
|
inputStream = new ByteArrayInputStream(zfIndex.read(entry));
|
||||||
}
|
}
|
||||||
return inputStream;
|
return inputStream;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -101,7 +101,7 @@ implements CRTFlags {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SourceRange pos = positions.get(entry.tree);
|
SourceRange pos = positions.get(entry.tree);
|
||||||
assert pos != null : "CRT: tree source positions are undefined";
|
Assert.checkNonNull(pos, "CRT: tree source positions are undefined");
|
||||||
if ((pos.startPos == Position.NOPOS) || (pos.endPos == Position.NOPOS))
|
if ((pos.startPos == Position.NOPOS) || (pos.endPos == Position.NOPOS))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ implements CRTFlags {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitTree(JCTree tree) {
|
public void visitTree(JCTree tree) {
|
||||||
assert false;
|
Assert.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The start position of given tree.
|
/** The start position of given tree.
|
||||||
|
|
|
@ -242,9 +242,9 @@ public class ClassReader implements Completer {
|
||||||
if (classes != null) return;
|
if (classes != null) return;
|
||||||
|
|
||||||
if (definitive) {
|
if (definitive) {
|
||||||
assert packages == null || packages == syms.packages;
|
Assert.check(packages == null || packages == syms.packages);
|
||||||
packages = syms.packages;
|
packages = syms.packages;
|
||||||
assert classes == null || classes == syms.classes;
|
Assert.check(classes == null || classes == syms.classes);
|
||||||
classes = syms.classes;
|
classes = syms.classes;
|
||||||
} else {
|
} else {
|
||||||
packages = new HashMap<Name, PackageSymbol>();
|
packages = new HashMap<Name, PackageSymbol>();
|
||||||
|
@ -530,7 +530,7 @@ public class ClassReader implements Completer {
|
||||||
int index = poolIdx[i];
|
int index = poolIdx[i];
|
||||||
int len = getChar(index + 1);
|
int len = getChar(index + 1);
|
||||||
int start = index + 3;
|
int start = index + 3;
|
||||||
assert buf[start] == '[' || buf[start + len - 1] != ';';
|
Assert.check(buf[start] == '[' || buf[start + len - 1] != ';');
|
||||||
// by the above assertion, the following test can be
|
// by the above assertion, the following test can be
|
||||||
// simplified to (buf[start] == '[')
|
// simplified to (buf[start] == '[')
|
||||||
return (buf[start] == '[' || buf[start + len - 1] == ';')
|
return (buf[start] == '[' || buf[start + len - 1] == ';')
|
||||||
|
@ -1041,7 +1041,7 @@ public class ClassReader implements Completer {
|
||||||
readingClassAttr = true;
|
readingClassAttr = true;
|
||||||
try {
|
try {
|
||||||
ClassType ct1 = (ClassType)c.type;
|
ClassType ct1 = (ClassType)c.type;
|
||||||
assert c == currentOwner;
|
Assert.check(c == currentOwner);
|
||||||
ct1.typarams_field = readTypeParams(nextChar());
|
ct1.typarams_field = readTypeParams(nextChar());
|
||||||
ct1.supertype_field = sigToType();
|
ct1.supertype_field = sigToType();
|
||||||
ListBuffer<Type> is = new ListBuffer<Type>();
|
ListBuffer<Type> is = new ListBuffer<Type>();
|
||||||
|
@ -1908,9 +1908,9 @@ public class ClassReader implements Completer {
|
||||||
if (ct.interfaces_field == null)
|
if (ct.interfaces_field == null)
|
||||||
ct.interfaces_field = is.reverse();
|
ct.interfaces_field = is.reverse();
|
||||||
|
|
||||||
if (fieldCount != nextChar()) assert false;
|
Assert.check(fieldCount == nextChar());
|
||||||
for (int i = 0; i < fieldCount; i++) enterMember(c, readField());
|
for (int i = 0; i < fieldCount; i++) enterMember(c, readField());
|
||||||
if (methodCount != nextChar()) assert false;
|
Assert.check(methodCount == nextChar());
|
||||||
for (int i = 0; i < methodCount; i++) enterMember(c, readMethod());
|
for (int i = 0; i < methodCount; i++) enterMember(c, readMethod());
|
||||||
|
|
||||||
typevars = typevars.leave();
|
typevars = typevars.leave();
|
||||||
|
@ -2019,7 +2019,7 @@ public class ClassReader implements Completer {
|
||||||
public ClassSymbol defineClass(Name name, Symbol owner) {
|
public ClassSymbol defineClass(Name name, Symbol owner) {
|
||||||
ClassSymbol c = new ClassSymbol(0, name, owner);
|
ClassSymbol c = new ClassSymbol(0, name, owner);
|
||||||
if (owner.kind == PCK)
|
if (owner.kind == PCK)
|
||||||
assert classes.get(c.flatname) == null : c;
|
Assert.checkNull(classes.get(c.flatname), c);
|
||||||
c.completer = this;
|
c.completer = this;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -2159,9 +2159,9 @@ public class ClassReader implements Completer {
|
||||||
if (classfile != null) {
|
if (classfile != null) {
|
||||||
JavaFileObject previousClassFile = currentClassFile;
|
JavaFileObject previousClassFile = currentClassFile;
|
||||||
try {
|
try {
|
||||||
assert !filling :
|
if (filling) {
|
||||||
"Filling " + classfile.toUri() +
|
Assert.error("Filling " + classfile.toUri() + " during " + previousClassFile);
|
||||||
" during " + previousClassFile;
|
}
|
||||||
currentClassFile = classfile;
|
currentClassFile = classfile;
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
printVerbose("loading", currentClassFile.toString());
|
printVerbose("loading", currentClassFile.toString());
|
||||||
|
@ -2307,7 +2307,7 @@ public class ClassReader implements Completer {
|
||||||
public PackageSymbol enterPackage(Name fullname) {
|
public PackageSymbol enterPackage(Name fullname) {
|
||||||
PackageSymbol p = packages.get(fullname);
|
PackageSymbol p = packages.get(fullname);
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
assert !fullname.isEmpty() : "rootPackage missing!";
|
Assert.check(!fullname.isEmpty(), "rootPackage missing!");
|
||||||
p = new PackageSymbol(
|
p = new PackageSymbol(
|
||||||
Convert.shortName(fullname),
|
Convert.shortName(fullname),
|
||||||
enterPackage(Convert.packagePart(fullname)));
|
enterPackage(Convert.packagePart(fullname)));
|
||||||
|
|
|
@ -219,11 +219,14 @@ public class ClassWriter extends ClassFile {
|
||||||
/** Return flags as a string, separated by " ".
|
/** Return flags as a string, separated by " ".
|
||||||
*/
|
*/
|
||||||
public static String flagNames(long flags) {
|
public static String flagNames(long flags) {
|
||||||
StringBuffer sbuf = new StringBuffer();
|
StringBuilder sbuf = new StringBuilder();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
long f = flags & StandardFlags;
|
long f = flags & StandardFlags;
|
||||||
while (f != 0) {
|
while (f != 0) {
|
||||||
if ((f & 1) != 0) sbuf.append(" " + flagName[i]);
|
if ((f & 1) != 0) {
|
||||||
|
sbuf.append(" ");
|
||||||
|
sbuf.append(flagName[i]);
|
||||||
|
}
|
||||||
f = f >> 1;
|
f = f >> 1;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +379,7 @@ public class ClassWriter extends ClassFile {
|
||||||
? types.erasure(outer)
|
? types.erasure(outer)
|
||||||
: outer);
|
: outer);
|
||||||
sigbuf.appendByte('.');
|
sigbuf.appendByte('.');
|
||||||
assert c.flatname.startsWith(c.owner.enclClass().flatname);
|
Assert.check(c.flatname.startsWith(c.owner.enclClass().flatname));
|
||||||
sigbuf.appendName(rawOuter
|
sigbuf.appendName(rawOuter
|
||||||
? c.flatname.subName(c.owner.enclClass().flatname.getByteLength()+1,c.flatname.getByteLength())
|
? c.flatname.subName(c.owner.enclClass().flatname.getByteLength()+1,c.flatname.getByteLength())
|
||||||
: c.name);
|
: c.name);
|
||||||
|
@ -416,7 +419,7 @@ public class ClassWriter extends ClassFile {
|
||||||
/** Return signature of given type
|
/** Return signature of given type
|
||||||
*/
|
*/
|
||||||
Name typeSig(Type type) {
|
Name typeSig(Type type) {
|
||||||
assert sigbuf.length == 0;
|
Assert.check(sigbuf.length == 0);
|
||||||
//- System.out.println(" ? " + type);
|
//- System.out.println(" ? " + type);
|
||||||
assembleSig(type);
|
assembleSig(type);
|
||||||
Name n = sigbuf.toName(names);
|
Name n = sigbuf.toName(names);
|
||||||
|
@ -466,7 +469,7 @@ public class ClassWriter extends ClassFile {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (i < pool.pp) {
|
while (i < pool.pp) {
|
||||||
Object value = pool.pool[i];
|
Object value = pool.pool[i];
|
||||||
assert value != null;
|
Assert.checkNonNull(value);
|
||||||
if (value instanceof Pool.Method)
|
if (value instanceof Pool.Method)
|
||||||
value = ((Pool.Method)value).m;
|
value = ((Pool.Method)value).m;
|
||||||
else if (value instanceof Pool.Variable)
|
else if (value instanceof Pool.Variable)
|
||||||
|
@ -529,7 +532,7 @@ public class ClassWriter extends ClassFile {
|
||||||
poolbuf.appendByte(CONSTANT_Class);
|
poolbuf.appendByte(CONSTANT_Class);
|
||||||
poolbuf.appendChar(pool.put(xClassName(type)));
|
poolbuf.appendChar(pool.put(xClassName(type)));
|
||||||
} else {
|
} else {
|
||||||
assert false : "writePool " + value;
|
Assert.error("writePool " + value);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -798,7 +801,7 @@ public class ClassWriter extends ClassFile {
|
||||||
databuf.appendByte('Z');
|
databuf.appendByte('Z');
|
||||||
break;
|
break;
|
||||||
case CLASS:
|
case CLASS:
|
||||||
assert value instanceof String;
|
Assert.check(value instanceof String);
|
||||||
databuf.appendByte('s');
|
databuf.appendByte('s');
|
||||||
value = names.fromString(value.toString()); // CONSTANT_Utf8
|
value = names.fromString(value.toString()); // CONSTANT_Utf8
|
||||||
break;
|
break;
|
||||||
|
@ -1015,11 +1018,11 @@ public class ClassWriter extends ClassFile {
|
||||||
Code.LocalVar var = code.varBuffer[i];
|
Code.LocalVar var = code.varBuffer[i];
|
||||||
|
|
||||||
// write variable info
|
// write variable info
|
||||||
assert var.start_pc >= 0;
|
Assert.check(var.start_pc >= 0
|
||||||
assert var.start_pc <= code.cp;
|
&& var.start_pc <= code.cp);
|
||||||
databuf.appendChar(var.start_pc);
|
databuf.appendChar(var.start_pc);
|
||||||
assert var.length >= 0;
|
Assert.check(var.length >= 0
|
||||||
assert (var.start_pc + var.length) <= code.cp;
|
&& (var.start_pc + var.length) <= code.cp);
|
||||||
databuf.appendChar(var.length);
|
databuf.appendChar(var.length);
|
||||||
VarSymbol sym = var.sym;
|
VarSymbol sym = var.sym;
|
||||||
databuf.appendChar(pool.put(sym.name));
|
databuf.appendChar(pool.put(sym.name));
|
||||||
|
@ -1051,7 +1054,7 @@ public class ClassWriter extends ClassFile {
|
||||||
databuf.appendChar(pool.put(typeSig(sym.type)));
|
databuf.appendChar(pool.put(typeSig(sym.type)));
|
||||||
databuf.appendChar(var.reg);
|
databuf.appendChar(var.reg);
|
||||||
}
|
}
|
||||||
assert count == nGenericVars;
|
Assert.check(count == nGenericVars);
|
||||||
endAttr(alenIdx);
|
endAttr(alenIdx);
|
||||||
acount++;
|
acount++;
|
||||||
}
|
}
|
||||||
|
@ -1122,7 +1125,7 @@ public class ClassWriter extends ClassFile {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JSR202: {
|
case JSR202: {
|
||||||
assert code.stackMapBuffer == null;
|
Assert.checkNull(code.stackMapBuffer);
|
||||||
for (int i=0; i<nframes; i++) {
|
for (int i=0; i<nframes; i++) {
|
||||||
if (debugstackmap) System.out.print(" " + i + ":");
|
if (debugstackmap) System.out.print(" " + i + ":");
|
||||||
StackMapTableFrame frame = code.stackMapTableBuffer[i];
|
StackMapTableFrame frame = code.stackMapTableBuffer[i];
|
||||||
|
@ -1462,7 +1465,7 @@ public class ClassWriter extends ClassFile {
|
||||||
*/
|
*/
|
||||||
public void writeClassFile(OutputStream out, ClassSymbol c)
|
public void writeClassFile(OutputStream out, ClassSymbol c)
|
||||||
throws IOException, PoolOverflow, StringOverflow {
|
throws IOException, PoolOverflow, StringOverflow {
|
||||||
assert (c.flags() & COMPOUND) == 0;
|
Assert.check((c.flags() & COMPOUND) == 0);
|
||||||
databuf.reset();
|
databuf.reset();
|
||||||
poolbuf.reset();
|
poolbuf.reset();
|
||||||
sigbuf.reset();
|
sigbuf.reset();
|
||||||
|
@ -1499,7 +1502,7 @@ public class ClassWriter extends ClassFile {
|
||||||
case MTH: if ((e.sym.flags() & HYPOTHETICAL) == 0) methodsCount++;
|
case MTH: if ((e.sym.flags() & HYPOTHETICAL) == 0) methodsCount++;
|
||||||
break;
|
break;
|
||||||
case TYP: enterInner((ClassSymbol)e.sym); break;
|
case TYP: enterInner((ClassSymbol)e.sym); break;
|
||||||
default : assert false;
|
default : Assert.error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
databuf.appendChar(fieldsCount);
|
databuf.appendChar(fieldsCount);
|
||||||
|
@ -1515,7 +1518,7 @@ public class ClassWriter extends ClassFile {
|
||||||
for (List<Type> l = interfaces; !sigReq && l.nonEmpty(); l = l.tail)
|
for (List<Type> l = interfaces; !sigReq && l.nonEmpty(); l = l.tail)
|
||||||
sigReq = l.head.allparams().length() != 0;
|
sigReq = l.head.allparams().length() != 0;
|
||||||
if (sigReq) {
|
if (sigReq) {
|
||||||
assert source.allowGenerics();
|
Assert.check(source.allowGenerics());
|
||||||
int alenIdx = writeAttr(names.Signature);
|
int alenIdx = writeAttr(names.Signature);
|
||||||
if (typarams.length() != 0) assembleParamsSig(typarams);
|
if (typarams.length() != 0) assembleParamsSig(typarams);
|
||||||
assembleSig(supertype);
|
assembleSig(supertype);
|
||||||
|
|
|
@ -372,7 +372,7 @@ public class Code {
|
||||||
}
|
}
|
||||||
|
|
||||||
void postop() {
|
void postop() {
|
||||||
assert alive || state.stacksize == 0;
|
Assert.check(alive || state.stacksize == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Emit a multinewarray instruction.
|
/** Emit a multinewarray instruction.
|
||||||
|
@ -583,7 +583,7 @@ public class Code {
|
||||||
case areturn:
|
case areturn:
|
||||||
case ireturn:
|
case ireturn:
|
||||||
case freturn:
|
case freturn:
|
||||||
assert state.nlocks == 0;
|
Assert.check(state.nlocks == 0);
|
||||||
state.pop(1);
|
state.pop(1);
|
||||||
markDead();
|
markDead();
|
||||||
break;
|
break;
|
||||||
|
@ -604,7 +604,7 @@ public class Code {
|
||||||
break;
|
break;
|
||||||
case lreturn:
|
case lreturn:
|
||||||
case dreturn:
|
case dreturn:
|
||||||
assert state.nlocks == 0;
|
Assert.check(state.nlocks == 0);
|
||||||
state.pop(2);
|
state.pop(2);
|
||||||
markDead();
|
markDead();
|
||||||
break;
|
break;
|
||||||
|
@ -612,7 +612,7 @@ public class Code {
|
||||||
state.push(state.stack[state.stacksize-1]);
|
state.push(state.stack[state.stacksize-1]);
|
||||||
break;
|
break;
|
||||||
case return_:
|
case return_:
|
||||||
assert state.nlocks == 0;
|
Assert.check(state.nlocks == 0);
|
||||||
markDead();
|
markDead();
|
||||||
break;
|
break;
|
||||||
case arraylength:
|
case arraylength:
|
||||||
|
@ -1147,7 +1147,7 @@ public class Code {
|
||||||
int pc = curPc();
|
int pc = curPc();
|
||||||
alive = true;
|
alive = true;
|
||||||
this.state = state.dup();
|
this.state = state.dup();
|
||||||
assert state.stacksize <= max_stack;
|
Assert.check(state.stacksize <= max_stack);
|
||||||
if (debugCode) System.err.println("entry point " + state);
|
if (debugCode) System.err.println("entry point " + state);
|
||||||
pendingStackMap = needStackMap;
|
pendingStackMap = needStackMap;
|
||||||
return pc;
|
return pc;
|
||||||
|
@ -1160,7 +1160,7 @@ public class Code {
|
||||||
int pc = curPc();
|
int pc = curPc();
|
||||||
alive = true;
|
alive = true;
|
||||||
this.state = state.dup();
|
this.state = state.dup();
|
||||||
assert state.stacksize <= max_stack;
|
Assert.check(state.stacksize <= max_stack);
|
||||||
this.state.push(pushed);
|
this.state.push(pushed);
|
||||||
if (debugCode) System.err.println("entry point " + state);
|
if (debugCode) System.err.println("entry point " + state);
|
||||||
pendingStackMap = needStackMap;
|
pendingStackMap = needStackMap;
|
||||||
|
@ -1289,7 +1289,7 @@ public class Code {
|
||||||
}
|
}
|
||||||
frame.locals = new Type[localCount];
|
frame.locals = new Type[localCount];
|
||||||
for (int i=0, j=0; i<localsSize; i++, j++) {
|
for (int i=0, j=0; i<localsSize; i++, j++) {
|
||||||
assert(j < localCount);
|
Assert.check(j < localCount);
|
||||||
frame.locals[j] = locals[i];
|
frame.locals[j] = locals[i];
|
||||||
if (width(locals[i]) > 1) i++;
|
if (width(locals[i]) > 1) i++;
|
||||||
}
|
}
|
||||||
|
@ -1435,8 +1435,8 @@ public class Code {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
State newState = state;
|
State newState = state;
|
||||||
for (; chain != null; chain = chain.next) {
|
for (; chain != null; chain = chain.next) {
|
||||||
assert state != chain.state;
|
Assert.check(state != chain.state
|
||||||
assert target > chain.pc || state.stacksize == 0;
|
&& (target > chain.pc || state.stacksize == 0));
|
||||||
if (target >= cp) {
|
if (target >= cp) {
|
||||||
target = cp;
|
target = cp;
|
||||||
} else if (get1(target) == goto_) {
|
} else if (get1(target) == goto_) {
|
||||||
|
@ -1464,9 +1464,9 @@ public class Code {
|
||||||
fatcode = true;
|
fatcode = true;
|
||||||
else
|
else
|
||||||
put2(chain.pc + 1, target - chain.pc);
|
put2(chain.pc + 1, target - chain.pc);
|
||||||
assert !alive ||
|
Assert.check(!alive ||
|
||||||
chain.state.stacksize == newState.stacksize &&
|
chain.state.stacksize == newState.stacksize &&
|
||||||
chain.state.nlocks == newState.nlocks;
|
chain.state.nlocks == newState.nlocks);
|
||||||
}
|
}
|
||||||
fixedPc = true;
|
fixedPc = true;
|
||||||
if (cp == target) {
|
if (cp == target) {
|
||||||
|
@ -1481,7 +1481,7 @@ public class Code {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert !changed || state != newState;
|
Assert.check(!changed || state != newState);
|
||||||
if (state != newState) {
|
if (state != newState) {
|
||||||
setDefined(newState.defined);
|
setDefined(newState.defined);
|
||||||
state = newState;
|
state = newState;
|
||||||
|
@ -1492,11 +1492,11 @@ public class Code {
|
||||||
/** Resolve chain to point to current code pointer.
|
/** Resolve chain to point to current code pointer.
|
||||||
*/
|
*/
|
||||||
public void resolve(Chain chain) {
|
public void resolve(Chain chain) {
|
||||||
assert
|
Assert.check(
|
||||||
!alive ||
|
!alive ||
|
||||||
chain==null ||
|
chain==null ||
|
||||||
state.stacksize == chain.state.stacksize &&
|
state.stacksize == chain.state.stacksize &&
|
||||||
state.nlocks == chain.state.nlocks;
|
state.nlocks == chain.state.nlocks);
|
||||||
pendingJumps = mergeChains(chain, pendingJumps);
|
pendingJumps = mergeChains(chain, pendingJumps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1514,9 +1514,9 @@ public class Code {
|
||||||
// recursive merge sort
|
// recursive merge sort
|
||||||
if (chain2 == null) return chain1;
|
if (chain2 == null) return chain1;
|
||||||
if (chain1 == null) return chain2;
|
if (chain1 == null) return chain2;
|
||||||
assert
|
Assert.check(
|
||||||
chain1.state.stacksize == chain2.state.stacksize &&
|
chain1.state.stacksize == chain2.state.stacksize &&
|
||||||
chain1.state.nlocks == chain2.state.nlocks;
|
chain1.state.nlocks == chain2.state.nlocks);
|
||||||
if (chain1.pc < chain2.pc)
|
if (chain1.pc < chain2.pc)
|
||||||
return new Chain(
|
return new Chain(
|
||||||
chain2.pc,
|
chain2.pc,
|
||||||
|
@ -1631,7 +1631,7 @@ public class Code {
|
||||||
|
|
||||||
void unlock(int register) {
|
void unlock(int register) {
|
||||||
nlocks--;
|
nlocks--;
|
||||||
assert locks[nlocks] == register;
|
Assert.check(locks[nlocks] == register);
|
||||||
locks[nlocks] = -1;
|
locks[nlocks] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1673,7 +1673,7 @@ public class Code {
|
||||||
stacksize--;
|
stacksize--;
|
||||||
Type result = stack[stacksize];
|
Type result = stack[stacksize];
|
||||||
stack[stacksize] = null;
|
stack[stacksize] = null;
|
||||||
assert result != null && width(result) == 1;
|
Assert.check(result != null && width(result) == 1);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1686,8 +1686,8 @@ public class Code {
|
||||||
stacksize -= 2;
|
stacksize -= 2;
|
||||||
Type result = stack[stacksize];
|
Type result = stack[stacksize];
|
||||||
stack[stacksize] = null;
|
stack[stacksize] = null;
|
||||||
assert stack[stacksize+1] == null;
|
Assert.check(stack[stacksize+1] == null
|
||||||
assert result != null && width(result) == 2;
|
&& result != null && width(result) == 2);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1712,8 +1712,8 @@ public class Code {
|
||||||
case ARRAY:
|
case ARRAY:
|
||||||
int width = width(t);
|
int width = width(t);
|
||||||
Type old = stack[stacksize-width];
|
Type old = stack[stacksize-width];
|
||||||
assert types.isSubtype(types.erasure(old),
|
Assert.check(types.isSubtype(types.erasure(old),
|
||||||
types.erasure(t));
|
types.erasure(t)));
|
||||||
stack[stacksize-width] = t;
|
stack[stacksize-width] = t;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1739,8 +1739,8 @@ public class Code {
|
||||||
|
|
||||||
State join(State other) {
|
State join(State other) {
|
||||||
defined = defined.andSet(other.defined);
|
defined = defined.andSet(other.defined);
|
||||||
assert stacksize == other.stacksize;
|
Assert.check(stacksize == other.stacksize
|
||||||
assert nlocks == other.nlocks;
|
&& nlocks == other.nlocks);
|
||||||
for (int i=0; i<stacksize; ) {
|
for (int i=0; i<stacksize; ) {
|
||||||
Type t = stack[i];
|
Type t = stack[i];
|
||||||
Type tother = other.stack[i];
|
Type tother = other.stack[i];
|
||||||
|
@ -1751,7 +1751,7 @@ public class Code {
|
||||||
error();
|
error();
|
||||||
int w = width(result);
|
int w = width(result);
|
||||||
stack[i] = result;
|
stack[i] = result;
|
||||||
if (w == 2) assert stack[i+1] == null;
|
if (w == 2) Assert.checkNull(stack[i+1]);
|
||||||
i += w;
|
i += w;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
@ -1847,7 +1847,7 @@ public class Code {
|
||||||
System.arraycopy(lvar, 0, new_lvar, 0, lvar.length);
|
System.arraycopy(lvar, 0, new_lvar, 0, lvar.length);
|
||||||
lvar = new_lvar;
|
lvar = new_lvar;
|
||||||
}
|
}
|
||||||
assert lvar[adr] == null;
|
Assert.checkNull(lvar[adr]);
|
||||||
if (pendingJumps != null) resolvePending();
|
if (pendingJumps != null) resolvePending();
|
||||||
lvar[adr] = new LocalVar(v);
|
lvar[adr] = new LocalVar(v);
|
||||||
state.defined.excl(adr);
|
state.defined.excl(adr);
|
||||||
|
|
|
@ -500,7 +500,7 @@ public class Gen extends JCTree.Visitor {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert false;
|
Assert.error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Insert any instance initializers into all constructors.
|
// Insert any instance initializers into all constructors.
|
||||||
|
@ -857,7 +857,7 @@ public class Gen extends JCTree.Visitor {
|
||||||
pts = pts.tail;
|
pts = pts.tail;
|
||||||
}
|
}
|
||||||
// require lists be of same length
|
// require lists be of same length
|
||||||
assert pts.isEmpty();
|
Assert.check(pts.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************
|
/* ************************************************************************
|
||||||
|
@ -1111,7 +1111,7 @@ public class Gen extends JCTree.Visitor {
|
||||||
|
|
||||||
public void visitSwitch(JCSwitch tree) {
|
public void visitSwitch(JCSwitch tree) {
|
||||||
int limit = code.nextreg;
|
int limit = code.nextreg;
|
||||||
assert tree.selector.type.tag != CLASS;
|
Assert.check(tree.selector.type.tag != CLASS);
|
||||||
int startpcCrt = genCrt ? code.curPc() : 0;
|
int startpcCrt = genCrt ? code.curPc() : 0;
|
||||||
Item sel = genExpr(tree.selector, syms.intType);
|
Item sel = genExpr(tree.selector, syms.intType);
|
||||||
List<JCCase> cases = tree.cases;
|
List<JCCase> cases = tree.cases;
|
||||||
|
@ -1148,7 +1148,7 @@ public class Gen extends JCTree.Visitor {
|
||||||
if (hi < val) hi = val;
|
if (hi < val) hi = val;
|
||||||
nlabels++;
|
nlabels++;
|
||||||
} else {
|
} else {
|
||||||
assert defaultIndex == -1;
|
Assert.check(defaultIndex == -1);
|
||||||
defaultIndex = i;
|
defaultIndex = i;
|
||||||
}
|
}
|
||||||
l = l.tail;
|
l = l.tail;
|
||||||
|
@ -1290,7 +1290,7 @@ public class Gen extends JCTree.Visitor {
|
||||||
syncEnv.info.finalize = new GenFinalizer() {
|
syncEnv.info.finalize = new GenFinalizer() {
|
||||||
void gen() {
|
void gen() {
|
||||||
genLast();
|
genLast();
|
||||||
assert syncEnv.info.gaps.length() % 2 == 0;
|
Assert.check(syncEnv.info.gaps.length() % 2 == 0);
|
||||||
syncEnv.info.gaps.append(code.curPc());
|
syncEnv.info.gaps.append(code.curPc());
|
||||||
}
|
}
|
||||||
void genLast() {
|
void genLast() {
|
||||||
|
@ -1329,10 +1329,10 @@ public class Gen extends JCTree.Visitor {
|
||||||
tryEnv.info.cont,
|
tryEnv.info.cont,
|
||||||
jsrState);
|
jsrState);
|
||||||
}
|
}
|
||||||
assert tryEnv.info.gaps.length() % 2 == 0;
|
Assert.check(tryEnv.info.gaps.length() % 2 == 0);
|
||||||
tryEnv.info.gaps.append(code.curPc());
|
tryEnv.info.gaps.append(code.curPc());
|
||||||
} else {
|
} else {
|
||||||
assert tryEnv.info.gaps.length() % 2 == 0;
|
Assert.check(tryEnv.info.gaps.length() % 2 == 0);
|
||||||
tryEnv.info.gaps.append(code.curPc());
|
tryEnv.info.gaps.append(code.curPc());
|
||||||
genLast();
|
genLast();
|
||||||
}
|
}
|
||||||
|
@ -1640,14 +1640,14 @@ public class Gen extends JCTree.Visitor {
|
||||||
|
|
||||||
public void visitBreak(JCBreak tree) {
|
public void visitBreak(JCBreak tree) {
|
||||||
Env<GenContext> targetEnv = unwind(tree.target, env);
|
Env<GenContext> targetEnv = unwind(tree.target, env);
|
||||||
assert code.state.stacksize == 0;
|
Assert.check(code.state.stacksize == 0);
|
||||||
targetEnv.info.addExit(code.branch(goto_));
|
targetEnv.info.addExit(code.branch(goto_));
|
||||||
endFinalizerGaps(env, targetEnv);
|
endFinalizerGaps(env, targetEnv);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitContinue(JCContinue tree) {
|
public void visitContinue(JCContinue tree) {
|
||||||
Env<GenContext> targetEnv = unwind(tree.target, env);
|
Env<GenContext> targetEnv = unwind(tree.target, env);
|
||||||
assert code.state.stacksize == 0;
|
Assert.check(code.state.stacksize == 0);
|
||||||
targetEnv.info.addCont(code.branch(goto_));
|
targetEnv.info.addCont(code.branch(goto_));
|
||||||
endFinalizerGaps(env, targetEnv);
|
endFinalizerGaps(env, targetEnv);
|
||||||
}
|
}
|
||||||
|
@ -1720,7 +1720,7 @@ public class Gen extends JCTree.Visitor {
|
||||||
public void visitNewClass(JCNewClass tree) {
|
public void visitNewClass(JCNewClass tree) {
|
||||||
// Enclosing instances or anonymous classes should have been eliminated
|
// Enclosing instances or anonymous classes should have been eliminated
|
||||||
// by now.
|
// by now.
|
||||||
assert tree.encl == null && tree.def == null;
|
Assert.check(tree.encl == null && tree.def == null);
|
||||||
|
|
||||||
code.emitop2(new_, makeRef(tree.pos(), tree.type));
|
code.emitop2(new_, makeRef(tree.pos(), tree.type));
|
||||||
code.emitop0(dup);
|
code.emitop0(dup);
|
||||||
|
@ -1902,7 +1902,7 @@ public class Gen extends JCTree.Visitor {
|
||||||
genNullCheck(tree.pos());
|
genNullCheck(tree.pos());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert false;
|
Assert.error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1977,7 +1977,7 @@ public class Gen extends JCTree.Visitor {
|
||||||
items.makeMemberItem(getStringBufferAppend(tree, t), false).invoke();
|
items.makeMemberItem(getStringBufferAppend(tree, t), false).invoke();
|
||||||
}
|
}
|
||||||
Symbol getStringBufferAppend(JCTree tree, Type t) {
|
Symbol getStringBufferAppend(JCTree tree, Type t) {
|
||||||
assert t.constValue() == null;
|
Assert.checkNull(t.constValue());
|
||||||
Symbol method = stringBufferAppend.get(t);
|
Symbol method = stringBufferAppend.get(t);
|
||||||
if (method == null) {
|
if (method == null) {
|
||||||
method = rs.resolveInternalMethod(tree.pos(),
|
method = rs.resolveInternalMethod(tree.pos(),
|
||||||
|
@ -2120,7 +2120,7 @@ public class Gen extends JCTree.Visitor {
|
||||||
Symbol sym = tree.sym;
|
Symbol sym = tree.sym;
|
||||||
|
|
||||||
if (tree.name == names._class) {
|
if (tree.name == names._class) {
|
||||||
assert target.hasClassLiterals();
|
Assert.check(target.hasClassLiterals());
|
||||||
code.emitop2(ldc2, makeRef(tree.pos(), tree.selected.type));
|
code.emitop2(ldc2, makeRef(tree.pos(), tree.selected.type));
|
||||||
result = items.makeStackItem(pt);
|
result = items.makeStackItem(pt);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -26,11 +26,11 @@
|
||||||
package com.sun.tools.javac.jvm;
|
package com.sun.tools.javac.jvm;
|
||||||
|
|
||||||
import com.sun.tools.javac.code.*;
|
import com.sun.tools.javac.code.*;
|
||||||
|
|
||||||
import com.sun.tools.javac.code.Symbol.*;
|
import com.sun.tools.javac.code.Symbol.*;
|
||||||
import com.sun.tools.javac.code.Type.*;
|
import com.sun.tools.javac.code.Type.*;
|
||||||
import com.sun.tools.javac.jvm.Code.*;
|
import com.sun.tools.javac.jvm.Code.*;
|
||||||
import com.sun.tools.javac.tree.JCTree;
|
import com.sun.tools.javac.tree.JCTree;
|
||||||
|
import com.sun.tools.javac.util.Assert;
|
||||||
|
|
||||||
import static com.sun.tools.javac.jvm.ByteCodes.*;
|
import static com.sun.tools.javac.jvm.ByteCodes.*;
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ public class Items {
|
||||||
|
|
||||||
LocalItem(Type type, int reg) {
|
LocalItem(Type type, int reg) {
|
||||||
super(Code.typecode(type));
|
super(Code.typecode(type));
|
||||||
assert reg >= 0;
|
Assert.check(reg >= 0);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.reg = reg;
|
this.reg = reg;
|
||||||
}
|
}
|
||||||
|
@ -469,16 +469,16 @@ public class Items {
|
||||||
class DynamicItem extends StaticItem {
|
class DynamicItem extends StaticItem {
|
||||||
DynamicItem(Symbol member) {
|
DynamicItem(Symbol member) {
|
||||||
super(member);
|
super(member);
|
||||||
assert member.owner == syms.invokeDynamicType.tsym;
|
Assert.check(member.owner == syms.invokeDynamicType.tsym);
|
||||||
}
|
}
|
||||||
|
|
||||||
Item load() {
|
Item load() {
|
||||||
assert false;
|
Assert.error();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void store() {
|
void store() {
|
||||||
assert false;
|
Assert.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
Item invoke() {
|
Item invoke() {
|
||||||
|
@ -620,7 +620,7 @@ public class Items {
|
||||||
ldc();
|
ldc();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert false;
|
Assert.error();
|
||||||
}
|
}
|
||||||
return stackItem[typecode];
|
return stackItem[typecode];
|
||||||
}
|
}
|
||||||
|
@ -716,7 +716,7 @@ public class Items {
|
||||||
}
|
}
|
||||||
|
|
||||||
void stash(int toscode) {
|
void stash(int toscode) {
|
||||||
assert false;
|
Assert.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
int width() {
|
int width() {
|
||||||
|
@ -784,7 +784,7 @@ public class Items {
|
||||||
}
|
}
|
||||||
|
|
||||||
void stash(int toscode) {
|
void stash(int toscode) {
|
||||||
assert false;
|
Assert.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
CondItem mkCond() {
|
CondItem mkCond() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -848,7 +848,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert false: "unknown compile policy";
|
Assert.error("unknown compile policy");
|
||||||
}
|
}
|
||||||
} catch (Abort ex) {
|
} catch (Abort ex) {
|
||||||
if (devVerbose)
|
if (devVerbose)
|
||||||
|
@ -1066,7 +1066,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
|
||||||
classSymbols = classSymbols.prepend((ClassSymbol)sym);
|
classSymbols = classSymbols.prepend((ClassSymbol)sym);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
assert sym.kind == Kinds.PCK;
|
Assert.check(sym.kind == Kinds.PCK);
|
||||||
log.warning("proc.package.does.not.exist", nameStr);
|
log.warning("proc.package.does.not.exist", nameStr);
|
||||||
pckSymbols = pckSymbols.prepend((PackageSymbol)sym);
|
pckSymbols = pckSymbols.prepend((PackageSymbol)sym);
|
||||||
} catch (CompletionFailure e) {
|
} catch (CompletionFailure e) {
|
||||||
|
@ -1086,8 +1086,8 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
|
||||||
if (c != this)
|
if (c != this)
|
||||||
annotationProcessingOccurred = c.annotationProcessingOccurred = true;
|
annotationProcessingOccurred = c.annotationProcessingOccurred = true;
|
||||||
// doProcessing will have handled deferred diagnostics
|
// doProcessing will have handled deferred diagnostics
|
||||||
assert c.log.deferDiagnostics == false;
|
Assert.check(c.log.deferDiagnostics == false
|
||||||
assert c.log.deferredDiagnostics.size() == 0;
|
&& c.log.deferredDiagnostics.size() == 0);
|
||||||
return c;
|
return c;
|
||||||
} finally {
|
} finally {
|
||||||
procEnvImpl.close();
|
procEnvImpl.close();
|
||||||
|
@ -1324,7 +1324,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
|
||||||
return;
|
return;
|
||||||
List<JCTree> pdef = lower.translateTopLevelClass(env, env.tree, localMake);
|
List<JCTree> pdef = lower.translateTopLevelClass(env, env.tree, localMake);
|
||||||
if (pdef.head != null) {
|
if (pdef.head != null) {
|
||||||
assert pdef.tail.isEmpty();
|
Assert.check(pdef.tail.isEmpty());
|
||||||
results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, (JCClassDecl)pdef.head));
|
results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, (JCClassDecl)pdef.head));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -547,7 +547,7 @@ public class JavacParser implements Parser {
|
||||||
null);
|
null);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert false;
|
Assert.error();
|
||||||
}
|
}
|
||||||
if (t == errorTree)
|
if (t == errorTree)
|
||||||
t = F.at(pos).Erroneous();
|
t = F.at(pos).Erroneous();
|
||||||
|
@ -724,7 +724,7 @@ public class JavacParser implements Parser {
|
||||||
topOpPos = posStack[top];
|
topOpPos = posStack[top];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert top == 0;
|
Assert.check(top == 0);
|
||||||
t = odStack[0];
|
t = odStack[0];
|
||||||
|
|
||||||
if (t.getTag() == JCTree.PLUS) {
|
if (t.getTag() == JCTree.PLUS) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -445,7 +445,7 @@ public class Scanner implements Lexer {
|
||||||
*/
|
*/
|
||||||
private void scanHexFractionAndSuffix(boolean seendigit) {
|
private void scanHexFractionAndSuffix(boolean seendigit) {
|
||||||
this.radix = 16;
|
this.radix = 16;
|
||||||
assert ch == '.';
|
Assert.check(ch == '.');
|
||||||
putChar(ch);
|
putChar(ch);
|
||||||
scanChar();
|
scanChar();
|
||||||
skipIllegalUnderscores();
|
skipIllegalUnderscores();
|
||||||
|
|
|
@ -65,6 +65,7 @@ import com.sun.tools.javac.parser.*;
|
||||||
import com.sun.tools.javac.tree.*;
|
import com.sun.tools.javac.tree.*;
|
||||||
import com.sun.tools.javac.tree.JCTree.*;
|
import com.sun.tools.javac.tree.JCTree.*;
|
||||||
import com.sun.tools.javac.util.Abort;
|
import com.sun.tools.javac.util.Abort;
|
||||||
|
import com.sun.tools.javac.util.Assert;
|
||||||
import com.sun.tools.javac.util.Context;
|
import com.sun.tools.javac.util.Context;
|
||||||
import com.sun.tools.javac.util.Convert;
|
import com.sun.tools.javac.util.Convert;
|
||||||
import com.sun.tools.javac.util.FatalError;
|
import com.sun.tools.javac.util.FatalError;
|
||||||
|
@ -1046,17 +1047,17 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
||||||
Context next = new Context();
|
Context next = new Context();
|
||||||
|
|
||||||
Options options = Options.instance(context);
|
Options options = Options.instance(context);
|
||||||
assert options != null;
|
Assert.checkNonNull(options);
|
||||||
next.put(Options.optionsKey, options);
|
next.put(Options.optionsKey, options);
|
||||||
|
|
||||||
PrintWriter out = context.get(Log.outKey);
|
PrintWriter out = context.get(Log.outKey);
|
||||||
assert out != null;
|
Assert.checkNonNull(out);
|
||||||
next.put(Log.outKey, out);
|
next.put(Log.outKey, out);
|
||||||
|
|
||||||
final boolean shareNames = true;
|
final boolean shareNames = true;
|
||||||
if (shareNames) {
|
if (shareNames) {
|
||||||
Names names = Names.instance(context);
|
Names names = Names.instance(context);
|
||||||
assert names != null;
|
Assert.checkNonNull(names);
|
||||||
next.put(Names.namesKey, names);
|
next.put(Names.namesKey, names);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,18 +1070,18 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
||||||
next.put(TaskListener.class, tl);
|
next.put(TaskListener.class, tl);
|
||||||
|
|
||||||
JavaFileManager jfm = context.get(JavaFileManager.class);
|
JavaFileManager jfm = context.get(JavaFileManager.class);
|
||||||
assert jfm != null;
|
Assert.checkNonNull(jfm);
|
||||||
next.put(JavaFileManager.class, jfm);
|
next.put(JavaFileManager.class, jfm);
|
||||||
if (jfm instanceof JavacFileManager) {
|
if (jfm instanceof JavacFileManager) {
|
||||||
((JavacFileManager)jfm).setContext(next);
|
((JavacFileManager)jfm).setContext(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
Names names = Names.instance(context);
|
Names names = Names.instance(context);
|
||||||
assert names != null;
|
Assert.checkNonNull(names);
|
||||||
next.put(Names.namesKey, names);
|
next.put(Names.namesKey, names);
|
||||||
|
|
||||||
Keywords keywords = Keywords.instance(context);
|
Keywords keywords = Keywords.instance(context);
|
||||||
assert(keywords != null);
|
Assert.checkNonNull(keywords);
|
||||||
next.put(Keywords.keywordsKey, keywords);
|
next.put(Keywords.keywordsKey, keywords);
|
||||||
|
|
||||||
JavaCompiler oldCompiler = JavaCompiler.instance(context);
|
JavaCompiler oldCompiler = JavaCompiler.instance(context);
|
||||||
|
@ -1239,7 +1240,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
||||||
for (JCTree node : unit.defs) {
|
for (JCTree node : unit.defs) {
|
||||||
if (node.getTag() == JCTree.CLASSDEF) {
|
if (node.getTag() == JCTree.CLASSDEF) {
|
||||||
ClassSymbol sym = ((JCClassDecl) node).sym;
|
ClassSymbol sym = ((JCClassDecl) node).sym;
|
||||||
assert sym != null;
|
Assert.checkNonNull(sym);
|
||||||
classes = classes.prepend(sym);
|
classes = classes.prepend(sym);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2235,7 +2235,7 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
|
||||||
public void visitErroneous(JCErroneous that) { visitTree(that); }
|
public void visitErroneous(JCErroneous that) { visitTree(that); }
|
||||||
public void visitLetExpr(LetExpr that) { visitTree(that); }
|
public void visitLetExpr(LetExpr that) { visitTree(that); }
|
||||||
|
|
||||||
public void visitTree(JCTree that) { assert false; }
|
public void visitTree(JCTree that) { Assert.error(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -445,7 +445,7 @@ public class TreeInfo {
|
||||||
public static int finalizerPos(JCTree tree) {
|
public static int finalizerPos(JCTree tree) {
|
||||||
if (tree.getTag() == JCTree.TRY) {
|
if (tree.getTag() == JCTree.TRY) {
|
||||||
JCTry t = (JCTry) tree;
|
JCTry t = (JCTry) tree;
|
||||||
assert t.finalizer != null;
|
Assert.checkNonNull(t.finalizer);
|
||||||
return firstStatPos(t.finalizer);
|
return firstStatPos(t.finalizer);
|
||||||
} else if (tree.getTag() == JCTree.SYNCHRONIZED) {
|
} else if (tree.getTag() == JCTree.SYNCHRONIZED) {
|
||||||
return endPos(((JCSynchronized) tree).body);
|
return endPos(((JCSynchronized) tree).body);
|
||||||
|
|
|
@ -122,15 +122,15 @@ public class TreeMaker implements JCTree.Factory {
|
||||||
public JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
|
public JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
|
||||||
JCExpression pid,
|
JCExpression pid,
|
||||||
List<JCTree> defs) {
|
List<JCTree> defs) {
|
||||||
assert packageAnnotations != null;
|
Assert.checkNonNull(packageAnnotations);
|
||||||
for (JCTree node : defs)
|
for (JCTree node : defs)
|
||||||
assert node instanceof JCClassDecl
|
Assert.check(node instanceof JCClassDecl
|
||||||
|| node instanceof JCImport
|
|| node instanceof JCImport
|
||||||
|| node instanceof JCSkip
|
|| node instanceof JCSkip
|
||||||
|| node instanceof JCErroneous
|
|| node instanceof JCErroneous
|
||||||
|| (node instanceof JCExpressionStatement
|
|| (node instanceof JCExpressionStatement
|
||||||
&& ((JCExpressionStatement)node).expr instanceof JCErroneous)
|
&& ((JCExpressionStatement)node).expr instanceof JCErroneous),
|
||||||
: node.getClass().getSimpleName();
|
node.getClass().getSimpleName());
|
||||||
JCCompilationUnit tree = new JCCompilationUnit(packageAnnotations, pid, defs,
|
JCCompilationUnit tree = new JCCompilationUnit(packageAnnotations, pid, defs,
|
||||||
null, null, null, null);
|
null, null, null, null);
|
||||||
tree.pos = pos;
|
tree.pos = pos;
|
||||||
|
@ -647,19 +647,14 @@ public class TreeMaker implements JCTree.Factory {
|
||||||
}
|
}
|
||||||
return tp.setType(t);
|
return tp.setType(t);
|
||||||
}
|
}
|
||||||
//where
|
|
||||||
private JCExpression Selectors(JCExpression base, Symbol sym, Symbol limit) {
|
|
||||||
if (sym == limit) return base;
|
|
||||||
else return Select(Selectors(base, sym.owner, limit), sym);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Create a list of trees representing given list of types.
|
/** Create a list of trees representing given list of types.
|
||||||
*/
|
*/
|
||||||
public List<JCExpression> Types(List<Type> ts) {
|
public List<JCExpression> Types(List<Type> ts) {
|
||||||
ListBuffer<JCExpression> types = new ListBuffer<JCExpression>();
|
ListBuffer<JCExpression> lb = new ListBuffer<JCExpression>();
|
||||||
for (List<Type> l = ts; l.nonEmpty(); l = l.tail)
|
for (List<Type> l = ts; l.nonEmpty(); l = l.tail)
|
||||||
types.append(Type(l.head));
|
lb.append(Type(l.head));
|
||||||
return types.toList();
|
return lb.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create a variable definition from a variable symbol and an initializer
|
/** Create a variable definition from a variable symbol and an initializer
|
||||||
|
|
|
@ -309,6 +309,6 @@ public class TreeScanner extends Visitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitTree(JCTree tree) {
|
public void visitTree(JCTree tree) {
|
||||||
assert false;
|
Assert.error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -117,7 +117,7 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter
|
||||||
protected abstract String formatDiagnostic(JCDiagnostic d, Locale locale);
|
protected abstract String formatDiagnostic(JCDiagnostic d, Locale locale);
|
||||||
|
|
||||||
public String formatPosition(JCDiagnostic d, PositionKind pk,Locale l) {
|
public String formatPosition(JCDiagnostic d, PositionKind pk,Locale l) {
|
||||||
assert (d.getPosition() != Position.NOPOS);
|
Assert.check(d.getPosition() != Position.NOPOS);
|
||||||
return String.valueOf(getPosition(d, pk));
|
return String.valueOf(getPosition(d, pk));
|
||||||
}
|
}
|
||||||
//where
|
//where
|
||||||
|
|
138
langtools/src/share/classes/com/sun/tools/javac/util/Assert.java
Normal file
138
langtools/src/share/classes/com/sun/tools/javac/util/Assert.java
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2011, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sun.tools.javac.util;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple facility for unconditional assertions.
|
||||||
|
* The methods in this class are described in terms of equivalent assert
|
||||||
|
* statements, assuming that assertions have been enabled.
|
||||||
|
*
|
||||||
|
* <p><b>This is NOT part of any supported API.
|
||||||
|
* If you write code that depends on this, you do so at your own risk.
|
||||||
|
* This code and its internal interfaces are subject to change or
|
||||||
|
* deletion without notice.</b>
|
||||||
|
*/
|
||||||
|
public class Assert {
|
||||||
|
/** Equivalent to
|
||||||
|
* assert cond;
|
||||||
|
*/
|
||||||
|
public static void check(boolean cond) {
|
||||||
|
if (!cond)
|
||||||
|
error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Equivalent to
|
||||||
|
* assert (o == null);
|
||||||
|
*/
|
||||||
|
public static void checkNull(Object o) {
|
||||||
|
if (o != null)
|
||||||
|
error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Equivalent to
|
||||||
|
* assert (t != null); return t;
|
||||||
|
*/
|
||||||
|
public static <T> T checkNonNull(T t) {
|
||||||
|
if (t == null)
|
||||||
|
error();
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Equivalent to
|
||||||
|
* assert cond : value;
|
||||||
|
*/
|
||||||
|
public static void check(boolean cond, int value) {
|
||||||
|
if (!cond)
|
||||||
|
error(String.valueOf(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Equivalent to
|
||||||
|
* assert cond : value;
|
||||||
|
*/
|
||||||
|
public static void check(boolean cond, long value) {
|
||||||
|
if (!cond)
|
||||||
|
error(String.valueOf(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Equivalent to
|
||||||
|
* assert cond : value;
|
||||||
|
*/
|
||||||
|
public static void check(boolean cond, Object value) {
|
||||||
|
if (!cond)
|
||||||
|
error(String.valueOf(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Equivalent to
|
||||||
|
* assert cond : value;
|
||||||
|
*/
|
||||||
|
public static void check(boolean cond, String msg) {
|
||||||
|
if (!cond)
|
||||||
|
error(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Equivalent to
|
||||||
|
* assert (o == null) : value;
|
||||||
|
*/
|
||||||
|
public static void checkNull(Object o, Object value) {
|
||||||
|
if (o != null)
|
||||||
|
error(String.valueOf(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Equivalent to
|
||||||
|
* assert (o == null) : value;
|
||||||
|
*/
|
||||||
|
public static void checkNull(Object o, String msg) {
|
||||||
|
if (o != null)
|
||||||
|
error(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Equivalent to
|
||||||
|
* assert (o != null) : value;
|
||||||
|
*/
|
||||||
|
public static <T> T checkNonNull(T t, String msg) {
|
||||||
|
if (t == null)
|
||||||
|
error(msg);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Equivalent to
|
||||||
|
* assert false;
|
||||||
|
*/
|
||||||
|
public static void error() {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Equivalent to
|
||||||
|
* assert false : msg;
|
||||||
|
*/
|
||||||
|
public static void error(String msg) {
|
||||||
|
throw new AssertionError(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Prevent instantiation. */
|
||||||
|
private Assert() { }
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -85,7 +85,7 @@ public class Bits {
|
||||||
/** Include x in this set.
|
/** Include x in this set.
|
||||||
*/
|
*/
|
||||||
public void incl(int x) {
|
public void incl(int x) {
|
||||||
assert x >= 0;
|
Assert.check(x >= 0);
|
||||||
sizeTo((x >>> wordshift) + 1);
|
sizeTo((x >>> wordshift) + 1);
|
||||||
bits[x >>> wordshift] = bits[x >>> wordshift] |
|
bits[x >>> wordshift] = bits[x >>> wordshift] |
|
||||||
(1 << (x & wordmask));
|
(1 << (x & wordmask));
|
||||||
|
@ -113,7 +113,7 @@ public class Bits {
|
||||||
/** Exclude x from this set.
|
/** Exclude x from this set.
|
||||||
*/
|
*/
|
||||||
public void excl(int x) {
|
public void excl(int x) {
|
||||||
assert x >= 0;
|
Assert.check(x >= 0);
|
||||||
sizeTo((x >>> wordshift) + 1);
|
sizeTo((x >>> wordshift) + 1);
|
||||||
bits[x >>> wordshift] = bits[x >>> wordshift] &
|
bits[x >>> wordshift] = bits[x >>> wordshift] &
|
||||||
~(1 << (x & wordmask));
|
~(1 << (x & wordmask));
|
||||||
|
@ -169,7 +169,7 @@ public class Bits {
|
||||||
* Delight" by Henry S. Warren Jr. (figure 5-13)
|
* Delight" by Henry S. Warren Jr. (figure 5-13)
|
||||||
*/
|
*/
|
||||||
private static int trailingZeroBits(int x) {
|
private static int trailingZeroBits(int x) {
|
||||||
assert wordlen == 32;
|
Assert.check(wordlen == 32);
|
||||||
if (x == 0) return 32;
|
if (x == 0) return 32;
|
||||||
int n = 1;
|
int n = 1;
|
||||||
if ((x & 0xffff) == 0) { n += 16; x >>>= 16; }
|
if ((x & 0xffff) == 0) { n += 16; x >>>= 16; }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -145,7 +145,7 @@ public class Context {
|
||||||
o = fac.make();
|
o = fac.make();
|
||||||
if (o instanceof Factory<?>)
|
if (o instanceof Factory<?>)
|
||||||
throw new AssertionError("T extends Context.Factory");
|
throw new AssertionError("T extends Context.Factory");
|
||||||
assert ht.get(key) == o;
|
Assert.check(ht.get(key) == o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following cast can't fail unless there was
|
/* The following cast can't fail unless there was
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -184,7 +184,7 @@ public class List<A> extends AbstractCollection<A> implements java.util.List<A>
|
||||||
// return this.prependList(xs.tail).prepend(xs.head);
|
// return this.prependList(xs.tail).prepend(xs.head);
|
||||||
List<A> result = this;
|
List<A> result = this;
|
||||||
List<A> rev = xs.reverse();
|
List<A> rev = xs.reverse();
|
||||||
assert rev != xs;
|
Assert.check(rev != xs);
|
||||||
// since xs.reverse() returned a new list, we can reuse the
|
// since xs.reverse() returned a new list, we can reuse the
|
||||||
// individual List objects, instead of allocating new ones.
|
// individual List objects, instead of allocating new ones.
|
||||||
while (rev.nonEmpty()) {
|
while (rev.nonEmpty()) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -107,7 +107,7 @@ public class UnsharedNameTable extends Name.Table {
|
||||||
hashes[h] = firstTableEntry = element.next;
|
hashes[h] = firstTableEntry = element.next;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert previousNonNullTableEntry != null : "previousNonNullTableEntry cannot be null here.";
|
Assert.checkNonNull(previousNonNullTableEntry, "previousNonNullTableEntry cannot be null here.");
|
||||||
previousNonNullTableEntry.next = element.next;
|
previousNonNullTableEntry.next = element.next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ public class UnsharedNameTable extends Name.Table {
|
||||||
hashes[h] = newEntry;
|
hashes[h] = newEntry;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert previousNonNullTableEntry.next == null : "previousNonNullTableEntry.next must be null.";
|
Assert.checkNull(previousNonNullTableEntry.next, "previousNonNullTableEntry.next must be null.");
|
||||||
previousNonNullTableEntry.next = newEntry;
|
previousNonNullTableEntry.next = newEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -172,7 +172,7 @@ public class ToolProvider {
|
||||||
{
|
{
|
||||||
// try loading class directly, in case tool is on the bootclasspath
|
// try loading class directly, in case tool is on the bootclasspath
|
||||||
try {
|
try {
|
||||||
return enableAsserts(Class.forName(toolClassName, false, null));
|
return Class.forName(toolClassName, false, null);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
trace(FINE, e);
|
trace(FINE, e);
|
||||||
|
|
||||||
|
@ -194,27 +194,10 @@ public class ToolProvider {
|
||||||
trace(FINE, urls[0].toString());
|
trace(FINE, urls[0].toString());
|
||||||
|
|
||||||
cl = URLClassLoader.newInstance(urls);
|
cl = URLClassLoader.newInstance(urls);
|
||||||
cl.setPackageAssertionStatus("com.sun.tools.javac", true);
|
|
||||||
refToolClassLoader = new WeakReference<ClassLoader>(cl);
|
refToolClassLoader = new WeakReference<ClassLoader>(cl);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Class.forName(toolClassName, false, cl);
|
return Class.forName(toolClassName, false, cl);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Class<?> enableAsserts(Class<?> cls) {
|
|
||||||
try {
|
|
||||||
ClassLoader loader = cls.getClassLoader();
|
|
||||||
if (loader != null)
|
|
||||||
loader.setPackageAssertionStatus("com.sun.tools.javac", true);
|
|
||||||
else
|
|
||||||
trace(FINE, "loader == null");
|
|
||||||
} catch (SecurityException ex) {
|
|
||||||
trace(FINE, ex);
|
|
||||||
}
|
|
||||||
return cls;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue