diff options
Diffstat (limited to 'src/proguard/classfile/constant')
22 files changed, 21 insertions, 635 deletions
diff --git a/src/proguard/classfile/constant/ClassConstant.java b/src/proguard/classfile/constant/ClassConstant.java index b9089d2..d217bf6 100644 --- a/src/proguard/classfile/constant/ClassConstant.java +++ b/src/proguard/classfile/constant/ClassConstant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/Constant.java b/src/proguard/classfile/constant/Constant.java index ec25a67..30ce5df 100644 --- a/src/proguard/classfile/constant/Constant.java +++ b/src/proguard/classfile/constant/Constant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/DoubleConstant.java b/src/proguard/classfile/constant/DoubleConstant.java index 08827c2..61779b5 100644 --- a/src/proguard/classfile/constant/DoubleConstant.java +++ b/src/proguard/classfile/constant/DoubleConstant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/FieldrefConstant.java b/src/proguard/classfile/constant/FieldrefConstant.java index ddd6fb1..d4afce5 100644 --- a/src/proguard/classfile/constant/FieldrefConstant.java +++ b/src/proguard/classfile/constant/FieldrefConstant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/FloatConstant.java b/src/proguard/classfile/constant/FloatConstant.java index e98aec2..578f567 100644 --- a/src/proguard/classfile/constant/FloatConstant.java +++ b/src/proguard/classfile/constant/FloatConstant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/IntegerConstant.java b/src/proguard/classfile/constant/IntegerConstant.java index bd6afa0..8a476c6 100644 --- a/src/proguard/classfile/constant/IntegerConstant.java +++ b/src/proguard/classfile/constant/IntegerConstant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/InterfaceMethodrefConstant.java b/src/proguard/classfile/constant/InterfaceMethodrefConstant.java index 80fe817..ddee42f 100644 --- a/src/proguard/classfile/constant/InterfaceMethodrefConstant.java +++ b/src/proguard/classfile/constant/InterfaceMethodrefConstant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/InvokeDynamicConstant.java b/src/proguard/classfile/constant/InvokeDynamicConstant.java deleted file mode 100755 index bbff88d..0000000 --- a/src/proguard/classfile/constant/InvokeDynamicConstant.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * 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.constant; - -import proguard.classfile.*; -import proguard.classfile.constant.visitor.*; -import proguard.classfile.visitor.*; - -/** - * This Constant represents an invoke dynamic constant in the constant pool. - * - * @author Eric Lafortune - */ -public class InvokeDynamicConstant extends Constant -{ - public int u2bootstrapMethodAttributeIndex; - public int u2nameAndTypeIndex; - - /** - * An extra field pointing to the Clazz objects referenced in the - * descriptor string. This field is filled out by the <code>{@link - * proguard.classfile.util.ClassReferenceInitializer ClassReferenceInitializer}</code>. - * References to primitive types are ignored. - */ - public Clazz[] referencedClasses; - - - /** - * Creates an uninitialized InvokeDynamicConstant. - */ - public InvokeDynamicConstant() - { - } - - - /** - * Creates a new InvokeDynamicConstant with the given bootstrap method - * and name-and-type indices. - * @param u2bootstrapMethodAttributeIndex the index of the bootstrap method - * entry in the bootstrap methods - * attribute. - * @param u2nameAndTypeIndex the index of the name and type - * entry in the constant pool. - * @param referencedClasses the classes referenced by the - * type. - */ - public InvokeDynamicConstant(int u2bootstrapMethodAttributeIndex, - int u2nameAndTypeIndex, - Clazz[] referencedClasses) - { - this.u2bootstrapMethodAttributeIndex = u2bootstrapMethodAttributeIndex; - this.u2nameAndTypeIndex = u2nameAndTypeIndex; - this.referencedClasses = referencedClasses; - } - - - /** - * Returns the index of the bootstrap method in the bootstrap methods - * attribute of the class. - */ - public int getBootstrapMethodAttributeIndex() - { - return u2bootstrapMethodAttributeIndex; - } - - /** - * Returns the name-and-type index. - */ - public int getNameAndTypeIndex() - { - return u2nameAndTypeIndex; - } - - /** - * Returns the method name. - */ - public String getName(Clazz clazz) - { - return clazz.getName(u2nameAndTypeIndex); - } - - /** - * Returns the method type. - */ - public String getType(Clazz clazz) - { - return clazz.getType(u2nameAndTypeIndex); - } - - - /** - * Lets the Clazz objects referenced in the descriptor string - * accept the given visitor. - */ - public void referencedClassesAccept(ClassVisitor classVisitor) - { - if (referencedClasses != null) - { - for (int index = 0; index < referencedClasses.length; index++) - { - if (referencedClasses[index] != null) - { - referencedClasses[index].accept(classVisitor); - } - } - } - } - - - /** - * Lets the bootstrap method handle constant accept the given visitor. - */ - public void bootstrapMethodHandleAccept(Clazz clazz, ConstantVisitor constantVisitor) - { - new BootstrapMethodHandleTraveler(constantVisitor).visitInvokeDynamicConstant(clazz, this); - } - - - // Implementations for Constant. - - public int getTag() - { - return ClassConstants.CONSTANT_InvokeDynamic; - } - - public void accept(Clazz clazz, ConstantVisitor constantVisitor) - { - constantVisitor.visitInvokeDynamicConstant(clazz, this); - } -} diff --git a/src/proguard/classfile/constant/LongConstant.java b/src/proguard/classfile/constant/LongConstant.java index 2d55e6a..ea66e07 100644 --- a/src/proguard/classfile/constant/LongConstant.java +++ b/src/proguard/classfile/constant/LongConstant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/MethodHandleConstant.java b/src/proguard/classfile/constant/MethodHandleConstant.java deleted file mode 100755 index c2e068e..0000000 --- a/src/proguard/classfile/constant/MethodHandleConstant.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * 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.constant; - -import proguard.classfile.*; -import proguard.classfile.constant.visitor.ConstantVisitor; - -/** - * This Constant represents a method handle constant in the constant pool. - * - * @author Eric Lafortune - */ -public class MethodHandleConstant extends Constant -{ - public int u1referenceKind; - public int u2referenceIndex; - - - /** - * An extra field pointing to the java.lang.invoke.MethodHandle Clazz object. - * This field is typically filled out by the <code>{@link - * proguard.classfile.util.ClassReferenceInitializer - * ClassReferenceInitializer}</code>.. - */ - public Clazz javaLangInvokeMethodHandleClass; - - - /** - * Creates an uninitialized MethodHandleConstant. - */ - public MethodHandleConstant() - { - } - - - /** - * Creates a new MethodHandleConstant with the given type and method ref - * index. - * @param u1referenceKind the reference kind. - * @param u2referenceIndex the index of the field ref constant, interface - * method ref constant, or method ref constant in - * the constant pool. - */ - public MethodHandleConstant(int u1referenceKind, int u2referenceIndex) - { - this.u1referenceKind = u1referenceKind; - this.u2referenceIndex = u2referenceIndex; - } - - - /** - * Returns the kind of reference to which this constant is pointing. - * @return One of - * {@link ClassConstants#REF_getField }, - * {@link ClassConstants#REF_getStatic }, - * {@link ClassConstants#REF_putField }, - * {@link ClassConstants#REF_putStatic }, - * {@link ClassConstants#REF_invokeVirtual }, - * {@link ClassConstants#REF_invokeStatic }, - * {@link ClassConstants#REF_invokeSpecial }, - * {@link ClassConstants#REF_newInvokeSpecial}, or - * {@link ClassConstants#REF_invokeInterface }. - */ - public int getReferenceKind() - { - return u1referenceKind; - } - - /** - * Returns the field ref, interface method ref, or method ref index. - */ - public int getReferenceIndex() - { - return u2referenceIndex; - } - - - /** - * Returns the method/field name. - */ - public String getName(Clazz clazz) - { - return clazz.getRefName(u2referenceIndex); - } - - /** - * Returns the type. - */ - public String getType(Clazz clazz) - { - return clazz.getRefType(u2referenceIndex); - } - - - // Implementations for Constant. - - public int getTag() - { - return ClassConstants.CONSTANT_MethodHandle; - } - - public void accept(Clazz clazz, ConstantVisitor constantVisitor) - { - constantVisitor.visitMethodHandleConstant(clazz, this); - } -} diff --git a/src/proguard/classfile/constant/MethodTypeConstant.java b/src/proguard/classfile/constant/MethodTypeConstant.java deleted file mode 100644 index 29f79d7..0000000 --- a/src/proguard/classfile/constant/MethodTypeConstant.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * 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.constant; - -import proguard.classfile.*; -import proguard.classfile.constant.visitor.ConstantVisitor; - -/** - * This Constant represents a method handle constant in the constant pool. - * - * @author Eric Lafortune - */ -public class MethodTypeConstant extends Constant -{ - public int u2descriptorIndex; - - - /** - * An extra field pointing to the java.lang.invoke.MethodType Clazz object. - * This field is typically filled out by the <code>{@link - * proguard.classfile.util.ClassReferenceInitializer - * ClassReferenceInitializer}</code>.. - */ - public Clazz javaLangInvokeMethodTypeClass; - - - /** - * Creates an uninitialized MethodTypeConstant. - */ - public MethodTypeConstant() - { - } - - - /** - * Creates a new MethodTypeConstant with the given descriptor index. - * @param u2descriptorIndex the index of the descriptor in the constant - * pool. - */ - public MethodTypeConstant(int u2descriptorIndex) - { - this.u2descriptorIndex = u2descriptorIndex; - } - - - /** - * Returns the descriptor index. - */ - public int getDescriptorIndex() - { - return u2descriptorIndex; - } - - - /** - * Returns the type. - */ - public String getType(Clazz clazz) - { - return clazz.getString(u2descriptorIndex); - } - - - // Implementations for Constant. - - public int getTag() - { - return ClassConstants.CONSTANT_MethodType; - } - - public void accept(Clazz clazz, ConstantVisitor constantVisitor) - { - constantVisitor.visitMethodTypeConstant(clazz, this); - } -} diff --git a/src/proguard/classfile/constant/MethodrefConstant.java b/src/proguard/classfile/constant/MethodrefConstant.java index a69c04e..858eec9 100644 --- a/src/proguard/classfile/constant/MethodrefConstant.java +++ b/src/proguard/classfile/constant/MethodrefConstant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/NameAndTypeConstant.java b/src/proguard/classfile/constant/NameAndTypeConstant.java index f8f814a..e83d2f1 100644 --- a/src/proguard/classfile/constant/NameAndTypeConstant.java +++ b/src/proguard/classfile/constant/NameAndTypeConstant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/RefConstant.java b/src/proguard/classfile/constant/RefConstant.java index c0531f6..4e4d019 100644 --- a/src/proguard/classfile/constant/RefConstant.java +++ b/src/proguard/classfile/constant/RefConstant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/StringConstant.java b/src/proguard/classfile/constant/StringConstant.java index 923c6dd..9a8d453 100644 --- a/src/proguard/classfile/constant/StringConstant.java +++ b/src/proguard/classfile/constant/StringConstant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/Utf8Constant.java b/src/proguard/classfile/constant/Utf8Constant.java index 27ef218..ae419c9 100644 --- a/src/proguard/classfile/constant/Utf8Constant.java +++ b/src/proguard/classfile/constant/Utf8Constant.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/visitor/AllConstantVisitor.java b/src/proguard/classfile/constant/visitor/AllConstantVisitor.java index 2b89657..d2d3c2c 100644 --- a/src/proguard/classfile/constant/visitor/AllConstantVisitor.java +++ b/src/proguard/classfile/constant/visitor/AllConstantVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/proguard/classfile/constant/visitor/BootstrapMethodHandleTraveler.java b/src/proguard/classfile/constant/visitor/BootstrapMethodHandleTraveler.java deleted file mode 100644 index 6b02b73..0000000 --- a/src/proguard/classfile/constant/visitor/BootstrapMethodHandleTraveler.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * 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.constant.visitor; - -import proguard.classfile.*; -import proguard.classfile.attribute.*; -import proguard.classfile.attribute.visitor.*; -import proguard.classfile.constant.*; -import proguard.classfile.instruction.*; -import proguard.classfile.instruction.visitor.InstructionVisitor; -import proguard.classfile.util.SimplifiedVisitor; -import proguard.classfile.visitor.*; -import proguard.optimize.info.MethodOptimizationInfo; - -/** - * This ConstantVisitor and BootstrapMethodInfoVisitor travels from any invoke - * dynamic constants or bootstrap method info entries that it visits to their - * bootstrap method handle constants, and applies a given constant visitor. - * - * @author Eric Lafortune - */ -public class BootstrapMethodHandleTraveler -extends SimplifiedVisitor -implements ConstantVisitor, - AttributeVisitor, - BootstrapMethodInfoVisitor -{ - private ConstantVisitor bootstrapMethodHandleVisitor; - - // Field serving as a method argument. - int bootstrapMethodAttributeIndex; - - - /** - * Creates a new BootstrapMethodHandleVisitor that will delegate to the - * given constant visitor. - */ - public BootstrapMethodHandleTraveler(ConstantVisitor bootstrapMethodHandleVisitor) - { - this.bootstrapMethodHandleVisitor = bootstrapMethodHandleVisitor; - } - - - // Implementations for ConstantVisitor. - - public void visitAnyConstant(Clazz clazz, Constant constant) {} - - - public void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant) - { - // Pass the method index. - bootstrapMethodAttributeIndex = - invokeDynamicConstant.u2bootstrapMethodAttributeIndex; - - // Delegate to the bootstrap method. - clazz.attributesAccept(this); - } - - - // Implementations for AttributeVisitor. - - public void visitAnyAttribute(Clazz clazz, Attribute attribute) {} - - - public void visitBootstrapMethodsAttribute(Clazz clazz, BootstrapMethodsAttribute bootstrapMethodsAttribute) - { - // Check bootstrap methods. - bootstrapMethodsAttribute.bootstrapMethodEntryAccept(clazz, - bootstrapMethodAttributeIndex, - this); - } - - - // Implementations for BootstrapMethodInfoVisitor. - - public void visitBootstrapMethodInfo(Clazz clazz, BootstrapMethodInfo bootstrapMethodInfo) - { - // Check bootstrap method. - clazz.constantPoolEntryAccept(bootstrapMethodInfo.u2methodHandleIndex, - bootstrapMethodHandleVisitor); - } -} diff --git a/src/proguard/classfile/constant/visitor/ConstantTagFilter.java b/src/proguard/classfile/constant/visitor/ConstantTagFilter.java deleted file mode 100644 index bfa7149..0000000 --- a/src/proguard/classfile/constant/visitor/ConstantTagFilter.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * 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.constant.visitor; - -import proguard.classfile.Clazz; -import proguard.classfile.constant.*; -import proguard.classfile.util.SimplifiedVisitor; - -/** - * This <code>ConstantVisitor</code> delegates its visits to one or more - * specified types of constants. - * - * @author Eric Lafortune - */ -public class ConstantTagFilter -extends SimplifiedVisitor -implements ConstantVisitor -{ - private final int constantTagMask; - private final ConstantVisitor constantVisitor; - - - /** - * Creates a new ConstantTagFilter. - * @param constantTag the type of constants for which visits will be - * delegated. - * @param constantVisitor the <code>ConstantVisitor</code> to which visits - * will be delegated. - */ - public ConstantTagFilter(int constantTag, - ConstantVisitor constantVisitor) - { - this.constantTagMask = 1 << constantTag; - this.constantVisitor = constantVisitor; - } - - - /** - * Creates a new ConstantTagFilter. - * @param constantTags the types of constants for which visits will be - * delegated. - * @param constantVisitor the <code>ConstantVisitor</code> to which visits - * will be delegated. - */ - public ConstantTagFilter(int[] constantTags, - ConstantVisitor constantVisitor) - { - int constantTagMask = 0; - for (int index = 0; index < constantTags.length; index++) - { - constantTagMask |= 1 << constantTags[index]; - } - - this.constantTagMask = constantTagMask; - this.constantVisitor = constantVisitor; - } - - - // Implementations for ConstantVisitor. - - public void visitAnyConstant(Clazz clazz, Constant constant) - { - if (((1 << constant.getTag()) & constantTagMask) != 0) - { - constant.accept(clazz, constantVisitor); - } - } -}
\ No newline at end of file diff --git a/src/proguard/classfile/constant/visitor/ConstantVisitor.java b/src/proguard/classfile/constant/visitor/ConstantVisitor.java index 2cec804..6cae352 100644 --- a/src/proguard/classfile/constant/visitor/ConstantVisitor.java +++ b/src/proguard/classfile/constant/visitor/ConstantVisitor.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -38,12 +38,9 @@ public interface ConstantVisitor public void visitDoubleConstant( Clazz clazz, DoubleConstant doubleConstant); public void visitStringConstant( Clazz clazz, StringConstant stringConstant); public void visitUtf8Constant( Clazz clazz, Utf8Constant utf8Constant); - public void visitInvokeDynamicConstant( Clazz clazz, InvokeDynamicConstant invokeDynamicConstant); - public void visitMethodHandleConstant( Clazz clazz, MethodHandleConstant methodHandleConstant); public void visitFieldrefConstant( Clazz clazz, FieldrefConstant fieldrefConstant); public void visitInterfaceMethodrefConstant(Clazz clazz, InterfaceMethodrefConstant interfaceMethodrefConstant); public void visitMethodrefConstant( Clazz clazz, MethodrefConstant methodrefConstant); public void visitClassConstant( Clazz clazz, ClassConstant classConstant); - public void visitMethodTypeConstant( Clazz clazz, MethodTypeConstant methodTypeConstant); public void visitNameAndTypeConstant( Clazz clazz, NameAndTypeConstant nameAndTypeConstant); } diff --git a/src/proguard/classfile/constant/visitor/ExceptClassConstantFilter.java b/src/proguard/classfile/constant/visitor/ExceptClassConstantFilter.java index 0477631..fbb3e52 100644 --- a/src/proguard/classfile/constant/visitor/ExceptClassConstantFilter.java +++ b/src/proguard/classfile/constant/visitor/ExceptClassConstantFilter.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -44,16 +44,16 @@ implements ConstantVisitor /** - * Creates a new ExceptClassConstantFilter. + * Creates a new ClassNameFilter. * @param exceptClassName the name of the class that will not be visited. * @param constantVisitor the <code>ConstantVisitor</code> to which visits * will be delegated. */ - public ExceptClassConstantFilter(String exceptClassName, - ConstantVisitor constantVisitor) + public ExceptClassConstantFilter(String exceptClassName, + ConstantVisitor constantVisitor) { - this.exceptClassName = exceptClassName; - this.constantVisitor = constantVisitor; + this.exceptClassName = exceptClassName; + this.constantVisitor = constantVisitor; } diff --git a/src/proguard/classfile/constant/visitor/MethodrefTraveler.java b/src/proguard/classfile/constant/visitor/MethodrefTraveler.java deleted file mode 100644 index 49c0917..0000000 --- a/src/proguard/classfile/constant/visitor/MethodrefTraveler.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * 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.constant.visitor; - -import proguard.classfile.Clazz; -import proguard.classfile.attribute.*; -import proguard.classfile.constant.*; -import proguard.classfile.util.SimplifiedVisitor; - -/** - * This ConstantVisitor travels from any method handle constants that it visits - * to their methodref constants, and applies a given constant visitor. - * - * @author Eric Lafortune - */ -public class MethodrefTraveler -extends SimplifiedVisitor -implements ConstantVisitor -{ - private ConstantVisitor methodrefConstantVisitor; - - - /** - * Creates a new v that will delegate to the given constant visitor. - */ - public MethodrefTraveler(ConstantVisitor methodrefConstantVisitor) - { - this.methodrefConstantVisitor = methodrefConstantVisitor; - } - - - // Implementations for ConstantVisitor. - - public void visitAnyConstant(Clazz clazz, Constant constant) {} - - - public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant) - { - clazz.constantPoolEntryAccept(methodHandleConstant.u2referenceIndex, - methodrefConstantVisitor); - } -} |