< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java

Print this page

        

@@ -91,10 +91,11 @@
     private final Operators operators;
     private final Check chk;
     private final Attr attr;
     private TreeMaker make;
     private DiagnosticPosition make_pos;
+    private final ClassWriter writer;
     private final ConstFold cfolder;
     private final Target target;
     private final Source source;
     private final TypeEnvs typeEnvs;
     private final Name dollarAssertionsDisabled;

@@ -113,10 +114,11 @@
         rs = Resolve.instance(context);
         operators = Operators.instance(context);
         chk = Check.instance(context);
         attr = Attr.instance(context);
         make = TreeMaker.instance(context);
+        writer = ClassWriter.instance(context);
         cfolder = ConstFold.instance(context);
         target = Target.instance(context);
         source = Source.instance(context);
         typeEnvs = TypeEnvs.instance(context);
         dollarAssertionsDisabled = names.

@@ -471,11 +473,11 @@
             this.pos = pos;
             Name varName = names
                 .fromString(target.syntheticNameChar() +
                             "SwitchMap" +
                             target.syntheticNameChar() +
-                            names.fromUtf(ClassWriter.externalize(forEnum.type.tsym.flatName())).toString()
+                            writer.xClassName(forEnum.type).toString()
                             .replace('/', '.')
                             .replace('.', target.syntheticNameChar()));
             ClassSymbol outerCacheClass = outerCacheClass();
             this.mapVar = new VarSymbol(STATIC | SYNTHETIC | FINAL,
                                         varName,

@@ -2633,17 +2635,17 @@
     // Equality checks involving a constant and null, e.g.
     //     "" == null
     // are safe to simplify as no side-effects can occur.
 
     private boolean isTrue(JCTree exp) {
-        if (exp.type.isTrue())
+        if (ConstFold.isTrue(exp.type.getTag(), exp.type.constValue()))
             return true;
         Boolean b = expValue(exp);
         return b == null ? false : b;
     }
     private boolean isFalse(JCTree exp) {
-        if (exp.type.isFalse())
+        if (ConstFold.isFalse(exp.type.getTag(), exp.type.constValue()))
             return true;
         Boolean b = expValue(exp);
         return b == null ? false : !b;
     }
     /* look for (in)equality relations involving null.

@@ -2728,15 +2730,15 @@
 
     /** Visitor method for assert statements. Translate them away.
      */
     public void visitAssert(JCAssert tree) {
         tree.cond = translate(tree.cond, syms.booleanType);
-        if (!tree.cond.type.isTrue()) {
+        if (!ConstFold.isTrue(tree.cond.type.getTag(), tree.cond.type.constValue())) {
             JCExpression cond = assertFlagTest(tree.pos());
             List<JCExpression> exnArgs = (tree.detail == null) ?
                 List.nil() : List.of(translate(tree.detail));
-            if (!tree.cond.type.isFalse()) {
+            if (!ConstFold.isFalse(tree.cond.type.getTag(), tree.cond.type.constValue())) {
                 cond = makeBinary
                     (AND,
                      cond,
                      makeUnary(NOT, tree.cond));
             }

@@ -3096,11 +3098,11 @@
         }
 
         tree.arg = boxIfNeeded(translate(tree.arg, tree), tree.type);
 
         if (tree.hasTag(NOT) && tree.arg.type.constValue() != null) {
-            tree.type = cfolder.fold1(bool_not, tree.arg.type);
+            tree.type = cfolder.fold1(tree.operator, tree.arg.type);
         }
 
         // If translated left hand side is an Apply, we are
         // seeing an access method invocation. In this case, return
         // that access method invocation as result.
< prev index next >