summaryrefslogtreecommitdiff
path: root/src/proguard/classfile/visitor
diff options
context:
space:
mode:
Diffstat (limited to 'src/proguard/classfile/visitor')
-rw-r--r--src/proguard/classfile/visitor/AllClassVisitor.java47
-rw-r--r--src/proguard/classfile/visitor/AllFieldVisitor.java55
-rw-r--r--src/proguard/classfile/visitor/AllMemberVisitor.java57
-rw-r--r--src/proguard/classfile/visitor/AllMethodVisitor.java55
-rw-r--r--src/proguard/classfile/visitor/BottomClassFilter.java69
-rw-r--r--src/proguard/classfile/visitor/ClassAccessFilter.java88
-rw-r--r--src/proguard/classfile/visitor/ClassCleaner.java364
-rw-r--r--src/proguard/classfile/visitor/ClassCollector.java58
-rw-r--r--src/proguard/classfile/visitor/ClassCounter.java56
-rw-r--r--src/proguard/classfile/visitor/ClassHierarchyTraveler.java91
-rw-r--r--src/proguard/classfile/visitor/ClassNameFilter.java112
-rw-r--r--src/proguard/classfile/visitor/ClassPoolFiller.java55
-rw-r--r--src/proguard/classfile/visitor/ClassPoolVisitor.java37
-rw-r--r--src/proguard/classfile/visitor/ClassPresenceFilter.java93
-rw-r--r--src/proguard/classfile/visitor/ClassPrinter.java1182
-rw-r--r--src/proguard/classfile/visitor/ClassVersionFilter.java85
-rw-r--r--src/proguard/classfile/visitor/ClassVersionSetter.java83
-rw-r--r--src/proguard/classfile/visitor/ClassVisitor.java36
-rw-r--r--src/proguard/classfile/visitor/ConcreteClassDownTraveler.java100
-rw-r--r--src/proguard/classfile/visitor/DotClassClassVisitor.java89
-rw-r--r--src/proguard/classfile/visitor/DynamicReturnedClassVisitor.java68
-rw-r--r--src/proguard/classfile/visitor/ExceptClassFilter.java69
-rw-r--r--src/proguard/classfile/visitor/ExceptClassesFilter.java90
-rw-r--r--src/proguard/classfile/visitor/ExceptionCounter.java52
-rw-r--r--src/proguard/classfile/visitor/ExceptionExcludedOffsetFilter.java64
-rw-r--r--src/proguard/classfile/visitor/ExceptionHandlerConstantVisitor.java62
-rw-r--r--src/proguard/classfile/visitor/ExceptionHandlerFilter.java70
-rw-r--r--src/proguard/classfile/visitor/ExceptionOffsetFilter.java64
-rw-r--r--src/proguard/classfile/visitor/ExceptionRangeFilter.java68
-rw-r--r--src/proguard/classfile/visitor/ImplementedClassConstantFilter.java69
-rw-r--r--src/proguard/classfile/visitor/ImplementedClassFilter.java71
-rw-r--r--src/proguard/classfile/visitor/ImplementingClassConstantFilter.java70
-rw-r--r--src/proguard/classfile/visitor/LibraryClassFilter.java60
-rw-r--r--src/proguard/classfile/visitor/LibraryMemberFilter.java73
-rw-r--r--src/proguard/classfile/visitor/MemberAccessFilter.java122
-rw-r--r--src/proguard/classfile/visitor/MemberClassAccessFilter.java106
-rw-r--r--src/proguard/classfile/visitor/MemberCollector.java59
-rw-r--r--src/proguard/classfile/visitor/MemberCounter.java72
-rw-r--r--src/proguard/classfile/visitor/MemberDescriptorFilter.java113
-rw-r--r--src/proguard/classfile/visitor/MemberDescriptorReferencedClassVisitor.java65
-rw-r--r--src/proguard/classfile/visitor/MemberNameFilter.java114
-rw-r--r--src/proguard/classfile/visitor/MemberToClassVisitor.java90
-rw-r--r--src/proguard/classfile/visitor/MemberVisitor.java40
-rw-r--r--src/proguard/classfile/visitor/MethodImplementationFilter.java70
-rw-r--r--src/proguard/classfile/visitor/MethodImplementationTraveler.java128
-rw-r--r--src/proguard/classfile/visitor/MultiClassPoolVisitor.java88
-rw-r--r--src/proguard/classfile/visitor/MultiClassVisitor.java97
-rw-r--r--src/proguard/classfile/visitor/MultiMemberVisitor.java113
-rw-r--r--src/proguard/classfile/visitor/NamedClassVisitor.java49
-rw-r--r--src/proguard/classfile/visitor/NamedFieldVisitor.java61
-rw-r--r--src/proguard/classfile/visitor/NamedMethodVisitor.java61
-rw-r--r--src/proguard/classfile/visitor/ParameterVisitor.java56
-rw-r--r--src/proguard/classfile/visitor/ProgramClassFilter.java60
-rw-r--r--src/proguard/classfile/visitor/ProgramMemberFilter.java73
-rw-r--r--src/proguard/classfile/visitor/ReferencedClassVisitor.java269
-rw-r--r--src/proguard/classfile/visitor/ReferencedMemberVisitor.java73
-rw-r--r--src/proguard/classfile/visitor/SimilarMemberVisitor.java125
-rw-r--r--src/proguard/classfile/visitor/SimpleClassPrinter.java167
-rw-r--r--src/proguard/classfile/visitor/SubclassFilter.java91
-rw-r--r--src/proguard/classfile/visitor/SubclassTraveler.java60
-rw-r--r--src/proguard/classfile/visitor/VariableClassVisitor.java78
-rw-r--r--src/proguard/classfile/visitor/VariableMemberVisitor.java96
-rw-r--r--src/proguard/classfile/visitor/package.html40
63 files changed, 0 insertions, 6398 deletions
diff --git a/src/proguard/classfile/visitor/AllClassVisitor.java b/src/proguard/classfile/visitor/AllClassVisitor.java
deleted file mode 100644
index 20c6349..0000000
--- a/src/proguard/classfile/visitor/AllClassVisitor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.ClassPool;
-
-
-/**
- * This ClassPoolVisitor lets a given ClassVisitor visit all Clazz
- * objects of the class pools it visits.
- *
- * @author Eric Lafortune
- */
-public class AllClassVisitor implements ClassPoolVisitor
-{
- private final ClassVisitor classVisitor;
-
-
- public AllClassVisitor(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
-
- public void visitClassPool(ClassPool classPool)
- {
- classPool.classesAccept(classVisitor);
- }
-}
diff --git a/src/proguard/classfile/visitor/AllFieldVisitor.java b/src/proguard/classfile/visitor/AllFieldVisitor.java
deleted file mode 100644
index 1860202..0000000
--- a/src/proguard/classfile/visitor/AllFieldVisitor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This ClassVisitor lets a given MemberVisitor visit all FieldMember
- * objects of the classes it visits.
- *
- * @author Eric Lafortune
- */
-public class AllFieldVisitor implements ClassVisitor
-{
- private final MemberVisitor memberVisitor;
-
-
- public AllFieldVisitor(MemberVisitor memberVisitor)
- {
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- programClass.fieldsAccept(memberVisitor);
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- libraryClass.fieldsAccept(memberVisitor);
- }
-}
diff --git a/src/proguard/classfile/visitor/AllMemberVisitor.java b/src/proguard/classfile/visitor/AllMemberVisitor.java
deleted file mode 100644
index c73df62..0000000
--- a/src/proguard/classfile/visitor/AllMemberVisitor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This ClassVisitor lets a given MemberVisitor visit all Member
- * objects of the classes it visits.
- *
- * @author Eric Lafortune
- */
-public class AllMemberVisitor implements ClassVisitor
-{
- private final MemberVisitor memberVisitor;
-
-
- public AllMemberVisitor(MemberVisitor memberVisitor)
- {
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- programClass.fieldsAccept(memberVisitor);
- programClass.methodsAccept(memberVisitor);
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- libraryClass.fieldsAccept(memberVisitor);
- libraryClass.methodsAccept(memberVisitor);
- }
-}
diff --git a/src/proguard/classfile/visitor/AllMethodVisitor.java b/src/proguard/classfile/visitor/AllMethodVisitor.java
deleted file mode 100644
index a5d97e7..0000000
--- a/src/proguard/classfile/visitor/AllMethodVisitor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This ClassVisitor lets a given MemberVisitor visit all MethodMember
- * objects of the classes it visits.
- *
- * @author Eric Lafortune
- */
-public class AllMethodVisitor implements ClassVisitor
-{
- private final MemberVisitor memberVisitor;
-
-
- public AllMethodVisitor(MemberVisitor memberVisitor)
- {
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- programClass.methodsAccept(memberVisitor);
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- libraryClass.methodsAccept(memberVisitor);
- }
-}
diff --git a/src/proguard/classfile/visitor/BottomClassFilter.java b/src/proguard/classfile/visitor/BottomClassFilter.java
deleted file mode 100644
index cf3244e..0000000
--- a/src/proguard/classfile/visitor/BottomClassFilter.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This <code>ClassVisitor</code> delegates its visits to another given
- * <code>ClassVisitor</code>, but only when visiting classes that don't
- * have any subclasses.
- *
- * @author Eric Lafortune
- */
-public class BottomClassFilter implements ClassVisitor
-{
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new ProgramClassFilter.
- * @param classVisitor the <code>ClassVisitor</code> to which visits
- * will be delegated.
- */
- public BottomClassFilter(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- // Is this a bottom class in the class hierarchy?
- if (programClass.subClasses == null)
- {
- classVisitor.visitProgramClass(programClass);
- }
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- // Is this a bottom class in the class hierarchy?
- if (libraryClass.subClasses == null)
- {
- classVisitor.visitLibraryClass(libraryClass);
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/ClassAccessFilter.java b/src/proguard/classfile/visitor/ClassAccessFilter.java
deleted file mode 100644
index 09af6d9..0000000
--- a/src/proguard/classfile/visitor/ClassAccessFilter.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This <code>ClassVisitor</code> delegates its visits to another given
- * <code>ClassVisitor</code>, but only when the visited class
- * has the proper access flags.
- *
- * @see ClassConstants
- *
- * @author Eric Lafortune
- */
-public class ClassAccessFilter implements ClassVisitor
-{
- private final int requiredSetAccessFlags;
- private final int requiredUnsetAccessFlags;
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new ClassAccessFilter.
- * @param requiredSetAccessFlags the class access flags that should be
- * set.
- * @param requiredUnsetAccessFlags the class access flags that should be
- * unset.
- * @param classVisitor the <code>ClassVisitor</code> to
- * which visits will be delegated.
- */
- public ClassAccessFilter(int requiredSetAccessFlags,
- int requiredUnsetAccessFlags,
- ClassVisitor classVisitor)
- {
- this.requiredSetAccessFlags = requiredSetAccessFlags;
- this.requiredUnsetAccessFlags = requiredUnsetAccessFlags;
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- if (accepted(programClass.getAccessFlags()))
- {
- classVisitor.visitProgramClass(programClass);
- }
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- if (accepted(libraryClass.getAccessFlags()))
- {
- classVisitor.visitLibraryClass(libraryClass);
- }
- }
-
-
- // Small utility methods.
-
- private boolean accepted(int accessFlags)
- {
- return (requiredSetAccessFlags & ~accessFlags) == 0 &&
- (requiredUnsetAccessFlags & accessFlags) == 0;
- }
-}
diff --git a/src/proguard/classfile/visitor/ClassCleaner.java b/src/proguard/classfile/visitor/ClassCleaner.java
deleted file mode 100644
index bf20866..0000000
--- a/src/proguard/classfile/visitor/ClassCleaner.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.annotation.*;
-import proguard.classfile.attribute.annotation.visitor.*;
-import proguard.classfile.attribute.preverification.*;
-import proguard.classfile.attribute.preverification.visitor.*;
-import proguard.classfile.attribute.visitor.*;
-import proguard.classfile.constant.Constant;
-import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.classfile.util.SimplifiedVisitor;
-
-/**
- * This <code>ClassVisitor</code> removes all visitor information of the
- * classes it visits.
- *
- * @author Eric Lafortune
- */
-public class ClassCleaner
-extends SimplifiedVisitor
-implements ClassVisitor,
- ConstantVisitor,
- MemberVisitor,
- AttributeVisitor,
- BootstrapMethodInfoVisitor,
- ExceptionInfoVisitor,
- InnerClassesInfoVisitor,
- StackMapFrameVisitor,
- VerificationTypeVisitor,
- ParameterInfoVisitor,
- LocalVariableInfoVisitor,
- LocalVariableTypeInfoVisitor,
- AnnotationVisitor,
- TypeAnnotationVisitor,
- ElementValueVisitor
-{
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- clean(programClass);
-
- programClass.constantPoolEntriesAccept(this);
-
- programClass.fieldsAccept(this);
- programClass.methodsAccept(this);
-
- programClass.attributesAccept(this);
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- clean(libraryClass);
-
- libraryClass.fieldsAccept(this);
- libraryClass.methodsAccept(this);
- }
-
-
- // Implementations for ConstantVisitor.
-
- public void visitAnyConstant(Clazz clazz, Constant constant)
- {
- clean(constant);
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramMember(ProgramClass programClass, ProgramMember programMember)
- {
- clean(programMember);
-
- programMember.attributesAccept(programClass, this);
- }
-
-
- public void visitLibraryMember(LibraryClass libraryClass, LibraryMember libraryMember)
- {
- clean(libraryMember);
- }
-
-
- // Implementations for AttributeVisitor.
-
- public void visitAnyAttribute(Clazz clazz, Attribute attribute)
- {
- clean(attribute);
- }
-
-
- public void visitBootstrapMethodsAttribute(Clazz clazz, BootstrapMethodsAttribute bootstrapMethodsAttribute)
- {
- clean(bootstrapMethodsAttribute);
-
- bootstrapMethodsAttribute.bootstrapMethodEntriesAccept(clazz, this);
- }
-
-
- public void visitInnerClassesAttribute(Clazz clazz, InnerClassesAttribute innerClassesAttribute)
- {
- clean(innerClassesAttribute);
-
- innerClassesAttribute.innerClassEntriesAccept(clazz, this);
- }
-
-
- public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute)
- {
- clean(methodParametersAttribute);
-
- methodParametersAttribute.parametersAccept(clazz, method, this);
- }
-
-
- public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
- {
- clean(exceptionsAttribute);
-
- exceptionsAttribute.exceptionEntriesAccept((ProgramClass)clazz, this);
- }
-
-
- public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
- {
- clean(codeAttribute);
-
- codeAttribute.exceptionsAccept(clazz, method, this);
- codeAttribute.attributesAccept(clazz, method, this);
- }
-
-
- public void visitStackMapAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, StackMapAttribute stackMapAttribute)
- {
- clean(stackMapAttribute);
-
- stackMapAttribute.stackMapFramesAccept(clazz, method, codeAttribute, this);
- }
-
-
- public void visitStackMapTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, StackMapTableAttribute stackMapTableAttribute)
- {
- clean(stackMapTableAttribute);
-
- stackMapTableAttribute.stackMapFramesAccept(clazz, method, codeAttribute, this);
- }
-
-
- public void visitLocalVariableTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTableAttribute localVariableTableAttribute)
- {
- clean(localVariableTableAttribute);
-
- localVariableTableAttribute.localVariablesAccept(clazz, method, codeAttribute, this);
- }
-
-
- public void visitLocalVariableTypeTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeTableAttribute localVariableTypeTableAttribute)
- {
- clean(localVariableTypeTableAttribute);
-
- localVariableTypeTableAttribute.localVariablesAccept(clazz, method, codeAttribute, this);
- }
-
-
- public void visitAnyAnnotationsAttribute(Clazz clazz, AnnotationsAttribute annotationsAttribute)
- {
- clean(annotationsAttribute);
-
- annotationsAttribute.annotationsAccept(clazz, this);
- }
-
-
- public void visitAnyParameterAnnotationsAttribute(Clazz clazz, Method method, ParameterAnnotationsAttribute parameterAnnotationsAttribute)
- {
- clean(parameterAnnotationsAttribute);
-
- parameterAnnotationsAttribute.annotationsAccept(clazz, method, this);
- }
-
-
- public void visitAnyTypeAnnotationsAttribute(Clazz clazz, TypeAnnotationsAttribute typeAnnotationsAttribute)
- {
- clean(typeAnnotationsAttribute);
-
- typeAnnotationsAttribute.typeAnnotationsAccept(clazz, this);
- }
-
-
- public void visitAnnotationDefaultAttribute(Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute)
- {
- clean(annotationDefaultAttribute);
-
- annotationDefaultAttribute.defaultValueAccept(clazz, this);
- }
-
-
- // Implementations for BootstrapMethodInfoVisitor.
-
- public void visitBootstrapMethodInfo(Clazz clazz, BootstrapMethodInfo bootstrapMethodInfo)
- {
- clean(bootstrapMethodInfo);
- }
-
-
- // Implementations for InnerClassesInfoVisitor.
-
- public void visitInnerClassesInfo(Clazz clazz, InnerClassesInfo innerClassesInfo)
- {
- clean(innerClassesInfo);
- }
-
-
- // Implementations for ExceptionInfoVisitor.
-
- public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
- {
- clean(exceptionInfo);
- }
-
-
- // Implementations for StackMapFrameVisitor.
-
- public void visitSameZeroFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SameZeroFrame sameZeroFrame)
- {
- clean(sameZeroFrame);
- }
-
-
- public void visitSameOneFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SameOneFrame sameOneFrame)
- {
- clean(sameOneFrame);
-
- sameOneFrame.stackItemAccept(clazz, method, codeAttribute, offset, this);
- }
-
-
- public void visitLessZeroFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, LessZeroFrame lessZeroFrame)
- {
- clean(lessZeroFrame);
- }
-
-
- public void visitMoreZeroFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, MoreZeroFrame moreZeroFrame)
- {
- clean(moreZeroFrame);
-
- moreZeroFrame.additionalVariablesAccept(clazz, method, codeAttribute, offset, this);
- }
-
-
- public void visitFullFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, FullFrame fullFrame)
- {
- clean(fullFrame);
-
- fullFrame.variablesAccept(clazz, method, codeAttribute, offset, this);
- fullFrame.stackAccept(clazz, method, codeAttribute, offset, this);
- }
-
-
- // Implementations for VerificationTypeVisitor.
-
- public void visitAnyVerificationType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VerificationType verificationType)
- {
- clean(verificationType);
- }
-
-
- // Implementations for ParameterInfoVisitor.
-
- public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo)
- {
- clean(parameterInfo);
- }
-
-
- // Implementations for LocalVariableInfoVisitor.
-
- public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
- {
- clean(localVariableInfo);
- }
-
-
- // Implementations for LocalVariableTypeInfoVisitor.
-
- public void visitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo)
- {
- clean(localVariableTypeInfo);
- }
-
-
- // Implementations for AnnotationVisitor.
-
- public void visitAnnotation(Clazz clazz, Annotation annotation)
- {
- clean(annotation);
-
- annotation.elementValuesAccept(clazz, this);
- }
-
-
- // Implementations for TypeAnnotationVisitor.
-
- public void visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation)
- {
- clean(typeAnnotation);
-
- //typeAnnotation.targetInfoAccept(clazz, this);
- //typeAnnotation.typePathInfosAccept(clazz, this);
- typeAnnotation.elementValuesAccept(clazz, this);
- }
-
-
- // Implementations for ElementValueVisitor.
-
- public void visitAnyElementValue(Clazz clazz, Annotation annotation, ElementValue elementValue)
- {
- clean(elementValue);
- }
-
-
- public void visitAnnotationElementValue(Clazz clazz, Annotation annotation, AnnotationElementValue annotationElementValue)
- {
- clean(annotationElementValue);
-
- annotationElementValue.annotationAccept(clazz, this);
- }
-
-
- public void visitArrayElementValue(Clazz clazz, Annotation annotation, ArrayElementValue arrayElementValue)
- {
- clean(arrayElementValue);
- }
-
-
- // Small utility methods.
-
- private void clean(VisitorAccepter visitorAccepter)
- {
- visitorAccepter.setVisitorInfo(null);
- }
-}
diff --git a/src/proguard/classfile/visitor/ClassCollector.java b/src/proguard/classfile/visitor/ClassCollector.java
deleted file mode 100644
index 05bb23b..0000000
--- a/src/proguard/classfile/visitor/ClassCollector.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.Clazz;
-import proguard.classfile.util.SimplifiedVisitor;
-
-import java.util.Set;
-
-/**
- * This <code>ClassVisitor</code> collects the classes that it visits in the
- * given collection.
- *
- * @author Eric Lafortune
- */
-public class ClassCollector
-extends SimplifiedVisitor
-implements ClassVisitor
-{
- private final Set set;
-
-
- /**
- * Creates a new ClassCollector.
- * @param set the <code>Set</code> in which all class names will be
- * collected.
- */
- public ClassCollector(Set set)
- {
- this.set = set;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitAnyClass(Clazz clazz)
- {
- set.add(clazz);
- }
-}
diff --git a/src/proguard/classfile/visitor/ClassCounter.java b/src/proguard/classfile/visitor/ClassCounter.java
deleted file mode 100644
index 835f0bd..0000000
--- a/src/proguard/classfile/visitor/ClassCounter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-/**
- * This ClassVisitor counts the number of classes that has been visited.
- *
- * @author Eric Lafortune
- */
-public class ClassCounter implements ClassVisitor
-{
- private int count;
-
-
- /**
- * Returns the number of classes that has been visited so far.
- */
- public int getCount()
- {
- return count;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- count++;
- }
-
-
- public void visitProgramClass(ProgramClass programClass)
- {
- count++;
- }
-}
diff --git a/src/proguard/classfile/visitor/ClassHierarchyTraveler.java b/src/proguard/classfile/visitor/ClassHierarchyTraveler.java
deleted file mode 100644
index d459719..0000000
--- a/src/proguard/classfile/visitor/ClassHierarchyTraveler.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This <code>ClassVisitor</code> lets a given <code>ClassVisitor</code>
- * optionally travel to the visited class, its superclass, its interfaces, and
- * its subclasses.
- *
- * @author Eric Lafortune
- */
-public class ClassHierarchyTraveler implements ClassVisitor
-{
- private final boolean visitThisClass;
- private final boolean visitSuperClass;
- private final boolean visitInterfaces;
- private final boolean visitSubclasses;
-
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new ClassHierarchyTraveler.
- * @param visitThisClass specifies whether to visit the originally visited
- * classes.
- * @param visitSuperClass specifies whether to visit the super classes of
- * the visited classes.
- * @param visitInterfaces specifies whether to visit the interfaces of
- * the visited classes.
- * @param visitSubclasses specifies whether to visit the subclasses of
- * the visited classes.
- * @param classVisitor the <code>ClassVisitor</code> to
- * which visits will be delegated.
- */
- public ClassHierarchyTraveler(boolean visitThisClass,
- boolean visitSuperClass,
- boolean visitInterfaces,
- boolean visitSubclasses,
- ClassVisitor classVisitor)
- {
- this.visitThisClass = visitThisClass;
- this.visitSuperClass = visitSuperClass;
- this.visitInterfaces = visitInterfaces;
- this.visitSubclasses = visitSubclasses;
-
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- programClass.hierarchyAccept(visitThisClass,
- visitSuperClass,
- visitInterfaces,
- visitSubclasses,
- classVisitor);
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- libraryClass.hierarchyAccept(visitThisClass,
- visitSuperClass,
- visitInterfaces,
- visitSubclasses,
- classVisitor);
- }
-}
diff --git a/src/proguard/classfile/visitor/ClassNameFilter.java b/src/proguard/classfile/visitor/ClassNameFilter.java
deleted file mode 100644
index 3415faa..0000000
--- a/src/proguard/classfile/visitor/ClassNameFilter.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.util.*;
-
-import java.util.List;
-
-/**
- * This <code>ClassVisitor</code> delegates its visits to another given
- * <code>ClassVisitor</code>, but only when the visited class has a name that
- * matches a given regular expression.
- *
- * @author Eric Lafortune
- */
-public class ClassNameFilter implements ClassVisitor
-{
- private final StringMatcher regularExpressionMatcher;
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new ClassNameFilter.
- * @param regularExpression the regular expression against which class names
- * will be matched.
- * @param classVisitor the <code>ClassVisitor</code> to which visits
- * will be delegated.
- */
- public ClassNameFilter(String regularExpression,
- ClassVisitor classVisitor)
- {
- this(new ListParser(new ClassNameParser()).parse(regularExpression),
- classVisitor);
- }
-
-
- /**
- * Creates a new ClassNameFilter.
- * @param regularExpression the regular expression against which class names
- * will be matched.
- * @param classVisitor the <code>ClassVisitor</code> to which visits
- * will be delegated.
- */
- public ClassNameFilter(List regularExpression,
- ClassVisitor classVisitor)
- {
- this(new ListParser(new ClassNameParser()).parse(regularExpression),
- classVisitor);
- }
-
-
- /**
- * Creates a new ClassNameFilter.
- * @param regularExpressionMatcher the string matcher against which
- * class names will be matched.
- * @param classVisitor the <code>ClassVisitor</code> to which
- * visits will be delegated.
- */
- public ClassNameFilter(StringMatcher regularExpressionMatcher,
- ClassVisitor classVisitor)
- {
- this.regularExpressionMatcher = regularExpressionMatcher;
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- if (accepted(programClass.getName()))
- {
- classVisitor.visitProgramClass(programClass);
- }
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- if (accepted(libraryClass.getName()))
- {
- classVisitor.visitLibraryClass(libraryClass);
- }
- }
-
-
- // Small utility methods.
-
- private boolean accepted(String name)
- {
- return regularExpressionMatcher.matches(name);
- }
-}
diff --git a/src/proguard/classfile/visitor/ClassPoolFiller.java b/src/proguard/classfile/visitor/ClassPoolFiller.java
deleted file mode 100644
index bd66a7d..0000000
--- a/src/proguard/classfile/visitor/ClassPoolFiller.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.util.SimplifiedVisitor;
-
-
-/**
- * This ClassVisitor collects all the classes it visits in a given
- * class pool.
- *
- * @author Eric Lafortune
- */
-public class ClassPoolFiller
-extends SimplifiedVisitor
-implements ClassVisitor
-{
- private final ClassPool classPool;
-
-
- /**
- * Creates a new ClassPoolFiller.
- */
- public ClassPoolFiller(ClassPool classPool)
- {
- this.classPool = classPool;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitAnyClass(Clazz clazz)
- {
- classPool.addClass(clazz);
- }
-}
diff --git a/src/proguard/classfile/visitor/ClassPoolVisitor.java b/src/proguard/classfile/visitor/ClassPoolVisitor.java
deleted file mode 100644
index a91a69d..0000000
--- a/src/proguard/classfile/visitor/ClassPoolVisitor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.ClassPool;
-
-
-/**
- * This interface specifies the methods for a visitor of
- * <code>ClassPool</code> objects. Note that there is only a single
- * implementation of <code>ClassPool</code>, such that this interface
- * is not strictly necessary as a visitor.
- *
- * @author Eric Lafortune
- */
-public interface ClassPoolVisitor
-{
- public void visitClassPool(ClassPool classPool);
-}
diff --git a/src/proguard/classfile/visitor/ClassPresenceFilter.java b/src/proguard/classfile/visitor/ClassPresenceFilter.java
deleted file mode 100644
index 42df828..0000000
--- a/src/proguard/classfile/visitor/ClassPresenceFilter.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-/**
- * This <code>ClassVisitor</code> delegates its visits to one of two
- * <code>ClassVisitor</code> instances, depending on whether the name of
- * the visited class file is present in a given <code>ClassPool</code> or not.
- *
- * @author Eric Lafortune
- */
-public class ClassPresenceFilter implements ClassVisitor
-{
- private final ClassPool classPool;
- private final ClassVisitor presentClassVisitor;
- private final ClassVisitor missingClassVisitor;
-
-
- /**
- * Creates a new ClassPresenceFilter.
- * @param classPool the <code>ClassPool</code> in which the
- * presence will be tested.
- * @param presentClassVisitor the <code>ClassVisitor</code> to which visits
- * of present class files will be delegated.
- * @param missingClassVisitor the <code>ClassVisitor</code> to which visits
- * of missing class files will be delegated.
- */
- public ClassPresenceFilter(ClassPool classPool,
- ClassVisitor presentClassVisitor,
- ClassVisitor missingClassVisitor)
- {
- this.classPool = classPool;
- this.presentClassVisitor = presentClassVisitor;
- this.missingClassVisitor = missingClassVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- ClassVisitor classFileVisitor = classFileVisitor(programClass);
-
- if (classFileVisitor != null)
- {
- classFileVisitor.visitProgramClass(programClass);
- }
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- ClassVisitor classFileVisitor = classFileVisitor(libraryClass);
-
- if (classFileVisitor != null)
- {
- classFileVisitor.visitLibraryClass(libraryClass);
- }
- }
-
-
- // Small utility methods.
-
- /**
- * Returns the appropriate <code>ClassVisitor</code>.
- */
- private ClassVisitor classFileVisitor(Clazz clazz)
- {
- return classPool.getClass(clazz.getName()) != null ?
- presentClassVisitor :
- missingClassVisitor;
- }
-}
diff --git a/src/proguard/classfile/visitor/ClassPrinter.java b/src/proguard/classfile/visitor/ClassPrinter.java
deleted file mode 100644
index 9af8f75..0000000
--- a/src/proguard/classfile/visitor/ClassPrinter.java
+++ /dev/null
@@ -1,1182 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.annotation.*;
-import proguard.classfile.attribute.annotation.target.*;
-import proguard.classfile.attribute.annotation.target.visitor.*;
-import proguard.classfile.attribute.annotation.visitor.*;
-import proguard.classfile.attribute.preverification.*;
-import proguard.classfile.attribute.preverification.visitor.*;
-import proguard.classfile.attribute.visitor.*;
-import proguard.classfile.constant.*;
-import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.classfile.instruction.*;
-import proguard.classfile.instruction.visitor.InstructionVisitor;
-import proguard.classfile.util.*;
-
-import java.io.PrintStream;
-
-
-/**
- * This <code>ClassVisitor</code> prints out the complete internal
- * structure of the classes it visits.
- *
- * @author Eric Lafortune
- */
-public class ClassPrinter
-extends SimplifiedVisitor
-implements ClassVisitor,
- ConstantVisitor,
- MemberVisitor,
- AttributeVisitor,
- BootstrapMethodInfoVisitor,
- InnerClassesInfoVisitor,
- ExceptionInfoVisitor,
- StackMapFrameVisitor,
- VerificationTypeVisitor,
- LineNumberInfoVisitor,
- ParameterInfoVisitor,
- LocalVariableInfoVisitor,
- LocalVariableTypeInfoVisitor,
- AnnotationVisitor,
- TypeAnnotationVisitor,
- TargetInfoVisitor,
- LocalVariableTargetElementVisitor,
- TypePathInfoVisitor,
- ElementValueVisitor,
- InstructionVisitor
-{
- private static final String INDENTATION = " ";
-
- private final PrintStream ps;
-
- private int indentation;
-
-
- /**
- * Creates a new ClassPrinter that prints to <code>System.out</code>.
- */
- public ClassPrinter()
- {
- this(System.out);
- }
-
-
- /**
- * Creates a new ClassPrinter that prints to the given
- * <code>PrintStream</code>.
- */
- public ClassPrinter(PrintStream printStream)
- {
- ps = printStream;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- println("_____________________________________________________________________");
- println(visitorInfo(programClass) + " " +
- "Program class: " + programClass.getName());
- indent();
- println("Superclass: " + programClass.getSuperName());
- println("Major version: 0x" + Integer.toHexString(ClassUtil.internalMajorClassVersion(programClass.u4version)));
- println("Minor version: 0x" + Integer.toHexString(ClassUtil.internalMinorClassVersion(programClass.u4version)));
- println(" = target " + ClassUtil.externalClassVersion(programClass.u4version));
- println("Access flags: 0x" + Integer.toHexString(programClass.u2accessFlags));
- println(" = " +
- ((programClass.u2accessFlags & ClassConstants.ACC_ANNOTATTION) != 0 ? "@ " : "") +
- ClassUtil.externalClassAccessFlags(programClass.u2accessFlags) +
- ((programClass.u2accessFlags & ClassConstants.ACC_ENUM) != 0 ? "enum " :
- (programClass.u2accessFlags & ClassConstants.ACC_INTERFACE) == 0 ? "class " :
- "") +
- ClassUtil.externalClassName(programClass.getName()) +
- (programClass.u2superClass == 0 ? "" : " extends " +
- ClassUtil.externalClassName(programClass.getSuperName())));
- outdent();
- println();
-
- println("Interfaces (count = " + programClass.u2interfacesCount + "):");
- indent();
- programClass.interfaceConstantsAccept(this);
- outdent();
- println();
-
- println("Constant Pool (count = " + programClass.u2constantPoolCount + "):");
- indent();
- programClass.constantPoolEntriesAccept(this);
- outdent();
- println();
-
- println("Fields (count = " + programClass.u2fieldsCount + "):");
- indent();
- programClass.fieldsAccept(this);
- outdent();
- println();
-
- println("Methods (count = " + programClass.u2methodsCount + "):");
- indent();
- programClass.methodsAccept(this);
- outdent();
- println();
-
- println("Class file attributes (count = " + programClass.u2attributesCount + "):");
- indent();
- programClass.attributesAccept(this);
- outdent();
- println();
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- println("_____________________________________________________________________");
- println(visitorInfo(libraryClass) + " " +
- "Library class: " + libraryClass.getName());
- indent();
- println("Superclass: " + libraryClass.getSuperName());
- println("Access flags: 0x" + Integer.toHexString(libraryClass.u2accessFlags));
- println(" = " +
- ((libraryClass.u2accessFlags & ClassConstants.ACC_ANNOTATTION) != 0 ? "@ " : "") +
- ClassUtil.externalClassAccessFlags(libraryClass.u2accessFlags) +
- ((libraryClass.u2accessFlags & ClassConstants.ACC_ENUM) != 0 ? "enum " :
- (libraryClass.u2accessFlags & ClassConstants.ACC_INTERFACE) == 0 ? "class " :
- "") +
- ClassUtil.externalClassName(libraryClass.getName()) +
- (libraryClass.getSuperName() == null ? "" : " extends " +
- ClassUtil.externalClassName(libraryClass.getSuperName())));
- outdent();
- println();
-
- println("Interfaces (count = " + libraryClass.interfaceClasses.length + "):");
- for (int index = 0; index < libraryClass.interfaceClasses.length; index++)
- {
- Clazz interfaceClass = libraryClass.interfaceClasses[index];
- if (interfaceClass != null)
- {
- println(" + " + interfaceClass.getName());
- }
- }
-
- println("Fields (count = " + libraryClass.fields.length + "):");
- libraryClass.fieldsAccept(this);
-
- println("Methods (count = " + libraryClass.methods.length + "):");
- libraryClass.methodsAccept(this);
- }
-
-
- // Implementations for ConstantVisitor.
-
- public void visitIntegerConstant(Clazz clazz, IntegerConstant integerConstant)
- {
- println(visitorInfo(integerConstant) + " Integer [" +
- integerConstant.getValue() + "]");
- }
-
-
- public void visitLongConstant(Clazz clazz, LongConstant longConstant)
- {
- println(visitorInfo(longConstant) + " Long [" +
- longConstant.getValue() + "]");
- }
-
-
- public void visitFloatConstant(Clazz clazz, FloatConstant floatConstant)
- {
- println(visitorInfo(floatConstant) + " Float [" +
- floatConstant.getValue() + "]");
- }
-
-
- public void visitDoubleConstant(Clazz clazz, DoubleConstant doubleConstant)
- {
- println(visitorInfo(doubleConstant) + " Double [" +
- doubleConstant.getValue() + "]");
- }
-
-
- public void visitStringConstant(Clazz clazz, StringConstant stringConstant)
- {
- println(visitorInfo(stringConstant) + " String [" +
- stringConstant.getString(clazz) + "]");
- }
-
-
- public void visitUtf8Constant(Clazz clazz, Utf8Constant utf8Constant)
- {
- println(visitorInfo(utf8Constant) + " Utf8 [" +
- utf8Constant.getString() + "]");
- }
-
-
- public void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant)
- {
- println(visitorInfo(invokeDynamicConstant) + " InvokeDynamic [bootstrap method index = " + invokeDynamicConstant.u2bootstrapMethodAttributeIndex + "]:");
-
- indent();
- clazz.constantPoolEntryAccept(invokeDynamicConstant.u2nameAndTypeIndex, this);
- outdent();
- }
-
-
- public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant)
- {
- println(visitorInfo(methodHandleConstant) + " MethodHandle [kind = " + methodHandleConstant.u1referenceKind + "]:");
-
- indent();
- clazz.constantPoolEntryAccept(methodHandleConstant.u2referenceIndex, this);
- outdent();
- }
-
-
- public void visitFieldrefConstant(Clazz clazz, FieldrefConstant fieldrefConstant)
- {
- println(visitorInfo(fieldrefConstant) + " Fieldref [" +
- clazz.getClassName(fieldrefConstant.u2classIndex) + "." +
- clazz.getName(fieldrefConstant.u2nameAndTypeIndex) + " " +
- clazz.getType(fieldrefConstant.u2nameAndTypeIndex) + "]");
- }
-
-
- public void visitInterfaceMethodrefConstant(Clazz clazz, InterfaceMethodrefConstant interfaceMethodrefConstant)
- {
- println(visitorInfo(interfaceMethodrefConstant) + " InterfaceMethodref [" +
- clazz.getClassName(interfaceMethodrefConstant.u2classIndex) + "." +
- clazz.getName(interfaceMethodrefConstant.u2nameAndTypeIndex) + " " +
- clazz.getType(interfaceMethodrefConstant.u2nameAndTypeIndex) + "]");
- }
-
-
- public void visitMethodrefConstant(Clazz clazz, MethodrefConstant methodrefConstant)
- {
- println(visitorInfo(methodrefConstant) + " Methodref [" +
- clazz.getClassName(methodrefConstant.u2classIndex) + "." +
- clazz.getName(methodrefConstant.u2nameAndTypeIndex) + " " +
- clazz.getType(methodrefConstant.u2nameAndTypeIndex) + "]");
- }
-
-
- public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
- {
- println(visitorInfo(classConstant) + " Class [" +
- classConstant.getName(clazz) + "]");
- }
-
-
- public void visitMethodTypeConstant(Clazz clazz, MethodTypeConstant methodTypeConstant)
- {
- println(visitorInfo(methodTypeConstant) + " MethodType [" +
- methodTypeConstant.getType(clazz) + "]");
- }
-
-
- public void visitNameAndTypeConstant(Clazz clazz, NameAndTypeConstant nameAndTypeConstant)
- {
- println(visitorInfo(nameAndTypeConstant) + " NameAndType [" +
- nameAndTypeConstant.getName(clazz) + " " +
- nameAndTypeConstant.getType(clazz) + "]");
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- println(visitorInfo(programField) + " " +
- "Field: " +
- programField.getName(programClass) + " " +
- programField.getDescriptor(programClass));
-
- indent();
- println("Access flags: 0x" + Integer.toHexString(programField.u2accessFlags));
- println(" = " +
- ClassUtil.externalFullFieldDescription(programField.u2accessFlags,
- programField.getName(programClass),
- programField.getDescriptor(programClass)));
-
- visitMember(programClass, programField);
- outdent();
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- println(visitorInfo(programMethod) + " " +
- "Method: " +
- programMethod.getName(programClass) +
- programMethod.getDescriptor(programClass));
-
- indent();
- println("Access flags: 0x" + Integer.toHexString(programMethod.u2accessFlags));
- println(" = " +
- ClassUtil.externalFullMethodDescription(programClass.getName(),
- programMethod.u2accessFlags,
- programMethod.getName(programClass),
- programMethod.getDescriptor(programClass)));
-
- visitMember(programClass, programMethod);
- outdent();
- }
-
-
- private void visitMember(ProgramClass programClass, ProgramMember programMember)
- {
- if (programMember.u2attributesCount > 0)
- {
- println("Class member attributes (count = " + programMember.u2attributesCount + "):");
- programMember.attributesAccept(programClass, this);
- }
- }
-
-
- public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- {
- println(visitorInfo(libraryField) + " " +
- "Field: " +
- libraryField.getName(libraryClass) + " " +
- libraryField.getDescriptor(libraryClass));
-
- indent();
- println("Access flags: 0x" + Integer.toHexString(libraryField.u2accessFlags));
- println(" = " +
- ClassUtil.externalFullFieldDescription(libraryField.u2accessFlags,
- libraryField.getName(libraryClass),
- libraryField.getDescriptor(libraryClass)));
- outdent();
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- println(visitorInfo(libraryMethod) + " " +
- "Method: " +
- libraryMethod.getName(libraryClass) + " " +
- libraryMethod.getDescriptor(libraryClass));
-
- indent();
- println("Access flags: 0x" + Integer.toHexString(libraryMethod.u2accessFlags));
- println(" = " +
- ClassUtil.externalFullMethodDescription(libraryClass.getName(),
- libraryMethod.u2accessFlags,
- libraryMethod.getName(libraryClass),
- libraryMethod.getDescriptor(libraryClass)));
- outdent();
- }
-
-
- // Implementations for AttributeVisitor.
- // Note that attributes are typically only referenced once, so we don't
- // test if they are marked already.
-
- public void visitUnknownAttribute(Clazz clazz, UnknownAttribute unknownAttribute)
- {
- println(visitorInfo(unknownAttribute) +
- " Unknown attribute (" + unknownAttribute.getAttributeName(clazz) + ")");
- }
-
-
- public void visitBootstrapMethodsAttribute(Clazz clazz, BootstrapMethodsAttribute bootstrapMethodsAttribute)
- {
- println(visitorInfo(bootstrapMethodsAttribute) +
- " Bootstrap methods attribute (count = " + bootstrapMethodsAttribute.u2bootstrapMethodsCount + "):");
-
- indent();
- bootstrapMethodsAttribute.bootstrapMethodEntriesAccept(clazz, this);
- outdent();
- }
-
-
- public void visitSourceFileAttribute(Clazz clazz, SourceFileAttribute sourceFileAttribute)
- {
- println(visitorInfo(sourceFileAttribute) +
- " Source file attribute:");
-
- indent();
- clazz.constantPoolEntryAccept(sourceFileAttribute.u2sourceFileIndex, this);
- outdent();
- }
-
-
- public void visitSourceDirAttribute(Clazz clazz, SourceDirAttribute sourceDirAttribute)
- {
- println(visitorInfo(sourceDirAttribute) +
- " Source dir attribute:");
-
- indent();
- clazz.constantPoolEntryAccept(sourceDirAttribute.u2sourceDirIndex, this);
- outdent();
- }
-
-
- public void visitInnerClassesAttribute(Clazz clazz, InnerClassesAttribute innerClassesAttribute)
- {
- println(visitorInfo(innerClassesAttribute) +
- " Inner classes attribute (count = " + innerClassesAttribute.u2classesCount + ")");
-
- indent();
- innerClassesAttribute.innerClassEntriesAccept(clazz, this);
- outdent();
- }
-
-
- public void visitEnclosingMethodAttribute(Clazz clazz, EnclosingMethodAttribute enclosingMethodAttribute)
- {
- println(visitorInfo(enclosingMethodAttribute) +
- " Enclosing method attribute:");
-
- indent();
- clazz.constantPoolEntryAccept(enclosingMethodAttribute.u2classIndex, this);
-
- if (enclosingMethodAttribute.u2nameAndTypeIndex != 0)
- {
- clazz.constantPoolEntryAccept(enclosingMethodAttribute.u2nameAndTypeIndex, this);
- }
- outdent();
- }
-
-
- public void visitDeprecatedAttribute(Clazz clazz, DeprecatedAttribute deprecatedAttribute)
- {
- println(visitorInfo(deprecatedAttribute) +
- " Deprecated attribute");
- }
-
-
- public void visitSyntheticAttribute(Clazz clazz, SyntheticAttribute syntheticAttribute)
- {
- println(visitorInfo(syntheticAttribute) +
- " Synthetic attribute");
- }
-
-
- public void visitSignatureAttribute(Clazz clazz, SignatureAttribute signatureAttribute)
- {
- println(visitorInfo(signatureAttribute) +
- " Signature attribute:");
-
- indent();
- clazz.constantPoolEntryAccept(signatureAttribute.u2signatureIndex, this);
- outdent();
- }
-
-
- public void visitConstantValueAttribute(Clazz clazz, Field field, ConstantValueAttribute constantValueAttribute)
- {
- println(visitorInfo(constantValueAttribute) +
- " Constant value attribute:");
-
- clazz.constantPoolEntryAccept(constantValueAttribute.u2constantValueIndex, this);
- }
-
-
- public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute)
- {
- println(visitorInfo(methodParametersAttribute) +
- " Method parameters attribute (count = " + methodParametersAttribute.u1parametersCount + ")");
-
- indent();
- methodParametersAttribute.parametersAccept(clazz, method, this);
- outdent();
- }
-
-
- public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
- {
- println(visitorInfo(exceptionsAttribute) +
- " Exceptions attribute (count = " + exceptionsAttribute.u2exceptionIndexTableLength + ")");
-
- indent();
- exceptionsAttribute.exceptionEntriesAccept((ProgramClass)clazz, this);
- outdent();
- }
-
-
- public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
- {
- println(visitorInfo(codeAttribute) +
- " Code attribute instructions (code length = "+ codeAttribute.u4codeLength +
- ", locals = "+ codeAttribute.u2maxLocals +
- ", stack = "+ codeAttribute.u2maxStack + "):");
-
- indent();
-
- codeAttribute.instructionsAccept(clazz, method, this);
-
- println("Code attribute exceptions (count = " +
- codeAttribute.u2exceptionTableLength + "):");
-
- codeAttribute.exceptionsAccept(clazz, method, this);
-
- println("Code attribute attributes (attribute count = " +
- codeAttribute.u2attributesCount + "):");
-
- codeAttribute.attributesAccept(clazz, method, this);
-
- outdent();
- }
-
-
- public void visitStackMapAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, StackMapAttribute stackMapAttribute)
- {
- println(visitorInfo(codeAttribute) +
- " Stack map attribute (count = "+
- stackMapAttribute.u2stackMapFramesCount + "):");
-
- indent();
- stackMapAttribute.stackMapFramesAccept(clazz, method, codeAttribute, this);
- outdent();
- }
-
-
- public void visitStackMapTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, StackMapTableAttribute stackMapTableAttribute)
- {
- println(visitorInfo(codeAttribute) +
- " Stack map table attribute (count = "+
- stackMapTableAttribute.u2stackMapFramesCount + "):");
-
- indent();
- stackMapTableAttribute.stackMapFramesAccept(clazz, method, codeAttribute, this);
- outdent();
- }
-
-
- public void visitLineNumberTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LineNumberTableAttribute lineNumberTableAttribute)
- {
- println(visitorInfo(lineNumberTableAttribute) +
- " Line number table attribute (count = " +
- lineNumberTableAttribute.u2lineNumberTableLength + ")");
-
- indent();
- lineNumberTableAttribute.lineNumbersAccept(clazz, method, codeAttribute, this);
- outdent();
- }
-
-
- public void visitLocalVariableTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTableAttribute localVariableTableAttribute)
- {
- println(visitorInfo(localVariableTableAttribute) +
- " Local variable table attribute (count = " +
- localVariableTableAttribute.u2localVariableTableLength + ")");
-
- indent();
- localVariableTableAttribute.localVariablesAccept(clazz, method, codeAttribute, this);
- outdent();
- }
-
-
- public void visitLocalVariableTypeTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeTableAttribute localVariableTypeTableAttribute)
- {
- println(visitorInfo(localVariableTypeTableAttribute) +
- " Local variable type table attribute (count = "+
- localVariableTypeTableAttribute.u2localVariableTypeTableLength + ")");
-
- indent();
- localVariableTypeTableAttribute.localVariablesAccept(clazz, method, codeAttribute, this);
- outdent();
- }
-
-
- public void visitRuntimeVisibleAnnotationsAttribute(Clazz clazz, RuntimeVisibleAnnotationsAttribute runtimeVisibleAnnotationsAttribute)
- {
- println(visitorInfo(runtimeVisibleAnnotationsAttribute) +
- " Runtime visible annotations attribute:");
-
- indent();
- runtimeVisibleAnnotationsAttribute.annotationsAccept(clazz, this);
- outdent();
- }
-
-
- public void visitRuntimeInvisibleAnnotationsAttribute(Clazz clazz, RuntimeInvisibleAnnotationsAttribute runtimeInvisibleAnnotationsAttribute)
- {
- println(visitorInfo(runtimeInvisibleAnnotationsAttribute) +
- " Runtime invisible annotations attribute:");
-
- indent();
- runtimeInvisibleAnnotationsAttribute.annotationsAccept(clazz, this);
- outdent();
- }
-
-
- public void visitRuntimeVisibleParameterAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute)
- {
- println(visitorInfo(runtimeVisibleParameterAnnotationsAttribute) +
- " Runtime visible parameter annotations attribute (parameter count = " + runtimeVisibleParameterAnnotationsAttribute.u1parametersCount + "):");
-
- indent();
- runtimeVisibleParameterAnnotationsAttribute.annotationsAccept(clazz, method, this);
- outdent();
- }
-
-
- public void visitRuntimeInvisibleParameterAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleParameterAnnotationsAttribute runtimeInvisibleParameterAnnotationsAttribute)
- {
- println(visitorInfo(runtimeInvisibleParameterAnnotationsAttribute) +
- " Runtime invisible parameter annotations attribute (parameter count = " + runtimeInvisibleParameterAnnotationsAttribute.u1parametersCount + "):");
-
- indent();
- runtimeInvisibleParameterAnnotationsAttribute.annotationsAccept(clazz, method, this);
- outdent();
- }
-
-
- public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
- {
- println(visitorInfo(runtimeVisibleTypeAnnotationsAttribute) +
- " Runtime visible type annotations attribute");
-
- indent();
- runtimeVisibleTypeAnnotationsAttribute.typeAnnotationsAccept(clazz, this);
- outdent();
- }
-
-
- public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
- {
- println(visitorInfo(runtimeInvisibleTypeAnnotationsAttribute) +
- " Runtime invisible type annotations attribute");
-
- indent();
- runtimeInvisibleTypeAnnotationsAttribute.typeAnnotationsAccept(clazz, this);
- outdent();
- }
-
-
- public void visitAnnotationDefaultAttribute(Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute)
- {
- println(visitorInfo(annotationDefaultAttribute) +
- " Annotation default attribute:");
-
- indent();
- annotationDefaultAttribute.defaultValueAccept(clazz, this);
- outdent();
- }
-
-
- // Implementations for BootstrapMethodInfoVisitor.
-
- public void visitBootstrapMethodInfo(Clazz clazz, BootstrapMethodInfo bootstrapMethodInfo)
- {
- println(visitorInfo(bootstrapMethodInfo) +
- " BootstrapMethodInfo (argument count = " +
- bootstrapMethodInfo.u2methodArgumentCount+ "):");
-
- indent();
- clazz.constantPoolEntryAccept(bootstrapMethodInfo.u2methodHandleIndex, this);
- bootstrapMethodInfo.methodArgumentsAccept(clazz, this);
- outdent();
- }
-
-
- // Implementations for InnerClassesInfoVisitor.
-
- public void visitInnerClassesInfo(Clazz clazz, InnerClassesInfo innerClassesInfo)
- {
- println(visitorInfo(innerClassesInfo) +
- " InnerClassesInfo:");
-
- indent();
- println("Access flags: 0x" + Integer.toHexString(innerClassesInfo.u2innerClassAccessFlags) + " = " +
- ClassUtil.externalClassAccessFlags(innerClassesInfo.u2innerClassAccessFlags));
- innerClassesInfo.innerClassConstantAccept(clazz, this);
- innerClassesInfo.outerClassConstantAccept(clazz, this);
- innerClassesInfo.innerNameConstantAccept(clazz, this);
- outdent();
- }
-
-
- // Implementations for InstructionVisitor.
-
- public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction)
- {
- println(instruction.toString(offset));
- }
-
-
- public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
- {
- println(constantInstruction.toString(offset));
-
- indent();
- clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);
- outdent();
- }
-
-
- public void visitTableSwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, TableSwitchInstruction tableSwitchInstruction)
- {
- println(tableSwitchInstruction.toString(offset));
-
- indent();
-
- int[] jumpOffsets = tableSwitchInstruction.jumpOffsets;
-
- for (int index = 0; index < jumpOffsets.length; index++)
- {
- int jumpOffset = jumpOffsets[index];
- println(Integer.toString(tableSwitchInstruction.lowCase + index) + ": offset = " + jumpOffset + ", target = " + (offset + jumpOffset));
- }
-
- int defaultOffset = tableSwitchInstruction.defaultOffset;
- println("default: offset = " + defaultOffset + ", target = "+ (offset + defaultOffset));
-
- outdent();
- }
-
-
- public void visitLookUpSwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, LookUpSwitchInstruction lookUpSwitchInstruction)
- {
- println(lookUpSwitchInstruction.toString(offset));
-
- indent();
-
- int[] cases = lookUpSwitchInstruction.cases;
- int[] jumpOffsets = lookUpSwitchInstruction.jumpOffsets;
-
- for (int index = 0; index < jumpOffsets.length; index++)
- {
- int jumpOffset = jumpOffsets[index];
- println(Integer.toString(cases[index]) + ": offset = " + jumpOffset + ", target = " + (offset + jumpOffset));
- }
-
- int defaultOffset = lookUpSwitchInstruction.defaultOffset;
- println("default: offset = " + defaultOffset + ", target = "+ (offset + defaultOffset));
-
- outdent();
- }
-
-
- // Implementations for ExceptionInfoVisitor.
-
- public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
- {
- println(visitorInfo(exceptionInfo) +
- " ExceptionInfo (" +
- exceptionInfo.u2startPC + " -> " +
- exceptionInfo.u2endPC + ": " +
- exceptionInfo.u2handlerPC + "):");
-
- if (exceptionInfo.u2catchType != 0)
- {
- clazz.constantPoolEntryAccept(exceptionInfo.u2catchType, this);
- }
- }
-
-
- // Implementations for StackMapFrameVisitor.
-
- public void visitSameZeroFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SameZeroFrame sameZeroFrame)
- {
- println(visitorInfo(sameZeroFrame) +
- " [" + offset + "]" +
- " Var: ..., Stack: (empty)");
- }
-
-
- public void visitSameOneFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SameOneFrame sameOneFrame)
- {
- print(visitorInfo(sameOneFrame) +
- " [" + offset + "]" +
- " Var: ..., Stack: ");
-
- sameOneFrame.stackItemAccept(clazz, method, codeAttribute, offset, this);
-
- println();
- }
-
-
- public void visitLessZeroFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, LessZeroFrame lessZeroFrame)
- {
- println(visitorInfo(lessZeroFrame) +
- " [" + offset + "]" +
- " Var: -" + lessZeroFrame.choppedVariablesCount +
- ", Stack: (empty)");
- }
-
-
- public void visitMoreZeroFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, MoreZeroFrame moreZeroFrame)
- {
- print(visitorInfo(moreZeroFrame) +
- " [" + offset + "]" +
- " Var: ...");
-
- moreZeroFrame.additionalVariablesAccept(clazz, method, codeAttribute, offset, this);
-
- ps.println(", Stack: (empty)");
- }
-
-
- public void visitFullFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, FullFrame fullFrame)
- {
- print(visitorInfo(fullFrame) +
- " [" + offset + "]" +
- " Var: ");
-
- fullFrame.variablesAccept(clazz, method, codeAttribute, offset, this);
-
- ps.print(", Stack: ");
-
- fullFrame.stackAccept(clazz, method, codeAttribute, offset, this);
-
- println();
- }
-
-
- // Implementations for VerificationTypeVisitor.
-
- public void visitIntegerType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, IntegerType integerType)
- {
- ps.print("[i]");
- }
-
-
- public void visitFloatType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, FloatType floatType)
- {
- ps.print("[f]");
- }
-
-
- public void visitLongType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, LongType longType)
- {
- ps.print("[l]");
- }
-
-
- public void visitDoubleType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, DoubleType doubleType)
- {
- ps.print("[d]");
- }
-
-
- public void visitTopType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, TopType topType)
- {
- ps.print("[T]");
- }
-
-
- public void visitObjectType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ObjectType objectType)
- {
- ps.print("[a:" + clazz.getClassName(objectType.u2classIndex) + "]");
- }
-
-
- public void visitNullType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, NullType nullType)
- {
- ps.print("[n]");
- }
-
-
- public void visitUninitializedType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, UninitializedType uninitializedType)
- {
- ps.print("[u:" + uninitializedType.u2newInstructionOffset + "]");
- }
-
-
- public void visitUninitializedThisType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, UninitializedThisType uninitializedThisType)
- {
- ps.print("[u:this]");
- }
-
-
- // Implementations for LineNumberInfoVisitor.
-
- public void visitLineNumberInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LineNumberInfo lineNumberInfo)
- {
- println("[" + lineNumberInfo.u2startPC + "] -> line " +
- lineNumberInfo.u2lineNumber);
- }
-
-
- // Implementations for ParameterInfoVisitor.
-
- public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo)
- {
- println("p" + parameterIndex + ": Access flags: 0x" + Integer.toHexString(parameterInfo.u2accessFlags) + " = " +
- ClassUtil.externalParameterAccessFlags(parameterInfo.u2accessFlags) + " [" +
- (parameterInfo.u2nameIndex == 0 ? "" : parameterInfo.getName(clazz)) + "]");
- }
-
-
- // Implementations for LocalVariableInfoVisitor.
-
- public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
- {
- println("v" + localVariableInfo.u2index + ": " +
- localVariableInfo.u2startPC + " -> " +
- (localVariableInfo.u2startPC + localVariableInfo.u2length) + " [" +
- localVariableInfo.getDescriptor(clazz) + " " +
- localVariableInfo.getName(clazz) + "]");
- }
-
-
- // Implementations for LocalVariableTypeInfoVisitor.
-
- public void visitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo)
- {
- println("v" + localVariableTypeInfo.u2index + ": " +
- localVariableTypeInfo.u2startPC + " -> " +
- (localVariableTypeInfo.u2startPC + localVariableTypeInfo.u2length) + " [" +
- localVariableTypeInfo.getSignature(clazz) + " " +
- localVariableTypeInfo.getName(clazz) + "]");
- }
-
-
- // Implementations for AnnotationVisitor.
-
- public void visitAnnotation(Clazz clazz, Annotation annotation)
- {
- println(visitorInfo(annotation) +
- " Annotation [" + annotation.getType(clazz) + "]:");
-
- indent();
- annotation.elementValuesAccept(clazz, this);
- outdent();
- }
-
-
- // Implementations for TypeAnnotationVisitor.
-
- public void visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation)
- {
- println(visitorInfo(typeAnnotation) +
- " Type annotation [" + typeAnnotation.getType(clazz) + "]:");
-
- indent();
- typeAnnotation.targetInfoAccept(clazz, this);
-
- println("Type path (count = " + typeAnnotation.typePath.length + "):");
- indent();
- typeAnnotation.typePathInfosAccept(clazz, this);
- outdent();
-
- typeAnnotation.elementValuesAccept(clazz, this);
-
- outdent();
- }
-
-
- // Implementations for TargetInfoVisitor.
-
- public void visitTypeParameterTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterTargetInfo typeParameterTargetInfo)
- {
- println("Target (type = 0x" + Integer.toHexString(typeParameterTargetInfo.u1targetType) + "): Parameter #" +
- typeParameterTargetInfo.u1typeParameterIndex);
- }
-
-
- public void visitSuperTypeTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, SuperTypeTargetInfo superTypeTargetInfo)
- {
- println("Target (type = 0x" + Integer.toHexString(superTypeTargetInfo.u1targetType) + "): " +
- (superTypeTargetInfo.u2superTypeIndex == 0xffff ?
- "super class" :
- "interface #" + superTypeTargetInfo.u2superTypeIndex));
- }
-
-
- public void visitTypeParameterBoundTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo)
- {
- println("Target (type = 0x" + Integer.toHexString(typeParameterBoundTargetInfo.u1targetType) + "): parameter #" +
- typeParameterBoundTargetInfo.u1typeParameterIndex + ", bound #" + typeParameterBoundTargetInfo.u1boundIndex);
- }
-
-
- public void visitEmptyTargetInfo(Clazz clazz, Member member, TypeAnnotation typeAnnotation, EmptyTargetInfo emptyTargetInfo)
- {
- println("Target (type = 0x" + Integer.toHexString(emptyTargetInfo.u1targetType) + ")");
- }
-
-
- public void visitFormalParameterTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, FormalParameterTargetInfo formalParameterTargetInfo)
- {
- println("Target (type = 0x" + Integer.toHexString(formalParameterTargetInfo.u1targetType) + "): formal parameter #" +
- formalParameterTargetInfo.u1formalParameterIndex);
- }
-
-
- public void visitThrowsTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, ThrowsTargetInfo throwsTargetInfo)
- {
- println("Target (type = 0x" + Integer.toHexString(throwsTargetInfo.u1targetType) + "): throws #" +
- throwsTargetInfo.u2throwsTypeIndex);
- }
-
-
- public void visitLocalVariableTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo)
- {
- println("Target (type = 0x" + Integer.toHexString(localVariableTargetInfo.u1targetType) + "): local variables (count = " +
- localVariableTargetInfo.u2tableLength + ")");
-
- indent();
- localVariableTargetInfo.targetElementsAccept(clazz, method, codeAttribute, typeAnnotation, this);
- outdent();
- }
-
-
- public void visitCatchTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, CatchTargetInfo catchTargetInfo)
- {
- println("Target (type = 0x" + Integer.toHexString(catchTargetInfo.u1targetType) + "): catch #" +
- catchTargetInfo.u2exceptionTableIndex);
- }
-
-
- public void visitOffsetTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, OffsetTargetInfo offsetTargetInfo)
- {
- println("Target (type = 0x" + Integer.toHexString(offsetTargetInfo.u1targetType) + "): offset " +
- offsetTargetInfo.u2offset);
- }
-
-
- public void visitTypeArgumentTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TypeArgumentTargetInfo typeArgumentTargetInfo)
- {
- println("Target (type = 0x" + Integer.toHexString(typeArgumentTargetInfo.u1targetType) + "): offset " +
- typeArgumentTargetInfo.u2offset + ", type argument " +
- typeArgumentTargetInfo.u1typeArgumentIndex);
- }
-
-
- // Implementations for TypePathInfoVisitor.
-
- public void visitTypePathInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo)
- {
- println("kind = " +
- typePathInfo.u1typePathKind + ", argument index = " +
- typePathInfo.u1typeArgumentIndex);
- }
-
-
- // Implementations for LocalVariableTargetElementVisitor.
-
- public void visitLocalVariableTargetElement(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo, LocalVariableTargetElement localVariableTargetElement)
- {
- println("v" +
- localVariableTargetElement.u2index + ": " +
- localVariableTargetElement.u2startPC + " -> " +
- (localVariableTargetElement.u2startPC + localVariableTargetElement.u2length));
- }
-
-
- // Implementations for ElementValueVisitor.
-
- public void visitConstantElementValue(Clazz clazz, Annotation annotation, ConstantElementValue constantElementValue)
- {
- println(visitorInfo(constantElementValue) +
- " Constant element value [" +
- (constantElementValue.u2elementNameIndex == 0 ? "(default)" :
- constantElementValue.getMethodName(clazz)) + " '" +
- constantElementValue.u1tag + "']");
-
- indent();
- clazz.constantPoolEntryAccept(constantElementValue.u2constantValueIndex, this);
- outdent();
- }
-
-
- public void visitEnumConstantElementValue(Clazz clazz, Annotation annotation, EnumConstantElementValue enumConstantElementValue)
- {
- println(visitorInfo(enumConstantElementValue) +
- " Enum constant element value [" +
- (enumConstantElementValue.u2elementNameIndex == 0 ? "(default)" :
- enumConstantElementValue.getMethodName(clazz)) + ", " +
- enumConstantElementValue.getTypeName(clazz) + ", " +
- enumConstantElementValue.getConstantName(clazz) + "]");
- }
-
-
- public void visitClassElementValue(Clazz clazz, Annotation annotation, ClassElementValue classElementValue)
- {
- println(visitorInfo(classElementValue) +
- " Class element value [" +
- (classElementValue.u2elementNameIndex == 0 ? "(default)" :
- classElementValue.getMethodName(clazz)) + ", " +
- classElementValue.getClassName(clazz) + "]");
- }
-
-
- public void visitAnnotationElementValue(Clazz clazz, Annotation annotation, AnnotationElementValue annotationElementValue)
- {
- println(visitorInfo(annotationElementValue) +
- " Annotation element value [" +
- (annotationElementValue.u2elementNameIndex == 0 ? "(default)" :
- annotationElementValue.getMethodName(clazz)) + "]:");
-
- indent();
- annotationElementValue.annotationAccept(clazz, this);
- outdent();
- }
-
-
- public void visitArrayElementValue(Clazz clazz, Annotation annotation, ArrayElementValue arrayElementValue)
- {
- println(visitorInfo(arrayElementValue) +
- " Array element value [" +
- (arrayElementValue.u2elementNameIndex == 0 ? "(default)" :
- arrayElementValue.getMethodName(clazz)) + "]:");
-
- indent();
- arrayElementValue.elementValuesAccept(clazz, annotation, this);
- outdent();
- }
-
-
- // Small utility methods.
-
- private void indent()
- {
- indentation++;
- }
-
- private void outdent()
- {
- indentation--;
- }
-
- private void println(String string)
- {
- print(string);
- println();
-
- }
-
- private void print(String string)
- {
- for (int index = 0; index < indentation; index++)
- {
- ps.print(INDENTATION);
- }
-
- ps.print(string);
- }
-
- private void println()
- {
- ps.println();
- }
-
-
- private String visitorInfo(VisitorAccepter visitorAccepter)
- {
- return visitorAccepter.getVisitorInfo() == null ? "-" : "+";
- }
-}
diff --git a/src/proguard/classfile/visitor/ClassVersionFilter.java b/src/proguard/classfile/visitor/ClassVersionFilter.java
deleted file mode 100644
index 0b80b10..0000000
--- a/src/proguard/classfile/visitor/ClassVersionFilter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-/**
- * This <code>ClassVisitor</code> delegates its visits to program classes to
- * another given <code>ClassVisitor</code>, but only when the class version
- * number of the visited program class lies in a given range.
- *
- * @author Eric Lafortune
- */
-public class ClassVersionFilter implements ClassVisitor
-{
- private final int minimumClassVersion;
- private final int maximumClassVersion;
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new ClassVersionFilter.
- * @param minimumClassVersion the minimum class version number.
- * @param classVisitor the <code>ClassVisitor</code> to which visits
- * will be delegated.
- */
- public ClassVersionFilter(int minimumClassVersion,
- ClassVisitor classVisitor)
- {
- this(minimumClassVersion, Integer.MAX_VALUE, classVisitor);
- }
-
-
- /**
- * Creates a new ClassVersionFilter.
- * @param minimumClassVersion the minimum class version number.
- * @param maximumClassVersion the maximum class version number.
- * @param classVisitor the <code>ClassVisitor</code> to which visits
- * will be delegated.
- */
- public ClassVersionFilter(int minimumClassVersion,
- int maximumClassVersion,
- ClassVisitor classVisitor)
- {
- this.minimumClassVersion = minimumClassVersion;
- this.maximumClassVersion = maximumClassVersion;
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- if (programClass.u4version >= minimumClassVersion &&
- programClass.u4version <= maximumClassVersion)
- {
- classVisitor.visitProgramClass(programClass);
- }
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- // Library classes don't have version numbers.
- }
-}
diff --git a/src/proguard/classfile/visitor/ClassVersionSetter.java b/src/proguard/classfile/visitor/ClassVersionSetter.java
deleted file mode 100644
index 3caf045..0000000
--- a/src/proguard/classfile/visitor/ClassVersionSetter.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-import java.util.Set;
-
-/**
- * This <code>ClassVisitor</code> sets the version number of the program classes
- * that it visits.
- *
- * @author Eric Lafortune
- */
-public class ClassVersionSetter implements ClassVisitor
-{
- private final int classVersion;
-
- private final Set newerClassVersions;
-
-
- /**
- * Creates a new ClassVersionSetter.
- * @param classVersion the class version number.
- */
- public ClassVersionSetter(int classVersion)
- {
- this(classVersion, null);
- }
-
-
- /**
- * Creates a new ClassVersionSetter that also stores any newer class version
- * numbers that it encounters while visiting program classes.
- * @param classVersion the class version number.
- * @param newerClassVersions the <code>Set</code> in which newer class
- * version numbers can be collected.
- */
- public ClassVersionSetter(int classVersion,
- Set newerClassVersions)
- {
- this.classVersion = classVersion;
- this.newerClassVersions = newerClassVersions;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- if (programClass.u4version > classVersion &&
- newerClassVersions != null)
- {
- newerClassVersions.add(new Integer(programClass.u4version));
- }
-
- programClass.u4version = classVersion;
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- // Library classes don't have version numbers.
- }
-}
diff --git a/src/proguard/classfile/visitor/ClassVisitor.java b/src/proguard/classfile/visitor/ClassVisitor.java
deleted file mode 100644
index 979b822..0000000
--- a/src/proguard/classfile/visitor/ClassVisitor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This interface specifies the methods for a visitor of
- * <code>Clazz</code> objects.
- *
- * @author Eric Lafortune
- */
-public interface ClassVisitor
-{
- public void visitProgramClass(ProgramClass programClass);
- public void visitLibraryClass(LibraryClass libraryClass);
-}
diff --git a/src/proguard/classfile/visitor/ConcreteClassDownTraveler.java b/src/proguard/classfile/visitor/ConcreteClassDownTraveler.java
deleted file mode 100644
index d82a674..0000000
--- a/src/proguard/classfile/visitor/ConcreteClassDownTraveler.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This <code>ClassVisitor</code> lets a given <code>ClassVisitor</code>
- * travel to the first concrete subclasses down in its hierarchy of abstract
- * classes and concrete classes.
- *
- * @author Eric Lafortune
- */
-public class ConcreteClassDownTraveler
-implements ClassVisitor
-{
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new ConcreteClassDownTraveler.
- * @param classVisitor the <code>ClassVisitor</code> to
- * which visits will be delegated.
- */
- public ConcreteClassDownTraveler(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- // Is this an abstract class or an interface?
- if ((programClass.getAccessFlags() &
- (ClassConstants.ACC_INTERFACE |
- ClassConstants.ACC_ABSTRACT)) != 0)
- {
- // Travel down the hierarchy.
- Clazz[] subClasses = programClass.subClasses;
- if (subClasses != null)
- {
- for (int index = 0; index < subClasses.length; index++)
- {
- subClasses[index].accept(this);
- }
- }
- }
- else
- {
- // Visit the class. Don't descend any further.
- programClass.accept(classVisitor);
- }
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- // Is this an abstract class or interface?
- if ((libraryClass.getAccessFlags() &
- (ClassConstants.ACC_INTERFACE |
- ClassConstants.ACC_ABSTRACT)) != 0)
- {
- // Travel down the hierarchy.
- Clazz[] subClasses = libraryClass.subClasses;
- if (subClasses != null)
- {
- for (int index = 0; index < subClasses.length; index++)
- {
- subClasses[index].accept(this);
- }
- }
- }
- else
- {
- // Visit the class. Don't descend any further.
- libraryClass.accept(classVisitor);
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/DotClassClassVisitor.java b/src/proguard/classfile/visitor/DotClassClassVisitor.java
deleted file mode 100644
index 5960ef6..0000000
--- a/src/proguard/classfile/visitor/DotClassClassVisitor.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.attribute.CodeAttribute;
-import proguard.classfile.constant.*;
-import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.classfile.instruction.*;
-import proguard.classfile.instruction.visitor.InstructionVisitor;
-import proguard.classfile.util.SimplifiedVisitor;
-
-
-/**
- * This InstructionVisitor lets a given <code>ClassVisitor</code> visit all
- * classes involved in any <code>.class</code> constructs that it visits.
- * <p>
- * Note that before JDK 1.5, <code>.class</code> constructs are actually
- * compiled differently, using <code>Class.forName</code> constructs.
- *
- * @author Eric Lafortune
- */
-public class DotClassClassVisitor
-extends SimplifiedVisitor
-implements InstructionVisitor,
- ConstantVisitor
-{
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new ClassHierarchyTraveler.
- * @param classVisitor the <code>ClassVisitor</code> to which visits will
- * be delegated.
- */
- public DotClassClassVisitor(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for InstructionVisitor.
-
- public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction) {}
-
-
- public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
- {
- byte opcode = constantInstruction.opcode;
-
- // Could this instruction be a .class construct?
- if (opcode == InstructionConstants.OP_LDC ||
- opcode == InstructionConstants.OP_LDC_W)
- {
- clazz.constantPoolEntryAccept(constantInstruction.constantIndex,
- this);
- }
- }
-
-
- // Implementations for ConstantVisitor.
-
- public void visitAnyConstant(Clazz clazz, Constant constant) {}
-
-
- public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
- {
- // Visit the referenced class from the .class construct.
- classConstant.referencedClassAccept(classVisitor);
- }
-}
diff --git a/src/proguard/classfile/visitor/DynamicReturnedClassVisitor.java b/src/proguard/classfile/visitor/DynamicReturnedClassVisitor.java
deleted file mode 100644
index f9ac3cb..0000000
--- a/src/proguard/classfile/visitor/DynamicReturnedClassVisitor.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.Clazz;
-import proguard.classfile.constant.*;
-import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.classfile.util.*;
-
-/**
- * This ConstantVisitor lets a given ClassVisitor visit all the referenced
- * classes that are returned by the invoke dynamic constants that it visits.
- *
- * @author Eric Lafortune
- */
-public class DynamicReturnedClassVisitor
-extends SimplifiedVisitor
-implements ConstantVisitor
-{
- protected final ClassVisitor classVisitor;
-
-
- public DynamicReturnedClassVisitor(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ConstantVisitor.
-
- public void visitAnyConstant(Clazz clazz, Constant constant) {}
-
-
- public void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant)
- {
- // Is the method returning a class type?
- Clazz[] referencedClasses = invokeDynamicConstant.referencedClasses;
- if (referencedClasses != null &&
- referencedClasses.length > 0 &&
- ClassUtil.isInternalClassType(ClassUtil.internalMethodReturnType(invokeDynamicConstant.getType(clazz))))
- {
- // Let the visitor visit the return type class, if any.
- Clazz referencedClass = referencedClasses[referencedClasses.length - 1];
- if (referencedClass != null)
- {
- referencedClass.accept(classVisitor);
- }
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/ExceptClassFilter.java b/src/proguard/classfile/visitor/ExceptClassFilter.java
deleted file mode 100644
index b216ba7..0000000
--- a/src/proguard/classfile/visitor/ExceptClassFilter.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-/**
- * This <code>ClassVisitor</code> delegates its visits to another given
- * <code>ClassVisitor</code>, except for one given class.
- *
- * @author Eric Lafortune
- */
-public class ExceptClassFilter implements ClassVisitor
-{
- private final Clazz exceptClass;
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new ClassNameFilter.
- * @param exceptClass the class that will not be visited.
- * @param classVisitor the <code>ClassVisitor</code> to which visits will
- * be delegated.
- */
- public ExceptClassFilter(Clazz exceptClass,
- ClassVisitor classVisitor)
- {
- this.exceptClass = exceptClass;
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- if (!programClass.equals(exceptClass))
- {
- classVisitor.visitProgramClass(programClass);
- }
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- if (!libraryClass.equals(exceptClass))
- {
- classVisitor.visitLibraryClass(libraryClass);
- }
- }
-} \ No newline at end of file
diff --git a/src/proguard/classfile/visitor/ExceptClassesFilter.java b/src/proguard/classfile/visitor/ExceptClassesFilter.java
deleted file mode 100644
index acc758c..0000000
--- a/src/proguard/classfile/visitor/ExceptClassesFilter.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-/**
- * This <code>ClassVisitor</code> delegates its visits to another given
- * <code>ClassVisitor</code>, except for classes are in a given list.
- *
- * @author Eric Lafortune
- */
-public class ExceptClassesFilter implements ClassVisitor
-{
- private final Clazz[] exceptClasses;
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new ExceptClassesFilter.
- * @param exceptClasses the classes that will not be visited.
- * @param classVisitor the <code>ClassVisitor</code> to which visits will
- * be delegated.
- */
- public ExceptClassesFilter(Clazz[] exceptClasses,
- ClassVisitor classVisitor)
- {
- this.exceptClasses = exceptClasses;
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- if (!present(programClass))
- {
- classVisitor.visitProgramClass(programClass);
- }
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- if (!present(libraryClass))
- {
- classVisitor.visitLibraryClass(libraryClass);
- }
- }
-
-
- // Small utility methods.
-
- private boolean present(Clazz clazz)
- {
- if (exceptClasses == null)
- {
- return false;
- }
-
- for (int index = 0; index < exceptClasses.length; index++)
- {
- if (exceptClasses[index].equals(clazz))
- {
- return true;
- }
- }
-
- return false;
- }
-} \ No newline at end of file
diff --git a/src/proguard/classfile/visitor/ExceptionCounter.java b/src/proguard/classfile/visitor/ExceptionCounter.java
deleted file mode 100644
index a3071a6..0000000
--- a/src/proguard/classfile/visitor/ExceptionCounter.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.visitor.ExceptionInfoVisitor;
-
-/**
- * This ExceptionInfoVisitor counts the number of exceptions that has been visited.
- *
- * @author Eric Lafortune
- */
-public class ExceptionCounter implements ExceptionInfoVisitor
-{
- private int count;
-
-
- /**
- * Returns the number of exceptions that has been visited so far.
- */
- public int getCount()
- {
- return count;
- }
-
-
- // Implementations for ExceptionInfoVisitor.
-
- public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
- {
- count++;
- }
-}
diff --git a/src/proguard/classfile/visitor/ExceptionExcludedOffsetFilter.java b/src/proguard/classfile/visitor/ExceptionExcludedOffsetFilter.java
deleted file mode 100644
index c7b05db..0000000
--- a/src/proguard/classfile/visitor/ExceptionExcludedOffsetFilter.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.visitor.ExceptionInfoVisitor;
-
-/**
- * This <code>ExceptionInfoVisitor</code> delegates its visits to another given
- * <code>ExceptionInfoVisitor</code>, but only when the visited exception
- * does not cover the instruction at the given offset.
- *
- * @author Eric Lafortune
- */
-public class ExceptionExcludedOffsetFilter
-implements ExceptionInfoVisitor
-{
- private final int instructionOffset;
- private final ExceptionInfoVisitor exceptionInfoVisitor;
-
-
- /**
- * Creates a new ExceptionExcludedOffsetFilter.
- * @param instructionOffset the instruction offset.
- * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
- * will be delegated.
- */
- public ExceptionExcludedOffsetFilter(int instructionOffset,
- ExceptionInfoVisitor exceptionInfoVisitor)
- {
- this.instructionOffset = instructionOffset;
- this.exceptionInfoVisitor = exceptionInfoVisitor;
- }
-
-
- // Implementations for ExceptionInfoVisitor.
-
- public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
- {
- if (!exceptionInfo.isApplicable(instructionOffset))
- {
- exceptionInfoVisitor.visitExceptionInfo(clazz, method, codeAttribute, exceptionInfo);
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/ExceptionHandlerConstantVisitor.java b/src/proguard/classfile/visitor/ExceptionHandlerConstantVisitor.java
deleted file mode 100644
index 3a08892..0000000
--- a/src/proguard/classfile/visitor/ExceptionHandlerConstantVisitor.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.visitor.ExceptionInfoVisitor;
-import proguard.classfile.constant.visitor.ConstantVisitor;
-
-/**
- * This <code>ExceptionInfoVisitor</code> lets a given
- * <code>ConstantVisitor</code> visit all catch class constants of exceptions
- * that it visits.
- *
- * @author Eric Lafortune
- */
-public class ExceptionHandlerConstantVisitor
-implements ExceptionInfoVisitor
-{
- private final ConstantVisitor constantVisitor;
-
-
- /**
- * Creates a new ExceptionHandlerConstantVisitor.
- * @param constantVisitor the ConstantVisitor that will visit the catch
- * class constants.
- */
- public ExceptionHandlerConstantVisitor(ConstantVisitor constantVisitor)
- {
- this.constantVisitor = constantVisitor;
- }
-
-
- // Implementations for ExceptionInfoVisitor.
-
- public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
- {
- int catchType = exceptionInfo.u2catchType;
- if (catchType != 0)
- {
- clazz.constantPoolEntryAccept(catchType, constantVisitor);
- }
- }
-} \ No newline at end of file
diff --git a/src/proguard/classfile/visitor/ExceptionHandlerFilter.java b/src/proguard/classfile/visitor/ExceptionHandlerFilter.java
deleted file mode 100644
index 25df0ac..0000000
--- a/src/proguard/classfile/visitor/ExceptionHandlerFilter.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.visitor.ExceptionInfoVisitor;
-
-/**
- * This <code>ExceptionInfoVisitor</code> delegates its visits to another given
- * <code>ExceptionInfoVisitor</code>, but only when the visited exception
- * targets an instruction in the given range of offsets.
- *
- * @author Eric Lafortune
- */
-public class ExceptionHandlerFilter
-implements ExceptionInfoVisitor
-{
- private final int startOffset;
- private final int endOffset;
- private final ExceptionInfoVisitor exceptionInfoVisitor;
-
-
- /**
- * Creates a new ExceptionHandlerFilter.
- * @param startOffset the start of the instruction offset range.
- * @param endOffset the end of the instruction offset range.
- * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
- * will be delegated.
- */
- public ExceptionHandlerFilter(int startOffset,
- int endOffset,
- ExceptionInfoVisitor exceptionInfoVisitor)
- {
- this.startOffset = startOffset;
- this.endOffset = endOffset;
- this.exceptionInfoVisitor = exceptionInfoVisitor;
- }
-
-
- // Implementations for ExceptionInfoVisitor.
-
- public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
- {
- int handlerPC = exceptionInfo.u2handlerPC;
- if (handlerPC >= startOffset &&
- handlerPC < endOffset)
- {
- exceptionInfoVisitor.visitExceptionInfo(clazz, method, codeAttribute, exceptionInfo);
- }
- }
-} \ No newline at end of file
diff --git a/src/proguard/classfile/visitor/ExceptionOffsetFilter.java b/src/proguard/classfile/visitor/ExceptionOffsetFilter.java
deleted file mode 100644
index babee27..0000000
--- a/src/proguard/classfile/visitor/ExceptionOffsetFilter.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.visitor.ExceptionInfoVisitor;
-
-/**
- * This <code>ExceptionInfoVisitor</code> delegates its visits to another given
- * <code>ExceptionInfoVisitor</code>, but only when the visited exception
- * covers the instruction at the given offset.
- *
- * @author Eric Lafortune
- */
-public class ExceptionOffsetFilter
-implements ExceptionInfoVisitor
-{
- private final int instructionOffset;
- private final ExceptionInfoVisitor exceptionInfoVisitor;
-
-
- /**
- * Creates a new ExceptionOffsetFilter.
- * @param instructionOffset the instruction offset.
- * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
- * will be delegated.
- */
- public ExceptionOffsetFilter(int instructionOffset,
- ExceptionInfoVisitor exceptionInfoVisitor)
- {
- this.instructionOffset = instructionOffset;
- this.exceptionInfoVisitor = exceptionInfoVisitor;
- }
-
-
- // Implementations for ExceptionInfoVisitor.
-
- public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
- {
- if (exceptionInfo.isApplicable(instructionOffset))
- {
- exceptionInfoVisitor.visitExceptionInfo(clazz, method, codeAttribute, exceptionInfo);
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/ExceptionRangeFilter.java b/src/proguard/classfile/visitor/ExceptionRangeFilter.java
deleted file mode 100644
index 9ce10ef..0000000
--- a/src/proguard/classfile/visitor/ExceptionRangeFilter.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.visitor.ExceptionInfoVisitor;
-
-/**
- * This <code>ExceptionInfoVisitor</code> delegates its visits to another given
- * <code>ExceptionInfoVisitor</code>, but only when the visited exception
- * overlaps with the given instruction range.
- *
- * @author Eric Lafortune
- */
-public class ExceptionRangeFilter
-implements ExceptionInfoVisitor
-{
- private final int startOffset;
- private final int endOffset;
- private final ExceptionInfoVisitor exceptionInfoVisitor;
-
-
- /**
- * Creates a new ExceptionRangeFilter.
- * @param startOffset the start offset of the instruction range.
- * @param endOffset the end offset of the instruction range.
- * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
- * will be delegated.
- */
- public ExceptionRangeFilter(int startOffset,
- int endOffset,
- ExceptionInfoVisitor exceptionInfoVisitor)
- {
- this.startOffset = startOffset;
- this.endOffset = endOffset;
- this.exceptionInfoVisitor = exceptionInfoVisitor;
- }
-
-
- // Implementations for ExceptionInfoVisitor.
-
- public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
- {
- if (exceptionInfo.isApplicable(startOffset, endOffset))
- {
- exceptionInfoVisitor.visitExceptionInfo(clazz, method, codeAttribute, exceptionInfo);
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/ImplementedClassConstantFilter.java b/src/proguard/classfile/visitor/ImplementedClassConstantFilter.java
deleted file mode 100644
index ac05841..0000000
--- a/src/proguard/classfile/visitor/ImplementedClassConstantFilter.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.Clazz;
-import proguard.classfile.constant.ClassConstant;
-import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.classfile.util.SimplifiedVisitor;
-
-/**
- * This <code>ConstantVisitor</code> delegates its visits to class constants
- * to another given <code>ConstantVisitor</code>, except for classes that
- * extend or implement a given class. This exception includes the class itself.
- *
- * @author Eric Lafortune
- */
-public class ImplementedClassConstantFilter
-extends SimplifiedVisitor
-implements ConstantVisitor
-{
- private final Clazz implementedClass;
- private final ConstantVisitor constantVisitor;
-
-
- /**
- * Creates a new ImplementedClassConstantFilter.
- * @param implementedClass the class whose implementations will not be
- * visited.
- * @param constantVisitor the <code>ConstantVisitor</code> to which visits
- * will be delegated.
- */
- public ImplementedClassConstantFilter(Clazz implementedClass,
- ConstantVisitor constantVisitor)
- {
- this.implementedClass = implementedClass;
- this.constantVisitor = constantVisitor;
- }
-
-
- // Implementations for ConstantVisitor.
-
- public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
- {
- Clazz referencedClass = classConstant.referencedClass;
- if (referencedClass == null ||
- !referencedClass.extendsOrImplements(implementedClass))
- {
- constantVisitor.visitClassConstant(clazz, classConstant);
- }
- }
-} \ No newline at end of file
diff --git a/src/proguard/classfile/visitor/ImplementedClassFilter.java b/src/proguard/classfile/visitor/ImplementedClassFilter.java
deleted file mode 100644
index accbb6a..0000000
--- a/src/proguard/classfile/visitor/ImplementedClassFilter.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-/**
- * This <code>ClassVisitor</code> delegates its visits to another given
- * <code>ClassVisitor</code>, except for classes that extend or implement
- * a given class.
- *
- * @author Eric Lafortune
- */
-public class ImplementedClassFilter implements ClassVisitor
-{
- private final Clazz implementedClass;
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new ImplementedClassFilter.
- * @param implementedClass the class whose implementations will not be
- * visited.
- * @param classVisitor the <code>ClassVisitor</code> to which visits will
- * be delegated.
- */
- public ImplementedClassFilter(Clazz implementedClass,
- ClassVisitor classVisitor)
- {
- this.implementedClass = implementedClass;
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- if (!programClass.extendsOrImplements(implementedClass))
- {
- classVisitor.visitProgramClass(programClass);
- }
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- if (!libraryClass.extendsOrImplements(implementedClass))
- {
- classVisitor.visitLibraryClass(libraryClass);
- }
- }
-} \ No newline at end of file
diff --git a/src/proguard/classfile/visitor/ImplementingClassConstantFilter.java b/src/proguard/classfile/visitor/ImplementingClassConstantFilter.java
deleted file mode 100644
index ee42fe2..0000000
--- a/src/proguard/classfile/visitor/ImplementingClassConstantFilter.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.Clazz;
-import proguard.classfile.constant.ClassConstant;
-import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.classfile.util.SimplifiedVisitor;
-
-/**
- * This <code>ConstantVisitor</code> delegates its visits to class constants
- * to another given <code>ConstantVisitor</code>, except for classes that
- * are extended or implemented by a given class. This exception includes the
- * class itself.
- *
- * @author Eric Lafortune
- */
-public class ImplementingClassConstantFilter
-extends SimplifiedVisitor
-implements ConstantVisitor
-{
- private final Clazz implementingClass;
- private final ConstantVisitor constantVisitor;
-
-
- /**
- * Creates a new ImplementingClassConstantFilter.
- * @param implementingClass the class whose superclasses and interfaces will
- * not be visited.
- * @param constantVisitor the <code>ConstantVisitor</code> to which visits
- * will be delegated.
- */
- public ImplementingClassConstantFilter(Clazz implementingClass,
- ConstantVisitor constantVisitor)
- {
- this.implementingClass = implementingClass;
- this.constantVisitor = constantVisitor;
- }
-
-
- // Implementations for ConstantVisitor.
-
- public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
- {
- Clazz referencedClass = classConstant.referencedClass;
- if (referencedClass == null ||
- !implementingClass.extendsOrImplements(referencedClass))
- {
- constantVisitor.visitClassConstant(clazz, classConstant);
- }
- }
-} \ No newline at end of file
diff --git a/src/proguard/classfile/visitor/LibraryClassFilter.java b/src/proguard/classfile/visitor/LibraryClassFilter.java
deleted file mode 100644
index 894c029..0000000
--- a/src/proguard/classfile/visitor/LibraryClassFilter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This <code>ClassVisitor</code> delegates its visits to another given
- * <code>ClassVisitor</code>, but only when visiting library classes.
- *
- * @author Eric Lafortune
- */
-public class LibraryClassFilter implements ClassVisitor
-{
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new LibraryClassFilter.
- * @param classVisitor the <code>ClassVisitor</code> to which visits
- * will be delegated.
- */
- public LibraryClassFilter(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- // Don't delegate visits to program classes.
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- classVisitor.visitLibraryClass(libraryClass);
- }
-}
diff --git a/src/proguard/classfile/visitor/LibraryMemberFilter.java b/src/proguard/classfile/visitor/LibraryMemberFilter.java
deleted file mode 100644
index c58798c..0000000
--- a/src/proguard/classfile/visitor/LibraryMemberFilter.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This <code>MemberVisitor</code> delegates its visits to another given
- * <code>MemberVisitor</code>, but only when visiting members of library
- * classes.
- *
- * @author Eric Lafortune
- */
-public class LibraryMemberFilter implements MemberVisitor
-{
- private final MemberVisitor memberVisitor;
-
-
- /**
- * Creates a new ProgramMemberFilter.
- * @param memberVisitor the <code>MemberVisitor</code> to which
- * visits will be delegated.
- */
- public LibraryMemberFilter(MemberVisitor memberVisitor)
- {
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- // Don't delegate visits to program members.
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- // Don't delegate visits to program members.
- }
-
-
- public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- {
- memberVisitor.visitLibraryField(libraryClass, libraryField);
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- memberVisitor.visitLibraryMethod(libraryClass, libraryMethod);
- }
-}
diff --git a/src/proguard/classfile/visitor/MemberAccessFilter.java b/src/proguard/classfile/visitor/MemberAccessFilter.java
deleted file mode 100644
index 4041e77..0000000
--- a/src/proguard/classfile/visitor/MemberAccessFilter.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This <code>MemberVisitor</code> delegates its visits to another given
- * <code>MemberVisitor</code>, but only when the visited member has the proper
- * access flags.
- * <p>
- * If conflicting access flags (public/private/protected) are specified,
- * having one of them set will be considered sufficient.
- *
- * @see ClassConstants
- *
- * @author Eric Lafortune
- */
-public class MemberAccessFilter
-implements MemberVisitor
-{
- // A mask of conflicting access flags. These are interpreted in a special
- // way if more of them are required at the same time. In that case, one
- // of them being set is sufficient.
- private static final int ACCESS_MASK =
- ClassConstants.ACC_PUBLIC |
- ClassConstants.ACC_PRIVATE |
- ClassConstants.ACC_PROTECTED;
-
- private final int requiredSetAccessFlags;
- private final int requiredUnsetAccessFlags;
- private final int requiredOneSetAccessFlags;
- private final MemberVisitor memberVisitor;
-
-
- /**
- * Creates a new MemberAccessFilter.
- * @param requiredSetAccessFlags the class access flags that should be
- * set.
- * @param requiredUnsetAccessFlags the class access flags that should be
- * unset.
- * @param memberVisitor the <code>MemberVisitor</code> to
- * which visits will be delegated.
- */
- public MemberAccessFilter(int requiredSetAccessFlags,
- int requiredUnsetAccessFlags,
- MemberVisitor memberVisitor)
- {
- this.requiredSetAccessFlags = requiredSetAccessFlags & ~ACCESS_MASK;
- this.requiredUnsetAccessFlags = requiredUnsetAccessFlags;
- this.requiredOneSetAccessFlags = requiredSetAccessFlags & ACCESS_MASK;
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- if (accepted(programField.getAccessFlags()))
- {
- memberVisitor.visitProgramField(programClass, programField);
- }
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- if (accepted(programMethod.getAccessFlags()))
- {
- memberVisitor.visitProgramMethod(programClass, programMethod);
- }
- }
-
-
- public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- {
- if (accepted(libraryField.getAccessFlags()))
- {
- memberVisitor.visitLibraryField(libraryClass, libraryField);
- }
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- if (accepted(libraryMethod.getAccessFlags()))
- {
- memberVisitor.visitLibraryMethod(libraryClass, libraryMethod);
- }
- }
-
-
- // Small utility methods.
-
- private boolean accepted(int accessFlags)
- {
- return (requiredSetAccessFlags & ~accessFlags) == 0 &&
- (requiredUnsetAccessFlags & accessFlags) == 0 &&
- (requiredOneSetAccessFlags == 0 ||
- (requiredOneSetAccessFlags & accessFlags) != 0);
- }
-}
diff --git a/src/proguard/classfile/visitor/MemberClassAccessFilter.java b/src/proguard/classfile/visitor/MemberClassAccessFilter.java
deleted file mode 100644
index 40418f4..0000000
--- a/src/proguard/classfile/visitor/MemberClassAccessFilter.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.util.*;
-
-/**
- * This <code>MemberVisitor</code> delegates its visits to another given
- * <code>MemberVisitor</code>, but only when the visited member is accessible
- * from the given referencing class.
- *
- * @author Eric Lafortune
- */
-public class MemberClassAccessFilter
-implements MemberVisitor
-{
- private final Clazz referencingClass;
- private final MemberVisitor memberVisitor;
-
-
- /**
- * Creates a new MemberAccessFilter.
- * @param referencingClass the class that is accessing the member.
- * @param memberVisitor the <code>MemberVisitor</code> to which visits
- * will be delegated.
- */
- public MemberClassAccessFilter(Clazz referencingClass,
- MemberVisitor memberVisitor)
- {
- this.referencingClass = referencingClass;
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- if (accepted(programClass, programField.getAccessFlags()))
- {
- memberVisitor.visitProgramField(programClass, programField);
- }
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- if (accepted(programClass, programMethod.getAccessFlags()))
- {
- memberVisitor.visitProgramMethod(programClass, programMethod);
- }
- }
-
-
- public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- {
- if (accepted(libraryClass, libraryField.getAccessFlags()))
- {
- memberVisitor.visitLibraryField(libraryClass, libraryField);
- }
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- if (accepted(libraryClass, libraryMethod.getAccessFlags()))
- {
- memberVisitor.visitLibraryMethod(libraryClass, libraryMethod);
- }
- }
-
-
- // Small utility methods.
-
- private boolean accepted(Clazz clazz, int memberAccessFlags)
- {
- int accessLevel = AccessUtil.accessLevel(memberAccessFlags);
-
- return
- (accessLevel >= AccessUtil.PUBLIC ) ||
- (accessLevel >= AccessUtil.PRIVATE && referencingClass.equals(clazz) ) ||
- (accessLevel >= AccessUtil.PACKAGE_VISIBLE && (ClassUtil.internalPackageName(referencingClass.getName()).equals(
- ClassUtil.internalPackageName(clazz.getName())))) ||
- (accessLevel >= AccessUtil.PROTECTED && (referencingClass.extends_(clazz) ||
- referencingClass.extendsOrImplements(clazz)) );
- }
-}
diff --git a/src/proguard/classfile/visitor/MemberCollector.java b/src/proguard/classfile/visitor/MemberCollector.java
deleted file mode 100644
index d1a3d2e..0000000
--- a/src/proguard/classfile/visitor/MemberCollector.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.util.SimplifiedVisitor;
-
-import java.util.Set;
-
-/**
- * This MemberVisitor collects the concatenated name/descriptor strings of
- * class members that have been visited.
- *
- * @author Eric Lafortune
- */
-public class MemberCollector
-extends SimplifiedVisitor
-implements MemberVisitor
-{
- private final Set set;
-
-
- /**
- * Creates a new MemberCollector.
- * @param set the <code>Set</code> in which all method names/descriptor
- * strings will be collected.
- */
- public MemberCollector(Set set)
- {
- this.set = set;
- }
-
-
- // Implementations for MemberVisitor.
-
-
- public void visitAnyMember(Clazz clazz, Member member)
- {
- set.add(member.getName(clazz) + member.getDescriptor(clazz));
- }
-} \ No newline at end of file
diff --git a/src/proguard/classfile/visitor/MemberCounter.java b/src/proguard/classfile/visitor/MemberCounter.java
deleted file mode 100644
index 55df638..0000000
--- a/src/proguard/classfile/visitor/MemberCounter.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-/**
- * This MemberVisitor counts the number of class members that have been visited.
- *
- * @author Eric Lafortune
- */
-public class MemberCounter implements MemberVisitor
-{
- private int count;
-
-
- /**
- * Returns the number of class members that has been visited so far.
- */
- public int getCount()
- {
- return count;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitLibraryField(LibraryClass libraryClass,
- LibraryField libraryField)
- {
- count++;
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass,
- LibraryMethod libraryMethod)
- {
- count++;
- }
-
-
- public void visitProgramField(ProgramClass programClass,
- ProgramField programField)
- {
- count++;
- }
-
-
- public void visitProgramMethod(ProgramClass programClass,
- ProgramMethod programMethod)
- {
- count++;
- }
-}
diff --git a/src/proguard/classfile/visitor/MemberDescriptorFilter.java b/src/proguard/classfile/visitor/MemberDescriptorFilter.java
deleted file mode 100644
index 3c0a646..0000000
--- a/src/proguard/classfile/visitor/MemberDescriptorFilter.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.util.*;
-
-
-/**
- * This <code>MemberVisitor</code> delegates its visits to another given
- * <code>MemberVisitor</code>, but only when the visited member
- * has a descriptor that matches a given regular expression.
- *
- * @author Eric Lafortune
- */
-public class MemberDescriptorFilter implements MemberVisitor
-{
- private final StringMatcher regularExpressionMatcher;
- private final MemberVisitor memberVisitor;
-
-
- /**
- * Creates a new MemberDescriptorFilter.
- * @param regularExpression the regular expression against which member
- * descriptors will be matched.
- * @param memberVisitor the <code>MemberVisitor</code> to which visits
- * will be delegated.
- */
- public MemberDescriptorFilter(String regularExpression,
- MemberVisitor memberVisitor)
- {
- this(new ClassNameParser().parse(regularExpression), memberVisitor);
- }
-
-
- /**
- * Creates a new MemberDescriptorFilter.
- * @param regularExpressionMatcher the regular expression against which
- * member descriptors will be matched.
- * @param memberVisitor the <code>MemberVisitor</code> to which
- * visits will be delegated.
- */
- public MemberDescriptorFilter(StringMatcher regularExpressionMatcher,
- MemberVisitor memberVisitor)
- {
- this.regularExpressionMatcher = regularExpressionMatcher;
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- if (accepted(programField.getDescriptor(programClass)))
- {
- memberVisitor.visitProgramField(programClass, programField);
- }
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- if (accepted(programMethod.getDescriptor(programClass)))
- {
- memberVisitor.visitProgramMethod(programClass, programMethod);
- }
- }
-
-
- public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- {
- if (accepted(libraryField.getDescriptor(libraryClass)))
- {
- memberVisitor.visitLibraryField(libraryClass, libraryField);
- }
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- if (accepted(libraryMethod.getDescriptor(libraryClass)))
- {
- memberVisitor.visitLibraryMethod(libraryClass, libraryMethod);
- }
- }
-
-
- // Small utility methods.
-
- private boolean accepted(String name)
- {
- return regularExpressionMatcher.matches(name);
- }
-}
diff --git a/src/proguard/classfile/visitor/MemberDescriptorReferencedClassVisitor.java b/src/proguard/classfile/visitor/MemberDescriptorReferencedClassVisitor.java
deleted file mode 100644
index 9ac1219..0000000
--- a/src/proguard/classfile/visitor/MemberDescriptorReferencedClassVisitor.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.annotation.*;
-import proguard.classfile.attribute.annotation.visitor.*;
-import proguard.classfile.attribute.visitor.*;
-import proguard.classfile.constant.*;
-import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.classfile.util.SimplifiedVisitor;
-
-/**
- * This MemberVisitor lets a given ClassVisitor visit all the classes
- * referenced by the descriptors of the class members that it visits.
- *
- * @author Eric Lafortune
- */
-public class MemberDescriptorReferencedClassVisitor
-extends SimplifiedVisitor
-implements MemberVisitor
-{
- private final ClassVisitor classVisitor;
-
-
- public MemberDescriptorReferencedClassVisitor(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramMember(ProgramClass programClass, ProgramMember programMember)
- {
- // Let the visitor visit the classes referenced in the descriptor string.
- programMember.referencedClassesAccept(classVisitor);
- }
-
-
- public void visitLibraryMember(LibraryClass programClass, LibraryMember libraryMember)
- {
- // Let the visitor visit the classes referenced in the descriptor string.
- libraryMember.referencedClassesAccept(classVisitor);
- }
-}
diff --git a/src/proguard/classfile/visitor/MemberNameFilter.java b/src/proguard/classfile/visitor/MemberNameFilter.java
deleted file mode 100644
index b40b208..0000000
--- a/src/proguard/classfile/visitor/MemberNameFilter.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.util.*;
-
-
-/**
- * This <code>MemberVisitor</code> delegates its visits to another given
- * <code>MemberVisitor</code>, but only when the visited member
- * has a name that matches a given regular expression.
- *
- * @author Eric Lafortune
- */
-public class MemberNameFilter implements MemberVisitor
-{
- private final StringMatcher regularExpressionMatcher;
- private final MemberVisitor memberVisitor;
-
-
- /**
- * Creates a new MemberNameFilter.
- * @param regularExpression the regular expression against which member
- * names will be matched.
- * @param memberVisitor the <code>MemberVisitor</code> to which visits
- * will be delegated.
- */
- public MemberNameFilter(String regularExpression,
- MemberVisitor memberVisitor)
- {
- this(new ListParser(new NameParser()).parse(regularExpression),
- memberVisitor);
- }
-
-
- /**
- * Creates a new MemberNameFilter.
- * @param regularExpressionMatcher the regular expression against which
- * member names will be matched.
- * @param memberVisitor the <code>MemberVisitor</code> to which
- * visits will be delegated.
- */
- public MemberNameFilter(StringMatcher regularExpressionMatcher,
- MemberVisitor memberVisitor)
- {
- this.regularExpressionMatcher = regularExpressionMatcher;
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- if (accepted(programField.getName(programClass)))
- {
- memberVisitor.visitProgramField(programClass, programField);
- }
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- if (accepted(programMethod.getName(programClass)))
- {
- memberVisitor.visitProgramMethod(programClass, programMethod);
- }
- }
-
-
- public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- {
- if (accepted(libraryField.getName(libraryClass)))
- {
- memberVisitor.visitLibraryField(libraryClass, libraryField);
- }
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- if (accepted(libraryMethod.getName(libraryClass)))
- {
- memberVisitor.visitLibraryMethod(libraryClass, libraryMethod);
- }
- }
-
-
- // Small utility methods.
-
- private boolean accepted(String name)
- {
- return regularExpressionMatcher.matches(name);
- }
-}
diff --git a/src/proguard/classfile/visitor/MemberToClassVisitor.java b/src/proguard/classfile/visitor/MemberToClassVisitor.java
deleted file mode 100644
index bb4bc03..0000000
--- a/src/proguard/classfile/visitor/MemberToClassVisitor.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This MemberVisitor delegates all visits to a given ClassVisitor.
- * The latter visits the class of each visited class member, although
- * never twice in a row.
- *
- * @author Eric Lafortune
- */
-public class MemberToClassVisitor implements MemberVisitor
-{
- private final ClassVisitor classVisitor;
-
- private Clazz lastVisitedClass;
-
-
- public MemberToClassVisitor(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- if (!programClass.equals(lastVisitedClass))
- {
- classVisitor.visitProgramClass(programClass);
-
- lastVisitedClass = programClass;
- }
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- if (!programClass.equals(lastVisitedClass))
- {
- classVisitor.visitProgramClass(programClass);
-
- lastVisitedClass = programClass;
- }
- }
-
-
- public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- {
- if (!libraryClass.equals(lastVisitedClass))
- {
- classVisitor.visitLibraryClass(libraryClass);
-
- lastVisitedClass = libraryClass;
- }
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- if (!libraryClass.equals(lastVisitedClass))
- {
- classVisitor.visitLibraryClass(libraryClass);
-
- lastVisitedClass = libraryClass;
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/MemberVisitor.java b/src/proguard/classfile/visitor/MemberVisitor.java
deleted file mode 100644
index 51a675c..0000000
--- a/src/proguard/classfile/visitor/MemberVisitor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This interface specifies the methods for a visitor of
- * <code>ProgramMember</code> objects and <code>LibraryMember</code>
- * objects.
- *
- * @author Eric Lafortune
- */
-public interface MemberVisitor
-{
- public void visitProgramField( ProgramClass programClass, ProgramField programField);
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod);
-
- public void visitLibraryField( LibraryClass libraryClass, LibraryField libraryField);
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod);
-}
diff --git a/src/proguard/classfile/visitor/MethodImplementationFilter.java b/src/proguard/classfile/visitor/MethodImplementationFilter.java
deleted file mode 100644
index be951df..0000000
--- a/src/proguard/classfile/visitor/MethodImplementationFilter.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.util.SimplifiedVisitor;
-
-/**
- * This <code>MemberVisitor</code> delegates its visits to methods to
- * another given <code>MemberVisitor</code>, but only when the visited
- * method may have implementations.
- *
- * @see Clazz#mayHaveImplementations(Method)
- * @author Eric Lafortune
- */
-public class MethodImplementationFilter
-extends SimplifiedVisitor
-implements MemberVisitor
-{
- private final MemberVisitor memberVisitor;
-
-
- /**
- * Creates a new MethodImplementationFilter.
- * @param memberVisitor the <code>MemberVisitor</code> to which
- * visits will be delegated.
- */
- public MethodImplementationFilter(MemberVisitor memberVisitor)
- {
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- if (programClass.mayHaveImplementations(programMethod))
- {
- memberVisitor.visitProgramMethod(programClass, programMethod);
- }
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- if (libraryClass.mayHaveImplementations(libraryMethod))
- {
- memberVisitor.visitLibraryMethod(libraryClass, libraryMethod);
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/MethodImplementationTraveler.java b/src/proguard/classfile/visitor/MethodImplementationTraveler.java
deleted file mode 100644
index 116b2af..0000000
--- a/src/proguard/classfile/visitor/MethodImplementationTraveler.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.util.SimplifiedVisitor;
-
-/**
- * This <code>MemberVisitor</code> lets a given <code>MemberVisitor</code>
- * travel to all concrete and abstract implementations of the visited methods
- * in their class hierarchies.
- *
- * @author Eric Lafortune
- */
-public class MethodImplementationTraveler
-extends SimplifiedVisitor
-implements MemberVisitor
-{
- private final boolean visitThisMethod;
- private final boolean visitSuperMethods;
- private final boolean visitInterfaceMethods;
- private final boolean visitOverridingMethods;
- private final MemberVisitor memberVisitor;
-
-
- /**
- * Creates a new MethodImplementationTraveler.
- * @param visitThisMethod specifies whether to visit the originally
- * visited methods.
- * @param visitSuperMethods specifies whether to visit the method in
- * the super classes.
- * @param visitInterfaceMethods specifies whether to visit the method in
- * the interface classes.
- * @param visitOverridingMethods specifies whether to visit the method in
- * the subclasses.
- * @param memberVisitor the <code>MemberVisitor</code> to which
- * visits will be delegated.
- */
- public MethodImplementationTraveler(boolean visitThisMethod,
- boolean visitSuperMethods,
- boolean visitInterfaceMethods,
- boolean visitOverridingMethods,
- MemberVisitor memberVisitor)
- {
- this.visitThisMethod = visitThisMethod;
- this.visitSuperMethods = visitSuperMethods;
- this.visitInterfaceMethods = visitInterfaceMethods;
- this.visitOverridingMethods = visitOverridingMethods;
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- if (visitThisMethod)
- {
- programMethod.accept(programClass, memberVisitor);
- }
-
- if (!isSpecial(programClass, programMethod))
- {
- programClass.hierarchyAccept(false,
- visitSuperMethods,
- visitInterfaceMethods,
- visitOverridingMethods,
- new NamedMethodVisitor(programMethod.getName(programClass),
- programMethod.getDescriptor(programClass),
- new MemberAccessFilter(0,
- ClassConstants.ACC_PRIVATE |
- ClassConstants.ACC_STATIC,
- memberVisitor)));
- }
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- if (visitThisMethod)
- {
- libraryMethod.accept(libraryClass, memberVisitor);
- }
-
- if (!isSpecial(libraryClass, libraryMethod))
- {
- libraryClass.hierarchyAccept(false,
- visitSuperMethods,
- visitInterfaceMethods,
- visitOverridingMethods,
- new NamedMethodVisitor(libraryMethod.getName(libraryClass),
- libraryMethod.getDescriptor(libraryClass),
- new MemberAccessFilter(0,
- ClassConstants.ACC_PRIVATE |
- ClassConstants.ACC_STATIC,
- memberVisitor)));
- }
- }
-
-
- // Small utility methods.
-
- private boolean isSpecial(Clazz clazz, Method method)
- {
- return (method.getAccessFlags() &
- (ClassConstants.ACC_PRIVATE |
- ClassConstants.ACC_STATIC)) != 0 ||
- method.getName(clazz).equals(ClassConstants.METHOD_NAME_INIT);
- }
-}
diff --git a/src/proguard/classfile/visitor/MultiClassPoolVisitor.java b/src/proguard/classfile/visitor/MultiClassPoolVisitor.java
deleted file mode 100644
index 17a084a..0000000
--- a/src/proguard/classfile/visitor/MultiClassPoolVisitor.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.ClassPool;
-
-
-/**
- * This ClassPoolVisitor delegates all visits to each ClassPoolVisitor
- * in a given list.
- *
- * @author Eric Lafortune
- */
-public class MultiClassPoolVisitor implements ClassPoolVisitor
-{
- private static final int ARRAY_SIZE_INCREMENT = 5;
-
- private ClassPoolVisitor[] classPoolVisitors;
- private int classPoolVisitorCount;
-
-
- public MultiClassPoolVisitor()
- {
- }
-
-
- public MultiClassPoolVisitor(ClassPoolVisitor[] classPoolVisitors)
- {
- this.classPoolVisitors = classPoolVisitors;
- this.classPoolVisitorCount = classPoolVisitors.length;
- }
-
-
- public void addClassPoolVisitor(ClassPoolVisitor classPoolVisitor)
- {
- ensureArraySize();
-
- classPoolVisitors[classPoolVisitorCount++] = classPoolVisitor;
- }
-
-
- private void ensureArraySize()
- {
- if (classPoolVisitors == null)
- {
- classPoolVisitors = new ClassPoolVisitor[ARRAY_SIZE_INCREMENT];
- }
- else if (classPoolVisitors.length == classPoolVisitorCount)
- {
- ClassPoolVisitor[] newClassPoolVisitors =
- new ClassPoolVisitor[classPoolVisitorCount +
- ARRAY_SIZE_INCREMENT];
- System.arraycopy(classPoolVisitors, 0,
- newClassPoolVisitors, 0,
- classPoolVisitorCount);
- classPoolVisitors = newClassPoolVisitors;
- }
- }
-
-
- // Implementations for ClassPoolVisitor.
-
- public void visitClassPool(ClassPool classPool)
- {
- for (int index = 0; index < classPoolVisitorCount; index++)
- {
- classPoolVisitors[index].visitClassPool(classPool);
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/MultiClassVisitor.java b/src/proguard/classfile/visitor/MultiClassVisitor.java
deleted file mode 100644
index cb79b7d..0000000
--- a/src/proguard/classfile/visitor/MultiClassVisitor.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This ClassVisitor delegates all visits to each ClassVisitor
- * in a given list.
- *
- * @author Eric Lafortune
- */
-public class MultiClassVisitor implements ClassVisitor
-{
- private static final int ARRAY_SIZE_INCREMENT = 5;
-
- private ClassVisitor[] classVisitors;
- private int classVisitorCount;
-
-
- public MultiClassVisitor()
- {
- }
-
-
- public MultiClassVisitor(ClassVisitor[] classVisitors)
- {
- this.classVisitors = classVisitors;
- this.classVisitorCount = classVisitors.length;
- }
-
-
- public void addClassVisitor(ClassVisitor classVisitor)
- {
- ensureArraySize();
-
- classVisitors[classVisitorCount++] = classVisitor;
- }
-
-
- private void ensureArraySize()
- {
- if (classVisitors == null)
- {
- classVisitors = new ClassVisitor[ARRAY_SIZE_INCREMENT];
- }
- else if (classVisitors.length == classVisitorCount)
- {
- ClassVisitor[] newClassVisitors =
- new ClassVisitor[classVisitorCount +
- ARRAY_SIZE_INCREMENT];
- System.arraycopy(classVisitors, 0,
- newClassVisitors, 0,
- classVisitorCount);
- classVisitors = newClassVisitors;
- }
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- for (int index = 0; index < classVisitorCount; index++)
- {
- classVisitors[index].visitProgramClass(programClass);
- }
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- for (int index = 0; index < classVisitorCount; index++)
- {
- classVisitors[index].visitLibraryClass(libraryClass);
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/MultiMemberVisitor.java b/src/proguard/classfile/visitor/MultiMemberVisitor.java
deleted file mode 100644
index 67bb53e..0000000
--- a/src/proguard/classfile/visitor/MultiMemberVisitor.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This MemberVisitor delegates all visits to each MemberVisitor
- * in a given list.
- *
- * @author Eric Lafortune
- */
-public class MultiMemberVisitor implements MemberVisitor
-{
- private static final int ARRAY_SIZE_INCREMENT = 5;
-
- private MemberVisitor[] memberVisitors;
- private int memberVisitorCount;
-
-
- public MultiMemberVisitor()
- {
- }
-
-
- public MultiMemberVisitor(MemberVisitor[] memberVisitors)
- {
- this.memberVisitors = memberVisitors;
- this.memberVisitorCount = memberVisitors.length;
- }
-
-
- public void addMemberVisitor(MemberVisitor memberVisitor)
- {
- ensureArraySize();
-
- memberVisitors[memberVisitorCount++] = memberVisitor;
- }
-
-
- private void ensureArraySize()
- {
- if (memberVisitors == null)
- {
- memberVisitors = new MemberVisitor[ARRAY_SIZE_INCREMENT];
- }
- else if (memberVisitors.length == memberVisitorCount)
- {
- MemberVisitor[] newMemberVisitors =
- new MemberVisitor[memberVisitorCount +
- ARRAY_SIZE_INCREMENT];
- System.arraycopy(memberVisitors, 0,
- newMemberVisitors, 0,
- memberVisitorCount);
- memberVisitors = newMemberVisitors;
- }
- }
-
-
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- for (int index = 0; index < memberVisitorCount; index++)
- {
- memberVisitors[index].visitProgramField(programClass, programField);
- }
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- for (int index = 0; index < memberVisitorCount; index++)
- {
- memberVisitors[index].visitProgramMethod(programClass, programMethod);
- }
- }
-
-
- public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- {
- for (int index = 0; index < memberVisitorCount; index++)
- {
- memberVisitors[index].visitLibraryField(libraryClass, libraryField);
- }
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- for (int index = 0; index < memberVisitorCount; index++)
- {
- memberVisitors[index].visitLibraryMethod(libraryClass, libraryMethod);
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/NamedClassVisitor.java b/src/proguard/classfile/visitor/NamedClassVisitor.java
deleted file mode 100644
index 52a0c5a..0000000
--- a/src/proguard/classfile/visitor/NamedClassVisitor.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.ClassPool;
-
-
-/**
- * This class visits Clazz objects with the given name.
- *
- * @author Eric Lafortune
- */
-public class NamedClassVisitor implements ClassPoolVisitor
-{
- private final ClassVisitor classVisitor;
- private final String name;
-
-
- public NamedClassVisitor(ClassVisitor classVisitor,
- String name)
- {
- this.classVisitor = classVisitor;
- this.name = name;
- }
-
-
- public void visitClassPool(ClassPool classPool)
- {
- classPool.classAccept(name, classVisitor);
- }
-}
diff --git a/src/proguard/classfile/visitor/NamedFieldVisitor.java b/src/proguard/classfile/visitor/NamedFieldVisitor.java
deleted file mode 100644
index 381c97c..0000000
--- a/src/proguard/classfile/visitor/NamedFieldVisitor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This class visits ProgramMember objects referring to fields, identified by
- * a name and descriptor pair.
- *
- * @author Eric Lafortune
- */
-public class NamedFieldVisitor implements ClassVisitor
-{
- private final String name;
- private final String descriptor;
- private final MemberVisitor memberVisitor;
-
-
- public NamedFieldVisitor(String name,
- String descriptor,
- MemberVisitor memberVisitor)
- {
- this.name = name;
- this.descriptor = descriptor;
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- programClass.fieldAccept(name, descriptor, memberVisitor);
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- libraryClass.fieldAccept(name, descriptor, memberVisitor);
- }
-}
diff --git a/src/proguard/classfile/visitor/NamedMethodVisitor.java b/src/proguard/classfile/visitor/NamedMethodVisitor.java
deleted file mode 100644
index 397e16d..0000000
--- a/src/proguard/classfile/visitor/NamedMethodVisitor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This class visits ProgramMember objects referring to methods, identified by
- * a name and descriptor pair.
- *
- * @author Eric Lafortune
- */
-public class NamedMethodVisitor implements ClassVisitor
-{
- private final String name;
- private final String descriptor;
- private final MemberVisitor memberVisitor;
-
-
- public NamedMethodVisitor(String name,
- String descriptor,
- MemberVisitor memberVisitor)
- {
- this.name = name;
- this.descriptor = descriptor;
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- programClass.methodAccept(name, descriptor, memberVisitor);
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- libraryClass.methodAccept(name, descriptor, memberVisitor);
- }
-}
diff --git a/src/proguard/classfile/visitor/ParameterVisitor.java b/src/proguard/classfile/visitor/ParameterVisitor.java
deleted file mode 100644
index fc124ae..0000000
--- a/src/proguard/classfile/visitor/ParameterVisitor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-/**
- * This interface specifies the methods for a visitor of method parameters or
- * field types (which can be considered parameters when storing values). The
- * parameters do not include or count the 'this' parameter or the method return
- * value.
- *
- * @author Eric Lafortune
- */
-public interface ParameterVisitor
-{
- /**
- * Visits the given parameter.
- * @param clazz the class of the method.
- * @param member the field or method of the parameter.
- * @param parameterIndex the index of the parameter.
- * @param parameterCount the total number of parameters.
- * @param parameterOffset the offset of the parameter, accounting for
- * longs and doubles taking up two entries.
- * @param parameterSize the total size of the parameters, accounting for
- * longs and doubles taking up two entries.
- * @param parameterType the parameter type.
- * @param referencedClass the class contained in the parameter type, if any.
- */
- public void visitParameter(Clazz clazz,
- Member member,
- int parameterIndex,
- int parameterCount,
- int parameterOffset,
- int parameterSize,
- String parameterType,
- Clazz referencedClass);
-}
diff --git a/src/proguard/classfile/visitor/ProgramClassFilter.java b/src/proguard/classfile/visitor/ProgramClassFilter.java
deleted file mode 100644
index 85f02a2..0000000
--- a/src/proguard/classfile/visitor/ProgramClassFilter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This <code>ClassVisitor</code> delegates its visits to another given
- * <code>ClassVisitor</code>, but only when visiting program classes.
- *
- * @author Eric Lafortune
- */
-public class ProgramClassFilter implements ClassVisitor
-{
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new ProgramClassFilter.
- * @param classVisitor the <code>ClassVisitor</code> to which visits
- * will be delegated.
- */
- public ProgramClassFilter(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- classVisitor.visitProgramClass(programClass);
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- // Don't delegate visits to library classes.
- }
-}
diff --git a/src/proguard/classfile/visitor/ProgramMemberFilter.java b/src/proguard/classfile/visitor/ProgramMemberFilter.java
deleted file mode 100644
index d3d88f8..0000000
--- a/src/proguard/classfile/visitor/ProgramMemberFilter.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This <code>MemberVisitor</code> delegates its visits to another given
- * <code>MemberVisitor</code>, but only when visiting members of program
- * classes.
- *
- * @author Eric Lafortune
- */
-public class ProgramMemberFilter implements MemberVisitor
-{
- private final MemberVisitor memberVisitor;
-
-
- /**
- * Creates a new ProgramMemberFilter.
- * @param memberVisitor the <code>MemberVisitor</code> to which
- * visits will be delegated.
- */
- public ProgramMemberFilter(MemberVisitor memberVisitor)
- {
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- memberVisitor.visitProgramField(programClass, programField);
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- memberVisitor.visitProgramMethod(programClass, programMethod);
- }
-
-
- public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- {
- // Don't delegate visits to library members.
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- // Don't delegate visits to library members.
- }
-}
diff --git a/src/proguard/classfile/visitor/ReferencedClassVisitor.java b/src/proguard/classfile/visitor/ReferencedClassVisitor.java
deleted file mode 100644
index 09449bc..0000000
--- a/src/proguard/classfile/visitor/ReferencedClassVisitor.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.annotation.*;
-import proguard.classfile.attribute.annotation.visitor.*;
-import proguard.classfile.attribute.visitor.*;
-import proguard.classfile.constant.*;
-import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.classfile.util.SimplifiedVisitor;
-
-/**
- * This ClassVisitor, MemberVisitor, ConstantVisitor, AttributeVisitor, etc.
- * lets a given ClassVisitor visit all the referenced classes of the elements
- * that it visits. Only downstream elements are considered (in order to avoid
- * loops and repeated visits).
- *
- * @author Eric Lafortune
- */
-public class ReferencedClassVisitor
-extends SimplifiedVisitor
-implements ClassVisitor,
- MemberVisitor,
- ConstantVisitor,
- AttributeVisitor,
- LocalVariableInfoVisitor,
- LocalVariableTypeInfoVisitor,
- AnnotationVisitor,
- ElementValueVisitor
-{
- protected final ClassVisitor classVisitor;
-
-
- public ReferencedClassVisitor(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- // Visit the constant pool entries.
- programClass.constantPoolEntriesAccept(this);
-
- // Visit the fields and methods.
- programClass.fieldsAccept(this);
- programClass.methodsAccept(this);
-
- // Visit the attributes.
- programClass.attributesAccept(this);
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- // Visit the superclass and interfaces.
- libraryClass.superClassAccept(classVisitor);
- libraryClass.interfacesAccept(classVisitor);
-
- // Visit the fields and methods.
- libraryClass.fieldsAccept(this);
- libraryClass.methodsAccept(this);
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramMember(ProgramClass programClass, ProgramMember programMember)
- {
- // Let the visitor visit the classes referenced in the descriptor string.
- programMember.referencedClassesAccept(classVisitor);
-
- // Visit the attributes.
- programMember.attributesAccept(programClass, this);
- }
-
-
- public void visitLibraryMember(LibraryClass programClass, LibraryMember libraryMember)
- {
- // Let the visitor visit the classes referenced in the descriptor string.
- libraryMember.referencedClassesAccept(classVisitor);
- }
-
-
- // Implementations for ConstantVisitor.
-
- public void visitAnyConstant(Clazz clazz, Constant constant) {}
-
-
- public void visitStringConstant(Clazz clazz, StringConstant stringConstant)
- {
- // Let the visitor visit the class referenced in the string constant.
- stringConstant.referencedClassAccept(classVisitor);
- }
-
-
- public void visitAnyRefConstant(Clazz clazz, RefConstant refConstant)
- {
- // Let the visitor visit the class referenced in the reference constant.
- refConstant.referencedClassAccept(classVisitor);
- }
-
-
- public void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant)
- {
- // Let the visitor visit the class referenced in the reference constant.
- invokeDynamicConstant.referencedClassesAccept(classVisitor);
- }
-
-
- public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
- {
- // Let the visitor visit the class referenced in the class constant.
- classConstant.referencedClassAccept(classVisitor);
- }
-
-
- public void visitMethodTypeConstant(Clazz clazz, MethodTypeConstant methodTypeConstant)
- {
- // Let the visitor visit the classes referenced in the method type constant.
- methodTypeConstant.referencedClassesAccept(classVisitor);
- }
-
-
- // Implementations for AttributeVisitor.
-
- public void visitAnyAttribute(Clazz clazz, Attribute attribute) {}
-
-
- public void visitEnclosingMethodAttribute(Clazz clazz, EnclosingMethodAttribute enclosingMethodAttribute)
- {
- // Let the visitor visit the class of the enclosing method.
- enclosingMethodAttribute.referencedClassAccept(classVisitor);
- }
-
-
- public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
- {
- // Visit the attributes of the code attribute.
- codeAttribute.attributesAccept(clazz, method, this);
- }
-
-
- public void visitLocalVariableTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTableAttribute localVariableTableAttribute)
- {
- // Visit the local variables.
- localVariableTableAttribute.localVariablesAccept(clazz, method, codeAttribute, this);
- }
-
-
- public void visitLocalVariableTypeTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeTableAttribute localVariableTypeTableAttribute)
- {
- // Visit the local variable types.
- localVariableTypeTableAttribute.localVariablesAccept(clazz, method, codeAttribute, this);
- }
-
-
- public void visitSignatureAttribute(Clazz clazz, SignatureAttribute signatureAttribute)
- {
- // Let the visitor visit the classes referenced in the signature string.
- signatureAttribute.referencedClassesAccept(classVisitor);
- }
-
-
- public void visitAnyAnnotationsAttribute(Clazz clazz, AnnotationsAttribute annotationsAttribute)
- {
- // Visit the annotations.
- annotationsAttribute.annotationsAccept(clazz, this);
- }
-
-
- public void visitAnyParameterAnnotationsAttribute(Clazz clazz, Method method, ParameterAnnotationsAttribute parameterAnnotationsAttribute)
- {
- // Visit the parameter annotations.
- parameterAnnotationsAttribute.annotationsAccept(clazz, method, this);
- }
-
-
- public void visitAnnotationDefaultAttribute(Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute)
- {
- // Visit the default element value.
- annotationDefaultAttribute.defaultValueAccept(clazz, this);
- }
-
-
- // Implementations for LocalVariableInfoVisitor.
-
- public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
- {
- // Let the visitor visit the class referenced in the local variable.
- localVariableInfo.referencedClassAccept(classVisitor);
- }
-
-
- // Implementations for LocalVariableTypeInfoVisitor.
-
- public void visitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo)
- {
- // Let the visitor visit the classes referenced in the local variable type.
- localVariableTypeInfo.referencedClassesAccept(classVisitor);
- }
-
-
- // Implementations for AnnotationVisitor.
-
- public void visitAnnotation(Clazz clazz, Annotation annotation)
- {
- // Let the visitor visit the classes referenced in the annotation.
- annotation.referencedClassesAccept(classVisitor);
-
- // Visit the element values.
- annotation.elementValuesAccept(clazz, this);
- }
-
-
- // Implementations for ElementValueVisitor.
-
- public void visitAnyElementValue(Clazz clazz, Annotation annotation, ElementValue elementValue) {}
-
-
- public void visitEnumConstantElementValue(Clazz clazz, Annotation annotation, EnumConstantElementValue enumConstantElementValue)
- {
- // Let the visitor visit the classes referenced in the constant element value.
- enumConstantElementValue.referencedClassesAccept(classVisitor);
- }
-
-
- public void visitClassElementValue(Clazz clazz, Annotation annotation, ClassElementValue classElementValue)
- {
- // Let the visitor visit the classes referenced in the class element value.
- classElementValue.referencedClassesAccept(classVisitor);
- }
-
-
- public void visitAnnotationElementValue(Clazz clazz, Annotation annotation, AnnotationElementValue annotationElementValue)
- {
- // Visit the contained annotation.
- annotationElementValue.annotationAccept(clazz, this);
- }
-
-
- public void visitArrayElementValue(Clazz clazz, Annotation annotation, ArrayElementValue arrayElementValue)
- {
- // Visit the element values.
- arrayElementValue.elementValuesAccept(clazz, annotation, this);
- }
-}
diff --git a/src/proguard/classfile/visitor/ReferencedMemberVisitor.java b/src/proguard/classfile/visitor/ReferencedMemberVisitor.java
deleted file mode 100644
index cb77b19..0000000
--- a/src/proguard/classfile/visitor/ReferencedMemberVisitor.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.Clazz;
-import proguard.classfile.attribute.annotation.*;
-import proguard.classfile.attribute.annotation.visitor.ElementValueVisitor;
-import proguard.classfile.constant.*;
-import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.classfile.util.SimplifiedVisitor;
-
-/**
- * This ConstantVisitor and ElementValueVisitor lets a given MemberVisitor
- * visit all the referenced class members of the elements that it visits.
- *
- * @author Eric Lafortune
- */
-public class ReferencedMemberVisitor
-extends SimplifiedVisitor
-implements ConstantVisitor,
- ElementValueVisitor
-{
- private final MemberVisitor memberVisitor;
-
-
- public ReferencedMemberVisitor(MemberVisitor memberVisitor)
- {
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for ConstantVisitor.
-
- public void visitAnyConstant(Clazz clazz, Constant constant) {}
-
-
- public void visitStringConstant(Clazz clazz, StringConstant stringConstant)
- {
- stringConstant.referencedMemberAccept(memberVisitor);
- }
-
-
- public void visitAnyRefConstant(Clazz clazz, RefConstant refConstant)
- {
- refConstant.referencedMemberAccept(memberVisitor);
- }
-
-
- // Implementations for ElementValueVisitor.
-
- public void visitAnyElementValue(Clazz clazz, Annotation annotation, ElementValue elementValue)
- {
- elementValue.referencedMethodAccept(memberVisitor);
- }
-}
diff --git a/src/proguard/classfile/visitor/SimilarMemberVisitor.java b/src/proguard/classfile/visitor/SimilarMemberVisitor.java
deleted file mode 100644
index 2649a2f..0000000
--- a/src/proguard/classfile/visitor/SimilarMemberVisitor.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-/**
- * This <code>MemberVisitor</code> lets a given <code>MemberVisitor</code>
- * visit all members that have the same name and type as the visited methods
- * in the class hierarchy of a given target class.
- *
- * @author Eric Lafortune
- */
-public class SimilarMemberVisitor
-implements MemberVisitor
-{
- private final Clazz targetClass;
- private final boolean visitThisMember;
- private final boolean visitSuperMembers;
- private final boolean visitInterfaceMembers;
- private final boolean visitOverridingMembers;
- private final MemberVisitor memberVisitor;
-
-
- /**
- * Creates a new SimilarMemberVisitor.
- * @param targetClass the class in whose hierarchy to look for
- * the visited class members.
- * @param visitThisMember specifies whether to visit the class
- * members in the target class itself.
- * @param visitSuperMembers specifies whether to visit the class
- * members in the super classes of the target
- * class.
- * @param visitInterfaceMembers specifies whether to visit the class
- * members in the interface classes of the
- * target class.
- * @param visitOverridingMembers specifies whether to visit the class
- * members in the subclasses of the target
- * class.
- * @param memberVisitor the <code>MemberVisitor</code> to which
- * visits will be delegated.
- */
- public SimilarMemberVisitor(Clazz targetClass,
- boolean visitThisMember,
- boolean visitSuperMembers,
- boolean visitInterfaceMembers,
- boolean visitOverridingMembers,
- MemberVisitor memberVisitor)
- {
- this.targetClass = targetClass;
- this.visitThisMember = visitThisMember;
- this.visitSuperMembers = visitSuperMembers;
- this.visitInterfaceMembers = visitInterfaceMembers;
- this.visitOverridingMembers = visitOverridingMembers;
- this.memberVisitor = memberVisitor;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- targetClass.hierarchyAccept(visitThisMember,
- visitSuperMembers,
- visitInterfaceMembers,
- visitOverridingMembers,
- new NamedFieldVisitor(programField.getName(programClass),
- programField.getDescriptor(programClass),
- memberVisitor));
- }
-
-
- public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- {
- targetClass.hierarchyAccept(visitThisMember,
- visitSuperMembers,
- visitInterfaceMembers,
- visitOverridingMembers,
- new NamedFieldVisitor(libraryField.getName(libraryClass),
- libraryField.getDescriptor(libraryClass),
- memberVisitor));
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- targetClass.hierarchyAccept(visitThisMember,
- visitSuperMembers,
- visitInterfaceMembers,
- visitOverridingMembers,
- new NamedMethodVisitor(programMethod.getName(programClass),
- programMethod.getDescriptor(programClass),
- memberVisitor));
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- targetClass.hierarchyAccept(visitThisMember,
- visitSuperMembers,
- visitInterfaceMembers,
- visitOverridingMembers,
- new NamedMethodVisitor(libraryMethod.getName(libraryClass),
- libraryMethod.getDescriptor(libraryClass),
- memberVisitor));
- }
-} \ No newline at end of file
diff --git a/src/proguard/classfile/visitor/SimpleClassPrinter.java b/src/proguard/classfile/visitor/SimpleClassPrinter.java
deleted file mode 100644
index 073c635..0000000
--- a/src/proguard/classfile/visitor/SimpleClassPrinter.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-import proguard.classfile.util.ClassUtil;
-
-import java.io.PrintStream;
-
-
-/**
- * This <code>ClassVisitor</code> and <code>MemberVisitor</code>
- * prints out the class names of the classes it visits, and the full class
- * member descriptions of the class members it visits. The names are printed
- * in a readable, Java-like format. The access modifiers can be included or not.
- *
- * @author Eric Lafortune
- */
-public class SimpleClassPrinter
-implements ClassVisitor,
- MemberVisitor
-{
- private final boolean printAccessModifiers;
- private final PrintStream ps;
-
-
- /**
- * Creates a new SimpleClassPrinter that prints to
- * <code>System.out</code>, including the access modifiers.
- */
- public SimpleClassPrinter()
- {
- this(true);
- }
-
- /**
- * Creates a new SimpleClassPrinter that prints to
- * <code>System.out</code>, with or without the access modifiers.
- */
- public SimpleClassPrinter(boolean printAccessModifiers)
- {
- this(printAccessModifiers, System.out);
- }
-
- /**
- * Creates a new SimpleClassPrinter that prints to the given
- * <code>PrintStream</code>, with or without the access modifiers.
- */
- public SimpleClassPrinter(boolean printAccessModifiers,
- PrintStream printStream)
- {
- this.printAccessModifiers = printAccessModifiers;
- this.ps = printStream;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- ps.println(ClassUtil.externalFullClassDescription(
- printAccessModifiers ?
- programClass.getAccessFlags() :
- 0,
- programClass.getName()));
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- ps.println(ClassUtil.externalFullClassDescription(
- printAccessModifiers ?
- libraryClass.getAccessFlags() :
- 0,
- libraryClass.getName()));
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- ps.println(ClassUtil.externalFullClassDescription(
- printAccessModifiers ?
- programClass.getAccessFlags() :
- 0,
- programClass.getName()) +
- ": " +
- ClassUtil.externalFullFieldDescription(
- printAccessModifiers ?
- programField.getAccessFlags() :
- 0,
- programField.getName(programClass),
- programField.getDescriptor(programClass)));
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- ps.println(ClassUtil.externalFullClassDescription(
- printAccessModifiers ?
- programClass.getAccessFlags() :
- 0,
- programClass.getName()) +
- ": " +
- ClassUtil.externalFullMethodDescription(
- programClass.getName(),
- printAccessModifiers ?
- programMethod.getAccessFlags() :
- 0,
- programMethod.getName(programClass),
- programMethod.getDescriptor(programClass)));
- }
-
-
- public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- {
- ps.println(ClassUtil.externalFullClassDescription(
- printAccessModifiers ?
- libraryClass.getAccessFlags() :
- 0,
- libraryClass.getName()) +
- ": " +
- ClassUtil.externalFullFieldDescription(
- printAccessModifiers ?
- libraryField.getAccessFlags() :
- 0,
- libraryField.getName(libraryClass),
- libraryField.getDescriptor(libraryClass)));
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- ps.println(ClassUtil.externalFullClassDescription(
- printAccessModifiers ?
- libraryClass.getAccessFlags() :
- 0,
- libraryClass.getName()) +
- ": " +
- ClassUtil.externalFullMethodDescription(
- libraryClass.getName(),
- printAccessModifiers ?
- libraryMethod.getAccessFlags() :
- 0,
- libraryMethod.getName(libraryClass),
- libraryMethod.getDescriptor(libraryClass)));
- }
-}
diff --git a/src/proguard/classfile/visitor/SubclassFilter.java b/src/proguard/classfile/visitor/SubclassFilter.java
deleted file mode 100644
index f50e498..0000000
--- a/src/proguard/classfile/visitor/SubclassFilter.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-/**
- * This <code>ClassVisitor</code> delegates its visits to another given
- * <code>ClassVisitor</code>, except for classes that have a given class as
- * direct subclass.
- *
- * @author Eric Lafortune
- */
-public class SubclassFilter implements ClassVisitor
-{
- private final Clazz subclass;
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new SubclassFilter.
- * @param subclass the class whose superclasses will not be visited.
- * @param classVisitor the <code>ClassVisitor</code> to which visits will
- * be delegated.
- */
- public SubclassFilter(Clazz subclass,
- ClassVisitor classVisitor)
- {
- this.subclass = subclass;
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- if (!present(programClass.subClasses))
- {
- classVisitor.visitProgramClass(programClass);
- }
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- if (!present(libraryClass.subClasses))
- {
- classVisitor.visitLibraryClass(libraryClass);
- }
- }
-
-
- // Small utility methods.
-
- private boolean present(Clazz[] subclasses)
- {
- if (subclasses == null)
- {
- return false;
- }
-
- for (int index = 0; index < subclasses.length; index++)
- {
- if (subclasses[index].equals(subclass))
- {
- return true;
- }
- }
-
- return false;
- }
-} \ No newline at end of file
diff --git a/src/proguard/classfile/visitor/SubclassTraveler.java b/src/proguard/classfile/visitor/SubclassTraveler.java
deleted file mode 100644
index 8e80913..0000000
--- a/src/proguard/classfile/visitor/SubclassTraveler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This <code>ClassVisitor</code> lets a given <code>ClassVisitor</code>
- * travel to direct subclasses of the visited class.
- *
- * @author Eric Lafortune
- */
-public class SubclassTraveler implements ClassVisitor
-{
- private final ClassVisitor classVisitor;
-
-
- /**
- * Creates a new ClassHierarchyTraveler.
- * @param classVisitor the <code>ClassVisitor</code> to
- * which visits will be delegated.
- */
- public SubclassTraveler(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- programClass.subclassesAccept(classVisitor);
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- libraryClass.subclassesAccept(classVisitor);
- }
-} \ No newline at end of file
diff --git a/src/proguard/classfile/visitor/VariableClassVisitor.java b/src/proguard/classfile/visitor/VariableClassVisitor.java
deleted file mode 100644
index c8e1ee3..0000000
--- a/src/proguard/classfile/visitor/VariableClassVisitor.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This ClassVisitor delegates all method calls to a ClassVisitor
- * that can be changed at any time.
- *
- * @author Eric Lafortune
- */
-public class VariableClassVisitor implements ClassVisitor
-{
- private ClassVisitor classVisitor;
-
-
- public VariableClassVisitor()
- {
- this(null);
- }
-
-
- public VariableClassVisitor(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
-
- public void setClassVisitor(ClassVisitor classVisitor)
- {
- this.classVisitor = classVisitor;
- }
-
- public ClassVisitor getClassVisitor()
- {
- return classVisitor;
- }
-
-
- // Implementations for ClassVisitor.
-
- public void visitProgramClass(ProgramClass programClass)
- {
- if (classVisitor != null)
- {
- classVisitor.visitProgramClass(programClass);
- }
- }
-
-
- public void visitLibraryClass(LibraryClass libraryClass)
- {
- if (classVisitor != null)
- {
- classVisitor.visitLibraryClass(libraryClass);
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/VariableMemberVisitor.java b/src/proguard/classfile/visitor/VariableMemberVisitor.java
deleted file mode 100644
index fbaedec..0000000
--- a/src/proguard/classfile/visitor/VariableMemberVisitor.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.visitor;
-
-import proguard.classfile.*;
-
-
-/**
- * This MemberVisitor delegates all method calls to a MemberVisitor
- * that can be changed at any time.
- *
- * @author Eric Lafortune
- */
-public class VariableMemberVisitor implements MemberVisitor
-{
- private MemberVisitor memberVisitor;
-
-
- public VariableMemberVisitor()
- {
- this(null);
- }
-
-
- public VariableMemberVisitor(MemberVisitor memberVisitor)
- {
- this.memberVisitor = memberVisitor;
- }
-
-
- public void setMemberVisitor(MemberVisitor memberVisitor)
- {
- this.memberVisitor = memberVisitor;
- }
-
- public MemberVisitor getMemberVisitor()
- {
- return memberVisitor;
- }
-
-
- // Implementations for MemberVisitor.
-
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- if (memberVisitor != null)
- {
- memberVisitor.visitProgramField(programClass, programField);
- }
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- if (memberVisitor != null)
- {
- memberVisitor.visitProgramMethod(programClass, programMethod);
- }
- }
-
-
- public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
- {
- if (memberVisitor != null)
- {
- memberVisitor.visitLibraryField(libraryClass, libraryField);
- }
- }
-
-
- public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
- {
- if (memberVisitor != null)
- {
- memberVisitor.visitLibraryMethod(libraryClass, libraryMethod);
- }
- }
-}
diff --git a/src/proguard/classfile/visitor/package.html b/src/proguard/classfile/visitor/package.html
deleted file mode 100644
index d3be40c..0000000
--- a/src/proguard/classfile/visitor/package.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<body>
-This package contains interfaces and classes for processing class files from
-the <code>{@link proguard.classfile proguard.classfile}</code> package using
-the <i>visitor pattern</i>. Cfr., for instance, "Design Patterns, Elements of
-Reusable OO Software", by Gamma, Helm, Johnson, and Vlissider.
-<p>
-Why the visitor pattern? Class files frequently contain lists of elements of
-various mixed types: class items, constant pool entries, attributes,...
-These lists and types are largely fixed; they won't change much in future
-releases of the Java class file specifications. On the other hand, the kinds
-of operations that we may wish to perform on the class files may change and
-expand. We want to separate the objects and the operations performed upon them.
-This is a good place to use the visitor pattern.
-<p>
-Visitor interfaces avoid having to do series of <code>instanceof</code> tests
-on the elements of a list, followed by type casts and the proper operations.
-Every list element is a visitor accepter. When its <code>accept</code> method
-is called by a visitor, it calls its corresponding <code>visitX</code> method
-in the visitor, passing itself as an argument. This technique is called
-double-dispatch.
-<p>
-As already mentioned, the main advantage is avoiding lots of
-<code>instanceof</code> tests and type casts. Also, implementing a visitor
-interface ensures you're handling all possible visitor accepter types. Each
-type has its own method, which you simply have to implement.
-<p>
-A disadvantage is that the visitor methods always get the same names, specified
-by the visitor interface. These names aren't descriptive at all, making code
-harder to read. It's the visitor classes that describe the operations now.
-<p>
-Also, the visitor methods always have the same parameters and return values, as
-specified by the visitor interfaces. Passing additional parameters is done by
-means of extra fields in the visitor, which is somewhat of a kludge.
-<p>
-Because objects (the visitor accepters) and the operations performed upon them
-(the visitors) are now separated, it becomes harder to associate some state
-with the objects. For convenience, we always provide an extra <i>visitor
-info</i> field in visitor accepters, in which visitors can put any temporary
-information they want.
-</body>