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