diff options
Diffstat (limited to 'src/proguard/shrink/AnnotationUsageMarker.java')
-rw-r--r-- | src/proguard/shrink/AnnotationUsageMarker.java | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/proguard/shrink/AnnotationUsageMarker.java b/src/proguard/shrink/AnnotationUsageMarker.java index 0b2fd91..9aaae34 100644 --- a/src/proguard/shrink/AnnotationUsageMarker.java +++ b/src/proguard/shrink/AnnotationUsageMarker.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 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 @@ -52,6 +52,7 @@ implements AttributeVisitor, // Fields acting as a return parameters for several methods. private boolean attributeUsed; private boolean annotationUsed; + private boolean elementValueUsed; private boolean classUsed; private boolean methodUsed; @@ -150,6 +151,9 @@ implements AttributeVisitor, markConstant(clazz, constantElementValue.u2elementNameIndex); markConstant(clazz, constantElementValue.u2constantValueIndex); + + // The return value. + elementValueUsed = true; } } @@ -160,7 +164,7 @@ implements AttributeVisitor, { // Check the referenced classes. classUsed = true; - enumConstantElementValue.referencedClassesAccept(this); + enumConstantElementValue.referencedClassesAccept(usageMarker); if (classUsed) { @@ -170,6 +174,9 @@ implements AttributeVisitor, markConstant(clazz, enumConstantElementValue.u2elementNameIndex); markConstant(clazz, enumConstantElementValue.u2typeNameIndex); markConstant(clazz, enumConstantElementValue.u2constantNameIndex); + + // The return value. + elementValueUsed = true; } } } @@ -181,7 +188,7 @@ implements AttributeVisitor, { // Check the referenced classes. classUsed = true; - classElementValue.referencedClassesAccept(this); + classElementValue.referencedClassesAccept(usageMarker); if (classUsed) { @@ -190,6 +197,9 @@ implements AttributeVisitor, markConstant(clazz, classElementValue.u2elementNameIndex); markConstant(clazz, classElementValue.u2classInfoIndex); + + // The return value. + elementValueUsed = true; } } } @@ -211,6 +221,9 @@ implements AttributeVisitor, usageMarker.markAsUsed(annotationElementValue); markConstant(clazz, annotationElementValue.u2elementNameIndex); + + // The return value. + elementValueUsed = true; } annotationUsed = oldAnnotationUsed; @@ -222,13 +235,26 @@ implements AttributeVisitor, { if (isReferencedMethodUsed(arrayElementValue)) { + boolean oldelementValueUsed = elementValueUsed; + // Check and mark the contained element values. + elementValueUsed = false; arrayElementValue.elementValuesAccept(clazz, annotation, this); - // Mark the element value as being used. - usageMarker.markAsUsed(arrayElementValue); + if (elementValueUsed) + { + // Mark the element value as being used. + usageMarker.markAsUsed(arrayElementValue); + + markConstant(clazz, arrayElementValue.u2elementNameIndex); - markConstant(clazz, arrayElementValue.u2elementNameIndex); + // The return value. + //elementValueUsed = true; + } + else + { + elementValueUsed = oldelementValueUsed; + } } } |