src/share/classes/sun/tools/tree/LongExpression.java

Print this page
rev 10195 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz
Contributed-by: otaviojava@java.net


  33  * WARNING: The contents of this source file are not part of any
  34  * supported API.  Code that depends on them does so at its own risk:
  35  * they are subject to change or removal without notice.
  36  */
  37 public
  38 class LongExpression extends ConstantExpression {
  39     long value;
  40 
  41     /**
  42      * Constructor
  43      */
  44     public LongExpression(long where, long value) {
  45         super(LONGVAL, where, Type.tLong);
  46         this.value = value;
  47     }
  48 
  49     /**
  50      * Get the value
  51      */
  52     public Object getValue() {
  53         return new Long(value);
  54     }
  55 
  56     /**
  57      * Check if the expression is equal to a value
  58      */
  59     public boolean equals(int i) {
  60         return value == i;
  61     }
  62 
  63     /**
  64      * Check if the expression is equal to its default static value
  65      */
  66     public boolean equalsDefault() {
  67         return value == 0;
  68     }
  69 
  70     /**
  71      * Code
  72      */
  73     public void codeValue(Environment env, Context ctx, Assembler asm) {
  74         asm.add(where, opc_ldc2_w, new Long(value));
  75     }
  76 
  77     /**
  78      * Print
  79      */
  80     public void print(PrintStream out) {
  81         out.print(value + "L");
  82     }
  83 }


  33  * WARNING: The contents of this source file are not part of any
  34  * supported API.  Code that depends on them does so at its own risk:
  35  * they are subject to change or removal without notice.
  36  */
  37 public
  38 class LongExpression extends ConstantExpression {
  39     long value;
  40 
  41     /**
  42      * Constructor
  43      */
  44     public LongExpression(long where, long value) {
  45         super(LONGVAL, where, Type.tLong);
  46         this.value = value;
  47     }
  48 
  49     /**
  50      * Get the value
  51      */
  52     public Object getValue() {
  53         return value;
  54     }
  55 
  56     /**
  57      * Check if the expression is equal to a value
  58      */
  59     public boolean equals(int i) {
  60         return value == i;
  61     }
  62 
  63     /**
  64      * Check if the expression is equal to its default static value
  65      */
  66     public boolean equalsDefault() {
  67         return value == 0;
  68     }
  69 
  70     /**
  71      * Code
  72      */
  73     public void codeValue(Environment env, Context ctx, Assembler asm) {
  74         asm.add(where, opc_ldc2_w, value);
  75     }
  76 
  77     /**
  78      * Print
  79      */
  80     public void print(PrintStream out) {
  81         out.print(value + "L");
  82     }
  83 }