diff options
Diffstat (limited to 'src/proguard/classfile/attribute')
104 files changed, 2494 insertions, 220 deletions
diff --git a/src/proguard/classfile/attribute/Attribute.java b/src/proguard/classfile/attribute/Attribute.java index f34a0ee..06845e0 100644 --- a/src/proguard/classfile/attribute/Attribute.java +++ b/src/proguard/classfile/attribute/Attribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -84,7 +84,7 @@ public abstract class Attribute implements VisitorAccepter */ public void accept(Clazz clazz, Field field, AttributeVisitor attributeVisitor) { - // Delegate the default invocation if the field is null anyway. + // Delegate to the default invocation if the field is null anyway. if (field == null) { accept(clazz, attributeVisitor); @@ -100,7 +100,7 @@ public abstract class Attribute implements VisitorAccepter */ public void accept(Clazz clazz, Method method, AttributeVisitor attributeVisitor) { - // Delegate the default invocation if the method is null anyway. + // Delegate to the default invocation if the method is null anyway. if (method == null) { accept(clazz, (Field)null, attributeVisitor); @@ -116,7 +116,8 @@ public abstract class Attribute implements VisitorAccepter */ public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, AttributeVisitor attributeVisitor) { - // Delegate the default invocation if the code attribute is null anyway. + // Delegate to the default invocation if the code attribute is null + // anyway. if (codeAttribute == null) { accept(clazz, method, attributeVisitor); diff --git a/src/proguard/classfile/attribute/BootstrapMethodInfo.java b/src/proguard/classfile/attribute/BootstrapMethodInfo.java index f246766..e819362 100755 --- a/src/proguard/classfile/attribute/BootstrapMethodInfo.java +++ b/src/proguard/classfile/attribute/BootstrapMethodInfo.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/BootstrapMethodsAttribute.java b/src/proguard/classfile/attribute/BootstrapMethodsAttribute.java index 4471a75..20b8965 100755 --- a/src/proguard/classfile/attribute/BootstrapMethodsAttribute.java +++ b/src/proguard/classfile/attribute/BootstrapMethodsAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -20,9 +20,8 @@ */ package proguard.classfile.attribute; -import proguard.classfile.*; +import proguard.classfile.Clazz; import proguard.classfile.attribute.visitor.*; -import proguard.classfile.constant.visitor.ConstantVisitor; /** * This Attribute represents a bootstrap methods attribute. @@ -66,8 +65,7 @@ public class BootstrapMethodsAttribute extends Attribute /** - * Applies the given constant pool visitor to all bootstrap method info - * entries. + * Applies the given visitor to all bootstrap method info entries. */ public void bootstrapMethodEntriesAccept(Clazz clazz, BootstrapMethodInfoVisitor bootstrapMethodInfoVisitor) { @@ -81,8 +79,8 @@ public class BootstrapMethodsAttribute extends Attribute /** - * Applies the given constant pool visitor to the specified bootstrap method - * info entry. + * Applies the given visitor to the specified bootstrap method info + * entry. */ public void bootstrapMethodEntryAccept(Clazz clazz, int bootstrapMethodIndex, diff --git a/src/proguard/classfile/attribute/CodeAttribute.java b/src/proguard/classfile/attribute/CodeAttribute.java index b3d4f4c..6bcaa0a 100644 --- a/src/proguard/classfile/attribute/CodeAttribute.java +++ b/src/proguard/classfile/attribute/CodeAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/ConstantValueAttribute.java b/src/proguard/classfile/attribute/ConstantValueAttribute.java index 056e377..b90f393 100644 --- a/src/proguard/classfile/attribute/ConstantValueAttribute.java +++ b/src/proguard/classfile/attribute/ConstantValueAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/DeprecatedAttribute.java b/src/proguard/classfile/attribute/DeprecatedAttribute.java index f668063..c1920e9 100644 --- a/src/proguard/classfile/attribute/DeprecatedAttribute.java +++ b/src/proguard/classfile/attribute/DeprecatedAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/EnclosingMethodAttribute.java b/src/proguard/classfile/attribute/EnclosingMethodAttribute.java index 1c2ecc4..8a31f03 100644 --- a/src/proguard/classfile/attribute/EnclosingMethodAttribute.java +++ b/src/proguard/classfile/attribute/EnclosingMethodAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/ExceptionInfo.java b/src/proguard/classfile/attribute/ExceptionInfo.java index 31512e5..2bb1118 100644 --- a/src/proguard/classfile/attribute/ExceptionInfo.java +++ b/src/proguard/classfile/attribute/ExceptionInfo.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/ExceptionsAttribute.java b/src/proguard/classfile/attribute/ExceptionsAttribute.java index ff7b84a..5ae5c3d 100644 --- a/src/proguard/classfile/attribute/ExceptionsAttribute.java +++ b/src/proguard/classfile/attribute/ExceptionsAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/InnerClassesAttribute.java b/src/proguard/classfile/attribute/InnerClassesAttribute.java index b08d104..f0c9e1e 100644 --- a/src/proguard/classfile/attribute/InnerClassesAttribute.java +++ b/src/proguard/classfile/attribute/InnerClassesAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/InnerClassesInfo.java b/src/proguard/classfile/attribute/InnerClassesInfo.java index 87b9de4..7a1eb67 100644 --- a/src/proguard/classfile/attribute/InnerClassesInfo.java +++ b/src/proguard/classfile/attribute/InnerClassesInfo.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/LineNumberInfo.java b/src/proguard/classfile/attribute/LineNumberInfo.java index 1bcacef..0dd527c 100644 --- a/src/proguard/classfile/attribute/LineNumberInfo.java +++ b/src/proguard/classfile/attribute/LineNumberInfo.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/LineNumberTableAttribute.java b/src/proguard/classfile/attribute/LineNumberTableAttribute.java index c217119..7bd3e00 100644 --- a/src/proguard/classfile/attribute/LineNumberTableAttribute.java +++ b/src/proguard/classfile/attribute/LineNumberTableAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/LocalVariableInfo.java b/src/proguard/classfile/attribute/LocalVariableInfo.java index 00bbd50..88035ce 100644 --- a/src/proguard/classfile/attribute/LocalVariableInfo.java +++ b/src/proguard/classfile/attribute/LocalVariableInfo.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -76,6 +76,24 @@ public class LocalVariableInfo implements VisitorAccepter, Comparable /** + * Returns the name. + */ + public String getName(Clazz clazz) + { + return clazz.getString(u2nameIndex); + } + + + /** + * Returns the descriptor. + */ + public String getDescriptor(Clazz clazz) + { + return clazz.getString(u2descriptorIndex); + } + + + /** * Lets the referenced class accept the given visitor. */ public void referencedClassAccept(ClassVisitor classVisitor) diff --git a/src/proguard/classfile/attribute/LocalVariableTableAttribute.java b/src/proguard/classfile/attribute/LocalVariableTableAttribute.java index 9e081c0..a48e890 100644 --- a/src/proguard/classfile/attribute/LocalVariableTableAttribute.java +++ b/src/proguard/classfile/attribute/LocalVariableTableAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/LocalVariableTypeInfo.java b/src/proguard/classfile/attribute/LocalVariableTypeInfo.java index 15b9d24..c0fc405 100644 --- a/src/proguard/classfile/attribute/LocalVariableTypeInfo.java +++ b/src/proguard/classfile/attribute/LocalVariableTypeInfo.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -77,6 +77,24 @@ public class LocalVariableTypeInfo implements VisitorAccepter, Comparable /** + * Returns the name. + */ + public String getName(Clazz clazz) + { + return clazz.getString(u2nameIndex); + } + + + /** + * Returns the signature. + */ + public String getSignature(Clazz clazz) + { + return clazz.getString(u2signatureIndex); + } + + + /** * Applies the given visitor to all referenced classes. */ public void referencedClassesAccept(ClassVisitor classVisitor) diff --git a/src/proguard/classfile/attribute/LocalVariableTypeTableAttribute.java b/src/proguard/classfile/attribute/LocalVariableTypeTableAttribute.java index dda24fb..62643bc 100644 --- a/src/proguard/classfile/attribute/LocalVariableTypeTableAttribute.java +++ b/src/proguard/classfile/attribute/LocalVariableTypeTableAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/MethodParametersAttribute.java b/src/proguard/classfile/attribute/MethodParametersAttribute.java new file mode 100644 index 0000000..5e832d2 --- /dev/null +++ b/src/proguard/classfile/attribute/MethodParametersAttribute.java @@ -0,0 +1,80 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute; + +import proguard.classfile.*; +import proguard.classfile.attribute.visitor.*; + +/** + * This Attribute represents a method parameters attribute. + * + * @author Eric Lafortune + */ +public class MethodParametersAttribute extends Attribute +{ + public int u1parametersCount; + public ParameterInfo[] parameters; + + + /** + * Creates an uninitialized MethodParametersAttribute. + */ + public MethodParametersAttribute() + { + } + + + /** + * Creates an initialized MethodParametersAttribute. + */ + public MethodParametersAttribute(int u2attributeNameIndex, + int u1parametersCount, + ParameterInfo[] parameters) + { + super(u2attributeNameIndex); + + this.u1parametersCount = u1parametersCount; + this.parameters = parameters; + } + + + // Implementations for Attribute. + + public void accept(Clazz clazz, Method method, AttributeVisitor attributeVisitor) + { + attributeVisitor.visitMethodParametersAttribute(clazz, method, this); + } + + + /** + * Applies the given visitor to all parameters. + */ + public void parametersAccept(Clazz clazz, Method method, ParameterInfoVisitor parameterInfoVisitor) + { + // Loop over all parameters. + for (int index = 0; index < u1parametersCount; index++) + { + // We don't need double dispatching here, since there is only one + // type of ParameterInfo. + parameterInfoVisitor.visitParameterInfo(clazz, method, index, parameters[index]); + } + } +} diff --git a/src/proguard/classfile/attribute/ParameterInfo.java b/src/proguard/classfile/attribute/ParameterInfo.java new file mode 100644 index 0000000..dac5e1a --- /dev/null +++ b/src/proguard/classfile/attribute/ParameterInfo.java @@ -0,0 +1,81 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute; + +import proguard.classfile.*; + +/** + * Representation of a parameter, as defined in a method parameters + * attribute. + * + * @author Eric Lafortune + */ +public class ParameterInfo implements VisitorAccepter +{ + public int u2nameIndex; + public int u2accessFlags; + + /** + * An extra field in which visitors can store information. + */ + public Object visitorInfo; + + + /** + * Creates an uninitialized ParameterInfo. + */ + public ParameterInfo() + { + } + + + /** + * Creates an initialized ParameterInfo. + */ + public ParameterInfo(int u2nameIndex, + int u2accessFlags) + { + this.u2nameIndex = u2nameIndex; + this.u2accessFlags = u2accessFlags; + } + + + /** + * Returns the parameter name. + */ + public String getName(Clazz clazz) + { + return clazz.getString(u2nameIndex); + } + + + // Implementations for VisitorAccepter. + + public Object getVisitorInfo() + { + return visitorInfo; + } + + public void setVisitorInfo(Object visitorInfo) + { + this.visitorInfo = visitorInfo; + } +} diff --git a/src/proguard/classfile/attribute/SignatureAttribute.java b/src/proguard/classfile/attribute/SignatureAttribute.java index 86f95b8..120fa96 100644 --- a/src/proguard/classfile/attribute/SignatureAttribute.java +++ b/src/proguard/classfile/attribute/SignatureAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -63,6 +63,15 @@ public class SignatureAttribute extends Attribute /** + * Returns the signature. + */ + public String getSignature(Clazz clazz) + { + return clazz.getString(u2signatureIndex); + } + + + /** * Lets the Clazz objects referenced in the signature string accept the * given visitor. */ diff --git a/src/proguard/classfile/attribute/SourceDirAttribute.java b/src/proguard/classfile/attribute/SourceDirAttribute.java index faa1c79..100c840 100644 --- a/src/proguard/classfile/attribute/SourceDirAttribute.java +++ b/src/proguard/classfile/attribute/SourceDirAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/SourceFileAttribute.java b/src/proguard/classfile/attribute/SourceFileAttribute.java index 4abac17..e10b784 100644 --- a/src/proguard/classfile/attribute/SourceFileAttribute.java +++ b/src/proguard/classfile/attribute/SourceFileAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/SyntheticAttribute.java b/src/proguard/classfile/attribute/SyntheticAttribute.java index 0135330..a308545 100644 --- a/src/proguard/classfile/attribute/SyntheticAttribute.java +++ b/src/proguard/classfile/attribute/SyntheticAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/UnknownAttribute.java b/src/proguard/classfile/attribute/UnknownAttribute.java index 182a9e8..f928f25 100644 --- a/src/proguard/classfile/attribute/UnknownAttribute.java +++ b/src/proguard/classfile/attribute/UnknownAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -32,15 +32,17 @@ import proguard.classfile.attribute.visitor.AttributeVisitor; public class UnknownAttribute extends Attribute { public final int u4attributeLength; - public byte[] info; + public byte[] info; /** - * Creates an uninitialized UnknownAttribute with the given length. + * Creates an uninitialized UnknownAttribute with the specified name and + * length. */ - public UnknownAttribute(int attributeLength) + public UnknownAttribute(int u2attributeNameIndex, + int attributeLength) { - u4attributeLength = attributeLength; + this(u2attributeNameIndex, attributeLength, null); } diff --git a/src/proguard/classfile/attribute/annotation/Annotation.java b/src/proguard/classfile/attribute/annotation/Annotation.java index b2f18d5..3e24a9e 100644 --- a/src/proguard/classfile/attribute/annotation/Annotation.java +++ b/src/proguard/classfile/attribute/annotation/Annotation.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/annotation/AnnotationDefaultAttribute.java b/src/proguard/classfile/attribute/annotation/AnnotationDefaultAttribute.java index b8f29cc..1b06e82 100644 --- a/src/proguard/classfile/attribute/annotation/AnnotationDefaultAttribute.java +++ b/src/proguard/classfile/attribute/annotation/AnnotationDefaultAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/annotation/AnnotationElementValue.java b/src/proguard/classfile/attribute/annotation/AnnotationElementValue.java index 8354f5d..1e6365c 100644 --- a/src/proguard/classfile/attribute/annotation/AnnotationElementValue.java +++ b/src/proguard/classfile/attribute/annotation/AnnotationElementValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/annotation/AnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/AnnotationsAttribute.java index a936ff4..dcb7cf6 100644 --- a/src/proguard/classfile/attribute/annotation/AnnotationsAttribute.java +++ b/src/proguard/classfile/attribute/annotation/AnnotationsAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -21,7 +21,7 @@ package proguard.classfile.attribute.annotation; import proguard.classfile.*; -import proguard.classfile.attribute.Attribute; +import proguard.classfile.attribute.*; import proguard.classfile.attribute.annotation.visitor.AnnotationVisitor; /** @@ -44,7 +44,7 @@ public abstract class AnnotationsAttribute extends Attribute /** - * Creates an initialized AnnotationsAttribute. + * Creates an initialized AnnotationsAttribute. */ protected AnnotationsAttribute(int u2attributeNameIndex, int u2annotationsCount, @@ -97,4 +97,18 @@ public abstract class AnnotationsAttribute extends Attribute annotationVisitor.visitAnnotation(clazz, method, annotations[index]); } } + + + /** + * Applies the given visitor to all code attribute annotations. + */ + public void annotationsAccept(Clazz clazz, Method method, CodeAttribute codeAttribute, AnnotationVisitor annotationVisitor) + { + for (int index = 0; index < u2annotationsCount; index++) + { + // We don't need double dispatching here, since there is only one + // type of Annotation. + annotationVisitor.visitAnnotation(clazz, method, codeAttribute, annotations[index]); + } + } } diff --git a/src/proguard/classfile/attribute/annotation/ArrayElementValue.java b/src/proguard/classfile/attribute/annotation/ArrayElementValue.java index 0aab49b..4d814c0 100644 --- a/src/proguard/classfile/attribute/annotation/ArrayElementValue.java +++ b/src/proguard/classfile/attribute/annotation/ArrayElementValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/annotation/ClassElementValue.java b/src/proguard/classfile/attribute/annotation/ClassElementValue.java index ffeaf71..0e5de1e 100644 --- a/src/proguard/classfile/attribute/annotation/ClassElementValue.java +++ b/src/proguard/classfile/attribute/annotation/ClassElementValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -63,6 +63,15 @@ public class ClassElementValue extends ElementValue /** + * Returns the class info name. + */ + public String getClassName(Clazz clazz) + { + return clazz.getString(u2classInfoIndex); + } + + + /** * Applies the given visitor to all referenced classes. */ public void referencedClassesAccept(ClassVisitor classVisitor) diff --git a/src/proguard/classfile/attribute/annotation/ConstantElementValue.java b/src/proguard/classfile/attribute/annotation/ConstantElementValue.java index 8be4329..5ff51db 100644 --- a/src/proguard/classfile/attribute/annotation/ConstantElementValue.java +++ b/src/proguard/classfile/attribute/annotation/ConstantElementValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/annotation/ElementValue.java b/src/proguard/classfile/attribute/annotation/ElementValue.java index 19a7198..9c0f2c9 100644 --- a/src/proguard/classfile/attribute/annotation/ElementValue.java +++ b/src/proguard/classfile/attribute/annotation/ElementValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/annotation/EnumConstantElementValue.java b/src/proguard/classfile/attribute/annotation/EnumConstantElementValue.java index cd0f2f9..1105100 100644 --- a/src/proguard/classfile/attribute/annotation/EnumConstantElementValue.java +++ b/src/proguard/classfile/attribute/annotation/EnumConstantElementValue.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/annotation/ParameterAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/ParameterAnnotationsAttribute.java index ddaa3a6..4b0cb1c 100644 --- a/src/proguard/classfile/attribute/annotation/ParameterAnnotationsAttribute.java +++ b/src/proguard/classfile/attribute/annotation/ParameterAnnotationsAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -25,13 +25,13 @@ import proguard.classfile.attribute.Attribute; import proguard.classfile.attribute.annotation.visitor.AnnotationVisitor; /** - * This Attribute represents a runtime parameter annotations attribute. + * This Attribute represents a parameter annotations attribute. * * @author Eric Lafortune */ public abstract class ParameterAnnotationsAttribute extends Attribute { - public int u2parametersCount; + public int u1parametersCount; public int[] u2parameterAnnotationsCount; public Annotation[][] parameterAnnotations; @@ -48,13 +48,13 @@ public abstract class ParameterAnnotationsAttribute extends Attribute * Creates an initialized ParameterAnnotationsAttribute. */ protected ParameterAnnotationsAttribute(int u2attributeNameIndex, - int u2parametersCount, + int u1parametersCount, int[] u2parameterAnnotationsCount, Annotation[][] parameterAnnotations) { super(u2attributeNameIndex); - this.u2parametersCount = u2parametersCount; + this.u1parametersCount = u1parametersCount; this.u2parameterAnnotationsCount = u2parameterAnnotationsCount; this.parameterAnnotations = parameterAnnotations; } @@ -66,7 +66,7 @@ public abstract class ParameterAnnotationsAttribute extends Attribute public void annotationsAccept(Clazz clazz, Method method, AnnotationVisitor annotationVisitor) { // Loop over all parameters. - for (int parameterIndex = 0; parameterIndex < u2parametersCount; parameterIndex++) + for (int parameterIndex = 0; parameterIndex < u1parametersCount; parameterIndex++) { int annotationsCount = u2parameterAnnotationsCount[parameterIndex]; Annotation[] annotations = parameterAnnotations[parameterIndex]; diff --git a/src/proguard/classfile/attribute/annotation/RuntimeInvisibleAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/RuntimeInvisibleAnnotationsAttribute.java index deda8a5..84d9d61 100644 --- a/src/proguard/classfile/attribute/annotation/RuntimeInvisibleAnnotationsAttribute.java +++ b/src/proguard/classfile/attribute/annotation/RuntimeInvisibleAnnotationsAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/annotation/RuntimeInvisibleParameterAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/RuntimeInvisibleParameterAnnotationsAttribute.java index 2fcae88..0a5e1d7 100644 --- a/src/proguard/classfile/attribute/annotation/RuntimeInvisibleParameterAnnotationsAttribute.java +++ b/src/proguard/classfile/attribute/annotation/RuntimeInvisibleParameterAnnotationsAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -42,12 +42,12 @@ public class RuntimeInvisibleParameterAnnotationsAttribute extends ParameterAnno * Creates an initialized RuntimeInvisibleParameterAnnotationsAttribute. */ public RuntimeInvisibleParameterAnnotationsAttribute(int u2attributeNameIndex, - int u2parametersCount, + int u1parametersCount, int[] u2parameterAnnotationsCount, Annotation[][] parameterAnnotations) { super(u2attributeNameIndex, - u2parametersCount, + u1parametersCount, u2parameterAnnotationsCount, parameterAnnotations); } diff --git a/src/proguard/classfile/attribute/annotation/RuntimeInvisibleTypeAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/RuntimeInvisibleTypeAnnotationsAttribute.java new file mode 100644 index 0000000..2e1ca95 --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/RuntimeInvisibleTypeAnnotationsAttribute.java @@ -0,0 +1,77 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.visitor.AttributeVisitor; + +/** + * This Attribute represents a runtime invisible type annotations attribute. + * + * @author Eric Lafortune + */ +public class RuntimeInvisibleTypeAnnotationsAttribute extends TypeAnnotationsAttribute +{ + /** + * Creates an uninitialized RuntimeInvisibleTypeAnnotationsAttribute. + */ + public RuntimeInvisibleTypeAnnotationsAttribute() + { + } + + + /** + * Creates an initialized RuntimeInvisibleTypeAnnotationsAttribute. + */ + public RuntimeInvisibleTypeAnnotationsAttribute(int u2attributeNameIndex, + int u2annotationsCount, + TypeAnnotation[] annotations) + { + super(u2attributeNameIndex, u2annotationsCount, annotations); + } + + + // Implementations for Attribute. + + public void accept(Clazz clazz, AttributeVisitor attributeVisitor) + { + attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, this); + } + + + public void accept(Clazz clazz, Field field, AttributeVisitor attributeVisitor) + { + attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, field, this); + } + + + public void accept(Clazz clazz, Method method, AttributeVisitor attributeVisitor) + { + attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, this); + } + + + public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, AttributeVisitor attributeVisitor) + { + attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, this); + } +} diff --git a/src/proguard/classfile/attribute/annotation/RuntimeVisibleAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/RuntimeVisibleAnnotationsAttribute.java index da94f0c..89acf04 100644 --- a/src/proguard/classfile/attribute/annotation/RuntimeVisibleAnnotationsAttribute.java +++ b/src/proguard/classfile/attribute/annotation/RuntimeVisibleAnnotationsAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/annotation/RuntimeVisibleParameterAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/RuntimeVisibleParameterAnnotationsAttribute.java index caa6830..cc273c2 100644 --- a/src/proguard/classfile/attribute/annotation/RuntimeVisibleParameterAnnotationsAttribute.java +++ b/src/proguard/classfile/attribute/annotation/RuntimeVisibleParameterAnnotationsAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -42,12 +42,12 @@ public class RuntimeVisibleParameterAnnotationsAttribute extends ParameterAnnota * Creates an initialized RuntimeVisibleParameterAnnotationsAttribute. */ public RuntimeVisibleParameterAnnotationsAttribute(int u2attributeNameIndex, - int u2parametersCount, + int u1parametersCount, int[] u2parameterAnnotationsCount, Annotation[][] parameterAnnotations) { super(u2attributeNameIndex, - u2parametersCount, + u1parametersCount, u2parameterAnnotationsCount, parameterAnnotations); } diff --git a/src/proguard/classfile/attribute/annotation/RuntimeVisibleTypeAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/RuntimeVisibleTypeAnnotationsAttribute.java new file mode 100644 index 0000000..084827a --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/RuntimeVisibleTypeAnnotationsAttribute.java @@ -0,0 +1,77 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.visitor.AttributeVisitor; + +/** + * This Attribute represents a runtime visible type annotations attribute. + * + * @author Eric Lafortune + */ +public class RuntimeVisibleTypeAnnotationsAttribute extends TypeAnnotationsAttribute +{ + /** + * Creates an uninitialized RuntimeVisibleTypeAnnotationsAttribute. + */ + public RuntimeVisibleTypeAnnotationsAttribute() + { + } + + + /** + * Creates an initialized RuntimeVisibleTypeAnnotationsAttribute. + */ + public RuntimeVisibleTypeAnnotationsAttribute(int u2attributeNameIndex, + int u2annotationsCount, + TypeAnnotation[] annotations) + { + super(u2attributeNameIndex, u2annotationsCount, annotations); + } + + + // Implementations for Attribute. + + public void accept(Clazz clazz, AttributeVisitor attributeVisitor) + { + attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, this); + } + + + public void accept(Clazz clazz, Field field, AttributeVisitor attributeVisitor) + { + attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, field, this); + } + + + public void accept(Clazz clazz, Method method, AttributeVisitor attributeVisitor) + { + attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, this); + } + + + public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, AttributeVisitor attributeVisitor) + { + attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, this); + } +} diff --git a/src/proguard/classfile/attribute/annotation/TypeAnnotation.java b/src/proguard/classfile/attribute/annotation/TypeAnnotation.java new file mode 100644 index 0000000..86e4ddf --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/TypeAnnotation.java @@ -0,0 +1,162 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.annotation.target.TargetInfo; +import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor; +import proguard.classfile.attribute.annotation.visitor.*; + +/** + * Representation of a type annotation. + * + * @author Eric Lafortune + */ +public class TypeAnnotation extends Annotation +{ + public TargetInfo targetInfo; + public TypePathInfo[] typePath; + + + /** + * Creates an uninitialized TypeAnnotation. + */ + public TypeAnnotation() + { + } + + + /** + * Creates an initialized TypeAnnotation. + */ + public TypeAnnotation(int u2typeIndex, + int u2elementValuesCount, + ElementValue[] elementValues, + TargetInfo targetInfo, + TypePathInfo[] typePath) + { + super(u2typeIndex, u2elementValuesCount, elementValues); + + this.targetInfo = targetInfo; + this.typePath = typePath; + } + + + /** + * Applies the given visitor to the target info. + */ + public void targetInfoAccept(Clazz clazz, TargetInfoVisitor targetInfoVisitor) + { + // We don't need double dispatching here, since there is only one + // type of TypePathInfo. + targetInfo.accept(clazz, this, targetInfoVisitor); + } + + + /** + * Applies the given visitor to the target info. + */ + public void targetInfoAccept(Clazz clazz, Field field, TargetInfoVisitor targetInfoVisitor) + { + // We don't need double dispatching here, since there is only one + // type of TypePathInfo. + targetInfo.accept(clazz, field, this, targetInfoVisitor); + } + + + /** + * Applies the given visitor to the target info. + */ + public void targetInfoAccept(Clazz clazz, Method method, TargetInfoVisitor targetInfoVisitor) + { + // We don't need double dispatching here, since there is only one + // type of TypePathInfo. + targetInfo.accept(clazz, method, this, targetInfoVisitor); + } + + + /** + * Applies the given visitor to the target info. + */ + public void targetInfoAccept(Clazz clazz, Method method, CodeAttribute codeAttribute, TargetInfoVisitor targetInfoVisitor) + { + // We don't need double dispatching here, since there is only one + // type of TypePathInfo. + targetInfo.accept(clazz, method, codeAttribute, this, targetInfoVisitor); + } + + + /** + * Applies the given visitor to all type path elements. + */ + public void typePathInfosAccept(Clazz clazz, TypePathInfoVisitor typePathVisitor) + { + for (int index = 0; index < typePath.length; index++) + { + // We don't need double dispatching here, since there is only one + // type of TypePathInfo. + typePathVisitor.visitTypePathInfo(clazz, this, typePath[index]); + } + } + + + /** + * Applies the given visitor to all type path elements. + */ + public void typePathInfosAccept(Clazz clazz, Field field, TypePathInfoVisitor typePathVisitor) + { + for (int index = 0; index < typePath.length; index++) + { + // We don't need double dispatching here, since there is only one + // type of TypePathInfo. + typePathVisitor.visitTypePathInfo(clazz, field, this, typePath[index]); + } + } + + + /** + * Applies the given visitor to all type path elements. + */ + public void typePathInfosAccept(Clazz clazz, Method method, TypePathInfoVisitor typePathVisitor) + { + for (int index = 0; index < typePath.length; index++) + { + // We don't need double dispatching here, since there is only one + // type of TypePathInfo. + typePathVisitor.visitTypePathInfo(clazz, method, this, typePath[index]); + } + } + + + /** + * Applies the given visitor to all type path elements. + */ + public void typePathInfosAccept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TypePathInfoVisitor typePathVisitor) + { + for (int index = 0; index < typePath.length; index++) + { + // We don't need double dispatching here, since there is only one + // type of TypePathInfo. + typePathVisitor.visitTypePathInfo(clazz, method, codeAttribute, typeAnnotation, typePath[index]); + } + } +} diff --git a/src/proguard/classfile/attribute/annotation/TypeAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/TypeAnnotationsAttribute.java new file mode 100644 index 0000000..7606e05 --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/TypeAnnotationsAttribute.java @@ -0,0 +1,98 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation; + +import proguard.classfile.*; +import proguard.classfile.attribute.annotation.visitor.*; + +/** + * This Attribute represents a type annotations attribute. + * + * @author Eric Lafortune + */ +public abstract class TypeAnnotationsAttribute extends AnnotationsAttribute +{ + /** + * Creates an uninitialized TypeAnnotationsAttribute. + */ + protected TypeAnnotationsAttribute() + { + } + + + /** + * Creates an initialized TypeAnnotationsAttribute. + */ + protected TypeAnnotationsAttribute(int u2attributeNameIndex, + int u2annotationsCount, + TypeAnnotation[] annotations) + { + super(u2attributeNameIndex, u2annotationsCount, annotations); + } + + + /** + * Applies the given visitor to all class annotations. + */ + public void typeAnnotationsAccept(Clazz clazz, TypeAnnotationVisitor typeAnnotationVisitor) + { + TypeAnnotation[] annotations = (TypeAnnotation[])this.annotations; + + for (int index = 0; index < u2annotationsCount; index++) + { + // We don't need double dispatching here, since there is only one + // type of Annotation. + typeAnnotationVisitor.visitTypeAnnotation(clazz, annotations[index]); + } + } + + + /** + * Applies the given visitor to all field annotations. + */ + public void typeAnnotationsAccept(Clazz clazz, Field field, TypeAnnotationVisitor typeAnnotationVisitor) + { + TypeAnnotation[] annotations = (TypeAnnotation[])this.annotations; + + for (int index = 0; index < u2annotationsCount; index++) + { + // We don't need double dispatching here, since there is only one + // type of Annotation. + typeAnnotationVisitor.visitTypeAnnotation(clazz, field, annotations[index]); + } + } + + + /** + * Applies the given visitor to all method annotations. + */ + public void typeAnnotationsAccept(Clazz clazz, Method method, TypeAnnotationVisitor typeAnnotationVisitor) + { + TypeAnnotation[] annotations = (TypeAnnotation[])this.annotations; + + for (int index = 0; index < u2annotationsCount; index++) + { + // We don't need double dispatching here, since there is only one + // type of Annotation. + typeAnnotationVisitor.visitTypeAnnotation(clazz, method, annotations[index]); + } + } +} diff --git a/src/proguard/classfile/attribute/annotation/TypePathInfo.java b/src/proguard/classfile/attribute/annotation/TypePathInfo.java new file mode 100644 index 0000000..9b40f7c --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/TypePathInfo.java @@ -0,0 +1,50 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation; + +/** + * Representation of a path element in a type annotation. + * + * @author Eric Lafortune + */ +public class TypePathInfo +{ + public int u1typePathKind; + public int u1typeArgumentIndex; + + + /** + * Creates an uninitialized TypePathInfo. + */ + public TypePathInfo() + { + } + + + /** + * Creates an initialized TypePathInfo. + */ + public TypePathInfo(int u1typePathKind, int u1typeArgumentIndex) + { + this.u1typePathKind = u1typePathKind; + this.u1typeArgumentIndex = u1typeArgumentIndex; + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/CatchTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/CatchTargetInfo.java new file mode 100644 index 0000000..9421b9c --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/CatchTargetInfo.java @@ -0,0 +1,82 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.annotation.TypeAnnotation; +import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor; + +/** + * Representation of a 'catch' annotation target. + * + * @author Eric Lafortune + */ +public class CatchTargetInfo extends TargetInfo +{ + public int u2exceptionTableIndex; + + + /** + * Creates an uninitialized CatchTargetInfo. + */ + public CatchTargetInfo() + { + } + + + /** + * Creates a partially initialized CatchTargetInfo. + */ + public CatchTargetInfo(byte u1targetType) + { + super(u1targetType); + } + + + /** + * Creates an initialized CatchTargetInfo. + */ + protected CatchTargetInfo(byte u1targetType, + int u2exceptionTableIndex) + { + super(u1targetType); + + this.u2exceptionTableIndex = u2exceptionTableIndex; + } + + + // Implementations for TargetInfo. + + /** + * Lets the visitor visit, with Method and CodeAttribute null. + */ + public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitCatchTargetInfo(clazz, null, null, typeAnnotation, this); + } + + + public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitCatchTargetInfo(clazz, method, codeAttribute, typeAnnotation, this); + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/EmptyTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/EmptyTargetInfo.java new file mode 100644 index 0000000..fb0d794 --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/EmptyTargetInfo.java @@ -0,0 +1,72 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target; + +import proguard.classfile.*; +import proguard.classfile.attribute.annotation.TypeAnnotation; +import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor; + +/** + * Representation of an empty annotation target. + * + * @author Eric Lafortune + */ +public class EmptyTargetInfo extends TargetInfo +{ + /** + * Creates an uninitialized EmptyTargetInfo. + */ + public EmptyTargetInfo() + { + } + + + /** + * Creates an initialized EmptyTargetInfo. + */ + public EmptyTargetInfo(byte u1targetType) + { + super(u1targetType); + } + + + // Implementations for TargetInfo. + + /** + * Lets the visitor visit, with Field null. + */ + public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitEmptyTargetInfo(clazz, (Field)null, typeAnnotation, this); + } + + + public void accept(Clazz clazz, Field field, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitEmptyTargetInfo(clazz, field, typeAnnotation, this); + } + + + public void accept(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitEmptyTargetInfo(clazz, method, typeAnnotation, this); + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/FormalParameterTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/FormalParameterTargetInfo.java new file mode 100644 index 0000000..04bd9c5 --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/FormalParameterTargetInfo.java @@ -0,0 +1,81 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target; + +import proguard.classfile.*; +import proguard.classfile.attribute.annotation.TypeAnnotation; +import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor; + +/** + * Representation of a formal parameter annotation target. + * + * @author Eric Lafortune + */ +public class FormalParameterTargetInfo extends TargetInfo +{ + public int u1formalParameterIndex; + + + /** + * Creates an uninitialized FormalParameterTargetInfo. + */ + public FormalParameterTargetInfo() + { + } + + + /** + * Creates a partially initialized FormalParameterTargetInfo. + */ + public FormalParameterTargetInfo(byte u1targetType) + { + super(u1targetType); + } + + + /** + * Creates an initialized FormalParameterTargetInfo. + */ + public FormalParameterTargetInfo(byte u1targetType, + int u1formalParameterIndex) + { + super(u1targetType); + + this.u1formalParameterIndex = u1formalParameterIndex; + } + + + // Implementations for TargetInfo. + + /** + * Lets the visitor visit, with Method null. + */ + public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitFormalParameterTargetInfo(clazz, null, typeAnnotation, this); + } + + + public void accept(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitFormalParameterTargetInfo(clazz, method, typeAnnotation, this); + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/LocalVariableTargetElement.java b/src/proguard/classfile/attribute/annotation/target/LocalVariableTargetElement.java new file mode 100644 index 0000000..bcf41dc --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/LocalVariableTargetElement.java @@ -0,0 +1,53 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target; + +/** + * Representation of an local variable target table entry. + * + * @author Eric Lafortune + */ +public class LocalVariableTargetElement +{ + public int u2startPC; + public int u2length; + public int u2index; + + /** + * Creates an uninitialized LocalVariableTargetElement. + */ + public LocalVariableTargetElement() + { + } + + + /** + * Creates an initialized LocalVariableTargetElement. + */ + public LocalVariableTargetElement(int u2startPC, + int u2length, + int u2index) + { + this.u2startPC = u2startPC; + this.u2length = u2length; + this.u2index = u2index; + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/LocalVariableTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/LocalVariableTargetInfo.java new file mode 100644 index 0000000..dd9246c --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/LocalVariableTargetInfo.java @@ -0,0 +1,99 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.annotation.TypeAnnotation; +import proguard.classfile.attribute.annotation.target.visitor.*; + +/** + * Representation of a local variable annotation target. + * + * @author Eric Lafortune + */ +public class LocalVariableTargetInfo extends TargetInfo +{ + public int u2tableLength; + public LocalVariableTargetElement[] table; + + + /** + * Creates an uninitialized LocalVariableTargetInfo. + */ + public LocalVariableTargetInfo() + { + } + + + /** + * Creates a partially initialized LocalVariableTargetInfo. + */ + public LocalVariableTargetInfo(byte u1targetType) + { + super(u1targetType); + } + + + /** + * Creates an initialized LocalVariableTargetInfo. + */ + protected LocalVariableTargetInfo(byte u1targetType, + int u2tableLength, + LocalVariableTargetElement[] table) + { + super(u1targetType); + + this.u2tableLength = u2tableLength; + this.table = table; + } + + + /** + * Applies the given visitor to all target elements. + */ + public void targetElementsAccept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetElementVisitor localVariableTargetElementVisitor) + { + for (int index = 0; index < u2tableLength; index++) + { + // We don't need double dispatching here, since there is only one + // type of TypePathInfo. + localVariableTargetElementVisitor.visitLocalVariableTargetElement(clazz, method, codeAttribute, typeAnnotation, this, table[index]); + } + } + + + // Implementations for TargetInfo. + + /** + * Lets the visitor visit, with Method and CodeAttribute null. + */ + public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitLocalVariableTargetInfo(clazz, null, null, typeAnnotation, this); + } + + + public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitLocalVariableTargetInfo(clazz, method, codeAttribute, typeAnnotation, this); + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/OffsetTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/OffsetTargetInfo.java new file mode 100644 index 0000000..312046b --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/OffsetTargetInfo.java @@ -0,0 +1,82 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.annotation.TypeAnnotation; +import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor; + +/** + * Representation of an offset annotation target. + * + * @author Eric Lafortune + */ +public class OffsetTargetInfo extends TargetInfo +{ + public int u2offset; + + + /** + * Creates an uninitialized OffsetTargetInfo. + */ + public OffsetTargetInfo() + { + } + + + /** + * Creates a partially initialized OffsetTargetInfo. + */ + public OffsetTargetInfo(byte u1targetType) + { + super(u1targetType); + } + + + /** + * Creates an initialized OffsetTargetInfo. + */ + protected OffsetTargetInfo(byte u1targetType, + int u2offset) + { + super(u1targetType); + + this.u2offset = u2offset; + } + + + // Implementations for TargetInfo. + + /** + * Lets the visitor visit, with Method and CodeAttribute null. + */ + public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitOffsetTargetInfo(clazz, null, null, typeAnnotation, this); + } + + + public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitOffsetTargetInfo(clazz, method, codeAttribute, typeAnnotation, this); + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/SuperTypeTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/SuperTypeTargetInfo.java new file mode 100644 index 0000000..0db7ea4 --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/SuperTypeTargetInfo.java @@ -0,0 +1,72 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target; + +import proguard.classfile.Clazz; +import proguard.classfile.attribute.annotation.TypeAnnotation; +import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor; + +/** + * Representation of a super type annotation target. + * + * @author Eric Lafortune + */ +public class SuperTypeTargetInfo extends TargetInfo +{ + public int u2superTypeIndex; + + + /** + * Creates an uninitialized SuperTypeTargetInfo. + */ + public SuperTypeTargetInfo() + { + } + + + /** + * Creates a partially initialized SuperTypeTargetInfo. + */ + public SuperTypeTargetInfo(byte u1targetType) + { + super(u1targetType); + } + + + /** + * Creates an initialized SuperTypeTargetInfo. + */ + public SuperTypeTargetInfo(byte u1targetType, + int u2superTypeIndex) + { + super(u1targetType); + + this.u2superTypeIndex = u2superTypeIndex; + } + + + // Implementations for TargetInfo. + + public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitSuperTypeTargetInfo(clazz, typeAnnotation, this); + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/TargetInfo.java b/src/proguard/classfile/attribute/annotation/target/TargetInfo.java new file mode 100644 index 0000000..efee2e2 --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/TargetInfo.java @@ -0,0 +1,97 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.annotation.TypeAnnotation; +import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor; + +/** + * Representation of an annotation target. + * + * @author Eric Lafortune + */ +public abstract class TargetInfo +{ + public byte u1targetType; + + + /** + * Creates an uninitialized TargetInfo. + */ + protected TargetInfo() + { + } + + + /** + * Creates an initialized TargetInfo. + */ + protected TargetInfo(byte u1targetType) + { + this.u1targetType = u1targetType; + } + + + /** + * Returns the type of the target. + */ + public byte getTargetType() + { + return u1targetType; + } + + + // Methods to be implemented by extensions. + + /** + * Accepts the given visitor, in the context of a type annotation on a class. + */ + public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + throw new UnsupportedOperationException("Unsupported type annotation [0x"+Integer.toHexString(u1targetType)+"] on a class"); + } + + /** + * Accepts the given visitor, in the context of a type annotation on a field. + */ + public void accept(Clazz clazz, Field field, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + throw new UnsupportedOperationException("Unsupported type annotation [0x"+Integer.toHexString(u1targetType)+"] on a field"); + } + + /** + * Accepts the given visitor, in the context of a type annotation on a method. + */ + public void accept(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + throw new UnsupportedOperationException("Unsupported type annotation [0x"+Integer.toHexString(u1targetType)+"] on a method"); + } + + /** + * Accepts the given visitor, in the context of a type annotation code. + */ + public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + throw new UnsupportedOperationException("Unsupported type annotation [0x"+Integer.toHexString(u1targetType)+"] on code"); + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/ThrowsTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/ThrowsTargetInfo.java new file mode 100644 index 0000000..d5b2db7 --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/ThrowsTargetInfo.java @@ -0,0 +1,81 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target; + +import proguard.classfile.*; +import proguard.classfile.attribute.annotation.TypeAnnotation; +import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor; + +/** + * Representation of a 'throws' annotation target. + * + * @author Eric Lafortune + */ +public class ThrowsTargetInfo extends TargetInfo +{ + public int u2throwsTypeIndex; + + + /** + * Creates an uninitialized ThrowsTargetInfo. + */ + public ThrowsTargetInfo() + { + } + + + /** + * Creates a partially initialized ThrowsTargetInfo. + */ + public ThrowsTargetInfo(byte u1targetType) + { + super(u1targetType); + } + + + /** + * Creates an initialized ThrowsTargetInfo. + */ + public ThrowsTargetInfo(byte u1targetType, + int u2throwsTypeIndex) + { + super(u1targetType); + + this.u2throwsTypeIndex = u2throwsTypeIndex; + } + + + // Implementations for TargetInfo. + + /** + * Lets the visitor visit, with Method null. + */ + public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitThrowsTargetInfo(clazz, null, typeAnnotation, this); + } + + + public void accept(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitThrowsTargetInfo(clazz, method, typeAnnotation, this); + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/TypeArgumentTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/TypeArgumentTargetInfo.java new file mode 100644 index 0000000..4aef72e --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/TypeArgumentTargetInfo.java @@ -0,0 +1,85 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.annotation.TypeAnnotation; +import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor; + +/** + * Representation of an offset annotation target. + * + * @author Eric Lafortune + */ +public class TypeArgumentTargetInfo extends TargetInfo +{ + public int u2offset; + public int u1typeArgumentIndex; + + + /** + * Creates an uninitialized TypeArgumentTargetInfo. + */ + public TypeArgumentTargetInfo() + { + } + + + /** + * Creates a partially initialized TypeArgumentTargetInfo. + */ + public TypeArgumentTargetInfo(byte u1targetType) + { + super(u1targetType); + } + + + /** + * Creates an initialized TypeArgumentTargetInfo. + */ + protected TypeArgumentTargetInfo(byte u1targetType, + int u2offset, + int u1typeArgumentIndex) + { + super(u1targetType); + + this.u2offset = u2offset; + this.u1typeArgumentIndex = u1typeArgumentIndex; + } + + + // Implementations for TargetInfo. + + /** + * Lets the visitor visit, with Method and CodeAttribute null. + */ + public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitTypeArgumentTargetInfo(clazz, null, null, typeAnnotation, this); + } + + + public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitTypeArgumentTargetInfo(clazz, method, codeAttribute, typeAnnotation, this); + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/TypeParameterBoundTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/TypeParameterBoundTargetInfo.java new file mode 100644 index 0000000..0f485ee --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/TypeParameterBoundTargetInfo.java @@ -0,0 +1,87 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target; + +import proguard.classfile.*; +import proguard.classfile.attribute.annotation.TypeAnnotation; +import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor; + +/** + * Representation of a type parameter bound annotation target. + * + * @author Eric Lafortune + */ +public class TypeParameterBoundTargetInfo extends TargetInfo +{ + public int u1typeParameterIndex; + public int u1boundIndex; + + + /** + * Creates an uninitialized TypeParameterBoundTargetInfo. + */ + public TypeParameterBoundTargetInfo() + { + } + + + /** + * Creates a partially initialized TypeParameterBoundTargetInfo. + */ + public TypeParameterBoundTargetInfo(byte u1targetType) + { + super(u1targetType); + } + + + /** + * Creates an initialized TypeParameterBoundTargetInfo. + */ + public TypeParameterBoundTargetInfo(byte u1targetType, + int u1typeParameterIndex, + int u1boundIndex) + { + super(u1targetType); + + this.u1typeParameterIndex = u1typeParameterIndex; + this.u1boundIndex = u1boundIndex; + } + + + // Implementations for TargetInfo. + + public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitTypeParameterBoundTargetInfo(clazz, typeAnnotation, this); + } + + + public void accept(Clazz clazz, Field field, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitTypeParameterBoundTargetInfo(clazz, field, typeAnnotation, this); + } + + + public void accept(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitTypeParameterBoundTargetInfo(clazz, method, typeAnnotation, this); + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/TypeParameterTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/TypeParameterTargetInfo.java new file mode 100644 index 0000000..3150a26 --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/TypeParameterTargetInfo.java @@ -0,0 +1,79 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.annotation.TypeAnnotation; +import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor; + +/** + * Representation of a type parameter annotation target. + * + * @author Eric Lafortune + */ +public class TypeParameterTargetInfo extends TargetInfo +{ + public int u1typeParameterIndex; + + + /** + * Creates an uninitialized TypeParameterTargetInfo. + */ + public TypeParameterTargetInfo() + { + } + + + /** + * Creates a partially initialized TypeParameterTargetInfo. + */ + public TypeParameterTargetInfo(byte u1targetType) + { + super(u1targetType); + } + + + /** + * Creates an initialized TypeParameterTargetInfo. + */ + public TypeParameterTargetInfo(byte u1targetType, + int u1typeParameterIndex) + { + super(u1targetType); + + this.u1typeParameterIndex = u1typeParameterIndex; + } + + + // Implementations for TargetInfo. + + public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitTypeParameterTargetInfo(clazz, typeAnnotation, this); + } + + + public void accept(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor) + { + targetInfoVisitor.visitTypeParameterTargetInfo(clazz, method, typeAnnotation, this); + } +} diff --git a/src/proguard/classfile/attribute/annotation/target/visitor/LocalVariableTargetElementVisitor.java b/src/proguard/classfile/attribute/annotation/target/visitor/LocalVariableTargetElementVisitor.java new file mode 100644 index 0000000..62fe148 --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/visitor/LocalVariableTargetElementVisitor.java @@ -0,0 +1,37 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target.visitor; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.annotation.TypeAnnotation; +import proguard.classfile.attribute.annotation.target.*; + +/** + * This interface specifies the methods for a visitor of LocalVariableTargetElement + * instances. + * + * @author Eric Lafortune + */ +public interface LocalVariableTargetElementVisitor +{ + public void visitLocalVariableTargetElement(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo, LocalVariableTargetElement localVariableTargetElement); +} diff --git a/src/proguard/classfile/attribute/annotation/target/visitor/TargetInfoVisitor.java b/src/proguard/classfile/attribute/annotation/target/visitor/TargetInfoVisitor.java new file mode 100644 index 0000000..33e7d32 --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/target/visitor/TargetInfoVisitor.java @@ -0,0 +1,50 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.target.visitor; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.annotation.*; +import proguard.classfile.attribute.annotation.target.*; + +/** + * This interface specifies the methods for a visitor of <code>TargetInfo</code> + * objects. + * + * @author Eric Lafortune + */ +public interface TargetInfoVisitor +{ + public void visitTypeParameterTargetInfo( Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterTargetInfo typeParameterTargetInfo); + public void visitTypeParameterTargetInfo( Clazz clazz, Method method, TypeAnnotation typeAnnotation, TypeParameterTargetInfo typeParameterTargetInfo); + public void visitSuperTypeTargetInfo( Clazz clazz, TypeAnnotation typeAnnotation, SuperTypeTargetInfo superTypeTargetInfo); + public void visitTypeParameterBoundTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo); + public void visitTypeParameterBoundTargetInfo(Clazz clazz, Field field, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo); + public void visitTypeParameterBoundTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo); + public void visitEmptyTargetInfo( Clazz clazz, Field field, TypeAnnotation typeAnnotation, EmptyTargetInfo emptyTargetInfo); + public void visitEmptyTargetInfo( Clazz clazz, Method method, TypeAnnotation typeAnnotation, EmptyTargetInfo emptyTargetInfo); + public void visitFormalParameterTargetInfo( Clazz clazz, Method method, TypeAnnotation typeAnnotation, FormalParameterTargetInfo formalParameterTargetInfo); + public void visitThrowsTargetInfo( Clazz clazz, Method method, TypeAnnotation typeAnnotation, ThrowsTargetInfo throwsTargetInfo); + public void visitLocalVariableTargetInfo( Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo); + public void visitCatchTargetInfo( Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, CatchTargetInfo catchTargetInfo); + public void visitOffsetTargetInfo( Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, OffsetTargetInfo offsetTargetInfo); + public void visitTypeArgumentTargetInfo( Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TypeArgumentTargetInfo typeArgumentTargetInfo); +} diff --git a/src/proguard/classfile/attribute/annotation/visitor/AllAnnotationVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/AllAnnotationVisitor.java index 0aadfe3..b4513d7 100644 --- a/src/proguard/classfile/attribute/annotation/visitor/AllAnnotationVisitor.java +++ b/src/proguard/classfile/attribute/annotation/visitor/AllAnnotationVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -21,7 +21,7 @@ package proguard.classfile.attribute.annotation.visitor; import proguard.classfile.*; -import proguard.classfile.attribute.Attribute; +import proguard.classfile.attribute.*; import proguard.classfile.attribute.annotation.*; import proguard.classfile.attribute.visitor.AttributeVisitor; import proguard.classfile.util.SimplifiedVisitor; @@ -102,4 +102,60 @@ implements AttributeVisitor // Visit the annotations. parameterAnnotationsAttribute.annotationsAccept(clazz, method, annotationVisitor); } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + // Visit the annotations. + runtimeVisibleTypeAnnotationsAttribute.annotationsAccept(clazz, annotationVisitor); + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + // Visit the annotations. + runtimeVisibleTypeAnnotationsAttribute.annotationsAccept(clazz, field, annotationVisitor); + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + // Visit the annotations. + runtimeVisibleTypeAnnotationsAttribute.annotationsAccept(clazz, method, annotationVisitor); + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + // Visit the annotations. + runtimeVisibleTypeAnnotationsAttribute.annotationsAccept(clazz, method, codeAttribute, annotationVisitor); + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + // Visit the annotations. + runtimeInvisibleTypeAnnotationsAttribute.annotationsAccept(clazz, annotationVisitor); + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + // Visit the annotations. + runtimeInvisibleTypeAnnotationsAttribute.annotationsAccept(clazz, field, annotationVisitor); + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + // Visit the annotations. + runtimeInvisibleTypeAnnotationsAttribute.annotationsAccept(clazz, method, annotationVisitor); + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + // Visit the annotations. + runtimeInvisibleTypeAnnotationsAttribute.annotationsAccept(clazz, method, codeAttribute, annotationVisitor); + } } diff --git a/src/proguard/classfile/attribute/annotation/visitor/AllElementValueVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/AllElementValueVisitor.java index b728b8b..4413082 100644 --- a/src/proguard/classfile/attribute/annotation/visitor/AllElementValueVisitor.java +++ b/src/proguard/classfile/attribute/annotation/visitor/AllElementValueVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -21,11 +21,10 @@ package proguard.classfile.attribute.annotation.visitor; import proguard.classfile.*; -import proguard.classfile.attribute.Attribute; +import proguard.classfile.attribute.*; import proguard.classfile.attribute.annotation.*; import proguard.classfile.attribute.visitor.AttributeVisitor; import proguard.classfile.util.SimplifiedVisitor; -import proguard.util.*; /** * This AttributeVisitor and AnnotationVisitor lets a given ElementValueVisitor @@ -158,6 +157,12 @@ implements AttributeVisitor, } + public void visitAnnotation(Clazz clazz, Method method, CodeAttribute codeAttribute, Annotation annotation) + { + annotation.elementValuesAccept(clazz, this); + } + + // Implementations for ElementValueVisitor. public void visitConstantElementValue(Clazz clazz, Annotation annotation, ConstantElementValue constantElementValue) diff --git a/src/proguard/classfile/attribute/annotation/visitor/AnnotatedClassVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/AnnotatedClassVisitor.java index 305928e..241e9e6 100644 --- a/src/proguard/classfile/attribute/annotation/visitor/AnnotatedClassVisitor.java +++ b/src/proguard/classfile/attribute/annotation/visitor/AnnotatedClassVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/annotation/visitor/AnnotationToMemberVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/AnnotationToMemberVisitor.java index 7833f7e..6bb2454 100644 --- a/src/proguard/classfile/attribute/annotation/visitor/AnnotationToMemberVisitor.java +++ b/src/proguard/classfile/attribute/annotation/visitor/AnnotationToMemberVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/annotation/visitor/AnnotationTypeFilter.java b/src/proguard/classfile/attribute/annotation/visitor/AnnotationTypeFilter.java index d6ec3ca..ad7b316 100644 --- a/src/proguard/classfile/attribute/annotation/visitor/AnnotationTypeFilter.java +++ b/src/proguard/classfile/attribute/annotation/visitor/AnnotationTypeFilter.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -21,8 +21,8 @@ package proguard.classfile.attribute.annotation.visitor; import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; import proguard.classfile.attribute.annotation.Annotation; -import proguard.classfile.util.SimplifiedVisitor; import proguard.util.*; /** @@ -92,6 +92,15 @@ implements AnnotationVisitor } + public void visitAnnotation(Clazz clazz, Method method, CodeAttribute codeAttribute, Annotation annotation) + { + if (accepted(annotation.getType(clazz))) + { + annotationVisitor.visitAnnotation(clazz, method, codeAttribute, annotation); + } + } + + // Small utility methods. private boolean accepted(String name) diff --git a/src/proguard/classfile/attribute/annotation/visitor/AnnotationVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/AnnotationVisitor.java index 8d207af..3225c97 100644 --- a/src/proguard/classfile/attribute/annotation/visitor/AnnotationVisitor.java +++ b/src/proguard/classfile/attribute/annotation/visitor/AnnotationVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -21,6 +21,7 @@ package proguard.classfile.attribute.annotation.visitor; import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; import proguard.classfile.attribute.annotation.Annotation; /** @@ -33,8 +34,9 @@ import proguard.classfile.attribute.annotation.Annotation; */ public interface AnnotationVisitor { - public void visitAnnotation(Clazz clazz, Annotation annotation); - public void visitAnnotation(Clazz clazz, Field field, Annotation annotation); - public void visitAnnotation(Clazz clazz, Method method, Annotation annotation); - public void visitAnnotation(Clazz clazz, Method method, int parameterIndex, Annotation annotation); + public void visitAnnotation(Clazz clazz, Annotation annotation); + public void visitAnnotation(Clazz clazz, Field field, Annotation annotation); + public void visitAnnotation(Clazz clazz, Method method, Annotation annotation); + public void visitAnnotation(Clazz clazz, Method method, int parameterIndex, Annotation annotation); + public void visitAnnotation(Clazz clazz, Method method, CodeAttribute codeAttribute, Annotation annotation); } diff --git a/src/proguard/classfile/attribute/annotation/visitor/ElementValueVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/ElementValueVisitor.java index 2d3a20d..453c14b 100644 --- a/src/proguard/classfile/attribute/annotation/visitor/ElementValueVisitor.java +++ b/src/proguard/classfile/attribute/annotation/visitor/ElementValueVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/annotation/visitor/TypeAnnotationVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/TypeAnnotationVisitor.java new file mode 100644 index 0000000..3a01887 --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/visitor/TypeAnnotationVisitor.java @@ -0,0 +1,41 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.visitor; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.annotation.*; + +/** + * This interface specifies the methods for a visitor of + * TypeAnnotation instances. Note that there is only a single + * implementation of TypeAnnotation, such that this interface + * is not strictly necessary as a visitor. + * + * @author Eric Lafortune + */ +public interface TypeAnnotationVisitor +{ + public void visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation); + public void visitTypeAnnotation(Clazz clazz, Field field, TypeAnnotation typeAnnotation); + public void visitTypeAnnotation(Clazz clazz, Method method, TypeAnnotation typeAnnotation); + public void visitTypeAnnotation(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation); +} diff --git a/src/proguard/classfile/attribute/annotation/visitor/TypePathInfoVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/TypePathInfoVisitor.java new file mode 100644 index 0000000..ab7d51b --- /dev/null +++ b/src/proguard/classfile/attribute/annotation/visitor/TypePathInfoVisitor.java @@ -0,0 +1,41 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.annotation.visitor; + +import proguard.classfile.*; +import proguard.classfile.attribute.CodeAttribute; +import proguard.classfile.attribute.annotation.*; + +/** + * This interface specifies the methods for a visitor of + * TypePathInfo instances. Note that there is only a single + * implementation of TypePathInfo, such that this interface + * is not strictly necessary as a visitor. + * + * @author Eric Lafortune + */ +public interface TypePathInfoVisitor +{ + public void visitTypePathInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo); + public void visitTypePathInfo(Clazz clazz, Field field, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo); + public void visitTypePathInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo); + public void visitTypePathInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo); +} diff --git a/src/proguard/classfile/attribute/preverification/DoubleType.java b/src/proguard/classfile/attribute/preverification/DoubleType.java index 1bc3e5d..1f0478d 100644 --- a/src/proguard/classfile/attribute/preverification/DoubleType.java +++ b/src/proguard/classfile/attribute/preverification/DoubleType.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/FloatType.java b/src/proguard/classfile/attribute/preverification/FloatType.java index c58cd0a..ee0fe94 100644 --- a/src/proguard/classfile/attribute/preverification/FloatType.java +++ b/src/proguard/classfile/attribute/preverification/FloatType.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/FullFrame.java b/src/proguard/classfile/attribute/preverification/FullFrame.java index 4f0d72e..09890f2 100644 --- a/src/proguard/classfile/attribute/preverification/FullFrame.java +++ b/src/proguard/classfile/attribute/preverification/FullFrame.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/IntegerType.java b/src/proguard/classfile/attribute/preverification/IntegerType.java index 9c43cae..9d8144a 100644 --- a/src/proguard/classfile/attribute/preverification/IntegerType.java +++ b/src/proguard/classfile/attribute/preverification/IntegerType.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/LessZeroFrame.java b/src/proguard/classfile/attribute/preverification/LessZeroFrame.java index f722d73..681c9ab 100644 --- a/src/proguard/classfile/attribute/preverification/LessZeroFrame.java +++ b/src/proguard/classfile/attribute/preverification/LessZeroFrame.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/LongType.java b/src/proguard/classfile/attribute/preverification/LongType.java index c986165..dafac5a 100644 --- a/src/proguard/classfile/attribute/preverification/LongType.java +++ b/src/proguard/classfile/attribute/preverification/LongType.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/MoreZeroFrame.java b/src/proguard/classfile/attribute/preverification/MoreZeroFrame.java index be74df0..be4e08d 100644 --- a/src/proguard/classfile/attribute/preverification/MoreZeroFrame.java +++ b/src/proguard/classfile/attribute/preverification/MoreZeroFrame.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/NullType.java b/src/proguard/classfile/attribute/preverification/NullType.java index fe0d85f..00b27a7 100644 --- a/src/proguard/classfile/attribute/preverification/NullType.java +++ b/src/proguard/classfile/attribute/preverification/NullType.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/ObjectType.java b/src/proguard/classfile/attribute/preverification/ObjectType.java index 4ea370a..6b54277 100644 --- a/src/proguard/classfile/attribute/preverification/ObjectType.java +++ b/src/proguard/classfile/attribute/preverification/ObjectType.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/SameOneFrame.java b/src/proguard/classfile/attribute/preverification/SameOneFrame.java index 4384aae..63b9058 100644 --- a/src/proguard/classfile/attribute/preverification/SameOneFrame.java +++ b/src/proguard/classfile/attribute/preverification/SameOneFrame.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/SameZeroFrame.java b/src/proguard/classfile/attribute/preverification/SameZeroFrame.java index a3bd824..694ed2a 100644 --- a/src/proguard/classfile/attribute/preverification/SameZeroFrame.java +++ b/src/proguard/classfile/attribute/preverification/SameZeroFrame.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/StackMapAttribute.java b/src/proguard/classfile/attribute/preverification/StackMapAttribute.java index 51e69fb..9b7bbfd 100644 --- a/src/proguard/classfile/attribute/preverification/StackMapAttribute.java +++ b/src/proguard/classfile/attribute/preverification/StackMapAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/StackMapFrame.java b/src/proguard/classfile/attribute/preverification/StackMapFrame.java index 01890f3..9b2f43b 100644 --- a/src/proguard/classfile/attribute/preverification/StackMapFrame.java +++ b/src/proguard/classfile/attribute/preverification/StackMapFrame.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/StackMapTableAttribute.java b/src/proguard/classfile/attribute/preverification/StackMapTableAttribute.java index 3de059f..a6f9ca6 100644 --- a/src/proguard/classfile/attribute/preverification/StackMapTableAttribute.java +++ b/src/proguard/classfile/attribute/preverification/StackMapTableAttribute.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/TopType.java b/src/proguard/classfile/attribute/preverification/TopType.java index 02dd1a2..9804c53 100644 --- a/src/proguard/classfile/attribute/preverification/TopType.java +++ b/src/proguard/classfile/attribute/preverification/TopType.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/UninitializedThisType.java b/src/proguard/classfile/attribute/preverification/UninitializedThisType.java index 7b2bfa9..fcbcd7d 100644 --- a/src/proguard/classfile/attribute/preverification/UninitializedThisType.java +++ b/src/proguard/classfile/attribute/preverification/UninitializedThisType.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/UninitializedType.java b/src/proguard/classfile/attribute/preverification/UninitializedType.java index 7e4a0fd..1b9de74 100644 --- a/src/proguard/classfile/attribute/preverification/UninitializedType.java +++ b/src/proguard/classfile/attribute/preverification/UninitializedType.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/VerificationType.java b/src/proguard/classfile/attribute/preverification/VerificationType.java index 02c3872..22ad72f 100644 --- a/src/proguard/classfile/attribute/preverification/VerificationType.java +++ b/src/proguard/classfile/attribute/preverification/VerificationType.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/VerificationTypeFactory.java b/src/proguard/classfile/attribute/preverification/VerificationTypeFactory.java index ada9ce8..71d2c3e 100644 --- a/src/proguard/classfile/attribute/preverification/VerificationTypeFactory.java +++ b/src/proguard/classfile/attribute/preverification/VerificationTypeFactory.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/visitor/StackMapFrameVisitor.java b/src/proguard/classfile/attribute/preverification/visitor/StackMapFrameVisitor.java index 5e4cf88..f269f6e 100644 --- a/src/proguard/classfile/attribute/preverification/visitor/StackMapFrameVisitor.java +++ b/src/proguard/classfile/attribute/preverification/visitor/StackMapFrameVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/preverification/visitor/VerificationTypeVisitor.java b/src/proguard/classfile/attribute/preverification/visitor/VerificationTypeVisitor.java index 2a3e9e7..cf39ca2 100644 --- a/src/proguard/classfile/attribute/preverification/visitor/VerificationTypeVisitor.java +++ b/src/proguard/classfile/attribute/preverification/visitor/VerificationTypeVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/visitor/AllAttributeVisitor.java b/src/proguard/classfile/attribute/visitor/AllAttributeVisitor.java index 9d8801c..701451e 100644 --- a/src/proguard/classfile/attribute/visitor/AllAttributeVisitor.java +++ b/src/proguard/classfile/attribute/visitor/AllAttributeVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/visitor/AllBootstrapMethodInfoVisitor.java b/src/proguard/classfile/attribute/visitor/AllBootstrapMethodInfoVisitor.java index d70803c..6110325 100644 --- a/src/proguard/classfile/attribute/visitor/AllBootstrapMethodInfoVisitor.java +++ b/src/proguard/classfile/attribute/visitor/AllBootstrapMethodInfoVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -20,7 +20,7 @@ */ package proguard.classfile.attribute.visitor; -import proguard.classfile.*; +import proguard.classfile.Clazz; import proguard.classfile.attribute.*; import proguard.classfile.util.SimplifiedVisitor; diff --git a/src/proguard/classfile/attribute/visitor/AllExceptionInfoVisitor.java b/src/proguard/classfile/attribute/visitor/AllExceptionInfoVisitor.java index 927bfd9..9b6c9de 100644 --- a/src/proguard/classfile/attribute/visitor/AllExceptionInfoVisitor.java +++ b/src/proguard/classfile/attribute/visitor/AllExceptionInfoVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/visitor/AllInnerClassesInfoVisitor.java b/src/proguard/classfile/attribute/visitor/AllInnerClassesInfoVisitor.java index 2422218..b1005c8 100644 --- a/src/proguard/classfile/attribute/visitor/AllInnerClassesInfoVisitor.java +++ b/src/proguard/classfile/attribute/visitor/AllInnerClassesInfoVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -20,7 +20,7 @@ */ package proguard.classfile.attribute.visitor; -import proguard.classfile.*; +import proguard.classfile.Clazz; import proguard.classfile.attribute.*; import proguard.classfile.util.SimplifiedVisitor; diff --git a/src/proguard/classfile/attribute/visitor/AttributeNameFilter.java b/src/proguard/classfile/attribute/visitor/AttributeNameFilter.java index 0db77d5..14c1edc 100644 --- a/src/proguard/classfile/attribute/visitor/AttributeNameFilter.java +++ b/src/proguard/classfile/attribute/visitor/AttributeNameFilter.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -93,7 +93,7 @@ implements AttributeVisitor { if (accepted(clazz, unknownAttribute)) { - unknownAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitUnknownAttribute(clazz, unknownAttribute); } } @@ -102,7 +102,7 @@ implements AttributeVisitor { if (accepted(clazz, bootstrapMethodsAttribute)) { - bootstrapMethodsAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitBootstrapMethodsAttribute(clazz, bootstrapMethodsAttribute); } } @@ -111,7 +111,7 @@ implements AttributeVisitor { if (accepted(clazz, sourceFileAttribute)) { - sourceFileAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitSourceFileAttribute(clazz, sourceFileAttribute); } } @@ -120,7 +120,7 @@ implements AttributeVisitor { if (accepted(clazz, sourceDirAttribute)) { - sourceDirAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitSourceDirAttribute(clazz, sourceDirAttribute); } } @@ -129,7 +129,7 @@ implements AttributeVisitor { if (accepted(clazz, innerClassesAttribute)) { - innerClassesAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitInnerClassesAttribute(clazz, innerClassesAttribute); } } @@ -138,7 +138,7 @@ implements AttributeVisitor { if (accepted(clazz, enclosingMethodAttribute)) { - enclosingMethodAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitEnclosingMethodAttribute(clazz, enclosingMethodAttribute); } } @@ -147,7 +147,7 @@ implements AttributeVisitor { if (accepted(clazz, deprecatedAttribute)) { - deprecatedAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitDeprecatedAttribute(clazz, deprecatedAttribute); } } @@ -156,7 +156,7 @@ implements AttributeVisitor { if (accepted(clazz, deprecatedAttribute)) { - deprecatedAttribute.accept(clazz, field, attributeVisitor); + attributeVisitor.visitDeprecatedAttribute(clazz, field, deprecatedAttribute); } } @@ -165,7 +165,7 @@ implements AttributeVisitor { if (accepted(clazz, deprecatedAttribute)) { - deprecatedAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitDeprecatedAttribute(clazz, method, deprecatedAttribute); } } @@ -174,7 +174,7 @@ implements AttributeVisitor { if (accepted(clazz, syntheticAttribute)) { - syntheticAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitSyntheticAttribute(clazz, syntheticAttribute); } } @@ -183,7 +183,7 @@ implements AttributeVisitor { if (accepted(clazz, syntheticAttribute)) { - syntheticAttribute.accept(clazz, field, attributeVisitor); + attributeVisitor.visitSyntheticAttribute(clazz, field, syntheticAttribute); } } @@ -192,7 +192,7 @@ implements AttributeVisitor { if (accepted(clazz, syntheticAttribute)) { - syntheticAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitSyntheticAttribute(clazz, method, syntheticAttribute); } } @@ -201,7 +201,7 @@ implements AttributeVisitor { if (accepted(clazz, signatureAttribute)) { - signatureAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitSignatureAttribute(clazz, signatureAttribute); } } @@ -210,7 +210,7 @@ implements AttributeVisitor { if (accepted(clazz, signatureAttribute)) { - signatureAttribute.accept(clazz, field, attributeVisitor); + attributeVisitor.visitSignatureAttribute(clazz, field, signatureAttribute); } } @@ -219,7 +219,7 @@ implements AttributeVisitor { if (accepted(clazz, signatureAttribute)) { - signatureAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitSignatureAttribute(clazz, method, signatureAttribute); } } @@ -228,7 +228,16 @@ implements AttributeVisitor { if (accepted(clazz, constantValueAttribute)) { - constantValueAttribute.accept(clazz, field, attributeVisitor); + attributeVisitor.visitConstantValueAttribute(clazz, field, constantValueAttribute); + } + } + + + public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute exceptionsAttribute) + { + if (accepted(clazz, exceptionsAttribute)) + { + attributeVisitor.visitMethodParametersAttribute(clazz, method, exceptionsAttribute); } } @@ -237,7 +246,7 @@ implements AttributeVisitor { if (accepted(clazz, exceptionsAttribute)) { - exceptionsAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitExceptionsAttribute(clazz, method, exceptionsAttribute); } } @@ -246,7 +255,7 @@ implements AttributeVisitor { if (accepted(clazz, codeAttribute)) { - codeAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitCodeAttribute(clazz, method, codeAttribute); } } @@ -255,7 +264,7 @@ implements AttributeVisitor { if (accepted(clazz, stackMapAttribute)) { - stackMapAttribute.accept(clazz, method, codeAttribute, attributeVisitor); + attributeVisitor.visitStackMapAttribute(clazz, method, codeAttribute, stackMapAttribute); } } @@ -264,7 +273,7 @@ implements AttributeVisitor { if (accepted(clazz, stackMapTableAttribute)) { - stackMapTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor); + attributeVisitor.visitStackMapTableAttribute(clazz, method, codeAttribute, stackMapTableAttribute); } } @@ -273,7 +282,7 @@ implements AttributeVisitor { if (accepted(clazz, lineNumberTableAttribute)) { - lineNumberTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor); + attributeVisitor.visitLineNumberTableAttribute(clazz, method, codeAttribute, lineNumberTableAttribute); } } @@ -282,7 +291,7 @@ implements AttributeVisitor { if (accepted(clazz, localVariableTableAttribute)) { - localVariableTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor); + attributeVisitor.visitLocalVariableTableAttribute(clazz, method, codeAttribute, localVariableTableAttribute); } } @@ -291,7 +300,7 @@ implements AttributeVisitor { if (accepted(clazz, localVariableTypeTableAttribute)) { - localVariableTypeTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor); + attributeVisitor.visitLocalVariableTypeTableAttribute(clazz, method, codeAttribute, localVariableTypeTableAttribute); } } @@ -300,7 +309,7 @@ implements AttributeVisitor { if (accepted(clazz, runtimeVisibleAnnotationsAttribute)) { - runtimeVisibleAnnotationsAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, runtimeVisibleAnnotationsAttribute); } } @@ -309,7 +318,7 @@ implements AttributeVisitor { if (accepted(clazz, runtimeVisibleAnnotationsAttribute)) { - runtimeVisibleAnnotationsAttribute.accept(clazz, field, attributeVisitor); + attributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, field, runtimeVisibleAnnotationsAttribute); } } @@ -318,7 +327,7 @@ implements AttributeVisitor { if (accepted(clazz, runtimeVisibleAnnotationsAttribute)) { - runtimeVisibleAnnotationsAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, method, runtimeVisibleAnnotationsAttribute); } } @@ -327,7 +336,7 @@ implements AttributeVisitor { if (accepted(clazz, runtimeInvisibleAnnotationsAttribute)) { - runtimeInvisibleAnnotationsAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, runtimeInvisibleAnnotationsAttribute); } } @@ -336,7 +345,7 @@ implements AttributeVisitor { if (accepted(clazz, runtimeInvisibleAnnotationsAttribute)) { - runtimeInvisibleAnnotationsAttribute.accept(clazz, field, attributeVisitor); + attributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, field, runtimeInvisibleAnnotationsAttribute); } } @@ -345,7 +354,7 @@ implements AttributeVisitor { if (accepted(clazz, runtimeInvisibleAnnotationsAttribute)) { - runtimeInvisibleAnnotationsAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, method, runtimeInvisibleAnnotationsAttribute); } } @@ -354,7 +363,7 @@ implements AttributeVisitor { if (accepted(clazz, runtimeVisibleParameterAnnotationsAttribute)) { - runtimeVisibleParameterAnnotationsAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitRuntimeVisibleParameterAnnotationsAttribute(clazz, method, runtimeVisibleParameterAnnotationsAttribute); } } @@ -363,7 +372,79 @@ implements AttributeVisitor { if (accepted(clazz, runtimeInvisibleParameterAnnotationsAttribute)) { - runtimeInvisibleParameterAnnotationsAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitRuntimeInvisibleParameterAnnotationsAttribute(clazz, method, runtimeInvisibleParameterAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + if (accepted(clazz, runtimeVisibleTypeAnnotationsAttribute)) + { + attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + if (accepted(clazz, runtimeVisibleTypeAnnotationsAttribute)) + { + attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, field, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + if (accepted(clazz, runtimeVisibleTypeAnnotationsAttribute)) + { + attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + if (accepted(clazz, runtimeVisibleTypeAnnotationsAttribute)) + { + attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + if (accepted(clazz, runtimeInvisibleTypeAnnotationsAttribute)) + { + attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + if (accepted(clazz, runtimeInvisibleTypeAnnotationsAttribute)) + { + attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, field, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + if (accepted(clazz, runtimeInvisibleTypeAnnotationsAttribute)) + { + attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + if (accepted(clazz, runtimeInvisibleTypeAnnotationsAttribute)) + { + attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeInvisibleTypeAnnotationsAttribute); } } @@ -372,7 +453,7 @@ implements AttributeVisitor { if (accepted(clazz, annotationDefaultAttribute)) { - annotationDefaultAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitAnnotationDefaultAttribute(clazz, method, annotationDefaultAttribute); } } diff --git a/src/proguard/classfile/attribute/visitor/AttributeVisitor.java b/src/proguard/classfile/attribute/visitor/AttributeVisitor.java index 76c1ab9..a9fc6b6 100644 --- a/src/proguard/classfile/attribute/visitor/AttributeVisitor.java +++ b/src/proguard/classfile/attribute/visitor/AttributeVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -62,8 +62,9 @@ public interface AttributeVisitor // Attributes that are attached to methods. - public void visitExceptionsAttribute( Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute); - public void visitCodeAttribute( Clazz clazz, Method method, CodeAttribute codeAttribute); + public void visitMethodParametersAttribute( Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute); + public void visitExceptionsAttribute( Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute); + public void visitCodeAttribute( Clazz clazz, Method method, CodeAttribute codeAttribute); // Attributes that are attached to code attributes. @@ -86,5 +87,15 @@ public interface AttributeVisitor public void visitRuntimeVisibleParameterAnnotationsAttribute( Clazz clazz, Method method, RuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute); public void visitRuntimeInvisibleParameterAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleParameterAnnotationsAttribute runtimeInvisibleParameterAnnotationsAttribute); + public void visitRuntimeVisibleTypeAnnotationsAttribute( Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute); + public void visitRuntimeVisibleTypeAnnotationsAttribute( Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute); + public void visitRuntimeVisibleTypeAnnotationsAttribute( Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute); + public void visitRuntimeVisibleTypeAnnotationsAttribute( Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute); + + public void visitRuntimeInvisibleTypeAnnotationsAttribute( Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute); + public void visitRuntimeInvisibleTypeAnnotationsAttribute( Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute); + public void visitRuntimeInvisibleTypeAnnotationsAttribute( Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute); + public void visitRuntimeInvisibleTypeAnnotationsAttribute( Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute); + public void visitAnnotationDefaultAttribute( Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute); } diff --git a/src/proguard/classfile/attribute/visitor/BootstrapMethodInfoVisitor.java b/src/proguard/classfile/attribute/visitor/BootstrapMethodInfoVisitor.java index 9aab92e..fb2a9d6 100755 --- a/src/proguard/classfile/attribute/visitor/BootstrapMethodInfoVisitor.java +++ b/src/proguard/classfile/attribute/visitor/BootstrapMethodInfoVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -20,10 +20,8 @@ */ package proguard.classfile.attribute.visitor; -import proguard.classfile.*; -import proguard.classfile.attribute.*; - -import java.beans.MethodDescriptor; +import proguard.classfile.Clazz; +import proguard.classfile.attribute.BootstrapMethodInfo; /** diff --git a/src/proguard/classfile/attribute/visitor/ExceptionInfoVisitor.java b/src/proguard/classfile/attribute/visitor/ExceptionInfoVisitor.java index 4a765f2..953dc06 100644 --- a/src/proguard/classfile/attribute/visitor/ExceptionInfoVisitor.java +++ b/src/proguard/classfile/attribute/visitor/ExceptionInfoVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/visitor/InnerClassesInfoVisitor.java b/src/proguard/classfile/attribute/visitor/InnerClassesInfoVisitor.java index b373493..f9e1a03 100644 --- a/src/proguard/classfile/attribute/visitor/InnerClassesInfoVisitor.java +++ b/src/proguard/classfile/attribute/visitor/InnerClassesInfoVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/visitor/LineNumberInfoVisitor.java b/src/proguard/classfile/attribute/visitor/LineNumberInfoVisitor.java index 189b3d0..5a6400d 100644 --- a/src/proguard/classfile/attribute/visitor/LineNumberInfoVisitor.java +++ b/src/proguard/classfile/attribute/visitor/LineNumberInfoVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/visitor/LocalVariableInfoVisitor.java b/src/proguard/classfile/attribute/visitor/LocalVariableInfoVisitor.java index c888d63..dd17bea 100644 --- a/src/proguard/classfile/attribute/visitor/LocalVariableInfoVisitor.java +++ b/src/proguard/classfile/attribute/visitor/LocalVariableInfoVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/visitor/LocalVariableTypeInfoVisitor.java b/src/proguard/classfile/attribute/visitor/LocalVariableTypeInfoVisitor.java index f992e6d..c37e9d7 100644 --- a/src/proguard/classfile/attribute/visitor/LocalVariableTypeInfoVisitor.java +++ b/src/proguard/classfile/attribute/visitor/LocalVariableTypeInfoVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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/classfile/attribute/visitor/MultiAttributeVisitor.java b/src/proguard/classfile/attribute/visitor/MultiAttributeVisitor.java index 37c0639..968f852 100644 --- a/src/proguard/classfile/attribute/visitor/MultiAttributeVisitor.java +++ b/src/proguard/classfile/attribute/visitor/MultiAttributeVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -220,6 +220,15 @@ public class MultiAttributeVisitor implements AttributeVisitor } + public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute) + { + for (int index = 0; index < attributeVisitors.length; index++) + { + attributeVisitors[index].visitMethodParametersAttribute(clazz, method, methodParametersAttribute); + } + } + + public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute) { for (int index = 0; index < attributeVisitors.length; index++) @@ -355,6 +364,78 @@ public class MultiAttributeVisitor implements AttributeVisitor } + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + for (int index = 0; index < attributeVisitors.length; index++) + { + attributeVisitors[index].visitRuntimeVisibleTypeAnnotationsAttribute(clazz, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + for (int index = 0; index < attributeVisitors.length; index++) + { + attributeVisitors[index].visitRuntimeVisibleTypeAnnotationsAttribute(clazz, field, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + for (int index = 0; index < attributeVisitors.length; index++) + { + attributeVisitors[index].visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + for (int index = 0; index < attributeVisitors.length; index++) + { + attributeVisitors[index].visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + for (int index = 0; index < attributeVisitors.length; index++) + { + attributeVisitors[index].visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + for (int index = 0; index < attributeVisitors.length; index++) + { + attributeVisitors[index].visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, field, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + for (int index = 0; index < attributeVisitors.length; index++) + { + attributeVisitors[index].visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + for (int index = 0; index < attributeVisitors.length; index++) + { + attributeVisitors[index].visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + public void visitAnnotationDefaultAttribute(Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute) { for (int index = 0; index < attributeVisitors.length; index++) diff --git a/src/proguard/classfile/attribute/visitor/NonEmptyAttributeFilter.java b/src/proguard/classfile/attribute/visitor/NonEmptyAttributeFilter.java index 2ccc09c..4a54f75 100644 --- a/src/proguard/classfile/attribute/visitor/NonEmptyAttributeFilter.java +++ b/src/proguard/classfile/attribute/visitor/NonEmptyAttributeFilter.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -24,7 +24,6 @@ import proguard.classfile.*; import proguard.classfile.attribute.*; import proguard.classfile.attribute.annotation.*; import proguard.classfile.attribute.preverification.*; -import proguard.util.StringMatcher; /** * This AttributeVisitor delegates its visits another AttributeVisitor, but @@ -54,7 +53,7 @@ implements AttributeVisitor public void visitUnknownAttribute(Clazz clazz, UnknownAttribute unknownAttribute) { - unknownAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitUnknownAttribute(clazz, unknownAttribute); } @@ -62,20 +61,20 @@ implements AttributeVisitor { if (bootstrapMethodsAttribute.u2bootstrapMethodsCount > 0) { - bootstrapMethodsAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitBootstrapMethodsAttribute(clazz, bootstrapMethodsAttribute); } } public void visitSourceFileAttribute(Clazz clazz, SourceFileAttribute sourceFileAttribute) { - sourceFileAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitSourceFileAttribute(clazz, sourceFileAttribute); } public void visitSourceDirAttribute(Clazz clazz, SourceDirAttribute sourceDirAttribute) { - sourceDirAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitSourceDirAttribute(clazz, sourceDirAttribute); } @@ -83,74 +82,83 @@ implements AttributeVisitor { if (innerClassesAttribute.u2classesCount > 0) { - innerClassesAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitInnerClassesAttribute(clazz, innerClassesAttribute); } } public void visitEnclosingMethodAttribute(Clazz clazz, EnclosingMethodAttribute enclosingMethodAttribute) { - enclosingMethodAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitEnclosingMethodAttribute(clazz, enclosingMethodAttribute); } public void visitDeprecatedAttribute(Clazz clazz, DeprecatedAttribute deprecatedAttribute) { - deprecatedAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitDeprecatedAttribute(clazz, deprecatedAttribute); } public void visitDeprecatedAttribute(Clazz clazz, Field field, DeprecatedAttribute deprecatedAttribute) { - deprecatedAttribute.accept(clazz, field, attributeVisitor); + attributeVisitor.visitDeprecatedAttribute(clazz, field, deprecatedAttribute); } public void visitDeprecatedAttribute(Clazz clazz, Method method, DeprecatedAttribute deprecatedAttribute) { - deprecatedAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitDeprecatedAttribute(clazz, method, deprecatedAttribute); } public void visitSyntheticAttribute(Clazz clazz, SyntheticAttribute syntheticAttribute) { - syntheticAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitSyntheticAttribute(clazz, syntheticAttribute); } public void visitSyntheticAttribute(Clazz clazz, Field field, SyntheticAttribute syntheticAttribute) { - syntheticAttribute.accept(clazz, field, attributeVisitor); + attributeVisitor.visitSyntheticAttribute(clazz, field, syntheticAttribute); } public void visitSyntheticAttribute(Clazz clazz, Method method, SyntheticAttribute syntheticAttribute) { - syntheticAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitSyntheticAttribute(clazz, method, syntheticAttribute); } public void visitSignatureAttribute(Clazz clazz, SignatureAttribute signatureAttribute) { - signatureAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitSignatureAttribute(clazz, signatureAttribute); } public void visitSignatureAttribute(Clazz clazz, Field field, SignatureAttribute signatureAttribute) { - signatureAttribute.accept(clazz, field, attributeVisitor); + attributeVisitor.visitSignatureAttribute(clazz, field, signatureAttribute); } public void visitSignatureAttribute(Clazz clazz, Method method, SignatureAttribute signatureAttribute) { - signatureAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitSignatureAttribute(clazz, method, signatureAttribute); } public void visitConstantValueAttribute(Clazz clazz, Field field, ConstantValueAttribute constantValueAttribute) { - constantValueAttribute.accept(clazz, field, attributeVisitor); + attributeVisitor.visitConstantValueAttribute(clazz, field, constantValueAttribute); + } + + + public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute exceptionsAttribute) + { + if (exceptionsAttribute.u1parametersCount > 0) + { + attributeVisitor.visitMethodParametersAttribute(clazz, method, exceptionsAttribute); + } } @@ -158,14 +166,14 @@ implements AttributeVisitor { if (exceptionsAttribute.u2exceptionIndexTableLength > 0) { - exceptionsAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitExceptionsAttribute(clazz, method, exceptionsAttribute); } } public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute) { - codeAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitCodeAttribute(clazz, method, codeAttribute); } @@ -173,7 +181,7 @@ implements AttributeVisitor { if (stackMapAttribute.u2stackMapFramesCount > 0) { - stackMapAttribute.accept(clazz, method, codeAttribute, attributeVisitor); + attributeVisitor.visitStackMapAttribute(clazz, method, codeAttribute, stackMapAttribute); } } @@ -182,7 +190,7 @@ implements AttributeVisitor { if (stackMapTableAttribute.u2stackMapFramesCount > 0) { - stackMapTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor); + attributeVisitor.visitStackMapTableAttribute(clazz, method, codeAttribute, stackMapTableAttribute); } } @@ -191,7 +199,7 @@ implements AttributeVisitor { if (lineNumberTableAttribute.u2lineNumberTableLength > 0) { - lineNumberTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor); + attributeVisitor.visitLineNumberTableAttribute(clazz, method, codeAttribute, lineNumberTableAttribute); } } @@ -200,7 +208,7 @@ implements AttributeVisitor { if (localVariableTableAttribute.u2localVariableTableLength > 0) { - localVariableTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor); + attributeVisitor.visitLocalVariableTableAttribute(clazz, method, codeAttribute, localVariableTableAttribute); } } @@ -209,7 +217,7 @@ implements AttributeVisitor { if (localVariableTypeTableAttribute.u2localVariableTypeTableLength > 0) { - localVariableTypeTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor); + attributeVisitor.visitLocalVariableTypeTableAttribute(clazz, method, codeAttribute, localVariableTypeTableAttribute); } } @@ -218,7 +226,7 @@ implements AttributeVisitor { if (runtimeVisibleAnnotationsAttribute.u2annotationsCount > 0) { - runtimeVisibleAnnotationsAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, runtimeVisibleAnnotationsAttribute); } } @@ -227,7 +235,7 @@ implements AttributeVisitor { if (runtimeVisibleAnnotationsAttribute.u2annotationsCount > 0) { - runtimeVisibleAnnotationsAttribute.accept(clazz, field, attributeVisitor); + attributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, field, runtimeVisibleAnnotationsAttribute); } } @@ -236,7 +244,7 @@ implements AttributeVisitor { if (runtimeVisibleAnnotationsAttribute.u2annotationsCount > 0) { - runtimeVisibleAnnotationsAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, method, runtimeVisibleAnnotationsAttribute); } } @@ -245,7 +253,7 @@ implements AttributeVisitor { if (runtimeInvisibleAnnotationsAttribute.u2annotationsCount > 0) { - runtimeInvisibleAnnotationsAttribute.accept(clazz, attributeVisitor); + attributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, runtimeInvisibleAnnotationsAttribute); } } @@ -254,7 +262,7 @@ implements AttributeVisitor { if (runtimeInvisibleAnnotationsAttribute.u2annotationsCount > 0) { - runtimeInvisibleAnnotationsAttribute.accept(clazz, field, attributeVisitor); + attributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, field, runtimeInvisibleAnnotationsAttribute); } } @@ -263,31 +271,103 @@ implements AttributeVisitor { if (runtimeInvisibleAnnotationsAttribute.u2annotationsCount > 0) { - runtimeInvisibleAnnotationsAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, method, runtimeInvisibleAnnotationsAttribute); } } public void visitRuntimeVisibleParameterAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute) { - if (runtimeVisibleParameterAnnotationsAttribute.u2parametersCount > 0) + if (runtimeVisibleParameterAnnotationsAttribute.u1parametersCount > 0) { - runtimeVisibleParameterAnnotationsAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitRuntimeVisibleParameterAnnotationsAttribute(clazz, method, runtimeVisibleParameterAnnotationsAttribute); } } public void visitRuntimeInvisibleParameterAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleParameterAnnotationsAttribute runtimeInvisibleParameterAnnotationsAttribute) { - if (runtimeInvisibleParameterAnnotationsAttribute.u2parametersCount > 0) + if (runtimeInvisibleParameterAnnotationsAttribute.u1parametersCount > 0) + { + attributeVisitor.visitRuntimeInvisibleParameterAnnotationsAttribute(clazz, method, runtimeInvisibleParameterAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + if (runtimeVisibleTypeAnnotationsAttribute.u2annotationsCount > 0) + { + attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + if (runtimeVisibleTypeAnnotationsAttribute.u2annotationsCount > 0) + { + attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, field, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + if (runtimeVisibleTypeAnnotationsAttribute.u2annotationsCount > 0) + { + attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + if (runtimeVisibleTypeAnnotationsAttribute.u2annotationsCount > 0) + { + attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + if (runtimeInvisibleTypeAnnotationsAttribute.u2annotationsCount > 0) + { + attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + if (runtimeInvisibleTypeAnnotationsAttribute.u2annotationsCount > 0) + { + attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, field, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + if (runtimeInvisibleTypeAnnotationsAttribute.u2annotationsCount > 0) + { + attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + if (runtimeInvisibleTypeAnnotationsAttribute.u2annotationsCount > 0) { - runtimeInvisibleParameterAnnotationsAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeInvisibleTypeAnnotationsAttribute); } } public void visitAnnotationDefaultAttribute(Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute) { - annotationDefaultAttribute.accept(clazz, method, attributeVisitor); + attributeVisitor.visitAnnotationDefaultAttribute(clazz, method, annotationDefaultAttribute); } } diff --git a/src/proguard/classfile/attribute/visitor/ParameterInfoVisitor.java b/src/proguard/classfile/attribute/visitor/ParameterInfoVisitor.java new file mode 100644 index 0000000..9f91c5b --- /dev/null +++ b/src/proguard/classfile/attribute/visitor/ParameterInfoVisitor.java @@ -0,0 +1,37 @@ +/* + * ProGuard -- shrinking, optimization, obfuscation, and preverification + * of Java bytecode. + * + * Copyright (c) 2002-2014 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package proguard.classfile.attribute.visitor; + +import proguard.classfile.*; +import proguard.classfile.attribute.ParameterInfo; + +/** + * This interface specifies the method for a visitor of + * <code>ParameterInfo</code> objects. Note that there is only a single + * implementation of <code>ParameterInfo</code>, such that this interface + * is not strictly necessary as a visitor. + * + * @author Eric Lafortune + */ +public interface ParameterInfoVisitor +{ + public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo); +} diff --git a/src/proguard/classfile/attribute/visitor/RequiredAttributeFilter.java b/src/proguard/classfile/attribute/visitor/RequiredAttributeFilter.java index 58e4e40..176846d 100644 --- a/src/proguard/classfile/attribute/visitor/RequiredAttributeFilter.java +++ b/src/proguard/classfile/attribute/visitor/RequiredAttributeFilter.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -77,7 +77,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - unknownAttribute.accept(clazz, optionalAttributeVisitor); + optionalAttributeVisitor.visitUnknownAttribute(clazz, unknownAttribute); } } @@ -86,7 +86,7 @@ implements AttributeVisitor { if (requiredAttributeVisitor != null) { - bootstrapMethodsAttribute.accept(clazz, requiredAttributeVisitor); + requiredAttributeVisitor.visitBootstrapMethodsAttribute(clazz, bootstrapMethodsAttribute); } } @@ -95,7 +95,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - sourceFileAttribute.accept(clazz, optionalAttributeVisitor); + optionalAttributeVisitor.visitSourceFileAttribute(clazz, sourceFileAttribute); } } @@ -104,7 +104,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - sourceDirAttribute.accept(clazz, optionalAttributeVisitor); + optionalAttributeVisitor.visitSourceDirAttribute(clazz, sourceDirAttribute); } } @@ -113,7 +113,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - innerClassesAttribute.accept(clazz, optionalAttributeVisitor); + optionalAttributeVisitor.visitInnerClassesAttribute(clazz, innerClassesAttribute); } } @@ -122,7 +122,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - enclosingMethodAttribute.accept(clazz, optionalAttributeVisitor); + optionalAttributeVisitor.visitEnclosingMethodAttribute(clazz, enclosingMethodAttribute); } } @@ -131,7 +131,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - deprecatedAttribute.accept(clazz, optionalAttributeVisitor); + optionalAttributeVisitor.visitDeprecatedAttribute(clazz, deprecatedAttribute); } } @@ -140,7 +140,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - deprecatedAttribute.accept(clazz, field, optionalAttributeVisitor); + optionalAttributeVisitor.visitDeprecatedAttribute(clazz, field, deprecatedAttribute); } } @@ -149,7 +149,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - deprecatedAttribute.accept(clazz, method, optionalAttributeVisitor); + optionalAttributeVisitor.visitDeprecatedAttribute(clazz, method, deprecatedAttribute); } } @@ -158,7 +158,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - syntheticAttribute.accept(clazz, optionalAttributeVisitor); + optionalAttributeVisitor.visitSyntheticAttribute(clazz, syntheticAttribute); } } @@ -167,7 +167,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - syntheticAttribute.accept(clazz, field, optionalAttributeVisitor); + optionalAttributeVisitor.visitSyntheticAttribute(clazz, field, syntheticAttribute); } } @@ -176,7 +176,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - syntheticAttribute.accept(clazz, method, optionalAttributeVisitor); + optionalAttributeVisitor.visitSyntheticAttribute(clazz, method, syntheticAttribute); } } @@ -185,7 +185,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - signatureAttribute.accept(clazz, optionalAttributeVisitor); + optionalAttributeVisitor.visitSignatureAttribute(clazz, signatureAttribute); } } @@ -194,7 +194,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - signatureAttribute.accept(clazz, field, optionalAttributeVisitor); + optionalAttributeVisitor.visitSignatureAttribute(clazz, field, signatureAttribute); } } @@ -203,7 +203,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - signatureAttribute.accept(clazz, method, optionalAttributeVisitor); + optionalAttributeVisitor.visitSignatureAttribute(clazz, method, signatureAttribute); } } @@ -212,7 +212,16 @@ implements AttributeVisitor { if (requiredAttributeVisitor != null) { - constantValueAttribute.accept(clazz, field, requiredAttributeVisitor); + requiredAttributeVisitor.visitConstantValueAttribute(clazz, field, constantValueAttribute); + } + } + + + public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute exceptionsAttribute) + { + if (optionalAttributeVisitor != null) + { + optionalAttributeVisitor.visitMethodParametersAttribute(clazz, method, exceptionsAttribute); } } @@ -221,7 +230,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - exceptionsAttribute.accept(clazz, method, optionalAttributeVisitor); + optionalAttributeVisitor.visitExceptionsAttribute(clazz, method, exceptionsAttribute); } } @@ -230,7 +239,7 @@ implements AttributeVisitor { if (requiredAttributeVisitor != null) { - codeAttribute.accept(clazz, method, requiredAttributeVisitor); + requiredAttributeVisitor.visitCodeAttribute(clazz, method, codeAttribute); } } @@ -239,7 +248,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - stackMapAttribute.accept(clazz, method, codeAttribute, optionalAttributeVisitor); + optionalAttributeVisitor.visitStackMapAttribute(clazz, method, codeAttribute, stackMapAttribute); } } @@ -248,7 +257,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - stackMapTableAttribute.accept(clazz, method, codeAttribute, optionalAttributeVisitor); + optionalAttributeVisitor.visitStackMapTableAttribute(clazz, method, codeAttribute, stackMapTableAttribute); } } @@ -257,7 +266,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - lineNumberTableAttribute.accept(clazz, method, codeAttribute, optionalAttributeVisitor); + optionalAttributeVisitor.visitLineNumberTableAttribute(clazz, method, codeAttribute, lineNumberTableAttribute); } } @@ -266,7 +275,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - localVariableTableAttribute.accept(clazz, method, codeAttribute, optionalAttributeVisitor); + optionalAttributeVisitor.visitLocalVariableTableAttribute(clazz, method, codeAttribute, localVariableTableAttribute); } } @@ -275,7 +284,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - localVariableTypeTableAttribute.accept(clazz, method, codeAttribute, optionalAttributeVisitor); + optionalAttributeVisitor.visitLocalVariableTypeTableAttribute(clazz, method, codeAttribute, localVariableTypeTableAttribute); } } @@ -284,7 +293,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - runtimeVisibleAnnotationsAttribute.accept(clazz, optionalAttributeVisitor); + optionalAttributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, runtimeVisibleAnnotationsAttribute); } } @@ -293,7 +302,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - runtimeVisibleAnnotationsAttribute.accept(clazz, field, optionalAttributeVisitor); + optionalAttributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, field, runtimeVisibleAnnotationsAttribute); } } @@ -302,7 +311,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - runtimeVisibleAnnotationsAttribute.accept(clazz, method, optionalAttributeVisitor); + optionalAttributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, method, runtimeVisibleAnnotationsAttribute); } } @@ -311,7 +320,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - runtimeInvisibleAnnotationsAttribute.accept(clazz, optionalAttributeVisitor); + optionalAttributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, runtimeInvisibleAnnotationsAttribute); } } @@ -320,7 +329,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - runtimeInvisibleAnnotationsAttribute.accept(clazz, field, optionalAttributeVisitor); + optionalAttributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, field, runtimeInvisibleAnnotationsAttribute); } } @@ -329,7 +338,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - runtimeInvisibleAnnotationsAttribute.accept(clazz, method, optionalAttributeVisitor); + optionalAttributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, method, runtimeInvisibleAnnotationsAttribute); } } @@ -338,7 +347,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - runtimeVisibleParameterAnnotationsAttribute.accept(clazz, method, optionalAttributeVisitor); + optionalAttributeVisitor.visitRuntimeVisibleParameterAnnotationsAttribute(clazz, method, runtimeVisibleParameterAnnotationsAttribute); } } @@ -347,7 +356,79 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - runtimeInvisibleParameterAnnotationsAttribute.accept(clazz, method, optionalAttributeVisitor); + optionalAttributeVisitor.visitRuntimeInvisibleParameterAnnotationsAttribute(clazz, method, runtimeInvisibleParameterAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + if (optionalAttributeVisitor != null) + { + optionalAttributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + if (optionalAttributeVisitor != null) + { + optionalAttributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, field, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + if (optionalAttributeVisitor != null) + { + optionalAttributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute) + { + if (optionalAttributeVisitor != null) + { + optionalAttributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeVisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + if (optionalAttributeVisitor != null) + { + optionalAttributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + if (optionalAttributeVisitor != null) + { + optionalAttributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, field, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + if (optionalAttributeVisitor != null) + { + optionalAttributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, runtimeInvisibleTypeAnnotationsAttribute); + } + } + + + public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute) + { + if (optionalAttributeVisitor != null) + { + optionalAttributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeInvisibleTypeAnnotationsAttribute); } } @@ -356,7 +437,7 @@ implements AttributeVisitor { if (optionalAttributeVisitor != null) { - annotationDefaultAttribute.accept(clazz, method, optionalAttributeVisitor); + optionalAttributeVisitor.visitAnnotationDefaultAttribute(clazz, method, annotationDefaultAttribute); } } } diff --git a/src/proguard/classfile/attribute/visitor/StackSizeComputer.java b/src/proguard/classfile/attribute/visitor/StackSizeComputer.java index b5e02e2..d5cd99d 100644 --- a/src/proguard/classfile/attribute/visitor/StackSizeComputer.java +++ b/src/proguard/classfile/attribute/visitor/StackSizeComputer.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -21,11 +21,11 @@ package proguard.classfile.attribute.visitor; import proguard.classfile.*; -import proguard.classfile.visitor.ClassPrinter; import proguard.classfile.attribute.*; import proguard.classfile.instruction.*; import proguard.classfile.instruction.visitor.InstructionVisitor; import proguard.classfile.util.SimplifiedVisitor; +import proguard.classfile.visitor.ClassPrinter; import java.util.Arrays; |