< prev index next >

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

Print this page

        

@@ -1699,11 +1699,11 @@
         if (condtype.constValue() != null &&
                 truetype.constValue() != null &&
                 falsetype.constValue() != null &&
                 !owntype.hasTag(NONE)) {
             //constant folding
-            owntype = cfolder.coerce(condtype.isTrue() ? truetype : falsetype, owntype);
+            owntype = cfolder.coerce(ConstFold.isTrue(condtype.getTag(), condtype.constValue()) ? truetype : falsetype, owntype);
         }
         result = check(tree, owntype, KindSelector.VAL, resultInfo);
     }
     //where
         private boolean isBooleanOrNumeric(Env<AttrContext> env, JCExpression tree) {

@@ -2912,11 +2912,11 @@
                 }
 
                 public void visitLambda(JCLambda that) {
                     // or lambda expressions!
                 }
-            }.scan(tree.body);
+            }.scan(tree);
         }
 
         Types.MapVisitor<DiagnosticPosition> targetChecker = new Types.MapVisitor<DiagnosticPosition>() {
 
             @Override

@@ -3570,11 +3570,11 @@
                 : operator.type.getReturnType();
             int opc = ((OperatorSymbol)operator).opcode;
 
             // If the argument is constant, fold it.
             if (argtype.constValue() != null) {
-                Type ctype = cfolder.fold1(opc, argtype);
+                Type ctype = cfolder.fold1((OperatorSymbol)operator, argtype);
                 if (ctype != null) {
                     owntype = cfolder.coerce(ctype, owntype);
                 }
             }
         }

@@ -3593,11 +3593,11 @@
                 !right.isErroneous()) {
             owntype = operator.type.getReturnType();
             int opc = ((OperatorSymbol)operator).opcode;
             // If both arguments are constants, fold them.
             if (left.constValue() != null && right.constValue() != null) {
-                Type ctype = cfolder.fold2(opc, left, right);
+                Type ctype = cfolder.fold2((OperatorSymbol)operator, left, right);
                 if (ctype != null) {
                     owntype = cfolder.coerce(ctype, owntype);
                 }
             }
 

@@ -4220,11 +4220,11 @@
          * reference its static members unless they are constant.
          *
          * @param tree    The tree making up the variable reference.
          * @param env     The current environment.
          * @param v       The variable's symbol.
-         * @jls 8.9 Enum Types
+         * @jls  section 8.9 Enums
          */
         private void checkEnumInitializer(JCTree tree, Env<AttrContext> env, VarSymbol v) {
             // JLS:
             //
             // "It is a compile-time error to reference a static field
< prev index next >