diff options
Diffstat (limited to 'src/proguard/evaluation/value')
46 files changed, 131 insertions, 85 deletions
diff --git a/src/proguard/evaluation/value/Category1Value.java b/src/proguard/evaluation/value/Category1Value.java index b8c5db2..0d5650b 100644 --- a/src/proguard/evaluation/value/Category1Value.java +++ b/src/proguard/evaluation/value/Category1Value.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/Category2Value.java b/src/proguard/evaluation/value/Category2Value.java index 65916c7..dde0625 100644 --- a/src/proguard/evaluation/value/Category2Value.java +++ b/src/proguard/evaluation/value/Category2Value.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/ComparisonValue.java b/src/proguard/evaluation/value/ComparisonValue.java index e4e2e02..55c942c 100644 --- a/src/proguard/evaluation/value/ComparisonValue.java +++ b/src/proguard/evaluation/value/ComparisonValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -35,11 +35,11 @@ final class ComparisonValue extends SpecificIntegerValue /** * Creates a new comparison integer value of the two given scalar values. */ - public ComparisonValue(Value integerValue1, - Value integerValue2) + public ComparisonValue(Value value1, + Value value2) { - this.value1 = integerValue1; - this.value2 = integerValue2; + this.value1 = value1; + this.value2 = value2; } diff --git a/src/proguard/evaluation/value/CompositeDoubleValue.java b/src/proguard/evaluation/value/CompositeDoubleValue.java index a6d48ef..d183dee 100644 --- a/src/proguard/evaluation/value/CompositeDoubleValue.java +++ b/src/proguard/evaluation/value/CompositeDoubleValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/CompositeFloatValue.java b/src/proguard/evaluation/value/CompositeFloatValue.java index 4df890a..ecc32bb 100644 --- a/src/proguard/evaluation/value/CompositeFloatValue.java +++ b/src/proguard/evaluation/value/CompositeFloatValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -36,7 +36,7 @@ final class CompositeFloatValue extends SpecificFloatValue private final FloatValue floatValue1; - private final byte operation; + private final byte operation; private final FloatValue floatValue2; @@ -45,11 +45,11 @@ final class CompositeFloatValue extends SpecificFloatValue * and the given operation. */ public CompositeFloatValue(FloatValue floatValue1, - byte operation, - FloatValue floatValue2) + byte operation, + FloatValue floatValue2) { this.floatValue1 = floatValue1; - this.operation = operation; + this.operation = operation; this.floatValue2 = floatValue2; } diff --git a/src/proguard/evaluation/value/CompositeIntegerValue.java b/src/proguard/evaluation/value/CompositeIntegerValue.java index 6d4f59c..a042fcf 100644 --- a/src/proguard/evaluation/value/CompositeIntegerValue.java +++ b/src/proguard/evaluation/value/CompositeIntegerValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/CompositeLongValue.java b/src/proguard/evaluation/value/CompositeLongValue.java index 7f63211..d4fa331 100644 --- a/src/proguard/evaluation/value/CompositeLongValue.java +++ b/src/proguard/evaluation/value/CompositeLongValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/ConvertedByteValue.java b/src/proguard/evaluation/value/ConvertedByteValue.java index 7ab5d0a..115e7d1 100644 --- a/src/proguard/evaluation/value/ConvertedByteValue.java +++ b/src/proguard/evaluation/value/ConvertedByteValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/ConvertedCharacterValue.java b/src/proguard/evaluation/value/ConvertedCharacterValue.java index 76568d1..88e0e25 100644 --- a/src/proguard/evaluation/value/ConvertedCharacterValue.java +++ b/src/proguard/evaluation/value/ConvertedCharacterValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/ConvertedDoubleValue.java b/src/proguard/evaluation/value/ConvertedDoubleValue.java index a6afe34..943e2a5 100644 --- a/src/proguard/evaluation/value/ConvertedDoubleValue.java +++ b/src/proguard/evaluation/value/ConvertedDoubleValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/ConvertedFloatValue.java b/src/proguard/evaluation/value/ConvertedFloatValue.java index 33683b7..df4994d 100644 --- a/src/proguard/evaluation/value/ConvertedFloatValue.java +++ b/src/proguard/evaluation/value/ConvertedFloatValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/ConvertedIntegerValue.java b/src/proguard/evaluation/value/ConvertedIntegerValue.java index aecb533..23ec03f 100644 --- a/src/proguard/evaluation/value/ConvertedIntegerValue.java +++ b/src/proguard/evaluation/value/ConvertedIntegerValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/ConvertedLongValue.java b/src/proguard/evaluation/value/ConvertedLongValue.java index ec97008..026bd5b 100644 --- a/src/proguard/evaluation/value/ConvertedLongValue.java +++ b/src/proguard/evaluation/value/ConvertedLongValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/ConvertedShortValue.java b/src/proguard/evaluation/value/ConvertedShortValue.java index ab79b49..c209d44 100644 --- a/src/proguard/evaluation/value/ConvertedShortValue.java +++ b/src/proguard/evaluation/value/ConvertedShortValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/DoubleValue.java b/src/proguard/evaluation/value/DoubleValue.java index e39ee5c..48d8f11 100644 --- a/src/proguard/evaluation/value/DoubleValue.java +++ b/src/proguard/evaluation/value/DoubleValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -342,11 +342,6 @@ public abstract class DoubleValue extends Category2Value return this; } - public Value refresh() - { - return this; - } - public final Value generalize(Value other) { return this.generalize(other.doubleValue()); diff --git a/src/proguard/evaluation/value/FloatValue.java b/src/proguard/evaluation/value/FloatValue.java index b30e395..3783096 100644 --- a/src/proguard/evaluation/value/FloatValue.java +++ b/src/proguard/evaluation/value/FloatValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/IdentifiedDoubleValue.java b/src/proguard/evaluation/value/IdentifiedDoubleValue.java index 4009c6e..86393a7 100644 --- a/src/proguard/evaluation/value/IdentifiedDoubleValue.java +++ b/src/proguard/evaluation/value/IdentifiedDoubleValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/IdentifiedFloatValue.java b/src/proguard/evaluation/value/IdentifiedFloatValue.java index 87bed64..363530b 100644 --- a/src/proguard/evaluation/value/IdentifiedFloatValue.java +++ b/src/proguard/evaluation/value/IdentifiedFloatValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/IdentifiedIntegerValue.java b/src/proguard/evaluation/value/IdentifiedIntegerValue.java index 66e88ee..57e73cb 100644 --- a/src/proguard/evaluation/value/IdentifiedIntegerValue.java +++ b/src/proguard/evaluation/value/IdentifiedIntegerValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/IdentifiedLongValue.java b/src/proguard/evaluation/value/IdentifiedLongValue.java index eea1816..a0c4636 100644 --- a/src/proguard/evaluation/value/IdentifiedLongValue.java +++ b/src/proguard/evaluation/value/IdentifiedLongValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/IdentifiedReferenceValue.java b/src/proguard/evaluation/value/IdentifiedReferenceValue.java index cb5efc1..1514d4d 100644 --- a/src/proguard/evaluation/value/IdentifiedReferenceValue.java +++ b/src/proguard/evaluation/value/IdentifiedReferenceValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -57,6 +57,17 @@ final class IdentifiedReferenceValue extends ReferenceValue } + // Implementations of binary methods of ReferenceValue. + + public ReferenceValue generalize(ReferenceValue other) + { + // Remove the ID if both values don't share the same ID. + return this.equals(other) ? + this : + new ReferenceValue(type, referencedClass, mayBeNull).generalize(other); + } + + // Implementations for Value. public boolean isSpecific() diff --git a/src/proguard/evaluation/value/IdentifiedValueFactory.java b/src/proguard/evaluation/value/IdentifiedValueFactory.java index 2b14e72..f2a3cab 100644 --- a/src/proguard/evaluation/value/IdentifiedValueFactory.java +++ b/src/proguard/evaluation/value/IdentifiedValueFactory.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/InstructionOffsetValue.java b/src/proguard/evaluation/value/InstructionOffsetValue.java index 10b5a6f..93d0380 100644 --- a/src/proguard/evaluation/value/InstructionOffsetValue.java +++ b/src/proguard/evaluation/value/InstructionOffsetValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/IntegerValue.java b/src/proguard/evaluation/value/IntegerValue.java index 508c5f5..6a0775d 100644 --- a/src/proguard/evaluation/value/IntegerValue.java +++ b/src/proguard/evaluation/value/IntegerValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/LongValue.java b/src/proguard/evaluation/value/LongValue.java index f7ba162..1d8f413 100644 --- a/src/proguard/evaluation/value/LongValue.java +++ b/src/proguard/evaluation/value/LongValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/NegatedDoubleValue.java b/src/proguard/evaluation/value/NegatedDoubleValue.java index 2bc9423..6409f8c 100644 --- a/src/proguard/evaluation/value/NegatedDoubleValue.java +++ b/src/proguard/evaluation/value/NegatedDoubleValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/NegatedFloatValue.java b/src/proguard/evaluation/value/NegatedFloatValue.java index 0ddf4ab..f0f7e40 100644 --- a/src/proguard/evaluation/value/NegatedFloatValue.java +++ b/src/proguard/evaluation/value/NegatedFloatValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/NegatedIntegerValue.java b/src/proguard/evaluation/value/NegatedIntegerValue.java index a89a2d9..74b857c 100644 --- a/src/proguard/evaluation/value/NegatedIntegerValue.java +++ b/src/proguard/evaluation/value/NegatedIntegerValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/NegatedLongValue.java b/src/proguard/evaluation/value/NegatedLongValue.java index c3b22bb..3f97fd0 100644 --- a/src/proguard/evaluation/value/NegatedLongValue.java +++ b/src/proguard/evaluation/value/NegatedLongValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/ParticularDoubleValue.java b/src/proguard/evaluation/value/ParticularDoubleValue.java index 05bc559..383cae3 100644 --- a/src/proguard/evaluation/value/ParticularDoubleValue.java +++ b/src/proguard/evaluation/value/ParticularDoubleValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -79,17 +79,23 @@ final class ParticularDoubleValue extends SpecificDoubleValue public DoubleValue add(DoubleValue other) { - return value == 0.0 ? other : other.add(this); + // Careful: -0.0 + 0.0 == 0.0 + //return value == 0.0 ? other : other.add(this); + return other.add(this); } public DoubleValue subtract(DoubleValue other) { - return value == 0.0 ? other.negate() : other.subtractFrom(this); + // Careful: -0.0 + 0.0 == 0.0 + //return value == 0.0 ? other.negate() : other.subtractFrom(this); + return other.subtractFrom(this); } public DoubleValue subtractFrom(DoubleValue other) { - return value == 0.0 ? other : other.subtract(this); + // Careful: -0.0 + 0.0 == 0.0 + //return value == 0.0 ? other : other.subtract(this); + return other.subtract(this); } public DoubleValue multiply(DoubleValue other) diff --git a/src/proguard/evaluation/value/ParticularFloatValue.java b/src/proguard/evaluation/value/ParticularFloatValue.java index 59e4357..335765c 100644 --- a/src/proguard/evaluation/value/ParticularFloatValue.java +++ b/src/proguard/evaluation/value/ParticularFloatValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -79,17 +79,23 @@ final class ParticularFloatValue extends SpecificFloatValue public FloatValue add(FloatValue other) { - return value == 0.0 ? other : other.add(this); + // Careful: -0.0 + 0.0 == 0.0 + //return value == 0.0 ? other : other.add(this); + return other.add(this); } public FloatValue subtract(FloatValue other) { - return value == 0.0 ? other.negate() : other.subtractFrom(this); + // Careful: -0.0 + 0.0 == 0.0 + //return value == 0.0 ? other.negate() : other.subtractFrom(this); + return other.subtractFrom(this); } public FloatValue subtractFrom(FloatValue other) { - return value == 0.0 ? other : other.subtract(this); + // Careful: -0.0 + 0.0 == 0.0 + //return value == 0.0 ? other : other.subtract(this); + return other.subtract(this); } public FloatValue multiply(FloatValue other) diff --git a/src/proguard/evaluation/value/ParticularIntegerValue.java b/src/proguard/evaluation/value/ParticularIntegerValue.java index 8a4ac1d..d6906e7 100644 --- a/src/proguard/evaluation/value/ParticularIntegerValue.java +++ b/src/proguard/evaluation/value/ParticularIntegerValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/ParticularLongValue.java b/src/proguard/evaluation/value/ParticularLongValue.java index 61d2e04..22d9d1a 100644 --- a/src/proguard/evaluation/value/ParticularLongValue.java +++ b/src/proguard/evaluation/value/ParticularLongValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/ReferenceValue.java b/src/proguard/evaluation/value/ReferenceValue.java index 418c6f8..084a1a4 100644 --- a/src/proguard/evaluation/value/ReferenceValue.java +++ b/src/proguard/evaluation/value/ReferenceValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -280,11 +280,25 @@ public class ReferenceValue extends Category1Value thisReferencedClass.hierarchyAccept(false, true, true, false, new ClassCollector(thisSuperClasses)); + int thisSuperClassesCount = thisSuperClasses.size(); + if (thisSuperClassesCount == 0 && + thisReferencedClass.getSuperName() != null) + { + throw new IllegalArgumentException("Can't find any super classes of ["+thisType+"] (not even immediate super class ["+thisReferencedClass.getSuperName()+"])"); + } + // Collect the superclasses and interfaces of the other class. Set otherSuperClasses = new HashSet(); otherReferencedClass.hierarchyAccept(false, true, true, false, new ClassCollector(otherSuperClasses)); + int otherSuperClassesCount = otherSuperClasses.size(); + if (otherSuperClassesCount == 0 && + otherReferencedClass.getSuperName() != null) + { + throw new IllegalArgumentException("Can't find any super classes of ["+otherType+"] (not even immediate super class ["+otherReferencedClass.getSuperName()+"])"); + } + if (DEBUG) { System.out.println("ReferenceValue.generalize this ["+thisReferencedClass.getName()+"] with other ["+otherReferencedClass.getName()+"]"); @@ -302,7 +316,7 @@ public class ReferenceValue extends Category1Value // Find a class that is a subclass of all common superclasses, // or that at least has the maximum number of common superclasses. - Clazz commonClazz = null; + Clazz commonClass = null; int maximumSuperClassCount = -1; @@ -317,31 +331,33 @@ public class ReferenceValue extends Category1Value int superClassCount = superClassCount(commonSuperClass, thisSuperClasses); if (maximumSuperClassCount < superClassCount || (maximumSuperClassCount == superClassCount && - commonClazz != null && - commonClazz.getName().compareTo(commonSuperClass.getName()) > 0)) + commonClass != null && + commonClass.getName().compareTo(commonSuperClass.getName()) > 0)) { - commonClazz = commonSuperClass; + commonClass = commonSuperClass; maximumSuperClassCount = superClassCount; } } - if (commonClazz == null) + if (commonClass == null) { - throw new IllegalArgumentException("Can't find common super class of ["+thisType+"] and ["+otherType+"]"); + throw new IllegalArgumentException("Can't find common super class of ["+ + thisType +"] (with "+thisSuperClassesCount +" known super classes) and ["+ + otherType+"] (with "+otherSuperClassesCount+" known super classes)"); } if (DEBUG) { - System.out.println(" Best common class: ["+commonClazz.getName()+"]"); + System.out.println(" Best common class: ["+commonClass.getName()+"]"); } // TODO: Handle more difficult cases, with multiple global subclasses. return new ReferenceValue(commonDimensionCount == 0 ? - commonClazz.getName() : - ClassUtil.internalArrayTypeFromClassName(commonClazz.getName(), + commonClass.getName() : + ClassUtil.internalArrayTypeFromClassName(commonClass.getName(), commonDimensionCount), - commonClazz, + commonClass, mayBeNull); } } @@ -402,8 +418,6 @@ public class ReferenceValue extends Category1Value } } - //System.out.println("ReferenceValue.superClassCount: ["+subClass.getName()+"]: "+count); - return count; } diff --git a/src/proguard/evaluation/value/SpecificDoubleValue.java b/src/proguard/evaluation/value/SpecificDoubleValue.java index 572d891..ea4ecc4 100644 --- a/src/proguard/evaluation/value/SpecificDoubleValue.java +++ b/src/proguard/evaluation/value/SpecificDoubleValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -153,9 +153,12 @@ abstract class SpecificDoubleValue extends DoubleValue public IntegerValue compare(SpecificDoubleValue other) { - return this.equals(other) ? - SpecificValueFactory.INTEGER_VALUE_0 : - new ComparisonValue(this, other); + return ValueFactory.INTEGER_VALUE; + + // Not handling NaN properly. + //return this.equals(other) ? + // SpecificValueFactory.INTEGER_VALUE_0 : + // new ComparisonValue(this, other); } diff --git a/src/proguard/evaluation/value/SpecificFloatValue.java b/src/proguard/evaluation/value/SpecificFloatValue.java index 3bc3679..1e55c23 100644 --- a/src/proguard/evaluation/value/SpecificFloatValue.java +++ b/src/proguard/evaluation/value/SpecificFloatValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -153,9 +153,12 @@ abstract class SpecificFloatValue extends FloatValue public IntegerValue compare(SpecificFloatValue other) { - return this.equals(other) ? - SpecificValueFactory.INTEGER_VALUE_0 : - new ComparisonValue(this, other); + return ValueFactory.INTEGER_VALUE; + + // Not handling NaN properly. + //return this.equals(other) ? + // SpecificValueFactory.INTEGER_VALUE_0 : + // new ComparisonValue(this, other); } diff --git a/src/proguard/evaluation/value/SpecificIntegerValue.java b/src/proguard/evaluation/value/SpecificIntegerValue.java index 57c48b1..45eb013 100644 --- a/src/proguard/evaluation/value/SpecificIntegerValue.java +++ b/src/proguard/evaluation/value/SpecificIntegerValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/SpecificLongValue.java b/src/proguard/evaluation/value/SpecificLongValue.java index 5e12bde..32302a4 100644 --- a/src/proguard/evaluation/value/SpecificLongValue.java +++ b/src/proguard/evaluation/value/SpecificLongValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/SpecificValueFactory.java b/src/proguard/evaluation/value/SpecificValueFactory.java index 72dd1d3..145ff55 100644 --- a/src/proguard/evaluation/value/SpecificValueFactory.java +++ b/src/proguard/evaluation/value/SpecificValueFactory.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -45,6 +45,10 @@ extends ValueFactory static final DoubleValue DOUBLE_VALUE_1 = new ParticularDoubleValue(1.0); + private static int POS_ZERO_FLOAT_BITS = Float.floatToIntBits(0.0f); + private static long POS_ZERO_DOUBLE_BITS = Double.doubleToLongBits(0.0); + + // Implementations for ValueFactory. public IntegerValue createIntegerValue(int value) @@ -73,7 +77,9 @@ extends ValueFactory public FloatValue createFloatValue(float value) { - return value == 0.0f ? FLOAT_VALUE_0 : + // Make sure to distinguish between +0.0 and -0.0. + return value == 0.0f && Float.floatToIntBits(value) == POS_ZERO_FLOAT_BITS + ? FLOAT_VALUE_0 : value == 1.0f ? FLOAT_VALUE_1 : value == 2.0f ? FLOAT_VALUE_2 : new ParticularFloatValue(value); @@ -82,7 +88,9 @@ extends ValueFactory public DoubleValue createDoubleValue(double value) { - return value == 0.0 ? DOUBLE_VALUE_0 : + // Make sure to distinguish between +0.0 and -0.0. + return value == 0.0 && Double.doubleToLongBits(value) == POS_ZERO_DOUBLE_BITS + ? DOUBLE_VALUE_0 : value == 1.0 ? DOUBLE_VALUE_1 : new ParticularDoubleValue(value); } diff --git a/src/proguard/evaluation/value/TopValue.java b/src/proguard/evaluation/value/TopValue.java index 048a1ff..ecd182e 100644 --- a/src/proguard/evaluation/value/TopValue.java +++ b/src/proguard/evaluation/value/TopValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/UnknownDoubleValue.java b/src/proguard/evaluation/value/UnknownDoubleValue.java index 79cc4de..96bf06a 100644 --- a/src/proguard/evaluation/value/UnknownDoubleValue.java +++ b/src/proguard/evaluation/value/UnknownDoubleValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/UnknownFloatValue.java b/src/proguard/evaluation/value/UnknownFloatValue.java index 3f9622a..14469f8 100644 --- a/src/proguard/evaluation/value/UnknownFloatValue.java +++ b/src/proguard/evaluation/value/UnknownFloatValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/UnknownIntegerValue.java b/src/proguard/evaluation/value/UnknownIntegerValue.java index be5e79d..94fcf60 100644 --- a/src/proguard/evaluation/value/UnknownIntegerValue.java +++ b/src/proguard/evaluation/value/UnknownIntegerValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/UnknownLongValue.java b/src/proguard/evaluation/value/UnknownLongValue.java index 83a75dc..f183447 100644 --- a/src/proguard/evaluation/value/UnknownLongValue.java +++ b/src/proguard/evaluation/value/UnknownLongValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/Value.java b/src/proguard/evaluation/value/Value.java index e24ece1..b4f1c6a 100644 --- a/src/proguard/evaluation/value/Value.java +++ b/src/proguard/evaluation/value/Value.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/evaluation/value/ValueFactory.java b/src/proguard/evaluation/value/ValueFactory.java index 8415381..2b9e7f1 100644 --- a/src/proguard/evaluation/value/ValueFactory.java +++ b/src/proguard/evaluation/value/ValueFactory.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free |