langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
changeset 23969 023c35e5c2b8
parent 23809 9405883da95f
child 24066 1dfb66929538
equal deleted inserted replaced
23968:d67158b385dd 23969:023c35e5c2b8
  3009             // If the argument is constant, fold it.
  3009             // If the argument is constant, fold it.
  3010             if (argtype.constValue() != null) {
  3010             if (argtype.constValue() != null) {
  3011                 Type ctype = cfolder.fold1(opc, argtype);
  3011                 Type ctype = cfolder.fold1(opc, argtype);
  3012                 if (ctype != null) {
  3012                 if (ctype != null) {
  3013                     owntype = cfolder.coerce(ctype, owntype);
  3013                     owntype = cfolder.coerce(ctype, owntype);
  3014 
       
  3015                     // Remove constant types from arguments to
       
  3016                     // conserve space. The parser will fold concatenations
       
  3017                     // of string literals; the code here also
       
  3018                     // gets rid of intermediate results when some of the
       
  3019                     // operands are constant identifiers.
       
  3020                     if (tree.arg.type.tsym == syms.stringType.tsym) {
       
  3021                         tree.arg.type = syms.stringType;
       
  3022                     }
       
  3023                 }
  3014                 }
  3024             }
  3015             }
  3025         }
  3016         }
  3026         result = check(tree, owntype, VAL, resultInfo);
  3017         result = check(tree, owntype, VAL, resultInfo);
  3027     }
  3018     }
  3051             // If both arguments are constants, fold them.
  3042             // If both arguments are constants, fold them.
  3052             if (left.constValue() != null && right.constValue() != null) {
  3043             if (left.constValue() != null && right.constValue() != null) {
  3053                 Type ctype = cfolder.fold2(opc, left, right);
  3044                 Type ctype = cfolder.fold2(opc, left, right);
  3054                 if (ctype != null) {
  3045                 if (ctype != null) {
  3055                     owntype = cfolder.coerce(ctype, owntype);
  3046                     owntype = cfolder.coerce(ctype, owntype);
  3056 
       
  3057                     // Remove constant types from arguments to
       
  3058                     // conserve space. The parser will fold concatenations
       
  3059                     // of string literals; the code here also
       
  3060                     // gets rid of intermediate results when some of the
       
  3061                     // operands are constant identifiers.
       
  3062                     if (tree.lhs.type.tsym == syms.stringType.tsym) {
       
  3063                         tree.lhs.type = syms.stringType;
       
  3064                     }
       
  3065                     if (tree.rhs.type.tsym == syms.stringType.tsym) {
       
  3066                         tree.rhs.type = syms.stringType;
       
  3067                     }
       
  3068                 }
  3047                 }
  3069             }
  3048             }
  3070 
  3049 
  3071             // Check that argument types of a reference ==, != are
  3050             // Check that argument types of a reference ==, != are
  3072             // castable to each other, (JLS 15.21).  Note: unboxing
  3051             // castable to each other, (JLS 15.21).  Note: unboxing