1 /* 2 * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 * of Java bytecode. 4 * 5 * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by the Free 9 * Software Foundation; either version 2 of the License, or (at your option) 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 * more details. 16 * 17 * You should have received a copy of the GNU General Public License along 18 * with this program; if not, write to the Free Software Foundation, Inc., 19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21 package proguard.evaluation.value; 22 23 /** 24 * This class represents a partially evaluated integer value. 25 * 26 * @author Eric Lafortune 27 */ 28 public class UnknownIntegerValue extends IntegerValue 29 { 30 // Basic unary methods. 31 negate()32 public IntegerValue negate() 33 { 34 return this; 35 } 36 convertToByte()37 public IntegerValue convertToByte() 38 { 39 return this; 40 } 41 convertToCharacter()42 public IntegerValue convertToCharacter() 43 { 44 return this; 45 } 46 convertToShort()47 public IntegerValue convertToShort() 48 { 49 return this; 50 } 51 convertToLong()52 public LongValue convertToLong() 53 { 54 return ValueFactory.LONG_VALUE; 55 } 56 convertToFloat()57 public FloatValue convertToFloat() 58 { 59 return ValueFactory.FLOAT_VALUE; 60 } 61 convertToDouble()62 public DoubleValue convertToDouble() 63 { 64 return ValueFactory.DOUBLE_VALUE; 65 } 66 67 68 // Basic binary methods. 69 generalize(IntegerValue other)70 public IntegerValue generalize(IntegerValue other) 71 { 72 return this; 73 } 74 75 add(IntegerValue other)76 public IntegerValue add(IntegerValue other) 77 { 78 return this; 79 } 80 subtract(IntegerValue other)81 public IntegerValue subtract(IntegerValue other) 82 { 83 return this; 84 } 85 subtractFrom(IntegerValue other)86 public IntegerValue subtractFrom(IntegerValue other) 87 { 88 return this; 89 } 90 multiply(IntegerValue other)91 public IntegerValue multiply(IntegerValue other) 92 throws ArithmeticException 93 { 94 return this; 95 } 96 divide(IntegerValue other)97 public IntegerValue divide(IntegerValue other) 98 throws ArithmeticException 99 { 100 return this; 101 } 102 divideOf(IntegerValue other)103 public IntegerValue divideOf(IntegerValue other) 104 throws ArithmeticException 105 { 106 return this; 107 } 108 remainder(IntegerValue other)109 public IntegerValue remainder(IntegerValue other) 110 throws ArithmeticException 111 { 112 return this; 113 } 114 remainderOf(IntegerValue other)115 public IntegerValue remainderOf(IntegerValue other) 116 throws ArithmeticException 117 { 118 return this; 119 } 120 shiftLeft(IntegerValue other)121 public IntegerValue shiftLeft(IntegerValue other) 122 { 123 return this; 124 } 125 shiftLeftOf(IntegerValue other)126 public IntegerValue shiftLeftOf(IntegerValue other) 127 { 128 return this; 129 } 130 shiftRight(IntegerValue other)131 public IntegerValue shiftRight(IntegerValue other) 132 { 133 return this; 134 } 135 shiftRightOf(IntegerValue other)136 public IntegerValue shiftRightOf(IntegerValue other) 137 { 138 return this; 139 } 140 unsignedShiftRight(IntegerValue other)141 public IntegerValue unsignedShiftRight(IntegerValue other) 142 { 143 return this; 144 } 145 unsignedShiftRightOf(IntegerValue other)146 public IntegerValue unsignedShiftRightOf(IntegerValue other) 147 { 148 return this; 149 } 150 shiftLeftOf(LongValue other)151 public LongValue shiftLeftOf(LongValue other) 152 { 153 return ValueFactory.LONG_VALUE; 154 } 155 shiftRightOf(LongValue other)156 public LongValue shiftRightOf(LongValue other) 157 { 158 return ValueFactory.LONG_VALUE; 159 } 160 unsignedShiftRightOf(LongValue other)161 public LongValue unsignedShiftRightOf(LongValue other) 162 { 163 return ValueFactory.LONG_VALUE; 164 } 165 and(IntegerValue other)166 public IntegerValue and(IntegerValue other) 167 { 168 return this; 169 } 170 or(IntegerValue other)171 public IntegerValue or(IntegerValue other) 172 { 173 return this; 174 } 175 xor(IntegerValue other)176 public IntegerValue xor(IntegerValue other) 177 { 178 return this; 179 } 180 equal(IntegerValue other)181 public int equal(IntegerValue other) 182 { 183 return MAYBE; 184 } 185 lessThan(IntegerValue other)186 public int lessThan(IntegerValue other) 187 { 188 return MAYBE; 189 } 190 lessThanOrEqual(IntegerValue other)191 public int lessThanOrEqual(IntegerValue other) 192 { 193 return MAYBE; 194 } 195 196 197 // Implementations for Object. 198 equals(Object object)199 public boolean equals(Object object) 200 { 201 return object != null && 202 this.getClass() == object.getClass(); 203 } 204 205 hashCode()206 public int hashCode() 207 { 208 return this.getClass().hashCode(); 209 } 210 211 toString()212 public String toString() 213 { 214 return "i"; 215 } 216 }