summaryrefslogtreecommitdiff
path: root/src/proguard/classfile
diff options
context:
space:
mode:
Diffstat (limited to 'src/proguard/classfile')
-rw-r--r--src/proguard/classfile/ClassConstants.java457
-rw-r--r--src/proguard/classfile/ClassPool.java3
-rw-r--r--src/proguard/classfile/Clazz.java7
-rw-r--r--src/proguard/classfile/Field.java2
-rw-r--r--src/proguard/classfile/JavaConstants.java89
-rw-r--r--src/proguard/classfile/LibraryClass.java19
-rw-r--r--src/proguard/classfile/LibraryField.java2
-rw-r--r--src/proguard/classfile/LibraryMember.java6
-rw-r--r--src/proguard/classfile/LibraryMethod.java2
-rw-r--r--src/proguard/classfile/Member.java2
-rw-r--r--src/proguard/classfile/Method.java2
-rw-r--r--src/proguard/classfile/ProgramClass.java24
-rw-r--r--src/proguard/classfile/ProgramField.java4
-rw-r--r--src/proguard/classfile/ProgramMember.java4
-rw-r--r--src/proguard/classfile/ProgramMethod.java4
-rw-r--r--src/proguard/classfile/VisitorAccepter.java2
-rw-r--r--src/proguard/classfile/attribute/Attribute.java9
-rwxr-xr-xsrc/proguard/classfile/attribute/BootstrapMethodInfo.java2
-rwxr-xr-xsrc/proguard/classfile/attribute/BootstrapMethodsAttribute.java12
-rw-r--r--src/proguard/classfile/attribute/CodeAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/ConstantValueAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/DeprecatedAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/EnclosingMethodAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/ExceptionInfo.java2
-rw-r--r--src/proguard/classfile/attribute/ExceptionsAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/InnerClassesAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/InnerClassesInfo.java2
-rw-r--r--src/proguard/classfile/attribute/LineNumberInfo.java2
-rw-r--r--src/proguard/classfile/attribute/LineNumberTableAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/LocalVariableInfo.java20
-rw-r--r--src/proguard/classfile/attribute/LocalVariableTableAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/LocalVariableTypeInfo.java20
-rw-r--r--src/proguard/classfile/attribute/LocalVariableTypeTableAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/MethodParametersAttribute.java80
-rw-r--r--src/proguard/classfile/attribute/ParameterInfo.java81
-rw-r--r--src/proguard/classfile/attribute/SignatureAttribute.java11
-rw-r--r--src/proguard/classfile/attribute/SourceDirAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/SourceFileAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/SyntheticAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/UnknownAttribute.java12
-rw-r--r--src/proguard/classfile/attribute/annotation/Annotation.java2
-rw-r--r--src/proguard/classfile/attribute/annotation/AnnotationDefaultAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/annotation/AnnotationElementValue.java2
-rw-r--r--src/proguard/classfile/attribute/annotation/AnnotationsAttribute.java20
-rw-r--r--src/proguard/classfile/attribute/annotation/ArrayElementValue.java2
-rw-r--r--src/proguard/classfile/attribute/annotation/ClassElementValue.java11
-rw-r--r--src/proguard/classfile/attribute/annotation/ConstantElementValue.java2
-rw-r--r--src/proguard/classfile/attribute/annotation/ElementValue.java2
-rw-r--r--src/proguard/classfile/attribute/annotation/EnumConstantElementValue.java2
-rw-r--r--src/proguard/classfile/attribute/annotation/ParameterAnnotationsAttribute.java12
-rw-r--r--src/proguard/classfile/attribute/annotation/RuntimeInvisibleAnnotationsAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/annotation/RuntimeInvisibleParameterAnnotationsAttribute.java6
-rw-r--r--src/proguard/classfile/attribute/annotation/RuntimeInvisibleTypeAnnotationsAttribute.java77
-rw-r--r--src/proguard/classfile/attribute/annotation/RuntimeVisibleAnnotationsAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/annotation/RuntimeVisibleParameterAnnotationsAttribute.java6
-rw-r--r--src/proguard/classfile/attribute/annotation/RuntimeVisibleTypeAnnotationsAttribute.java77
-rw-r--r--src/proguard/classfile/attribute/annotation/TypeAnnotation.java162
-rw-r--r--src/proguard/classfile/attribute/annotation/TypeAnnotationsAttribute.java98
-rw-r--r--src/proguard/classfile/attribute/annotation/TypePathInfo.java50
-rw-r--r--src/proguard/classfile/attribute/annotation/target/CatchTargetInfo.java82
-rw-r--r--src/proguard/classfile/attribute/annotation/target/EmptyTargetInfo.java72
-rw-r--r--src/proguard/classfile/attribute/annotation/target/FormalParameterTargetInfo.java81
-rw-r--r--src/proguard/classfile/attribute/annotation/target/LocalVariableTargetElement.java53
-rw-r--r--src/proguard/classfile/attribute/annotation/target/LocalVariableTargetInfo.java99
-rw-r--r--src/proguard/classfile/attribute/annotation/target/OffsetTargetInfo.java82
-rw-r--r--src/proguard/classfile/attribute/annotation/target/SuperTypeTargetInfo.java72
-rw-r--r--src/proguard/classfile/attribute/annotation/target/TargetInfo.java97
-rw-r--r--src/proguard/classfile/attribute/annotation/target/ThrowsTargetInfo.java81
-rw-r--r--src/proguard/classfile/attribute/annotation/target/TypeArgumentTargetInfo.java85
-rw-r--r--src/proguard/classfile/attribute/annotation/target/TypeParameterBoundTargetInfo.java87
-rw-r--r--src/proguard/classfile/attribute/annotation/target/TypeParameterTargetInfo.java79
-rw-r--r--src/proguard/classfile/attribute/annotation/target/visitor/LocalVariableTargetElementVisitor.java37
-rw-r--r--src/proguard/classfile/attribute/annotation/target/visitor/TargetInfoVisitor.java50
-rw-r--r--src/proguard/classfile/attribute/annotation/visitor/AllAnnotationVisitor.java60
-rw-r--r--src/proguard/classfile/attribute/annotation/visitor/AllElementValueVisitor.java11
-rw-r--r--src/proguard/classfile/attribute/annotation/visitor/AnnotatedClassVisitor.java2
-rw-r--r--src/proguard/classfile/attribute/annotation/visitor/AnnotationToMemberVisitor.java2
-rw-r--r--src/proguard/classfile/attribute/annotation/visitor/AnnotationTypeFilter.java13
-rw-r--r--src/proguard/classfile/attribute/annotation/visitor/AnnotationVisitor.java12
-rw-r--r--src/proguard/classfile/attribute/annotation/visitor/ElementValueVisitor.java2
-rw-r--r--src/proguard/classfile/attribute/annotation/visitor/TypeAnnotationVisitor.java41
-rw-r--r--src/proguard/classfile/attribute/annotation/visitor/TypePathInfoVisitor.java41
-rw-r--r--src/proguard/classfile/attribute/preverification/DoubleType.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/FloatType.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/FullFrame.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/IntegerType.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/LessZeroFrame.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/LongType.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/MoreZeroFrame.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/NullType.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/ObjectType.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/SameOneFrame.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/SameZeroFrame.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/StackMapAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/StackMapFrame.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/StackMapTableAttribute.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/TopType.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/UninitializedThisType.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/UninitializedType.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/VerificationType.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/VerificationTypeFactory.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/visitor/StackMapFrameVisitor.java2
-rw-r--r--src/proguard/classfile/attribute/preverification/visitor/VerificationTypeVisitor.java2
-rw-r--r--src/proguard/classfile/attribute/visitor/AllAttributeVisitor.java2
-rw-r--r--src/proguard/classfile/attribute/visitor/AllBootstrapMethodInfoVisitor.java4
-rw-r--r--src/proguard/classfile/attribute/visitor/AllExceptionInfoVisitor.java2
-rw-r--r--src/proguard/classfile/attribute/visitor/AllInnerClassesInfoVisitor.java4
-rw-r--r--src/proguard/classfile/attribute/visitor/AttributeNameFilter.java147
-rw-r--r--src/proguard/classfile/attribute/visitor/AttributeVisitor.java17
-rwxr-xr-xsrc/proguard/classfile/attribute/visitor/BootstrapMethodInfoVisitor.java8
-rw-r--r--src/proguard/classfile/attribute/visitor/ExceptionInfoVisitor.java2
-rw-r--r--src/proguard/classfile/attribute/visitor/InnerClassesInfoVisitor.java2
-rw-r--r--src/proguard/classfile/attribute/visitor/LineNumberInfoVisitor.java2
-rw-r--r--src/proguard/classfile/attribute/visitor/LocalVariableInfoVisitor.java2
-rw-r--r--src/proguard/classfile/attribute/visitor/LocalVariableTypeInfoVisitor.java2
-rw-r--r--src/proguard/classfile/attribute/visitor/MultiAttributeVisitor.java83
-rw-r--r--src/proguard/classfile/attribute/visitor/NonEmptyAttributeFilter.java152
-rw-r--r--src/proguard/classfile/attribute/visitor/ParameterInfoVisitor.java37
-rw-r--r--src/proguard/classfile/attribute/visitor/RequiredAttributeFilter.java147
-rw-r--r--src/proguard/classfile/attribute/visitor/StackSizeComputer.java4
-rw-r--r--src/proguard/classfile/constant/ClassConstant.java2
-rw-r--r--src/proguard/classfile/constant/Constant.java2
-rw-r--r--src/proguard/classfile/constant/DoubleConstant.java2
-rw-r--r--src/proguard/classfile/constant/FieldrefConstant.java2
-rw-r--r--src/proguard/classfile/constant/FloatConstant.java2
-rw-r--r--src/proguard/classfile/constant/IntegerConstant.java2
-rw-r--r--src/proguard/classfile/constant/InterfaceMethodrefConstant.java2
-rwxr-xr-xsrc/proguard/classfile/constant/InvokeDynamicConstant.java4
-rw-r--r--src/proguard/classfile/constant/LongConstant.java2
-rwxr-xr-xsrc/proguard/classfile/constant/MethodHandleConstant.java12
-rw-r--r--src/proguard/classfile/constant/MethodTypeConstant.java31
-rw-r--r--src/proguard/classfile/constant/MethodrefConstant.java2
-rw-r--r--src/proguard/classfile/constant/NameAndTypeConstant.java2
-rw-r--r--src/proguard/classfile/constant/RefConstant.java2
-rw-r--r--src/proguard/classfile/constant/StringConstant.java2
-rw-r--r--src/proguard/classfile/constant/Utf8Constant.java2
-rw-r--r--src/proguard/classfile/constant/visitor/AllConstantVisitor.java2
-rw-r--r--src/proguard/classfile/constant/visitor/BootstrapMethodArgumentVisitor.java56
-rw-r--r--src/proguard/classfile/constant/visitor/BootstrapMethodHandleTraveler.java8
-rw-r--r--src/proguard/classfile/constant/visitor/ConstantTagFilter.java4
-rw-r--r--src/proguard/classfile/constant/visitor/ConstantVisitor.java2
-rw-r--r--src/proguard/classfile/constant/visitor/ExceptClassConstantFilter.java9
-rw-r--r--src/proguard/classfile/constant/visitor/MethodrefTraveler.java3
-rw-r--r--src/proguard/classfile/editor/AccessFixer.java234
-rw-r--r--src/proguard/classfile/editor/AnnotationAdder.java2
-rw-r--r--src/proguard/classfile/editor/AnnotationsAttributeEditor.java2
-rw-r--r--src/proguard/classfile/editor/AttributeAdder.java42
-rw-r--r--src/proguard/classfile/editor/AttributeSorter.java2
-rw-r--r--src/proguard/classfile/editor/AttributesEditor.java71
-rw-r--r--src/proguard/classfile/editor/BootstrapMethodInfoAdder.java86
-rw-r--r--src/proguard/classfile/editor/BootstrapMethodRemapper.java88
-rw-r--r--src/proguard/classfile/editor/BootstrapMethodsAttributeAdder.java91
-rw-r--r--src/proguard/classfile/editor/BootstrapMethodsAttributeEditor.java60
-rw-r--r--src/proguard/classfile/editor/BridgeMethodFixer.java12
-rw-r--r--src/proguard/classfile/editor/ClassEditor.java2
-rw-r--r--src/proguard/classfile/editor/ClassElementSorter.java2
-rw-r--r--src/proguard/classfile/editor/ClassMemberSorter.java2
-rw-r--r--src/proguard/classfile/editor/ClassReferenceFixer.java93
-rw-r--r--src/proguard/classfile/editor/CodeAttributeComposer.java73
-rw-r--r--src/proguard/classfile/editor/CodeAttributeEditor.java142
-rw-r--r--src/proguard/classfile/editor/CodeAttributeEditorResetter.java2
-rw-r--r--src/proguard/classfile/editor/ComparableConstant.java77
-rw-r--r--src/proguard/classfile/editor/ConstantAdder.java28
-rw-r--r--src/proguard/classfile/editor/ConstantPoolEditor.java2
-rw-r--r--src/proguard/classfile/editor/ConstantPoolRemapper.java36
-rw-r--r--src/proguard/classfile/editor/ConstantPoolShrinker.java34
-rw-r--r--src/proguard/classfile/editor/ConstantPoolSorter.java2
-rw-r--r--src/proguard/classfile/editor/ElementValueAdder.java2
-rw-r--r--src/proguard/classfile/editor/ElementValuesEditor.java4
-rw-r--r--src/proguard/classfile/editor/ExceptionAdder.java2
-rw-r--r--src/proguard/classfile/editor/ExceptionInfoAdder.java2
-rw-r--r--src/proguard/classfile/editor/ExceptionsAttributeEditor.java2
-rw-r--r--src/proguard/classfile/editor/InnerClassesAccessFixer.java6
-rw-r--r--src/proguard/classfile/editor/InstructionAdder.java6
-rw-r--r--src/proguard/classfile/editor/InstructionWriter.java2
-rw-r--r--src/proguard/classfile/editor/InterfaceAdder.java5
-rw-r--r--src/proguard/classfile/editor/InterfaceDeleter.java190
-rw-r--r--src/proguard/classfile/editor/InterfaceSorter.java48
-rw-r--r--src/proguard/classfile/editor/InterfacesEditor.java33
-rw-r--r--src/proguard/classfile/editor/LineNumberInfoAdder.java6
-rw-r--r--src/proguard/classfile/editor/LineNumberTableAttributeEditor.java2
-rw-r--r--src/proguard/classfile/editor/LocalVariableInfoAdder.java16
-rw-r--r--src/proguard/classfile/editor/LocalVariableTableAttributeEditor.java28
-rw-r--r--src/proguard/classfile/editor/LocalVariableTypeInfoAdder.java16
-rw-r--r--src/proguard/classfile/editor/LocalVariableTypeTableAttributeEditor.java30
-rw-r--r--src/proguard/classfile/editor/MemberAdder.java18
-rw-r--r--src/proguard/classfile/editor/MemberReferenceFixer.java4
-rw-r--r--src/proguard/classfile/editor/MethodInvocationFixer.java12
-rw-r--r--src/proguard/classfile/editor/NameAndTypeShrinker.java17
-rw-r--r--src/proguard/classfile/editor/NamedAttributeDeleter.java36
-rw-r--r--src/proguard/classfile/editor/ParameterAnnotationsAttributeEditor.java25
-rw-r--r--src/proguard/classfile/editor/ParameterInfoAdder.java62
-rw-r--r--src/proguard/classfile/editor/StackSizeUpdater.java2
-rw-r--r--src/proguard/classfile/editor/SubclassAdder.java2
-rw-r--r--src/proguard/classfile/editor/SubclassToAdder.java2
-rw-r--r--src/proguard/classfile/editor/Utf8Shrinker.java38
-rw-r--r--src/proguard/classfile/editor/VariableCleaner.java2
-rw-r--r--src/proguard/classfile/editor/VariableEditor.java2
-rw-r--r--src/proguard/classfile/editor/VariableRemapper.java62
-rw-r--r--src/proguard/classfile/editor/VariableSizeUpdater.java2
-rw-r--r--src/proguard/classfile/instruction/BranchInstruction.java2
-rw-r--r--src/proguard/classfile/instruction/ConstantInstruction.java2
-rw-r--r--src/proguard/classfile/instruction/Instruction.java219
-rw-r--r--src/proguard/classfile/instruction/InstructionConstants.java2
-rw-r--r--src/proguard/classfile/instruction/InstructionFactory.java2
-rw-r--r--src/proguard/classfile/instruction/InstructionUtil.java34
-rw-r--r--src/proguard/classfile/instruction/LookUpSwitchInstruction.java2
-rw-r--r--src/proguard/classfile/instruction/SimpleInstruction.java2
-rw-r--r--src/proguard/classfile/instruction/SwitchInstruction.java2
-rw-r--r--src/proguard/classfile/instruction/TableSwitchInstruction.java2
-rw-r--r--src/proguard/classfile/instruction/VariableInstruction.java2
-rw-r--r--src/proguard/classfile/instruction/visitor/AllInstructionVisitor.java2
-rw-r--r--src/proguard/classfile/instruction/visitor/InstructionConstantVisitor.java4
-rw-r--r--src/proguard/classfile/instruction/visitor/InstructionCounter.java2
-rw-r--r--src/proguard/classfile/instruction/visitor/InstructionVisitor.java2
-rw-r--r--src/proguard/classfile/instruction/visitor/MultiInstructionVisitor.java2
-rw-r--r--src/proguard/classfile/io/LibraryClassReader.java4
-rw-r--r--src/proguard/classfile/io/ProgramClassReader.java235
-rw-r--r--src/proguard/classfile/io/ProgramClassWriter.java144
-rw-r--r--src/proguard/classfile/io/RuntimeDataInput.java2
-rw-r--r--src/proguard/classfile/io/RuntimeDataOutput.java2
-rw-r--r--src/proguard/classfile/util/AccessUtil.java26
-rw-r--r--src/proguard/classfile/util/AllParameterVisitor.java239
-rw-r--r--src/proguard/classfile/util/ClassReferenceInitializer.java38
-rw-r--r--src/proguard/classfile/util/ClassSubHierarchyInitializer.java2
-rw-r--r--src/proguard/classfile/util/ClassSuperHierarchyInitializer.java2
-rw-r--r--src/proguard/classfile/util/ClassUtil.java496
-rw-r--r--src/proguard/classfile/util/DescriptorClassEnumeration.java49
-rw-r--r--src/proguard/classfile/util/DynamicClassReferenceInitializer.java61
-rw-r--r--src/proguard/classfile/util/DynamicMemberReferenceInitializer.java81
-rw-r--r--src/proguard/classfile/util/EnumFieldReferenceInitializer.java17
-rw-r--r--src/proguard/classfile/util/ExternalTypeEnumeration.java12
-rw-r--r--src/proguard/classfile/util/InstructionSequenceMatcher.java10
-rw-r--r--src/proguard/classfile/util/InternalTypeEnumeration.java31
-rw-r--r--src/proguard/classfile/util/MemberFinder.java6
-rw-r--r--src/proguard/classfile/util/MethodLinker.java7
-rw-r--r--src/proguard/classfile/util/SimplifiedVisitor.java282
-rw-r--r--src/proguard/classfile/util/StringReferenceInitializer.java2
-rw-r--r--src/proguard/classfile/util/StringSharer.java2
-rw-r--r--src/proguard/classfile/util/WarningPrinter.java2
-rw-r--r--src/proguard/classfile/visitor/AllClassVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/AllFieldVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/AllMemberVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/AllMethodVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/BottomClassFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ClassAccessFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ClassCleaner.java91
-rw-r--r--src/proguard/classfile/visitor/ClassCollector.java2
-rw-r--r--src/proguard/classfile/visitor/ClassCounter.java2
-rw-r--r--src/proguard/classfile/visitor/ClassHierarchyTraveler.java2
-rw-r--r--src/proguard/classfile/visitor/ClassNameFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ClassPoolFiller.java2
-rw-r--r--src/proguard/classfile/visitor/ClassPoolVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/ClassPresenceFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ClassPrinter.java226
-rw-r--r--src/proguard/classfile/visitor/ClassVersionFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ClassVersionSetter.java2
-rw-r--r--src/proguard/classfile/visitor/ClassVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/ConcreteClassDownTraveler.java10
-rw-r--r--src/proguard/classfile/visitor/DotClassClassVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/DynamicReturnedClassVisitor.java68
-rw-r--r--src/proguard/classfile/visitor/ExceptClassFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ExceptClassesFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ExceptionCounter.java2
-rw-r--r--src/proguard/classfile/visitor/ExceptionExcludedOffsetFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ExceptionHandlerConstantVisitor.java4
-rw-r--r--src/proguard/classfile/visitor/ExceptionHandlerFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ExceptionOffsetFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ExceptionRangeFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ImplementedClassConstantFilter.java6
-rw-r--r--src/proguard/classfile/visitor/ImplementedClassFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ImplementingClassConstantFilter.java6
-rw-r--r--src/proguard/classfile/visitor/LibraryClassFilter.java2
-rw-r--r--src/proguard/classfile/visitor/LibraryMemberFilter.java2
-rw-r--r--src/proguard/classfile/visitor/MemberAccessFilter.java8
-rw-r--r--src/proguard/classfile/visitor/MemberClassAccessFilter.java2
-rw-r--r--src/proguard/classfile/visitor/MemberCollector.java2
-rw-r--r--src/proguard/classfile/visitor/MemberCounter.java2
-rw-r--r--src/proguard/classfile/visitor/MemberDescriptorFilter.java2
-rw-r--r--src/proguard/classfile/visitor/MemberDescriptorReferencedClassVisitor.java65
-rw-r--r--src/proguard/classfile/visitor/MemberNameFilter.java2
-rw-r--r--src/proguard/classfile/visitor/MemberToClassVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/MemberVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/MethodImplementationFilter.java2
-rw-r--r--src/proguard/classfile/visitor/MethodImplementationTraveler.java16
-rw-r--r--src/proguard/classfile/visitor/MultiClassPoolVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/MultiClassVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/MultiMemberVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/NamedClassVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/NamedFieldVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/NamedMethodVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/ParameterVisitor.java56
-rw-r--r--src/proguard/classfile/visitor/ProgramClassFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ProgramMemberFilter.java2
-rw-r--r--src/proguard/classfile/visitor/ReferencedClassVisitor.java18
-rw-r--r--src/proguard/classfile/visitor/ReferencedMemberVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/SimilarMemberVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/SimpleClassPrinter.java2
-rw-r--r--src/proguard/classfile/visitor/SubclassFilter.java2
-rw-r--r--src/proguard/classfile/visitor/SubclassTraveler.java2
-rw-r--r--src/proguard/classfile/visitor/VariableClassVisitor.java2
-rw-r--r--src/proguard/classfile/visitor/VariableMemberVisitor.java2
302 files changed, 6604 insertions, 1476 deletions
diff --git a/src/proguard/classfile/ClassConstants.java b/src/proguard/classfile/ClassConstants.java
index 59580c5..7220285 100644
--- a/src/proguard/classfile/ClassConstants.java
+++ b/src/proguard/classfile/ClassConstants.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,118 +21,94 @@
package proguard.classfile;
/**
- * Constants used in representing a Java class (*.class).
+ * Constants used in representing a Java class file (*.class).
*
* @author Eric Lafortune
*/
-public interface ClassConstants
+public class ClassConstants
{
public static final String CLASS_FILE_EXTENSION = ".class";
public static final int MAGIC = 0xCAFEBABE;
- public static final int INTERNAL_CLASS_VERSION_1_0_MAJOR = 45;
- public static final int INTERNAL_CLASS_VERSION_1_0_MINOR = 3;
- public static final int INTERNAL_CLASS_VERSION_1_2_MAJOR = 46;
- public static final int INTERNAL_CLASS_VERSION_1_2_MINOR = 0;
- public static final int INTERNAL_CLASS_VERSION_1_3_MAJOR = 47;
- public static final int INTERNAL_CLASS_VERSION_1_3_MINOR = 0;
- public static final int INTERNAL_CLASS_VERSION_1_4_MAJOR = 48;
- public static final int INTERNAL_CLASS_VERSION_1_4_MINOR = 0;
- public static final int INTERNAL_CLASS_VERSION_1_5_MAJOR = 49;
- public static final int INTERNAL_CLASS_VERSION_1_5_MINOR = 0;
- public static final int INTERNAL_CLASS_VERSION_1_6_MAJOR = 50;
- public static final int INTERNAL_CLASS_VERSION_1_6_MINOR = 0;
- public static final int INTERNAL_CLASS_VERSION_1_7_MAJOR = 51;
- public static final int INTERNAL_CLASS_VERSION_1_7_MINOR = 0;
+ public static final int CLASS_VERSION_1_0_MAJOR = 45;
+ public static final int CLASS_VERSION_1_0_MINOR = 3;
+ public static final int CLASS_VERSION_1_2_MAJOR = 46;
+ public static final int CLASS_VERSION_1_2_MINOR = 0;
+ public static final int CLASS_VERSION_1_3_MAJOR = 47;
+ public static final int CLASS_VERSION_1_3_MINOR = 0;
+ public static final int CLASS_VERSION_1_4_MAJOR = 48;
+ public static final int CLASS_VERSION_1_4_MINOR = 0;
+ public static final int CLASS_VERSION_1_5_MAJOR = 49;
+ public static final int CLASS_VERSION_1_5_MINOR = 0;
+ public static final int CLASS_VERSION_1_6_MAJOR = 50;
+ public static final int CLASS_VERSION_1_6_MINOR = 0;
+ public static final int CLASS_VERSION_1_7_MAJOR = 51;
+ public static final int CLASS_VERSION_1_7_MINOR = 0;
+ public static final int CLASS_VERSION_1_8_MAJOR = 52;
+ public static final int CLASS_VERSION_1_8_MINOR = 0;
- public static final int INTERNAL_CLASS_VERSION_1_0 = (INTERNAL_CLASS_VERSION_1_0_MAJOR << 16) | INTERNAL_CLASS_VERSION_1_0_MINOR;
- public static final int INTERNAL_CLASS_VERSION_1_2 = (INTERNAL_CLASS_VERSION_1_2_MAJOR << 16) | INTERNAL_CLASS_VERSION_1_2_MINOR;
- public static final int INTERNAL_CLASS_VERSION_1_3 = (INTERNAL_CLASS_VERSION_1_3_MAJOR << 16) | INTERNAL_CLASS_VERSION_1_3_MINOR;
- public static final int INTERNAL_CLASS_VERSION_1_4 = (INTERNAL_CLASS_VERSION_1_4_MAJOR << 16) | INTERNAL_CLASS_VERSION_1_4_MINOR;
- public static final int INTERNAL_CLASS_VERSION_1_5 = (INTERNAL_CLASS_VERSION_1_5_MAJOR << 16) | INTERNAL_CLASS_VERSION_1_5_MINOR;
- public static final int INTERNAL_CLASS_VERSION_1_6 = (INTERNAL_CLASS_VERSION_1_6_MAJOR << 16) | INTERNAL_CLASS_VERSION_1_6_MINOR;
- public static final int INTERNAL_CLASS_VERSION_1_7 = (INTERNAL_CLASS_VERSION_1_7_MAJOR << 16) | INTERNAL_CLASS_VERSION_1_7_MINOR;
+ public static final int CLASS_VERSION_1_0 = (CLASS_VERSION_1_0_MAJOR << 16) | CLASS_VERSION_1_0_MINOR;
+ public static final int CLASS_VERSION_1_2 = (CLASS_VERSION_1_2_MAJOR << 16) | CLASS_VERSION_1_2_MINOR;
+ public static final int CLASS_VERSION_1_3 = (CLASS_VERSION_1_3_MAJOR << 16) | CLASS_VERSION_1_3_MINOR;
+ public static final int CLASS_VERSION_1_4 = (CLASS_VERSION_1_4_MAJOR << 16) | CLASS_VERSION_1_4_MINOR;
+ public static final int CLASS_VERSION_1_5 = (CLASS_VERSION_1_5_MAJOR << 16) | CLASS_VERSION_1_5_MINOR;
+ public static final int CLASS_VERSION_1_6 = (CLASS_VERSION_1_6_MAJOR << 16) | CLASS_VERSION_1_6_MINOR;
+ public static final int CLASS_VERSION_1_7 = (CLASS_VERSION_1_7_MAJOR << 16) | CLASS_VERSION_1_7_MINOR;
+ public static final int CLASS_VERSION_1_8 = (CLASS_VERSION_1_8_MAJOR << 16) | CLASS_VERSION_1_8_MINOR;
- public static final String EXTERNAL_CLASS_VERSION_1_0 = "1.0";
- public static final String EXTERNAL_CLASS_VERSION_1_1 = "1.1";
- public static final String EXTERNAL_CLASS_VERSION_1_2 = "1.2";
- public static final String EXTERNAL_CLASS_VERSION_1_3 = "1.3";
- public static final String EXTERNAL_CLASS_VERSION_1_4 = "1.4";
- public static final String EXTERNAL_CLASS_VERSION_1_5 = "1.5";
- public static final String EXTERNAL_CLASS_VERSION_1_6 = "1.6";
- public static final String EXTERNAL_CLASS_VERSION_1_7 = "1.7";
- public static final String EXTERNAL_CLASS_VERSION_1_5_ALIAS = "5";
- public static final String EXTERNAL_CLASS_VERSION_1_6_ALIAS = "6";
- public static final String EXTERNAL_CLASS_VERSION_1_7_ALIAS = "7";
+ public static final int ACC_PUBLIC = 0x0001;
+ public static final int ACC_PRIVATE = 0x0002;
+ public static final int ACC_PROTECTED = 0x0004;
+ public static final int ACC_STATIC = 0x0008;
+ public static final int ACC_FINAL = 0x0010;
+ public static final int ACC_SUPER = 0x0020;
+ public static final int ACC_SYNCHRONIZED = 0x0020;
+ public static final int ACC_VOLATILE = 0x0040;
+ public static final int ACC_TRANSIENT = 0x0080;
+ public static final int ACC_BRIDGE = 0x0040;
+ public static final int ACC_VARARGS = 0x0080;
+ public static final int ACC_NATIVE = 0x0100;
+ public static final int ACC_INTERFACE = 0x0200;
+ public static final int ACC_ABSTRACT = 0x0400;
+ public static final int ACC_STRICT = 0x0800;
+ public static final int ACC_SYNTHETIC = 0x1000;
+ public static final int ACC_ANNOTATTION = 0x2000;
+ public static final int ACC_ENUM = 0x4000;
+ public static final int ACC_MANDATED = 0x8000;
- public static final int INTERNAL_ACC_PUBLIC = 0x0001;
- public static final int INTERNAL_ACC_PRIVATE = 0x0002;
- public static final int INTERNAL_ACC_PROTECTED = 0x0004;
- public static final int INTERNAL_ACC_STATIC = 0x0008;
- public static final int INTERNAL_ACC_FINAL = 0x0010;
- public static final int INTERNAL_ACC_SUPER = 0x0020;
- public static final int INTERNAL_ACC_SYNCHRONIZED = 0x0020;
- public static final int INTERNAL_ACC_VOLATILE = 0x0040;
- public static final int INTERNAL_ACC_TRANSIENT = 0x0080;
- public static final int INTERNAL_ACC_BRIDGE = 0x0040;
- public static final int INTERNAL_ACC_VARARGS = 0x0080;
- public static final int INTERNAL_ACC_NATIVE = 0x0100;
- public static final int INTERNAL_ACC_INTERFACE = 0x0200;
- public static final int INTERNAL_ACC_ABSTRACT = 0x0400;
- public static final int INTERNAL_ACC_STRICT = 0x0800;
- public static final int INTERNAL_ACC_SYNTHETIC = 0x1000;
- public static final int INTERNAL_ACC_ANNOTATTION = 0x2000;
- public static final int INTERNAL_ACC_ENUM = 0x4000;
-
- public static final int VALID_INTERNAL_ACC_CLASS = INTERNAL_ACC_PUBLIC |
- INTERNAL_ACC_FINAL |
- INTERNAL_ACC_SUPER |
- INTERNAL_ACC_INTERFACE |
- INTERNAL_ACC_ABSTRACT |
- INTERNAL_ACC_SYNTHETIC |
- INTERNAL_ACC_ANNOTATTION |
- INTERNAL_ACC_ENUM;
- public static final int VALID_INTERNAL_ACC_FIELD = INTERNAL_ACC_PUBLIC |
- INTERNAL_ACC_PRIVATE |
- INTERNAL_ACC_PROTECTED |
- INTERNAL_ACC_STATIC |
- INTERNAL_ACC_FINAL |
- INTERNAL_ACC_VOLATILE |
- INTERNAL_ACC_TRANSIENT |
- INTERNAL_ACC_SYNTHETIC |
- INTERNAL_ACC_ENUM;
- public static final int VALID_INTERNAL_ACC_METHOD = INTERNAL_ACC_PUBLIC |
- INTERNAL_ACC_PRIVATE |
- INTERNAL_ACC_PROTECTED |
- INTERNAL_ACC_STATIC |
- INTERNAL_ACC_FINAL |
- INTERNAL_ACC_SYNCHRONIZED |
- INTERNAL_ACC_BRIDGE |
- INTERNAL_ACC_VARARGS |
- INTERNAL_ACC_NATIVE |
- INTERNAL_ACC_ABSTRACT |
- INTERNAL_ACC_STRICT |
- INTERNAL_ACC_SYNTHETIC;
-
- public static final String EXTERNAL_ACC_PUBLIC = "public";
- public static final String EXTERNAL_ACC_PRIVATE = "private";
- public static final String EXTERNAL_ACC_PROTECTED = "protected";
- public static final String EXTERNAL_ACC_STATIC = "static";
- public static final String EXTERNAL_ACC_FINAL = "final";
- public static final String EXTERNAL_ACC_SUPER = "super";
- public static final String EXTERNAL_ACC_SYNCHRONIZED = "synchronized";
- public static final String EXTERNAL_ACC_VOLATILE = "volatile";
- public static final String EXTERNAL_ACC_TRANSIENT = "transient";
- public static final String EXTERNAL_ACC_BRIDGE = "bridge";
- public static final String EXTERNAL_ACC_VARARGS = "varargs";
- public static final String EXTERNAL_ACC_NATIVE = "native";
- public static final String EXTERNAL_ACC_INTERFACE = "interface";
- public static final String EXTERNAL_ACC_ABSTRACT = "abstract";
- public static final String EXTERNAL_ACC_STRICT = "strictfp";
- public static final String EXTERNAL_ACC_SYNTHETIC = "synthetic";
- public static final String EXTERNAL_ACC_ANNOTATION = "@";
- public static final String EXTERNAL_ACC_ENUM = "enum";
+ public static final int VALID_ACC_CLASS = ACC_PUBLIC |
+ ACC_FINAL |
+ ACC_SUPER |
+ ACC_INTERFACE |
+ ACC_ABSTRACT |
+ ACC_SYNTHETIC |
+ ACC_ANNOTATTION |
+ ACC_ENUM;
+ public static final int VALID_ACC_FIELD = ACC_PUBLIC |
+ ACC_PRIVATE |
+ ACC_PROTECTED |
+ ACC_STATIC |
+ ACC_FINAL |
+ ACC_VOLATILE |
+ ACC_TRANSIENT |
+ ACC_SYNTHETIC |
+ ACC_ENUM;
+ public static final int VALID_ACC_METHOD = ACC_PUBLIC |
+ ACC_PRIVATE |
+ ACC_PROTECTED |
+ ACC_STATIC |
+ ACC_FINAL |
+ ACC_SYNCHRONIZED |
+ ACC_BRIDGE |
+ ACC_VARARGS |
+ ACC_NATIVE |
+ ACC_ABSTRACT |
+ ACC_STRICT |
+ ACC_SYNTHETIC;
+ public static final int VALID_ACC_PARAMETER = ACC_FINAL |
+ ACC_SYNTHETIC |
+ ACC_MANDATED;
public static final int CONSTANT_Utf8 = 1;
public static final int CONSTANT_Integer = 3;
@@ -168,6 +144,7 @@ public interface ClassConstants
public static final String ATTR_Synthetic = "Synthetic";
public static final String ATTR_Signature = "Signature";
public static final String ATTR_ConstantValue = "ConstantValue";
+ public static final String ATTR_MethodParameters = "MethodParameters";
public static final String ATTR_Exceptions = "Exceptions";
public static final String ATTR_Code = "Code";
public static final String ATTR_StackMap = "StackMap";
@@ -179,145 +156,183 @@ public interface ClassConstants
public static final String ATTR_RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
public static final String ATTR_RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
public static final String ATTR_RuntimeInvisibleParameterAnnotations = "RuntimeInvisibleParameterAnnotations";
+ public static final String ATTR_RuntimeVisibleTypeAnnotations = "RuntimeVisibleTypeAnnotations";
+ public static final String ATTR_RuntimeInvisibleTypeAnnotations = "RuntimeInvisibleTypeAnnotations";
public static final String ATTR_AnnotationDefault = "AnnotationDefault";
+ public static final int ANNOTATION_TARGET_ParameterGenericClass = 0x00;
+ public static final int ANNOTATION_TARGET_ParameterGenericMethod = 0x01;
+ public static final int ANNOTATION_TARGET_Extends = 0x10;
+ public static final int ANNOTATION_TARGET_BoundGenericClass = 0x11;
+ public static final int ANNOTATION_TARGET_BoundGenericMethod = 0x12;
+ public static final int ANNOTATION_TARGET_Field = 0x13;
+ public static final int ANNOTATION_TARGET_Return = 0x14;
+ public static final int ANNOTATION_TARGET_Receiver = 0x15;
+ public static final int ANNOTATION_TARGET_Parameter = 0x16;
+ public static final int ANNOTATION_TARGET_Throws = 0x17;
+ public static final int ANNOTATION_TARGET_LocalVariable = 0x40;
+ public static final int ANNOTATION_TARGET_ResourceVariable = 0x41;
+ public static final int ANNOTATION_TARGET_Catch = 0x42;
+ public static final int ANNOTATION_TARGET_InstanceOf = 0x43;
+ public static final int ANNOTATION_TARGET_New = 0x44;
+ public static final int ANNOTATION_TARGET_MethodReferenceNew = 0x45;
+ public static final int ANNOTATION_TARGET_MethodReference = 0x46;
+ public static final int ANNOTATION_TARGET_Cast = 0x47;
+ public static final int ANNOTATION_TARGET_ArgumentGenericMethodNew = 0x48;
+ public static final int ANNOTATION_TARGET_ArgumentGenericMethod = 0x49;
+ public static final int ANNOTATION_TARGET_ArgumentGenericMethodReferenceNew = 0x4a;
+ public static final int ANNOTATION_TARGET_ArgumentGenericMethodReference = 0x4b;
+
public static final char ELEMENT_VALUE_STRING_CONSTANT = 's';
public static final char ELEMENT_VALUE_ENUM_CONSTANT = 'e';
public static final char ELEMENT_VALUE_CLASS = 'c';
public static final char ELEMENT_VALUE_ANNOTATION = '@';
public static final char ELEMENT_VALUE_ARRAY = '[';
- public static final char EXTERNAL_PACKAGE_SEPARATOR = '.';
- public static final char EXTERNAL_INNER_CLASS_SEPARATOR = '.';
- public static final char INTERNAL_PACKAGE_SEPARATOR = '/';
- public static final char INTERNAL_INNER_CLASS_SEPARATOR = '$';
- public static final char SPECIAL_CLASS_CHARACTER = '-';
- public static final char SPECIAL_MEMBER_SEPARATOR = '$';
-
- public static final char EXTERNAL_METHOD_ARGUMENTS_OPEN = '(';
- public static final char EXTERNAL_METHOD_ARGUMENTS_CLOSE = ')';
- public static final char EXTERNAL_METHOD_ARGUMENTS_SEPARATOR = ',';
-
- public static final char INTERNAL_METHOD_ARGUMENTS_OPEN = '(';
- public static final char INTERNAL_METHOD_ARGUMENTS_CLOSE = ')';
+ public static final char PACKAGE_SEPARATOR = '/';
+ public static final char INNER_CLASS_SEPARATOR = '$';
+ public static final char SPECIAL_CLASS_CHARACTER = '-';
+ public static final char SPECIAL_MEMBER_SEPARATOR = '$';
- public static final String INTERNAL_PACKAGE_JAVA_LANG = "java/lang/";
- public static final String INTERNAL_NAME_JAVA_LANG_OBJECT = "java/lang/Object";
- public static final String INTERNAL_TYPE_JAVA_LANG_OBJECT = "Ljava/lang/Object;";
- public static final String INTERNAL_NAME_JAVA_LANG_CLONEABLE = "java/lang/Cloneable";
- public static final String INTERNAL_NAME_JAVA_LANG_THROWABLE = "java/lang/Throwable";
- public static final String INTERNAL_NAME_JAVA_LANG_CLASS = "java/lang/Class";
- public static final String INTERNAL_NAME_JAVA_LANG_STRING = "java/lang/String";
- public static final String INTERNAL_NAME_JAVA_LANG_STRING_BUFFER = "java/lang/StringBuffer";
- public static final String INTERNAL_NAME_JAVA_LANG_STRING_BUILDER = "java/lang/StringBuilder";
- public static final String INTERNAL_NAME_JAVA_LANG_INVOKE_METHOD_HANDLE = "java/lang/invoke/MethodHandle";
- public static final String INTERNAL_NAME_JAVA_LANG_INVOKE_METHOD_TYPE = "java/lang/invoke/MethodType";
- public static final String INTERNAL_NAME_JAVA_IO_SERIALIZABLE = "java/io/Serializable";
+ public static final char METHOD_ARGUMENTS_OPEN = '(';
+ public static final char METHOD_ARGUMENTS_CLOSE = ')';
- public static final String INTERNAL_NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_INTEGER_FIELD_UPDATER = "java/util/concurrent/atomic/AtomicIntegerFieldUpdater";
- public static final String INTERNAL_NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_LONG_FIELD_UPDATER = "java/util/concurrent/atomic/AtomicLongFieldUpdater";
- public static final String INTERNAL_NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_REFERENCE_FIELD_UPDATER = "java/util/concurrent/atomic/AtomicReferenceFieldUpdater";
+ public static final String PACKAGE_JAVA_LANG = "java/lang/";
+ public static final String NAME_JAVA_LANG_OBJECT = "java/lang/Object";
+ public static final String TYPE_JAVA_LANG_OBJECT = "Ljava/lang/Object;";
+ public static final String NAME_JAVA_LANG_CLONEABLE = "java/lang/Cloneable";
+ public static final String NAME_JAVA_LANG_THROWABLE = "java/lang/Throwable";
+ public static final String NAME_JAVA_LANG_CLASS = "java/lang/Class";
+ public static final String NAME_JAVA_LANG_STRING = "java/lang/String";
+ public static final String NAME_JAVA_LANG_STRING_BUFFER = "java/lang/StringBuffer";
+ public static final String NAME_JAVA_LANG_STRING_BUILDER = "java/lang/StringBuilder";
+ public static final String NAME_JAVA_LANG_INVOKE_METHOD_HANDLE = "java/lang/invoke/MethodHandle";
+ public static final String NAME_JAVA_LANG_INVOKE_METHOD_TYPE = "java/lang/invoke/MethodType";
+ public static final String NAME_JAVA_LANG_VOID = "java/lang/Void";
+ public static final String NAME_JAVA_LANG_BOOLEAN = "java/lang/Boolean";
+ public static final String NAME_JAVA_LANG_BYTE = "java/lang/Byte";
+ public static final String NAME_JAVA_LANG_SHORT = "java/lang/Short";
+ public static final String NAME_JAVA_LANG_CHARACTER = "java/lang/Character";
+ public static final String NAME_JAVA_LANG_INTEGER = "java/lang/Integer";
+ public static final String NAME_JAVA_LANG_LONG = "java/lang/Long";
+ public static final String NAME_JAVA_LANG_FLOAT = "java/lang/Float";
+ public static final String NAME_JAVA_LANG_DOUBLE = "java/lang/Double";
+ public static final String NAME_JAVA_LANG_MATH = "java/lang/Math";
+ public static final String NAME_JAVA_LANG_SYSTEM = "java/lang/System";
+ public static final String NAME_JAVA_LANG_RUNTIME = "java/lang/Runtime";
+ public static final String NAME_JAVA_LANG_REFLECT_ARRAY = "java/lang/reflect/Array";
+ public static final String NAME_JAVA_LANG_REFLECT_FIELD = "java/lang/reflect/Field";
+ public static final String NAME_JAVA_LANG_REFLECT_METHOD = "java/lang/reflect/Method";
+ public static final String NAME_JAVA_LANG_REFLECT_CONSTRUCTOR = "java/lang/reflect/Constructor";
+ public static final String NAME_JAVA_LANG_REFLECT_ACCESSIBLE_OBJECT = "java/lang/reflect/AccessibleObject";
+ public static final String NAME_JAVA_IO_SERIALIZABLE = "java/io/Serializable";
- public static final String INTERNAL_METHOD_NAME_INIT = "<init>";
- public static final String INTERNAL_METHOD_TYPE_INIT = "()V";
- public static final String INTERNAL_METHOD_NAME_CLINIT = "<clinit>";
- public static final String INTERNAL_METHOD_TYPE_CLINIT = "()V";
+ public static final String NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_INTEGER_FIELD_UPDATER = "java/util/concurrent/atomic/AtomicIntegerFieldUpdater";
+ public static final String NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_LONG_FIELD_UPDATER = "java/util/concurrent/atomic/AtomicLongFieldUpdater";
+ public static final String NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_REFERENCE_FIELD_UPDATER = "java/util/concurrent/atomic/AtomicReferenceFieldUpdater";
- public static final String INTERNAL_METHOD_NAME_CLASS_FOR_NAME = "forName";
- public static final String INTERNAL_METHOD_TYPE_CLASS_FOR_NAME = "(Ljava/lang/String;)Ljava/lang/Class;";
- public static final String INTERNAL_METHOD_NAME_CLASS_GET_COMPONENT_TYPE = "getComponentType";
- public static final String INTERNAL_METHOD_TYPE_CLASS_GET_COMPONENT_TYPE = "()Ljava/lang/Class;";
- public static final String INTERNAL_METHOD_NAME_CLASS_GET_FIELD = "getField";
- public static final String INTERNAL_METHOD_TYPE_CLASS_GET_FIELD = "(Ljava/lang/String;)Ljava/lang/reflect/Field;";
- public static final String INTERNAL_METHOD_NAME_CLASS_GET_DECLARED_FIELD = "getDeclaredField";
- public static final String INTERNAL_METHOD_TYPE_CLASS_GET_DECLARED_FIELD = "(Ljava/lang/String;)Ljava/lang/reflect/Field;";
- public static final String INTERNAL_CONSTRUCTOR_NAME_CLASS_GET_CONSTRUCTOR = "getConstructor";
- public static final String INTERNAL_CONSTRUCTOR_TYPE_CLASS_GET_CONSTRUCTOR = "([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;";
- public static final String INTERNAL_CONSTRUCTOR_NAME_CLASS_GET_DECLARED_CONSTRUCTOR = "getDeclaredConstructor";
- public static final String INTERNAL_CONSTRUCTOR_TYPE_CLASS_GET_DECLARED_CONSTRUCTOR = "([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;";
- public static final String INTERNAL_METHOD_NAME_CLASS_GET_METHOD = "getMethod";
- public static final String INTERNAL_METHOD_TYPE_CLASS_GET_METHOD = "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;";
- public static final String INTERNAL_METHOD_NAME_CLASS_GET_DECLARED_METHOD = "getDeclaredMethod";
- public static final String INTERNAL_METHOD_TYPE_CLASS_GET_DECLARED_METHOD = "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;";
- public static final String INTERNAL_METHOD_NAME_NEW_UPDATER = "newUpdater";
- public static final String INTERNAL_METHOD_TYPE_NEW_INTEGER_UPDATER = "(Ljava/lang/Class;Ljava/lang/String;)Ljava/util/concurrent/atomic/AtomicIntegerFieldUpdater;";
- public static final String INTERNAL_METHOD_TYPE_NEW_LONG_UPDATER = "(Ljava/lang/Class;Ljava/lang/String;)Ljava/util/concurrent/atomic/AtomicLongFieldUpdater;";
- public static final String INTERNAL_METHOD_TYPE_NEW_REFERENCE_UPDATER = "(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/String;)Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;";
+ public static final String METHOD_NAME_INIT = "<init>";
+ public static final String METHOD_TYPE_INIT = "()V";
+ public static final String METHOD_NAME_CLINIT = "<clinit>";
+ public static final String METHOD_TYPE_CLINIT = "()V";
- public static final String INTERNAL_METHOD_NAME_DOT_CLASS_JAVAC = "class$";
- public static final String INTERNAL_METHOD_TYPE_DOT_CLASS_JAVAC = "(Ljava/lang/String;)Ljava/lang/Class;";
- public static final String INTERNAL_METHOD_NAME_DOT_CLASS_JIKES = "class";
- public static final String INTERNAL_METHOD_TYPE_DOT_CLASS_JIKES = "(Ljava/lang/String;Z)Ljava/lang/Class;";
+ public static final String METHOD_NAME_CLASS_FOR_NAME = "forName";
+ public static final String METHOD_TYPE_CLASS_FOR_NAME = "(Ljava/lang/String;)Ljava/lang/Class;";
+ public static final String METHOD_NAME_CLASS_GET_COMPONENT_TYPE = "getComponentType";
+ public static final String METHOD_TYPE_CLASS_GET_COMPONENT_TYPE = "()Ljava/lang/Class;";
+ public static final String METHOD_NAME_CLASS_GET_FIELD = "getField";
+ public static final String METHOD_TYPE_CLASS_GET_FIELD = "(Ljava/lang/String;)Ljava/lang/reflect/Field;";
+ public static final String METHOD_NAME_CLASS_GET_DECLARED_FIELD = "getDeclaredField";
+ public static final String METHOD_TYPE_CLASS_GET_DECLARED_FIELD = "(Ljava/lang/String;)Ljava/lang/reflect/Field;";
+ public static final String CONSTRUCTOR_NAME_CLASS_GET_CONSTRUCTOR = "getConstructor";
+ public static final String CONSTRUCTOR_TYPE_CLASS_GET_CONSTRUCTOR = "([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;";
+ public static final String CONSTRUCTOR_NAME_CLASS_GET_DECLARED_CONSTRUCTOR = "getDeclaredConstructor";
+ public static final String CONSTRUCTOR_TYPE_CLASS_GET_DECLARED_CONSTRUCTOR = "([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;";
+ public static final String METHOD_NAME_CLASS_GET_METHOD = "getMethod";
+ public static final String METHOD_TYPE_CLASS_GET_METHOD = "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;";
+ public static final String METHOD_NAME_CLASS_GET_DECLARED_METHOD = "getDeclaredMethod";
+ public static final String METHOD_TYPE_CLASS_GET_DECLARED_METHOD = "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;";
+ public static final String METHOD_NAME_CLASS_GET_DECLARING_CLASS = "getDeclaringClass";
+ public static final String METHOD_NAME_CLASS_GET_ENCLOSING_CLASS = "getEnclosingClass";
+ public static final String METHOD_NAME_CLASS_GET_ENCLOSING_CONSTRUCTOR = "getEnclosingConstructor";
+ public static final String METHOD_NAME_CLASS_GET_ENCLOSING_METHOD = "getEnclosingMethod";
+ public static final String METHOD_NAME_GET_ANNOTATION = "getAnnotation";
+ public static final String METHOD_NAME_GET_ANNOTATIONS = "getAnnotations";
+ public static final String METHOD_NAME_GET_DECLARED_ANNOTATIONS = "getDeclaredAnnotations";
+ public static final String METHOD_NAME_GET_PARAMETER_ANNOTATIONS = "getParameterAnnotations";
+ public static final String METHOD_NAME_GET_TYPE_PREFIX = "getType";
+ public static final String METHOD_NAME_GET_GENERIC_PREFIX = "getGeneric";
+ public static final String METHOD_NAME_NEW_UPDATER = "newUpdater";
+ public static final String METHOD_TYPE_NEW_INTEGER_UPDATER = "(Ljava/lang/Class;Ljava/lang/String;)Ljava/util/concurrent/atomic/AtomicIntegerFieldUpdater;";
+ public static final String METHOD_TYPE_NEW_LONG_UPDATER = "(Ljava/lang/Class;Ljava/lang/String;)Ljava/util/concurrent/atomic/AtomicLongFieldUpdater;";
+ public static final String METHOD_TYPE_NEW_REFERENCE_UPDATER = "(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/String;)Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;";
- public static final String INTERNAL_METHOD_TYPE_INIT_ENUM = "(Ljava/lang/String;I)V";
+ public static final String METHOD_NAME_DOT_CLASS_JAVAC = "class$";
+ public static final String METHOD_TYPE_DOT_CLASS_JAVAC = "(Ljava/lang/String;)Ljava/lang/Class;";
+ public static final String METHOD_NAME_DOT_CLASS_JIKES = "class";
+ public static final String METHOD_TYPE_DOT_CLASS_JIKES = "(Ljava/lang/String;Z)Ljava/lang/Class;";
- public static final String INTERNAL_METHOD_NAME_NEW_INSTANCE = "newInstance";
- public static final String INTERNAL_METHOD_TYPE_NEW_INSTANCE = "()Ljava/lang/Object;";
+ public static final String METHOD_TYPE_INIT_ENUM = "(Ljava/lang/String;I)V";
- public static final String INTERNAL_METHOD_NAME_EQUALS = "equals";
- public static final String INTERNAL_METHOD_TYPE_EQUALS = "(Ljava/lang/Object;)Z";
- public static final String INTERNAL_METHOD_NAME_LENGTH = "length";
- public static final String INTERNAL_METHOD_NAME_VALUEOF = "valueOf";
- public static final String INTERNAL_METHOD_TYPE_VALUEOF_BOOLEAN = "(Z)Ljava/lang/String;";
- public static final String INTERNAL_METHOD_TYPE_VALUEOF_CHAR = "(C)Ljava/lang/String;";
- public static final String INTERNAL_METHOD_TYPE_VALUEOF_INT = "(I)Ljava/lang/String;";
- public static final String INTERNAL_METHOD_TYPE_VALUEOF_LONG = "(J)Ljava/lang/String;";
- public static final String INTERNAL_METHOD_TYPE_VALUEOF_FLOAT = "(F)Ljava/lang/String;";
- public static final String INTERNAL_METHOD_TYPE_VALUEOF_DOUBLE = "(D)Ljava/lang/String;";
- public static final String INTERNAL_METHOD_TYPE_VALUEOF_OBJECT = "(Ljava/lang/Object;)Ljava/lang/String;";
+ public static final String METHOD_NAME_NEW_INSTANCE = "newInstance";
+ public static final String METHOD_TYPE_NEW_INSTANCE = "()Ljava/lang/Object;";
- public static final String INTERNAL_METHOD_TYPE_LENGTH = "()I";
- public static final String INTERNAL_METHOD_NAME_APPEND = "append";
- public static final String INTERNAL_METHOD_TYPE_STRING_VOID = "(Ljava/lang/String;)V";
- public static final String INTERNAL_METHOD_TYPE_BOOLEAN_STRING_BUFFER = "(Z)Ljava/lang/StringBuffer;";
- public static final String INTERNAL_METHOD_TYPE_CHAR_STRING_BUFFER = "(C)Ljava/lang/StringBuffer;";
- public static final String INTERNAL_METHOD_TYPE_INT_STRING_BUFFER = "(I)Ljava/lang/StringBuffer;";
- public static final String INTERNAL_METHOD_TYPE_LONG_STRING_BUFFER = "(J)Ljava/lang/StringBuffer;";
- public static final String INTERNAL_METHOD_TYPE_FLOAT_STRING_BUFFER = "(F)Ljava/lang/StringBuffer;";
- public static final String INTERNAL_METHOD_TYPE_DOUBLE_STRING_BUFFER = "(D)Ljava/lang/StringBuffer;";
- public static final String INTERNAL_METHOD_TYPE_STRING_STRING_BUFFER = "(Ljava/lang/String;)Ljava/lang/StringBuffer;";
- public static final String INTERNAL_METHOD_TYPE_OBJECT_STRING_BUFFER = "(Ljava/lang/Object;)Ljava/lang/StringBuffer;";
- public static final String INTERNAL_METHOD_TYPE_BOOLEAN_STRING_BUILDER = "(Z)Ljava/lang/StringBuilder;";
- public static final String INTERNAL_METHOD_TYPE_CHAR_STRING_BUILDER = "(C)Ljava/lang/StringBuilder;";
- public static final String INTERNAL_METHOD_TYPE_INT_STRING_BUILDER = "(I)Ljava/lang/StringBuilder;";
- public static final String INTERNAL_METHOD_TYPE_LONG_STRING_BUILDER = "(J)Ljava/lang/StringBuilder;";
- public static final String INTERNAL_METHOD_TYPE_FLOAT_STRING_BUILDER = "(F)Ljava/lang/StringBuilder;";
- public static final String INTERNAL_METHOD_TYPE_DOUBLE_STRING_BUILDER = "(D)Ljava/lang/StringBuilder;";
- public static final String INTERNAL_METHOD_TYPE_STRING_STRING_BUILDER = "(Ljava/lang/String;)Ljava/lang/StringBuilder;";
- public static final String INTERNAL_METHOD_TYPE_OBJECT_STRING_BUILDER = "(Ljava/lang/Object;)Ljava/lang/StringBuilder;";
- public static final String INTERNAL_METHOD_NAME_TOSTRING = "toString";
- public static final String INTERNAL_METHOD_TYPE_TOSTRING = "()Ljava/lang/String;";
+ public static final String METHOD_NAME_EQUALS = "equals";
+ public static final String METHOD_TYPE_EQUALS = "(Ljava/lang/Object;)Z";
+ public static final String METHOD_NAME_LENGTH = "length";
+ public static final String METHOD_NAME_VALUEOF = "valueOf";
+ public static final String METHOD_TYPE_VALUEOF_BOOLEAN = "(Z)Ljava/lang/String;";
+ public static final String METHOD_TYPE_VALUEOF_CHAR = "(C)Ljava/lang/String;";
+ public static final String METHOD_TYPE_VALUEOF_INT = "(I)Ljava/lang/String;";
+ public static final String METHOD_TYPE_VALUEOF_LONG = "(J)Ljava/lang/String;";
+ public static final String METHOD_TYPE_VALUEOF_FLOAT = "(F)Ljava/lang/String;";
+ public static final String METHOD_TYPE_VALUEOF_DOUBLE = "(D)Ljava/lang/String;";
+ public static final String METHOD_TYPE_VALUEOF_OBJECT = "(Ljava/lang/Object;)Ljava/lang/String;";
- public static final char INTERNAL_TYPE_VOID = 'V';
- public static final char INTERNAL_TYPE_BOOLEAN = 'Z';
- public static final char INTERNAL_TYPE_BYTE = 'B';
- public static final char INTERNAL_TYPE_CHAR = 'C';
- public static final char INTERNAL_TYPE_SHORT = 'S';
- public static final char INTERNAL_TYPE_INT = 'I';
- public static final char INTERNAL_TYPE_LONG = 'J';
- public static final char INTERNAL_TYPE_FLOAT = 'F';
- public static final char INTERNAL_TYPE_DOUBLE = 'D';
- public static final char INTERNAL_TYPE_CLASS_START = 'L';
- public static final char INTERNAL_TYPE_CLASS_END = ';';
- public static final char INTERNAL_TYPE_ARRAY = '[';
- public static final char INTERNAL_TYPE_GENERIC_VARIABLE_START = 'T';
- public static final char INTERNAL_TYPE_GENERIC_START = '<';
- public static final char INTERNAL_TYPE_GENERIC_BOUND = ':';
- public static final char INTERNAL_TYPE_GENERIC_END = '>';
+ public static final String METHOD_TYPE_LENGTH = "()I";
+ public static final String METHOD_NAME_APPEND = "append";
+ public static final String METHOD_TYPE_STRING_VOID = "(Ljava/lang/String;)V";
+ public static final String METHOD_TYPE_BOOLEAN_STRING_BUFFER = "(Z)Ljava/lang/StringBuffer;";
+ public static final String METHOD_TYPE_CHAR_STRING_BUFFER = "(C)Ljava/lang/StringBuffer;";
+ public static final String METHOD_TYPE_INT_STRING_BUFFER = "(I)Ljava/lang/StringBuffer;";
+ public static final String METHOD_TYPE_LONG_STRING_BUFFER = "(J)Ljava/lang/StringBuffer;";
+ public static final String METHOD_TYPE_FLOAT_STRING_BUFFER = "(F)Ljava/lang/StringBuffer;";
+ public static final String METHOD_TYPE_DOUBLE_STRING_BUFFER = "(D)Ljava/lang/StringBuffer;";
+ public static final String METHOD_TYPE_STRING_STRING_BUFFER = "(Ljava/lang/String;)Ljava/lang/StringBuffer;";
+ public static final String METHOD_TYPE_OBJECT_STRING_BUFFER = "(Ljava/lang/Object;)Ljava/lang/StringBuffer;";
+ public static final String METHOD_TYPE_BOOLEAN_STRING_BUILDER = "(Z)Ljava/lang/StringBuilder;";
+ public static final String METHOD_TYPE_CHAR_STRING_BUILDER = "(C)Ljava/lang/StringBuilder;";
+ public static final String METHOD_TYPE_INT_STRING_BUILDER = "(I)Ljava/lang/StringBuilder;";
+ public static final String METHOD_TYPE_LONG_STRING_BUILDER = "(J)Ljava/lang/StringBuilder;";
+ public static final String METHOD_TYPE_FLOAT_STRING_BUILDER = "(F)Ljava/lang/StringBuilder;";
+ public static final String METHOD_TYPE_DOUBLE_STRING_BUILDER = "(D)Ljava/lang/StringBuilder;";
+ public static final String METHOD_TYPE_STRING_STRING_BUILDER = "(Ljava/lang/String;)Ljava/lang/StringBuilder;";
+ public static final String METHOD_TYPE_OBJECT_STRING_BUILDER = "(Ljava/lang/Object;)Ljava/lang/StringBuilder;";
+ public static final String METHOD_NAME_TOSTRING = "toString";
+ public static final String METHOD_TYPE_TOSTRING = "()Ljava/lang/String;";
+ public static final String METHOD_NAME_CLONE = "clone";
+ public static final String METHOD_TYPE_CLONE = "()Ljava/lang/Object;";
- public static final String EXTERNAL_TYPE_JAVA_LANG_OBJECT = "java.lang.Object";
- public static final String EXTERNAL_PACKAGE_JAVA_LANG = "java.lang.";
+ public static final String METHOD_NAME_VALUES = "values";
+ public static final String METHOD_NAME_ORDINAL = "ordinal";
+ public static final String METHOD_TYPE_ORDINAL = "()I";
- public static final String EXTERNAL_TYPE_VOID = "void";
- public static final String EXTERNAL_TYPE_BOOLEAN = "boolean";
- public static final String EXTERNAL_TYPE_BYTE = "byte";
- public static final String EXTERNAL_TYPE_CHAR = "char";
- public static final String EXTERNAL_TYPE_SHORT = "short";
- public static final String EXTERNAL_TYPE_INT = "int";
- public static final String EXTERNAL_TYPE_FLOAT = "float";
- public static final String EXTERNAL_TYPE_LONG = "long";
- public static final String EXTERNAL_TYPE_DOUBLE = "double";
- public static final String EXTERNAL_TYPE_ARRAY = "[]";
+ public static final char TYPE_VOID = 'V';
+ public static final char TYPE_BOOLEAN = 'Z';
+ public static final char TYPE_BYTE = 'B';
+ public static final char TYPE_CHAR = 'C';
+ public static final char TYPE_SHORT = 'S';
+ public static final char TYPE_INT = 'I';
+ public static final char TYPE_LONG = 'J';
+ public static final char TYPE_FLOAT = 'F';
+ public static final char TYPE_DOUBLE = 'D';
+ public static final char TYPE_CLASS_START = 'L';
+ public static final char TYPE_CLASS_END = ';';
+ public static final char TYPE_ARRAY = '[';
+ public static final char TYPE_GENERIC_VARIABLE_START = 'T';
+ public static final char TYPE_GENERIC_START = '<';
+ public static final char TYPE_GENERIC_BOUND = ':';
+ public static final char TYPE_GENERIC_END = '>';
public static final int TYPICAL_CONSTANT_POOL_SIZE = 256;
public static final int TYPICAL_FIELD_COUNT = 64;
diff --git a/src/proguard/classfile/ClassPool.java b/src/proguard/classfile/ClassPool.java
index 5439c6f..da874b5 100644
--- a/src/proguard/classfile/ClassPool.java
+++ b/src/proguard/classfile/ClassPool.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,7 +20,6 @@
*/
package proguard.classfile;
-import proguard.classfile.util.ClassUtil;
import proguard.classfile.visitor.*;
import java.util.*;
diff --git a/src/proguard/classfile/Clazz.java b/src/proguard/classfile/Clazz.java
index 35f8a1c..a055752 100644
--- a/src/proguard/classfile/Clazz.java
+++ b/src/proguard/classfile/Clazz.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -91,6 +91,11 @@ public interface Clazz extends VisitorAccepter
public String getType(int constantIndex);
/**
+ * Returns the class name of the RefConstant at the specified index.
+ */
+ public String getRefClassName(int constantIndex);
+
+ /**
* Returns the name of the RefConstant at the specified index.
*/
public String getRefName(int constantIndex);
diff --git a/src/proguard/classfile/Field.java b/src/proguard/classfile/Field.java
index 61bf2da..b3865a9 100644
--- a/src/proguard/classfile/Field.java
+++ b/src/proguard/classfile/Field.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/JavaConstants.java b/src/proguard/classfile/JavaConstants.java
new file mode 100644
index 0000000..ad8eeca
--- /dev/null
+++ b/src/proguard/classfile/JavaConstants.java
@@ -0,0 +1,89 @@
+/*
+ * 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;
+
+/**
+ * Constants used in representing a Java source file (*.java).
+ *
+ * @author Eric Lafortune
+ */
+public interface JavaConstants
+{
+ public static final String JAVA_FILE_EXTENSION = ".java";
+
+ public static final String CLASS_VERSION_1_0 = "1.0";
+ public static final String CLASS_VERSION_1_1 = "1.1";
+ public static final String CLASS_VERSION_1_2 = "1.2";
+ public static final String CLASS_VERSION_1_3 = "1.3";
+ public static final String CLASS_VERSION_1_4 = "1.4";
+ public static final String CLASS_VERSION_1_5 = "1.5";
+ public static final String CLASS_VERSION_1_6 = "1.6";
+ public static final String CLASS_VERSION_1_7 = "1.7";
+ public static final String CLASS_VERSION_1_8 = "1.8";
+ public static final String CLASS_VERSION_1_5_ALIAS = "5";
+ public static final String CLASS_VERSION_1_6_ALIAS = "6";
+ public static final String CLASS_VERSION_1_7_ALIAS = "7";
+ public static final String CLASS_VERSION_1_8_ALIAS = "8";
+
+ public static final String ACC_PUBLIC = "public";
+ public static final String ACC_PRIVATE = "private";
+ public static final String ACC_PROTECTED = "protected";
+ public static final String ACC_STATIC = "static";
+ public static final String ACC_FINAL = "final";
+// public static final String ACC_SUPER = "super";
+ public static final String ACC_SYNCHRONIZED = "synchronized";
+ public static final String ACC_VOLATILE = "volatile";
+ public static final String ACC_TRANSIENT = "transient";
+ public static final String ACC_BRIDGE = "bridge";
+ public static final String ACC_VARARGS = "varargs";
+ public static final String ACC_NATIVE = "native";
+ public static final String ACC_INTERFACE = "interface";
+ public static final String ACC_ABSTRACT = "abstract";
+ public static final String ACC_STRICT = "strictfp";
+ public static final String ACC_SYNTHETIC = "synthetic";
+ public static final String ACC_ANNOTATION = "@";
+ public static final String ACC_ENUM = "enum";
+ public static final String ACC_MANDATED = "mandated";
+// public static final String ACC_CONSTRUCTOR = "constructor";
+
+ public static final char PACKAGE_SEPARATOR = '.';
+ public static final char INNER_CLASS_SEPARATOR = '.';
+ public static final char SPECIAL_CLASS_CHARACTER = '-';
+ public static final char SPECIAL_MEMBER_SEPARATOR = '$';
+
+ public static final char METHOD_ARGUMENTS_OPEN = '(';
+ public static final char METHOD_ARGUMENTS_CLOSE = ')';
+ public static final char METHOD_ARGUMENTS_SEPARATOR = ',';
+
+ public static final String TYPE_JAVA_LANG_OBJECT = "java.lang.Object";
+ public static final String PACKAGE_JAVA_LANG = "java.lang.";
+
+ public static final String TYPE_VOID = "void";
+ public static final String TYPE_BOOLEAN = "boolean";
+ public static final String TYPE_BYTE = "byte";
+ public static final String TYPE_CHAR = "char";
+ public static final String TYPE_SHORT = "short";
+ public static final String TYPE_INT = "int";
+ public static final String TYPE_FLOAT = "float";
+ public static final String TYPE_LONG = "long";
+ public static final String TYPE_DOUBLE = "double";
+ public static final String TYPE_ARRAY = "[]";
+} \ No newline at end of file
diff --git a/src/proguard/classfile/LibraryClass.java b/src/proguard/classfile/LibraryClass.java
index 151a32a..3975677 100644
--- a/src/proguard/classfile/LibraryClass.java
+++ b/src/proguard/classfile/LibraryClass.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -74,7 +74,7 @@ public class LibraryClass implements Clazz
*/
boolean isVisible()
{
- return (u2accessFlags & ClassConstants.INTERNAL_ACC_PUBLIC) != 0;
+ return (u2accessFlags & ClassConstants.ACC_PUBLIC) != 0;
}
@@ -137,6 +137,11 @@ public class LibraryClass implements Clazz
}
+ public String getRefClassName(int constantIndex)
+ {
+ throw new UnsupportedOperationException("Library class ["+thisClassName+"] doesn't store constant pool");
+ }
+
public String getRefName(int constantIndex)
{
throw new UnsupportedOperationException("Library class ["+thisClassName+"] doesn't store constant pool");
@@ -505,12 +510,12 @@ public class LibraryClass implements Clazz
public boolean mayHaveImplementations(Method method)
{
return
- (u2accessFlags & ClassConstants.INTERNAL_ACC_FINAL) == 0 &&
+ (u2accessFlags & ClassConstants.ACC_FINAL) == 0 &&
(method == null ||
- ((method.getAccessFlags() & (ClassConstants.INTERNAL_ACC_PRIVATE |
- ClassConstants.INTERNAL_ACC_STATIC |
- ClassConstants.INTERNAL_ACC_FINAL)) == 0 &&
- !method.getName(this).equals(ClassConstants.INTERNAL_METHOD_NAME_INIT)));
+ ((method.getAccessFlags() & (ClassConstants.ACC_PRIVATE |
+ ClassConstants.ACC_STATIC |
+ ClassConstants.ACC_FINAL)) == 0 &&
+ !method.getName(this).equals(ClassConstants.METHOD_NAME_INIT)));
}
diff --git a/src/proguard/classfile/LibraryField.java b/src/proguard/classfile/LibraryField.java
index 1c1c427..2e28d37 100644
--- a/src/proguard/classfile/LibraryField.java
+++ b/src/proguard/classfile/LibraryField.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/LibraryMember.java b/src/proguard/classfile/LibraryMember.java
index 8d8d00e..1c27e1b 100644
--- a/src/proguard/classfile/LibraryMember.java
+++ b/src/proguard/classfile/LibraryMember.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -29,10 +29,6 @@ import proguard.classfile.visitor.MemberVisitor;
*/
public abstract class LibraryMember implements Member
{
- private static final int ACC_VISIBLE = ClassConstants.INTERNAL_ACC_PUBLIC |
- ClassConstants.INTERNAL_ACC_PROTECTED;
-
-
public int u2accessFlags;
public String name;
public String descriptor;
diff --git a/src/proguard/classfile/LibraryMethod.java b/src/proguard/classfile/LibraryMethod.java
index ac07857..0ef7b01 100644
--- a/src/proguard/classfile/LibraryMethod.java
+++ b/src/proguard/classfile/LibraryMethod.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/Member.java b/src/proguard/classfile/Member.java
index ee2cf19..d94cd80 100644
--- a/src/proguard/classfile/Member.java
+++ b/src/proguard/classfile/Member.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/Method.java b/src/proguard/classfile/Method.java
index 64ff50a..76eaf4f 100644
--- a/src/proguard/classfile/Method.java
+++ b/src/proguard/classfile/Method.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/ProgramClass.java b/src/proguard/classfile/ProgramClass.java
index 54bb8b1..b5d885c 100644
--- a/src/proguard/classfile/ProgramClass.java
+++ b/src/proguard/classfile/ProgramClass.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -170,6 +170,18 @@ public class ProgramClass implements Clazz
}
+ public String getRefClassName(int constantIndex)
+ {
+ try
+ {
+ return ((RefConstant)constantPool[constantIndex]).getClassName(this);
+ }
+ catch (ClassCastException ex)
+ {
+ throw ((IllegalStateException)new IllegalStateException("Expected RefConstant at index ["+constantIndex+"] in class ["+getName()+"]").initCause(ex));
+ }
+ }
+
public String getRefName(int constantIndex)
{
try
@@ -519,12 +531,12 @@ public class ProgramClass implements Clazz
public boolean mayHaveImplementations(Method method)
{
return
- (u2accessFlags & ClassConstants.INTERNAL_ACC_FINAL) == 0 &&
+ (u2accessFlags & ClassConstants.ACC_FINAL) == 0 &&
(method == null ||
- ((method.getAccessFlags() & (ClassConstants.INTERNAL_ACC_PRIVATE |
- ClassConstants.INTERNAL_ACC_STATIC |
- ClassConstants.INTERNAL_ACC_FINAL)) == 0 &&
- !method.getName(this).equals(ClassConstants.INTERNAL_METHOD_NAME_INIT)));
+ ((method.getAccessFlags() & (ClassConstants.ACC_PRIVATE |
+ ClassConstants.ACC_STATIC |
+ ClassConstants.ACC_FINAL)) == 0 &&
+ !method.getName(this).equals(ClassConstants.METHOD_NAME_INIT)));
}
diff --git a/src/proguard/classfile/ProgramField.java b/src/proguard/classfile/ProgramField.java
index 3bdfd85..c1ed101 100644
--- a/src/proguard/classfile/ProgramField.java
+++ b/src/proguard/classfile/ProgramField.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,8 +20,8 @@
*/
package proguard.classfile;
-import proguard.classfile.attribute.visitor.AttributeVisitor;
import proguard.classfile.attribute.Attribute;
+import proguard.classfile.attribute.visitor.AttributeVisitor;
import proguard.classfile.visitor.*;
/**
diff --git a/src/proguard/classfile/ProgramMember.java b/src/proguard/classfile/ProgramMember.java
index 240d344..6a9b1f2 100644
--- a/src/proguard/classfile/ProgramMember.java
+++ b/src/proguard/classfile/ProgramMember.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,7 +21,7 @@
package proguard.classfile;
-import proguard.classfile.attribute.*;
+import proguard.classfile.attribute.Attribute;
import proguard.classfile.attribute.visitor.AttributeVisitor;
import proguard.classfile.visitor.MemberVisitor;
diff --git a/src/proguard/classfile/ProgramMethod.java b/src/proguard/classfile/ProgramMethod.java
index 26f793f..80e35e5 100644
--- a/src/proguard/classfile/ProgramMethod.java
+++ b/src/proguard/classfile/ProgramMethod.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,8 +20,8 @@
*/
package proguard.classfile;
-import proguard.classfile.attribute.visitor.AttributeVisitor;
import proguard.classfile.attribute.Attribute;
+import proguard.classfile.attribute.visitor.AttributeVisitor;
import proguard.classfile.visitor.*;
/**
diff --git a/src/proguard/classfile/VisitorAccepter.java b/src/proguard/classfile/VisitorAccepter.java
index 9c7a062..8fae922 100644
--- a/src/proguard/classfile/VisitorAccepter.java
+++ b/src/proguard/classfile/VisitorAccepter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/Attribute.java b/src/proguard/classfile/attribute/Attribute.java
index f34a0ee..06845e0 100644
--- a/src/proguard/classfile/attribute/Attribute.java
+++ b/src/proguard/classfile/attribute/Attribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -84,7 +84,7 @@ public abstract class Attribute implements VisitorAccepter
*/
public void accept(Clazz clazz, Field field, AttributeVisitor attributeVisitor)
{
- // Delegate the default invocation if the field is null anyway.
+ // Delegate to the default invocation if the field is null anyway.
if (field == null)
{
accept(clazz, attributeVisitor);
@@ -100,7 +100,7 @@ public abstract class Attribute implements VisitorAccepter
*/
public void accept(Clazz clazz, Method method, AttributeVisitor attributeVisitor)
{
- // Delegate the default invocation if the method is null anyway.
+ // Delegate to the default invocation if the method is null anyway.
if (method == null)
{
accept(clazz, (Field)null, attributeVisitor);
@@ -116,7 +116,8 @@ public abstract class Attribute implements VisitorAccepter
*/
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, AttributeVisitor attributeVisitor)
{
- // Delegate the default invocation if the code attribute is null anyway.
+ // Delegate to the default invocation if the code attribute is null
+ // anyway.
if (codeAttribute == null)
{
accept(clazz, method, attributeVisitor);
diff --git a/src/proguard/classfile/attribute/BootstrapMethodInfo.java b/src/proguard/classfile/attribute/BootstrapMethodInfo.java
index f246766..e819362 100755
--- a/src/proguard/classfile/attribute/BootstrapMethodInfo.java
+++ b/src/proguard/classfile/attribute/BootstrapMethodInfo.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/BootstrapMethodsAttribute.java b/src/proguard/classfile/attribute/BootstrapMethodsAttribute.java
index 4471a75..20b8965 100755
--- a/src/proguard/classfile/attribute/BootstrapMethodsAttribute.java
+++ b/src/proguard/classfile/attribute/BootstrapMethodsAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,9 +20,8 @@
*/
package proguard.classfile.attribute;
-import proguard.classfile.*;
+import proguard.classfile.Clazz;
import proguard.classfile.attribute.visitor.*;
-import proguard.classfile.constant.visitor.ConstantVisitor;
/**
* This Attribute represents a bootstrap methods attribute.
@@ -66,8 +65,7 @@ public class BootstrapMethodsAttribute extends Attribute
/**
- * Applies the given constant pool visitor to all bootstrap method info
- * entries.
+ * Applies the given visitor to all bootstrap method info entries.
*/
public void bootstrapMethodEntriesAccept(Clazz clazz, BootstrapMethodInfoVisitor bootstrapMethodInfoVisitor)
{
@@ -81,8 +79,8 @@ public class BootstrapMethodsAttribute extends Attribute
/**
- * Applies the given constant pool visitor to the specified bootstrap method
- * info entry.
+ * Applies the given visitor to the specified bootstrap method info
+ * entry.
*/
public void bootstrapMethodEntryAccept(Clazz clazz,
int bootstrapMethodIndex,
diff --git a/src/proguard/classfile/attribute/CodeAttribute.java b/src/proguard/classfile/attribute/CodeAttribute.java
index b3d4f4c..6bcaa0a 100644
--- a/src/proguard/classfile/attribute/CodeAttribute.java
+++ b/src/proguard/classfile/attribute/CodeAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/ConstantValueAttribute.java b/src/proguard/classfile/attribute/ConstantValueAttribute.java
index 056e377..b90f393 100644
--- a/src/proguard/classfile/attribute/ConstantValueAttribute.java
+++ b/src/proguard/classfile/attribute/ConstantValueAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/DeprecatedAttribute.java b/src/proguard/classfile/attribute/DeprecatedAttribute.java
index f668063..c1920e9 100644
--- a/src/proguard/classfile/attribute/DeprecatedAttribute.java
+++ b/src/proguard/classfile/attribute/DeprecatedAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/EnclosingMethodAttribute.java b/src/proguard/classfile/attribute/EnclosingMethodAttribute.java
index 1c2ecc4..8a31f03 100644
--- a/src/proguard/classfile/attribute/EnclosingMethodAttribute.java
+++ b/src/proguard/classfile/attribute/EnclosingMethodAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/ExceptionInfo.java b/src/proguard/classfile/attribute/ExceptionInfo.java
index 31512e5..2bb1118 100644
--- a/src/proguard/classfile/attribute/ExceptionInfo.java
+++ b/src/proguard/classfile/attribute/ExceptionInfo.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/ExceptionsAttribute.java b/src/proguard/classfile/attribute/ExceptionsAttribute.java
index ff7b84a..5ae5c3d 100644
--- a/src/proguard/classfile/attribute/ExceptionsAttribute.java
+++ b/src/proguard/classfile/attribute/ExceptionsAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/InnerClassesAttribute.java b/src/proguard/classfile/attribute/InnerClassesAttribute.java
index b08d104..f0c9e1e 100644
--- a/src/proguard/classfile/attribute/InnerClassesAttribute.java
+++ b/src/proguard/classfile/attribute/InnerClassesAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/InnerClassesInfo.java b/src/proguard/classfile/attribute/InnerClassesInfo.java
index 87b9de4..7a1eb67 100644
--- a/src/proguard/classfile/attribute/InnerClassesInfo.java
+++ b/src/proguard/classfile/attribute/InnerClassesInfo.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/LineNumberInfo.java b/src/proguard/classfile/attribute/LineNumberInfo.java
index 1bcacef..0dd527c 100644
--- a/src/proguard/classfile/attribute/LineNumberInfo.java
+++ b/src/proguard/classfile/attribute/LineNumberInfo.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/LineNumberTableAttribute.java b/src/proguard/classfile/attribute/LineNumberTableAttribute.java
index c217119..7bd3e00 100644
--- a/src/proguard/classfile/attribute/LineNumberTableAttribute.java
+++ b/src/proguard/classfile/attribute/LineNumberTableAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/LocalVariableInfo.java b/src/proguard/classfile/attribute/LocalVariableInfo.java
index 00bbd50..88035ce 100644
--- a/src/proguard/classfile/attribute/LocalVariableInfo.java
+++ b/src/proguard/classfile/attribute/LocalVariableInfo.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -76,6 +76,24 @@ public class LocalVariableInfo implements VisitorAccepter, Comparable
/**
+ * Returns the name.
+ */
+ public String getName(Clazz clazz)
+ {
+ return clazz.getString(u2nameIndex);
+ }
+
+
+ /**
+ * Returns the descriptor.
+ */
+ public String getDescriptor(Clazz clazz)
+ {
+ return clazz.getString(u2descriptorIndex);
+ }
+
+
+ /**
* Lets the referenced class accept the given visitor.
*/
public void referencedClassAccept(ClassVisitor classVisitor)
diff --git a/src/proguard/classfile/attribute/LocalVariableTableAttribute.java b/src/proguard/classfile/attribute/LocalVariableTableAttribute.java
index 9e081c0..a48e890 100644
--- a/src/proguard/classfile/attribute/LocalVariableTableAttribute.java
+++ b/src/proguard/classfile/attribute/LocalVariableTableAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/LocalVariableTypeInfo.java b/src/proguard/classfile/attribute/LocalVariableTypeInfo.java
index 15b9d24..c0fc405 100644
--- a/src/proguard/classfile/attribute/LocalVariableTypeInfo.java
+++ b/src/proguard/classfile/attribute/LocalVariableTypeInfo.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -77,6 +77,24 @@ public class LocalVariableTypeInfo implements VisitorAccepter, Comparable
/**
+ * Returns the name.
+ */
+ public String getName(Clazz clazz)
+ {
+ return clazz.getString(u2nameIndex);
+ }
+
+
+ /**
+ * Returns the signature.
+ */
+ public String getSignature(Clazz clazz)
+ {
+ return clazz.getString(u2signatureIndex);
+ }
+
+
+ /**
* Applies the given visitor to all referenced classes.
*/
public void referencedClassesAccept(ClassVisitor classVisitor)
diff --git a/src/proguard/classfile/attribute/LocalVariableTypeTableAttribute.java b/src/proguard/classfile/attribute/LocalVariableTypeTableAttribute.java
index dda24fb..62643bc 100644
--- a/src/proguard/classfile/attribute/LocalVariableTypeTableAttribute.java
+++ b/src/proguard/classfile/attribute/LocalVariableTypeTableAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/MethodParametersAttribute.java b/src/proguard/classfile/attribute/MethodParametersAttribute.java
new file mode 100644
index 0000000..5e832d2
--- /dev/null
+++ b/src/proguard/classfile/attribute/MethodParametersAttribute.java
@@ -0,0 +1,80 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.visitor.*;
+
+/**
+ * This Attribute represents a method parameters attribute.
+ *
+ * @author Eric Lafortune
+ */
+public class MethodParametersAttribute extends Attribute
+{
+ public int u1parametersCount;
+ public ParameterInfo[] parameters;
+
+
+ /**
+ * Creates an uninitialized MethodParametersAttribute.
+ */
+ public MethodParametersAttribute()
+ {
+ }
+
+
+ /**
+ * Creates an initialized MethodParametersAttribute.
+ */
+ public MethodParametersAttribute(int u2attributeNameIndex,
+ int u1parametersCount,
+ ParameterInfo[] parameters)
+ {
+ super(u2attributeNameIndex);
+
+ this.u1parametersCount = u1parametersCount;
+ this.parameters = parameters;
+ }
+
+
+ // Implementations for Attribute.
+
+ public void accept(Clazz clazz, Method method, AttributeVisitor attributeVisitor)
+ {
+ attributeVisitor.visitMethodParametersAttribute(clazz, method, this);
+ }
+
+
+ /**
+ * Applies the given visitor to all parameters.
+ */
+ public void parametersAccept(Clazz clazz, Method method, ParameterInfoVisitor parameterInfoVisitor)
+ {
+ // Loop over all parameters.
+ for (int index = 0; index < u1parametersCount; index++)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of ParameterInfo.
+ parameterInfoVisitor.visitParameterInfo(clazz, method, index, parameters[index]);
+ }
+ }
+}
diff --git a/src/proguard/classfile/attribute/ParameterInfo.java b/src/proguard/classfile/attribute/ParameterInfo.java
new file mode 100644
index 0000000..dac5e1a
--- /dev/null
+++ b/src/proguard/classfile/attribute/ParameterInfo.java
@@ -0,0 +1,81 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute;
+
+import proguard.classfile.*;
+
+/**
+ * Representation of a parameter, as defined in a method parameters
+ * attribute.
+ *
+ * @author Eric Lafortune
+ */
+public class ParameterInfo implements VisitorAccepter
+{
+ public int u2nameIndex;
+ public int u2accessFlags;
+
+ /**
+ * An extra field in which visitors can store information.
+ */
+ public Object visitorInfo;
+
+
+ /**
+ * Creates an uninitialized ParameterInfo.
+ */
+ public ParameterInfo()
+ {
+ }
+
+
+ /**
+ * Creates an initialized ParameterInfo.
+ */
+ public ParameterInfo(int u2nameIndex,
+ int u2accessFlags)
+ {
+ this.u2nameIndex = u2nameIndex;
+ this.u2accessFlags = u2accessFlags;
+ }
+
+
+ /**
+ * Returns the parameter name.
+ */
+ public String getName(Clazz clazz)
+ {
+ return clazz.getString(u2nameIndex);
+ }
+
+
+ // Implementations for VisitorAccepter.
+
+ public Object getVisitorInfo()
+ {
+ return visitorInfo;
+ }
+
+ public void setVisitorInfo(Object visitorInfo)
+ {
+ this.visitorInfo = visitorInfo;
+ }
+}
diff --git a/src/proguard/classfile/attribute/SignatureAttribute.java b/src/proguard/classfile/attribute/SignatureAttribute.java
index 86f95b8..120fa96 100644
--- a/src/proguard/classfile/attribute/SignatureAttribute.java
+++ b/src/proguard/classfile/attribute/SignatureAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -63,6 +63,15 @@ public class SignatureAttribute extends Attribute
/**
+ * Returns the signature.
+ */
+ public String getSignature(Clazz clazz)
+ {
+ return clazz.getString(u2signatureIndex);
+ }
+
+
+ /**
* Lets the Clazz objects referenced in the signature string accept the
* given visitor.
*/
diff --git a/src/proguard/classfile/attribute/SourceDirAttribute.java b/src/proguard/classfile/attribute/SourceDirAttribute.java
index faa1c79..100c840 100644
--- a/src/proguard/classfile/attribute/SourceDirAttribute.java
+++ b/src/proguard/classfile/attribute/SourceDirAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/SourceFileAttribute.java b/src/proguard/classfile/attribute/SourceFileAttribute.java
index 4abac17..e10b784 100644
--- a/src/proguard/classfile/attribute/SourceFileAttribute.java
+++ b/src/proguard/classfile/attribute/SourceFileAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/SyntheticAttribute.java b/src/proguard/classfile/attribute/SyntheticAttribute.java
index 0135330..a308545 100644
--- a/src/proguard/classfile/attribute/SyntheticAttribute.java
+++ b/src/proguard/classfile/attribute/SyntheticAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/UnknownAttribute.java b/src/proguard/classfile/attribute/UnknownAttribute.java
index 182a9e8..f928f25 100644
--- a/src/proguard/classfile/attribute/UnknownAttribute.java
+++ b/src/proguard/classfile/attribute/UnknownAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -32,15 +32,17 @@ import proguard.classfile.attribute.visitor.AttributeVisitor;
public class UnknownAttribute extends Attribute
{
public final int u4attributeLength;
- public byte[] info;
+ public byte[] info;
/**
- * Creates an uninitialized UnknownAttribute with the given length.
+ * Creates an uninitialized UnknownAttribute with the specified name and
+ * length.
*/
- public UnknownAttribute(int attributeLength)
+ public UnknownAttribute(int u2attributeNameIndex,
+ int attributeLength)
{
- u4attributeLength = attributeLength;
+ this(u2attributeNameIndex, attributeLength, null);
}
diff --git a/src/proguard/classfile/attribute/annotation/Annotation.java b/src/proguard/classfile/attribute/annotation/Annotation.java
index b2f18d5..3e24a9e 100644
--- a/src/proguard/classfile/attribute/annotation/Annotation.java
+++ b/src/proguard/classfile/attribute/annotation/Annotation.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/annotation/AnnotationDefaultAttribute.java b/src/proguard/classfile/attribute/annotation/AnnotationDefaultAttribute.java
index b8f29cc..1b06e82 100644
--- a/src/proguard/classfile/attribute/annotation/AnnotationDefaultAttribute.java
+++ b/src/proguard/classfile/attribute/annotation/AnnotationDefaultAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/annotation/AnnotationElementValue.java b/src/proguard/classfile/attribute/annotation/AnnotationElementValue.java
index 8354f5d..1e6365c 100644
--- a/src/proguard/classfile/attribute/annotation/AnnotationElementValue.java
+++ b/src/proguard/classfile/attribute/annotation/AnnotationElementValue.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/annotation/AnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/AnnotationsAttribute.java
index a936ff4..dcb7cf6 100644
--- a/src/proguard/classfile/attribute/annotation/AnnotationsAttribute.java
+++ b/src/proguard/classfile/attribute/annotation/AnnotationsAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,7 +21,7 @@
package proguard.classfile.attribute.annotation;
import proguard.classfile.*;
-import proguard.classfile.attribute.Attribute;
+import proguard.classfile.attribute.*;
import proguard.classfile.attribute.annotation.visitor.AnnotationVisitor;
/**
@@ -44,7 +44,7 @@ public abstract class AnnotationsAttribute extends Attribute
/**
- * Creates an initialized AnnotationsAttribute.
+ * Creates an initialized AnnotationsAttribute.
*/
protected AnnotationsAttribute(int u2attributeNameIndex,
int u2annotationsCount,
@@ -97,4 +97,18 @@ public abstract class AnnotationsAttribute extends Attribute
annotationVisitor.visitAnnotation(clazz, method, annotations[index]);
}
}
+
+
+ /**
+ * Applies the given visitor to all code attribute annotations.
+ */
+ public void annotationsAccept(Clazz clazz, Method method, CodeAttribute codeAttribute, AnnotationVisitor annotationVisitor)
+ {
+ for (int index = 0; index < u2annotationsCount; index++)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of Annotation.
+ annotationVisitor.visitAnnotation(clazz, method, codeAttribute, annotations[index]);
+ }
+ }
}
diff --git a/src/proguard/classfile/attribute/annotation/ArrayElementValue.java b/src/proguard/classfile/attribute/annotation/ArrayElementValue.java
index 0aab49b..4d814c0 100644
--- a/src/proguard/classfile/attribute/annotation/ArrayElementValue.java
+++ b/src/proguard/classfile/attribute/annotation/ArrayElementValue.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/annotation/ClassElementValue.java b/src/proguard/classfile/attribute/annotation/ClassElementValue.java
index ffeaf71..0e5de1e 100644
--- a/src/proguard/classfile/attribute/annotation/ClassElementValue.java
+++ b/src/proguard/classfile/attribute/annotation/ClassElementValue.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -63,6 +63,15 @@ public class ClassElementValue extends ElementValue
/**
+ * Returns the class info name.
+ */
+ public String getClassName(Clazz clazz)
+ {
+ return clazz.getString(u2classInfoIndex);
+ }
+
+
+ /**
* Applies the given visitor to all referenced classes.
*/
public void referencedClassesAccept(ClassVisitor classVisitor)
diff --git a/src/proguard/classfile/attribute/annotation/ConstantElementValue.java b/src/proguard/classfile/attribute/annotation/ConstantElementValue.java
index 8be4329..5ff51db 100644
--- a/src/proguard/classfile/attribute/annotation/ConstantElementValue.java
+++ b/src/proguard/classfile/attribute/annotation/ConstantElementValue.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/annotation/ElementValue.java b/src/proguard/classfile/attribute/annotation/ElementValue.java
index 19a7198..9c0f2c9 100644
--- a/src/proguard/classfile/attribute/annotation/ElementValue.java
+++ b/src/proguard/classfile/attribute/annotation/ElementValue.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/annotation/EnumConstantElementValue.java b/src/proguard/classfile/attribute/annotation/EnumConstantElementValue.java
index cd0f2f9..1105100 100644
--- a/src/proguard/classfile/attribute/annotation/EnumConstantElementValue.java
+++ b/src/proguard/classfile/attribute/annotation/EnumConstantElementValue.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/annotation/ParameterAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/ParameterAnnotationsAttribute.java
index ddaa3a6..4b0cb1c 100644
--- a/src/proguard/classfile/attribute/annotation/ParameterAnnotationsAttribute.java
+++ b/src/proguard/classfile/attribute/annotation/ParameterAnnotationsAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -25,13 +25,13 @@ import proguard.classfile.attribute.Attribute;
import proguard.classfile.attribute.annotation.visitor.AnnotationVisitor;
/**
- * This Attribute represents a runtime parameter annotations attribute.
+ * This Attribute represents a parameter annotations attribute.
*
* @author Eric Lafortune
*/
public abstract class ParameterAnnotationsAttribute extends Attribute
{
- public int u2parametersCount;
+ public int u1parametersCount;
public int[] u2parameterAnnotationsCount;
public Annotation[][] parameterAnnotations;
@@ -48,13 +48,13 @@ public abstract class ParameterAnnotationsAttribute extends Attribute
* Creates an initialized ParameterAnnotationsAttribute.
*/
protected ParameterAnnotationsAttribute(int u2attributeNameIndex,
- int u2parametersCount,
+ int u1parametersCount,
int[] u2parameterAnnotationsCount,
Annotation[][] parameterAnnotations)
{
super(u2attributeNameIndex);
- this.u2parametersCount = u2parametersCount;
+ this.u1parametersCount = u1parametersCount;
this.u2parameterAnnotationsCount = u2parameterAnnotationsCount;
this.parameterAnnotations = parameterAnnotations;
}
@@ -66,7 +66,7 @@ public abstract class ParameterAnnotationsAttribute extends Attribute
public void annotationsAccept(Clazz clazz, Method method, AnnotationVisitor annotationVisitor)
{
// Loop over all parameters.
- for (int parameterIndex = 0; parameterIndex < u2parametersCount; parameterIndex++)
+ for (int parameterIndex = 0; parameterIndex < u1parametersCount; parameterIndex++)
{
int annotationsCount = u2parameterAnnotationsCount[parameterIndex];
Annotation[] annotations = parameterAnnotations[parameterIndex];
diff --git a/src/proguard/classfile/attribute/annotation/RuntimeInvisibleAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/RuntimeInvisibleAnnotationsAttribute.java
index deda8a5..84d9d61 100644
--- a/src/proguard/classfile/attribute/annotation/RuntimeInvisibleAnnotationsAttribute.java
+++ b/src/proguard/classfile/attribute/annotation/RuntimeInvisibleAnnotationsAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/annotation/RuntimeInvisibleParameterAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/RuntimeInvisibleParameterAnnotationsAttribute.java
index 2fcae88..0a5e1d7 100644
--- a/src/proguard/classfile/attribute/annotation/RuntimeInvisibleParameterAnnotationsAttribute.java
+++ b/src/proguard/classfile/attribute/annotation/RuntimeInvisibleParameterAnnotationsAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -42,12 +42,12 @@ public class RuntimeInvisibleParameterAnnotationsAttribute extends ParameterAnno
* Creates an initialized RuntimeInvisibleParameterAnnotationsAttribute.
*/
public RuntimeInvisibleParameterAnnotationsAttribute(int u2attributeNameIndex,
- int u2parametersCount,
+ int u1parametersCount,
int[] u2parameterAnnotationsCount,
Annotation[][] parameterAnnotations)
{
super(u2attributeNameIndex,
- u2parametersCount,
+ u1parametersCount,
u2parameterAnnotationsCount,
parameterAnnotations);
}
diff --git a/src/proguard/classfile/attribute/annotation/RuntimeInvisibleTypeAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/RuntimeInvisibleTypeAnnotationsAttribute.java
new file mode 100644
index 0000000..2e1ca95
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/RuntimeInvisibleTypeAnnotationsAttribute.java
@@ -0,0 +1,77 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.visitor.AttributeVisitor;
+
+/**
+ * This Attribute represents a runtime invisible type annotations attribute.
+ *
+ * @author Eric Lafortune
+ */
+public class RuntimeInvisibleTypeAnnotationsAttribute extends TypeAnnotationsAttribute
+{
+ /**
+ * Creates an uninitialized RuntimeInvisibleTypeAnnotationsAttribute.
+ */
+ public RuntimeInvisibleTypeAnnotationsAttribute()
+ {
+ }
+
+
+ /**
+ * Creates an initialized RuntimeInvisibleTypeAnnotationsAttribute.
+ */
+ public RuntimeInvisibleTypeAnnotationsAttribute(int u2attributeNameIndex,
+ int u2annotationsCount,
+ TypeAnnotation[] annotations)
+ {
+ super(u2attributeNameIndex, u2annotationsCount, annotations);
+ }
+
+
+ // Implementations for Attribute.
+
+ public void accept(Clazz clazz, AttributeVisitor attributeVisitor)
+ {
+ attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, this);
+ }
+
+
+ public void accept(Clazz clazz, Field field, AttributeVisitor attributeVisitor)
+ {
+ attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, field, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, AttributeVisitor attributeVisitor)
+ {
+ attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, AttributeVisitor attributeVisitor)
+ {
+ attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, this);
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/RuntimeVisibleAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/RuntimeVisibleAnnotationsAttribute.java
index da94f0c..89acf04 100644
--- a/src/proguard/classfile/attribute/annotation/RuntimeVisibleAnnotationsAttribute.java
+++ b/src/proguard/classfile/attribute/annotation/RuntimeVisibleAnnotationsAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/annotation/RuntimeVisibleParameterAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/RuntimeVisibleParameterAnnotationsAttribute.java
index caa6830..cc273c2 100644
--- a/src/proguard/classfile/attribute/annotation/RuntimeVisibleParameterAnnotationsAttribute.java
+++ b/src/proguard/classfile/attribute/annotation/RuntimeVisibleParameterAnnotationsAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -42,12 +42,12 @@ public class RuntimeVisibleParameterAnnotationsAttribute extends ParameterAnnota
* Creates an initialized RuntimeVisibleParameterAnnotationsAttribute.
*/
public RuntimeVisibleParameterAnnotationsAttribute(int u2attributeNameIndex,
- int u2parametersCount,
+ int u1parametersCount,
int[] u2parameterAnnotationsCount,
Annotation[][] parameterAnnotations)
{
super(u2attributeNameIndex,
- u2parametersCount,
+ u1parametersCount,
u2parameterAnnotationsCount,
parameterAnnotations);
}
diff --git a/src/proguard/classfile/attribute/annotation/RuntimeVisibleTypeAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/RuntimeVisibleTypeAnnotationsAttribute.java
new file mode 100644
index 0000000..084827a
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/RuntimeVisibleTypeAnnotationsAttribute.java
@@ -0,0 +1,77 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.visitor.AttributeVisitor;
+
+/**
+ * This Attribute represents a runtime visible type annotations attribute.
+ *
+ * @author Eric Lafortune
+ */
+public class RuntimeVisibleTypeAnnotationsAttribute extends TypeAnnotationsAttribute
+{
+ /**
+ * Creates an uninitialized RuntimeVisibleTypeAnnotationsAttribute.
+ */
+ public RuntimeVisibleTypeAnnotationsAttribute()
+ {
+ }
+
+
+ /**
+ * Creates an initialized RuntimeVisibleTypeAnnotationsAttribute.
+ */
+ public RuntimeVisibleTypeAnnotationsAttribute(int u2attributeNameIndex,
+ int u2annotationsCount,
+ TypeAnnotation[] annotations)
+ {
+ super(u2attributeNameIndex, u2annotationsCount, annotations);
+ }
+
+
+ // Implementations for Attribute.
+
+ public void accept(Clazz clazz, AttributeVisitor attributeVisitor)
+ {
+ attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, this);
+ }
+
+
+ public void accept(Clazz clazz, Field field, AttributeVisitor attributeVisitor)
+ {
+ attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, field, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, AttributeVisitor attributeVisitor)
+ {
+ attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, AttributeVisitor attributeVisitor)
+ {
+ attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, this);
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/TypeAnnotation.java b/src/proguard/classfile/attribute/annotation/TypeAnnotation.java
new file mode 100644
index 0000000..86e4ddf
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/TypeAnnotation.java
@@ -0,0 +1,162 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.annotation.target.TargetInfo;
+import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor;
+import proguard.classfile.attribute.annotation.visitor.*;
+
+/**
+ * Representation of a type annotation.
+ *
+ * @author Eric Lafortune
+ */
+public class TypeAnnotation extends Annotation
+{
+ public TargetInfo targetInfo;
+ public TypePathInfo[] typePath;
+
+
+ /**
+ * Creates an uninitialized TypeAnnotation.
+ */
+ public TypeAnnotation()
+ {
+ }
+
+
+ /**
+ * Creates an initialized TypeAnnotation.
+ */
+ public TypeAnnotation(int u2typeIndex,
+ int u2elementValuesCount,
+ ElementValue[] elementValues,
+ TargetInfo targetInfo,
+ TypePathInfo[] typePath)
+ {
+ super(u2typeIndex, u2elementValuesCount, elementValues);
+
+ this.targetInfo = targetInfo;
+ this.typePath = typePath;
+ }
+
+
+ /**
+ * Applies the given visitor to the target info.
+ */
+ public void targetInfoAccept(Clazz clazz, TargetInfoVisitor targetInfoVisitor)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of TypePathInfo.
+ targetInfo.accept(clazz, this, targetInfoVisitor);
+ }
+
+
+ /**
+ * Applies the given visitor to the target info.
+ */
+ public void targetInfoAccept(Clazz clazz, Field field, TargetInfoVisitor targetInfoVisitor)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of TypePathInfo.
+ targetInfo.accept(clazz, field, this, targetInfoVisitor);
+ }
+
+
+ /**
+ * Applies the given visitor to the target info.
+ */
+ public void targetInfoAccept(Clazz clazz, Method method, TargetInfoVisitor targetInfoVisitor)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of TypePathInfo.
+ targetInfo.accept(clazz, method, this, targetInfoVisitor);
+ }
+
+
+ /**
+ * Applies the given visitor to the target info.
+ */
+ public void targetInfoAccept(Clazz clazz, Method method, CodeAttribute codeAttribute, TargetInfoVisitor targetInfoVisitor)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of TypePathInfo.
+ targetInfo.accept(clazz, method, codeAttribute, this, targetInfoVisitor);
+ }
+
+
+ /**
+ * Applies the given visitor to all type path elements.
+ */
+ public void typePathInfosAccept(Clazz clazz, TypePathInfoVisitor typePathVisitor)
+ {
+ for (int index = 0; index < typePath.length; index++)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of TypePathInfo.
+ typePathVisitor.visitTypePathInfo(clazz, this, typePath[index]);
+ }
+ }
+
+
+ /**
+ * Applies the given visitor to all type path elements.
+ */
+ public void typePathInfosAccept(Clazz clazz, Field field, TypePathInfoVisitor typePathVisitor)
+ {
+ for (int index = 0; index < typePath.length; index++)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of TypePathInfo.
+ typePathVisitor.visitTypePathInfo(clazz, field, this, typePath[index]);
+ }
+ }
+
+
+ /**
+ * Applies the given visitor to all type path elements.
+ */
+ public void typePathInfosAccept(Clazz clazz, Method method, TypePathInfoVisitor typePathVisitor)
+ {
+ for (int index = 0; index < typePath.length; index++)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of TypePathInfo.
+ typePathVisitor.visitTypePathInfo(clazz, method, this, typePath[index]);
+ }
+ }
+
+
+ /**
+ * Applies the given visitor to all type path elements.
+ */
+ public void typePathInfosAccept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TypePathInfoVisitor typePathVisitor)
+ {
+ for (int index = 0; index < typePath.length; index++)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of TypePathInfo.
+ typePathVisitor.visitTypePathInfo(clazz, method, codeAttribute, typeAnnotation, typePath[index]);
+ }
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/TypeAnnotationsAttribute.java b/src/proguard/classfile/attribute/annotation/TypeAnnotationsAttribute.java
new file mode 100644
index 0000000..7606e05
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/TypeAnnotationsAttribute.java
@@ -0,0 +1,98 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.annotation.visitor.*;
+
+/**
+ * This Attribute represents a type annotations attribute.
+ *
+ * @author Eric Lafortune
+ */
+public abstract class TypeAnnotationsAttribute extends AnnotationsAttribute
+{
+ /**
+ * Creates an uninitialized TypeAnnotationsAttribute.
+ */
+ protected TypeAnnotationsAttribute()
+ {
+ }
+
+
+ /**
+ * Creates an initialized TypeAnnotationsAttribute.
+ */
+ protected TypeAnnotationsAttribute(int u2attributeNameIndex,
+ int u2annotationsCount,
+ TypeAnnotation[] annotations)
+ {
+ super(u2attributeNameIndex, u2annotationsCount, annotations);
+ }
+
+
+ /**
+ * Applies the given visitor to all class annotations.
+ */
+ public void typeAnnotationsAccept(Clazz clazz, TypeAnnotationVisitor typeAnnotationVisitor)
+ {
+ TypeAnnotation[] annotations = (TypeAnnotation[])this.annotations;
+
+ for (int index = 0; index < u2annotationsCount; index++)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of Annotation.
+ typeAnnotationVisitor.visitTypeAnnotation(clazz, annotations[index]);
+ }
+ }
+
+
+ /**
+ * Applies the given visitor to all field annotations.
+ */
+ public void typeAnnotationsAccept(Clazz clazz, Field field, TypeAnnotationVisitor typeAnnotationVisitor)
+ {
+ TypeAnnotation[] annotations = (TypeAnnotation[])this.annotations;
+
+ for (int index = 0; index < u2annotationsCount; index++)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of Annotation.
+ typeAnnotationVisitor.visitTypeAnnotation(clazz, field, annotations[index]);
+ }
+ }
+
+
+ /**
+ * Applies the given visitor to all method annotations.
+ */
+ public void typeAnnotationsAccept(Clazz clazz, Method method, TypeAnnotationVisitor typeAnnotationVisitor)
+ {
+ TypeAnnotation[] annotations = (TypeAnnotation[])this.annotations;
+
+ for (int index = 0; index < u2annotationsCount; index++)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of Annotation.
+ typeAnnotationVisitor.visitTypeAnnotation(clazz, method, annotations[index]);
+ }
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/TypePathInfo.java b/src/proguard/classfile/attribute/annotation/TypePathInfo.java
new file mode 100644
index 0000000..9b40f7c
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/TypePathInfo.java
@@ -0,0 +1,50 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation;
+
+/**
+ * Representation of a path element in a type annotation.
+ *
+ * @author Eric Lafortune
+ */
+public class TypePathInfo
+{
+ public int u1typePathKind;
+ public int u1typeArgumentIndex;
+
+
+ /**
+ * Creates an uninitialized TypePathInfo.
+ */
+ public TypePathInfo()
+ {
+ }
+
+
+ /**
+ * Creates an initialized TypePathInfo.
+ */
+ public TypePathInfo(int u1typePathKind, int u1typeArgumentIndex)
+ {
+ this.u1typePathKind = u1typePathKind;
+ this.u1typeArgumentIndex = u1typeArgumentIndex;
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/CatchTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/CatchTargetInfo.java
new file mode 100644
index 0000000..9421b9c
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/CatchTargetInfo.java
@@ -0,0 +1,82 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.annotation.TypeAnnotation;
+import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor;
+
+/**
+ * Representation of a 'catch' annotation target.
+ *
+ * @author Eric Lafortune
+ */
+public class CatchTargetInfo extends TargetInfo
+{
+ public int u2exceptionTableIndex;
+
+
+ /**
+ * Creates an uninitialized CatchTargetInfo.
+ */
+ public CatchTargetInfo()
+ {
+ }
+
+
+ /**
+ * Creates a partially initialized CatchTargetInfo.
+ */
+ public CatchTargetInfo(byte u1targetType)
+ {
+ super(u1targetType);
+ }
+
+
+ /**
+ * Creates an initialized CatchTargetInfo.
+ */
+ protected CatchTargetInfo(byte u1targetType,
+ int u2exceptionTableIndex)
+ {
+ super(u1targetType);
+
+ this.u2exceptionTableIndex = u2exceptionTableIndex;
+ }
+
+
+ // Implementations for TargetInfo.
+
+ /**
+ * Lets the visitor visit, with Method and CodeAttribute null.
+ */
+ public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitCatchTargetInfo(clazz, null, null, typeAnnotation, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitCatchTargetInfo(clazz, method, codeAttribute, typeAnnotation, this);
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/EmptyTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/EmptyTargetInfo.java
new file mode 100644
index 0000000..fb0d794
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/EmptyTargetInfo.java
@@ -0,0 +1,72 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.annotation.TypeAnnotation;
+import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor;
+
+/**
+ * Representation of an empty annotation target.
+ *
+ * @author Eric Lafortune
+ */
+public class EmptyTargetInfo extends TargetInfo
+{
+ /**
+ * Creates an uninitialized EmptyTargetInfo.
+ */
+ public EmptyTargetInfo()
+ {
+ }
+
+
+ /**
+ * Creates an initialized EmptyTargetInfo.
+ */
+ public EmptyTargetInfo(byte u1targetType)
+ {
+ super(u1targetType);
+ }
+
+
+ // Implementations for TargetInfo.
+
+ /**
+ * Lets the visitor visit, with Field null.
+ */
+ public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitEmptyTargetInfo(clazz, (Field)null, typeAnnotation, this);
+ }
+
+
+ public void accept(Clazz clazz, Field field, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitEmptyTargetInfo(clazz, field, typeAnnotation, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitEmptyTargetInfo(clazz, method, typeAnnotation, this);
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/FormalParameterTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/FormalParameterTargetInfo.java
new file mode 100644
index 0000000..04bd9c5
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/FormalParameterTargetInfo.java
@@ -0,0 +1,81 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.annotation.TypeAnnotation;
+import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor;
+
+/**
+ * Representation of a formal parameter annotation target.
+ *
+ * @author Eric Lafortune
+ */
+public class FormalParameterTargetInfo extends TargetInfo
+{
+ public int u1formalParameterIndex;
+
+
+ /**
+ * Creates an uninitialized FormalParameterTargetInfo.
+ */
+ public FormalParameterTargetInfo()
+ {
+ }
+
+
+ /**
+ * Creates a partially initialized FormalParameterTargetInfo.
+ */
+ public FormalParameterTargetInfo(byte u1targetType)
+ {
+ super(u1targetType);
+ }
+
+
+ /**
+ * Creates an initialized FormalParameterTargetInfo.
+ */
+ public FormalParameterTargetInfo(byte u1targetType,
+ int u1formalParameterIndex)
+ {
+ super(u1targetType);
+
+ this.u1formalParameterIndex = u1formalParameterIndex;
+ }
+
+
+ // Implementations for TargetInfo.
+
+ /**
+ * Lets the visitor visit, with Method null.
+ */
+ public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitFormalParameterTargetInfo(clazz, null, typeAnnotation, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitFormalParameterTargetInfo(clazz, method, typeAnnotation, this);
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/LocalVariableTargetElement.java b/src/proguard/classfile/attribute/annotation/target/LocalVariableTargetElement.java
new file mode 100644
index 0000000..bcf41dc
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/LocalVariableTargetElement.java
@@ -0,0 +1,53 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target;
+
+/**
+ * Representation of an local variable target table entry.
+ *
+ * @author Eric Lafortune
+ */
+public class LocalVariableTargetElement
+{
+ public int u2startPC;
+ public int u2length;
+ public int u2index;
+
+ /**
+ * Creates an uninitialized LocalVariableTargetElement.
+ */
+ public LocalVariableTargetElement()
+ {
+ }
+
+
+ /**
+ * Creates an initialized LocalVariableTargetElement.
+ */
+ public LocalVariableTargetElement(int u2startPC,
+ int u2length,
+ int u2index)
+ {
+ this.u2startPC = u2startPC;
+ this.u2length = u2length;
+ this.u2index = u2index;
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/LocalVariableTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/LocalVariableTargetInfo.java
new file mode 100644
index 0000000..dd9246c
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/LocalVariableTargetInfo.java
@@ -0,0 +1,99 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.annotation.TypeAnnotation;
+import proguard.classfile.attribute.annotation.target.visitor.*;
+
+/**
+ * Representation of a local variable annotation target.
+ *
+ * @author Eric Lafortune
+ */
+public class LocalVariableTargetInfo extends TargetInfo
+{
+ public int u2tableLength;
+ public LocalVariableTargetElement[] table;
+
+
+ /**
+ * Creates an uninitialized LocalVariableTargetInfo.
+ */
+ public LocalVariableTargetInfo()
+ {
+ }
+
+
+ /**
+ * Creates a partially initialized LocalVariableTargetInfo.
+ */
+ public LocalVariableTargetInfo(byte u1targetType)
+ {
+ super(u1targetType);
+ }
+
+
+ /**
+ * Creates an initialized LocalVariableTargetInfo.
+ */
+ protected LocalVariableTargetInfo(byte u1targetType,
+ int u2tableLength,
+ LocalVariableTargetElement[] table)
+ {
+ super(u1targetType);
+
+ this.u2tableLength = u2tableLength;
+ this.table = table;
+ }
+
+
+ /**
+ * Applies the given visitor to all target elements.
+ */
+ public void targetElementsAccept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetElementVisitor localVariableTargetElementVisitor)
+ {
+ for (int index = 0; index < u2tableLength; index++)
+ {
+ // We don't need double dispatching here, since there is only one
+ // type of TypePathInfo.
+ localVariableTargetElementVisitor.visitLocalVariableTargetElement(clazz, method, codeAttribute, typeAnnotation, this, table[index]);
+ }
+ }
+
+
+ // Implementations for TargetInfo.
+
+ /**
+ * Lets the visitor visit, with Method and CodeAttribute null.
+ */
+ public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitLocalVariableTargetInfo(clazz, null, null, typeAnnotation, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitLocalVariableTargetInfo(clazz, method, codeAttribute, typeAnnotation, this);
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/OffsetTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/OffsetTargetInfo.java
new file mode 100644
index 0000000..312046b
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/OffsetTargetInfo.java
@@ -0,0 +1,82 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.annotation.TypeAnnotation;
+import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor;
+
+/**
+ * Representation of an offset annotation target.
+ *
+ * @author Eric Lafortune
+ */
+public class OffsetTargetInfo extends TargetInfo
+{
+ public int u2offset;
+
+
+ /**
+ * Creates an uninitialized OffsetTargetInfo.
+ */
+ public OffsetTargetInfo()
+ {
+ }
+
+
+ /**
+ * Creates a partially initialized OffsetTargetInfo.
+ */
+ public OffsetTargetInfo(byte u1targetType)
+ {
+ super(u1targetType);
+ }
+
+
+ /**
+ * Creates an initialized OffsetTargetInfo.
+ */
+ protected OffsetTargetInfo(byte u1targetType,
+ int u2offset)
+ {
+ super(u1targetType);
+
+ this.u2offset = u2offset;
+ }
+
+
+ // Implementations for TargetInfo.
+
+ /**
+ * Lets the visitor visit, with Method and CodeAttribute null.
+ */
+ public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitOffsetTargetInfo(clazz, null, null, typeAnnotation, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitOffsetTargetInfo(clazz, method, codeAttribute, typeAnnotation, this);
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/SuperTypeTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/SuperTypeTargetInfo.java
new file mode 100644
index 0000000..0db7ea4
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/SuperTypeTargetInfo.java
@@ -0,0 +1,72 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target;
+
+import proguard.classfile.Clazz;
+import proguard.classfile.attribute.annotation.TypeAnnotation;
+import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor;
+
+/**
+ * Representation of a super type annotation target.
+ *
+ * @author Eric Lafortune
+ */
+public class SuperTypeTargetInfo extends TargetInfo
+{
+ public int u2superTypeIndex;
+
+
+ /**
+ * Creates an uninitialized SuperTypeTargetInfo.
+ */
+ public SuperTypeTargetInfo()
+ {
+ }
+
+
+ /**
+ * Creates a partially initialized SuperTypeTargetInfo.
+ */
+ public SuperTypeTargetInfo(byte u1targetType)
+ {
+ super(u1targetType);
+ }
+
+
+ /**
+ * Creates an initialized SuperTypeTargetInfo.
+ */
+ public SuperTypeTargetInfo(byte u1targetType,
+ int u2superTypeIndex)
+ {
+ super(u1targetType);
+
+ this.u2superTypeIndex = u2superTypeIndex;
+ }
+
+
+ // Implementations for TargetInfo.
+
+ public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitSuperTypeTargetInfo(clazz, typeAnnotation, this);
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/TargetInfo.java b/src/proguard/classfile/attribute/annotation/target/TargetInfo.java
new file mode 100644
index 0000000..efee2e2
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/TargetInfo.java
@@ -0,0 +1,97 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.annotation.TypeAnnotation;
+import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor;
+
+/**
+ * Representation of an annotation target.
+ *
+ * @author Eric Lafortune
+ */
+public abstract class TargetInfo
+{
+ public byte u1targetType;
+
+
+ /**
+ * Creates an uninitialized TargetInfo.
+ */
+ protected TargetInfo()
+ {
+ }
+
+
+ /**
+ * Creates an initialized TargetInfo.
+ */
+ protected TargetInfo(byte u1targetType)
+ {
+ this.u1targetType = u1targetType;
+ }
+
+
+ /**
+ * Returns the type of the target.
+ */
+ public byte getTargetType()
+ {
+ return u1targetType;
+ }
+
+
+ // Methods to be implemented by extensions.
+
+ /**
+ * Accepts the given visitor, in the context of a type annotation on a class.
+ */
+ public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ throw new UnsupportedOperationException("Unsupported type annotation [0x"+Integer.toHexString(u1targetType)+"] on a class");
+ }
+
+ /**
+ * Accepts the given visitor, in the context of a type annotation on a field.
+ */
+ public void accept(Clazz clazz, Field field, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ throw new UnsupportedOperationException("Unsupported type annotation [0x"+Integer.toHexString(u1targetType)+"] on a field");
+ }
+
+ /**
+ * Accepts the given visitor, in the context of a type annotation on a method.
+ */
+ public void accept(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ throw new UnsupportedOperationException("Unsupported type annotation [0x"+Integer.toHexString(u1targetType)+"] on a method");
+ }
+
+ /**
+ * Accepts the given visitor, in the context of a type annotation code.
+ */
+ public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ throw new UnsupportedOperationException("Unsupported type annotation [0x"+Integer.toHexString(u1targetType)+"] on code");
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/ThrowsTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/ThrowsTargetInfo.java
new file mode 100644
index 0000000..d5b2db7
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/ThrowsTargetInfo.java
@@ -0,0 +1,81 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.annotation.TypeAnnotation;
+import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor;
+
+/**
+ * Representation of a 'throws' annotation target.
+ *
+ * @author Eric Lafortune
+ */
+public class ThrowsTargetInfo extends TargetInfo
+{
+ public int u2throwsTypeIndex;
+
+
+ /**
+ * Creates an uninitialized ThrowsTargetInfo.
+ */
+ public ThrowsTargetInfo()
+ {
+ }
+
+
+ /**
+ * Creates a partially initialized ThrowsTargetInfo.
+ */
+ public ThrowsTargetInfo(byte u1targetType)
+ {
+ super(u1targetType);
+ }
+
+
+ /**
+ * Creates an initialized ThrowsTargetInfo.
+ */
+ public ThrowsTargetInfo(byte u1targetType,
+ int u2throwsTypeIndex)
+ {
+ super(u1targetType);
+
+ this.u2throwsTypeIndex = u2throwsTypeIndex;
+ }
+
+
+ // Implementations for TargetInfo.
+
+ /**
+ * Lets the visitor visit, with Method null.
+ */
+ public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitThrowsTargetInfo(clazz, null, typeAnnotation, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitThrowsTargetInfo(clazz, method, typeAnnotation, this);
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/TypeArgumentTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/TypeArgumentTargetInfo.java
new file mode 100644
index 0000000..4aef72e
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/TypeArgumentTargetInfo.java
@@ -0,0 +1,85 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.annotation.TypeAnnotation;
+import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor;
+
+/**
+ * Representation of an offset annotation target.
+ *
+ * @author Eric Lafortune
+ */
+public class TypeArgumentTargetInfo extends TargetInfo
+{
+ public int u2offset;
+ public int u1typeArgumentIndex;
+
+
+ /**
+ * Creates an uninitialized TypeArgumentTargetInfo.
+ */
+ public TypeArgumentTargetInfo()
+ {
+ }
+
+
+ /**
+ * Creates a partially initialized TypeArgumentTargetInfo.
+ */
+ public TypeArgumentTargetInfo(byte u1targetType)
+ {
+ super(u1targetType);
+ }
+
+
+ /**
+ * Creates an initialized TypeArgumentTargetInfo.
+ */
+ protected TypeArgumentTargetInfo(byte u1targetType,
+ int u2offset,
+ int u1typeArgumentIndex)
+ {
+ super(u1targetType);
+
+ this.u2offset = u2offset;
+ this.u1typeArgumentIndex = u1typeArgumentIndex;
+ }
+
+
+ // Implementations for TargetInfo.
+
+ /**
+ * Lets the visitor visit, with Method and CodeAttribute null.
+ */
+ public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitTypeArgumentTargetInfo(clazz, null, null, typeAnnotation, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitTypeArgumentTargetInfo(clazz, method, codeAttribute, typeAnnotation, this);
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/TypeParameterBoundTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/TypeParameterBoundTargetInfo.java
new file mode 100644
index 0000000..0f485ee
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/TypeParameterBoundTargetInfo.java
@@ -0,0 +1,87 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.annotation.TypeAnnotation;
+import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor;
+
+/**
+ * Representation of a type parameter bound annotation target.
+ *
+ * @author Eric Lafortune
+ */
+public class TypeParameterBoundTargetInfo extends TargetInfo
+{
+ public int u1typeParameterIndex;
+ public int u1boundIndex;
+
+
+ /**
+ * Creates an uninitialized TypeParameterBoundTargetInfo.
+ */
+ public TypeParameterBoundTargetInfo()
+ {
+ }
+
+
+ /**
+ * Creates a partially initialized TypeParameterBoundTargetInfo.
+ */
+ public TypeParameterBoundTargetInfo(byte u1targetType)
+ {
+ super(u1targetType);
+ }
+
+
+ /**
+ * Creates an initialized TypeParameterBoundTargetInfo.
+ */
+ public TypeParameterBoundTargetInfo(byte u1targetType,
+ int u1typeParameterIndex,
+ int u1boundIndex)
+ {
+ super(u1targetType);
+
+ this.u1typeParameterIndex = u1typeParameterIndex;
+ this.u1boundIndex = u1boundIndex;
+ }
+
+
+ // Implementations for TargetInfo.
+
+ public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitTypeParameterBoundTargetInfo(clazz, typeAnnotation, this);
+ }
+
+
+ public void accept(Clazz clazz, Field field, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitTypeParameterBoundTargetInfo(clazz, field, typeAnnotation, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitTypeParameterBoundTargetInfo(clazz, method, typeAnnotation, this);
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/TypeParameterTargetInfo.java b/src/proguard/classfile/attribute/annotation/target/TypeParameterTargetInfo.java
new file mode 100644
index 0000000..3150a26
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/TypeParameterTargetInfo.java
@@ -0,0 +1,79 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.annotation.TypeAnnotation;
+import proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor;
+
+/**
+ * Representation of a type parameter annotation target.
+ *
+ * @author Eric Lafortune
+ */
+public class TypeParameterTargetInfo extends TargetInfo
+{
+ public int u1typeParameterIndex;
+
+
+ /**
+ * Creates an uninitialized TypeParameterTargetInfo.
+ */
+ public TypeParameterTargetInfo()
+ {
+ }
+
+
+ /**
+ * Creates a partially initialized TypeParameterTargetInfo.
+ */
+ public TypeParameterTargetInfo(byte u1targetType)
+ {
+ super(u1targetType);
+ }
+
+
+ /**
+ * Creates an initialized TypeParameterTargetInfo.
+ */
+ public TypeParameterTargetInfo(byte u1targetType,
+ int u1typeParameterIndex)
+ {
+ super(u1targetType);
+
+ this.u1typeParameterIndex = u1typeParameterIndex;
+ }
+
+
+ // Implementations for TargetInfo.
+
+ public void accept(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitTypeParameterTargetInfo(clazz, typeAnnotation, this);
+ }
+
+
+ public void accept(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TargetInfoVisitor targetInfoVisitor)
+ {
+ targetInfoVisitor.visitTypeParameterTargetInfo(clazz, method, typeAnnotation, this);
+ }
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/visitor/LocalVariableTargetElementVisitor.java b/src/proguard/classfile/attribute/annotation/target/visitor/LocalVariableTargetElementVisitor.java
new file mode 100644
index 0000000..62fe148
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/visitor/LocalVariableTargetElementVisitor.java
@@ -0,0 +1,37 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target.visitor;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.annotation.TypeAnnotation;
+import proguard.classfile.attribute.annotation.target.*;
+
+/**
+ * This interface specifies the methods for a visitor of LocalVariableTargetElement
+ * instances.
+ *
+ * @author Eric Lafortune
+ */
+public interface LocalVariableTargetElementVisitor
+{
+ public void visitLocalVariableTargetElement(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo, LocalVariableTargetElement localVariableTargetElement);
+}
diff --git a/src/proguard/classfile/attribute/annotation/target/visitor/TargetInfoVisitor.java b/src/proguard/classfile/attribute/annotation/target/visitor/TargetInfoVisitor.java
new file mode 100644
index 0000000..33e7d32
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/target/visitor/TargetInfoVisitor.java
@@ -0,0 +1,50 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.target.visitor;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.annotation.*;
+import proguard.classfile.attribute.annotation.target.*;
+
+/**
+ * This interface specifies the methods for a visitor of <code>TargetInfo</code>
+ * objects.
+ *
+ * @author Eric Lafortune
+ */
+public interface TargetInfoVisitor
+{
+ public void visitTypeParameterTargetInfo( Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterTargetInfo typeParameterTargetInfo);
+ public void visitTypeParameterTargetInfo( Clazz clazz, Method method, TypeAnnotation typeAnnotation, TypeParameterTargetInfo typeParameterTargetInfo);
+ public void visitSuperTypeTargetInfo( Clazz clazz, TypeAnnotation typeAnnotation, SuperTypeTargetInfo superTypeTargetInfo);
+ public void visitTypeParameterBoundTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo);
+ public void visitTypeParameterBoundTargetInfo(Clazz clazz, Field field, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo);
+ public void visitTypeParameterBoundTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo);
+ public void visitEmptyTargetInfo( Clazz clazz, Field field, TypeAnnotation typeAnnotation, EmptyTargetInfo emptyTargetInfo);
+ public void visitEmptyTargetInfo( Clazz clazz, Method method, TypeAnnotation typeAnnotation, EmptyTargetInfo emptyTargetInfo);
+ public void visitFormalParameterTargetInfo( Clazz clazz, Method method, TypeAnnotation typeAnnotation, FormalParameterTargetInfo formalParameterTargetInfo);
+ public void visitThrowsTargetInfo( Clazz clazz, Method method, TypeAnnotation typeAnnotation, ThrowsTargetInfo throwsTargetInfo);
+ public void visitLocalVariableTargetInfo( Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo);
+ public void visitCatchTargetInfo( Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, CatchTargetInfo catchTargetInfo);
+ public void visitOffsetTargetInfo( Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, OffsetTargetInfo offsetTargetInfo);
+ public void visitTypeArgumentTargetInfo( Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TypeArgumentTargetInfo typeArgumentTargetInfo);
+}
diff --git a/src/proguard/classfile/attribute/annotation/visitor/AllAnnotationVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/AllAnnotationVisitor.java
index 0aadfe3..b4513d7 100644
--- a/src/proguard/classfile/attribute/annotation/visitor/AllAnnotationVisitor.java
+++ b/src/proguard/classfile/attribute/annotation/visitor/AllAnnotationVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,7 +21,7 @@
package proguard.classfile.attribute.annotation.visitor;
import proguard.classfile.*;
-import proguard.classfile.attribute.Attribute;
+import proguard.classfile.attribute.*;
import proguard.classfile.attribute.annotation.*;
import proguard.classfile.attribute.visitor.AttributeVisitor;
import proguard.classfile.util.SimplifiedVisitor;
@@ -102,4 +102,60 @@ implements AttributeVisitor
// Visit the annotations.
parameterAnnotationsAttribute.annotationsAccept(clazz, method, annotationVisitor);
}
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ // Visit the annotations.
+ runtimeVisibleTypeAnnotationsAttribute.annotationsAccept(clazz, annotationVisitor);
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ // Visit the annotations.
+ runtimeVisibleTypeAnnotationsAttribute.annotationsAccept(clazz, field, annotationVisitor);
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ // Visit the annotations.
+ runtimeVisibleTypeAnnotationsAttribute.annotationsAccept(clazz, method, annotationVisitor);
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ // Visit the annotations.
+ runtimeVisibleTypeAnnotationsAttribute.annotationsAccept(clazz, method, codeAttribute, annotationVisitor);
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ // Visit the annotations.
+ runtimeInvisibleTypeAnnotationsAttribute.annotationsAccept(clazz, annotationVisitor);
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ // Visit the annotations.
+ runtimeInvisibleTypeAnnotationsAttribute.annotationsAccept(clazz, field, annotationVisitor);
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ // Visit the annotations.
+ runtimeInvisibleTypeAnnotationsAttribute.annotationsAccept(clazz, method, annotationVisitor);
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ // Visit the annotations.
+ runtimeInvisibleTypeAnnotationsAttribute.annotationsAccept(clazz, method, codeAttribute, annotationVisitor);
+ }
}
diff --git a/src/proguard/classfile/attribute/annotation/visitor/AllElementValueVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/AllElementValueVisitor.java
index b728b8b..4413082 100644
--- a/src/proguard/classfile/attribute/annotation/visitor/AllElementValueVisitor.java
+++ b/src/proguard/classfile/attribute/annotation/visitor/AllElementValueVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,11 +21,10 @@
package proguard.classfile.attribute.annotation.visitor;
import proguard.classfile.*;
-import proguard.classfile.attribute.Attribute;
+import proguard.classfile.attribute.*;
import proguard.classfile.attribute.annotation.*;
import proguard.classfile.attribute.visitor.AttributeVisitor;
import proguard.classfile.util.SimplifiedVisitor;
-import proguard.util.*;
/**
* This AttributeVisitor and AnnotationVisitor lets a given ElementValueVisitor
@@ -158,6 +157,12 @@ implements AttributeVisitor,
}
+ public void visitAnnotation(Clazz clazz, Method method, CodeAttribute codeAttribute, Annotation annotation)
+ {
+ annotation.elementValuesAccept(clazz, this);
+ }
+
+
// Implementations for ElementValueVisitor.
public void visitConstantElementValue(Clazz clazz, Annotation annotation, ConstantElementValue constantElementValue)
diff --git a/src/proguard/classfile/attribute/annotation/visitor/AnnotatedClassVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/AnnotatedClassVisitor.java
index 305928e..241e9e6 100644
--- a/src/proguard/classfile/attribute/annotation/visitor/AnnotatedClassVisitor.java
+++ b/src/proguard/classfile/attribute/annotation/visitor/AnnotatedClassVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/annotation/visitor/AnnotationToMemberVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/AnnotationToMemberVisitor.java
index 7833f7e..6bb2454 100644
--- a/src/proguard/classfile/attribute/annotation/visitor/AnnotationToMemberVisitor.java
+++ b/src/proguard/classfile/attribute/annotation/visitor/AnnotationToMemberVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/annotation/visitor/AnnotationTypeFilter.java b/src/proguard/classfile/attribute/annotation/visitor/AnnotationTypeFilter.java
index d6ec3ca..ad7b316 100644
--- a/src/proguard/classfile/attribute/annotation/visitor/AnnotationTypeFilter.java
+++ b/src/proguard/classfile/attribute/annotation/visitor/AnnotationTypeFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,8 +21,8 @@
package proguard.classfile.attribute.annotation.visitor;
import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
import proguard.classfile.attribute.annotation.Annotation;
-import proguard.classfile.util.SimplifiedVisitor;
import proguard.util.*;
/**
@@ -92,6 +92,15 @@ implements AnnotationVisitor
}
+ public void visitAnnotation(Clazz clazz, Method method, CodeAttribute codeAttribute, Annotation annotation)
+ {
+ if (accepted(annotation.getType(clazz)))
+ {
+ annotationVisitor.visitAnnotation(clazz, method, codeAttribute, annotation);
+ }
+ }
+
+
// Small utility methods.
private boolean accepted(String name)
diff --git a/src/proguard/classfile/attribute/annotation/visitor/AnnotationVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/AnnotationVisitor.java
index 8d207af..3225c97 100644
--- a/src/proguard/classfile/attribute/annotation/visitor/AnnotationVisitor.java
+++ b/src/proguard/classfile/attribute/annotation/visitor/AnnotationVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,6 +21,7 @@
package proguard.classfile.attribute.annotation.visitor;
import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
import proguard.classfile.attribute.annotation.Annotation;
/**
@@ -33,8 +34,9 @@ import proguard.classfile.attribute.annotation.Annotation;
*/
public interface AnnotationVisitor
{
- public void visitAnnotation(Clazz clazz, Annotation annotation);
- public void visitAnnotation(Clazz clazz, Field field, Annotation annotation);
- public void visitAnnotation(Clazz clazz, Method method, Annotation annotation);
- public void visitAnnotation(Clazz clazz, Method method, int parameterIndex, Annotation annotation);
+ public void visitAnnotation(Clazz clazz, Annotation annotation);
+ public void visitAnnotation(Clazz clazz, Field field, Annotation annotation);
+ public void visitAnnotation(Clazz clazz, Method method, Annotation annotation);
+ public void visitAnnotation(Clazz clazz, Method method, int parameterIndex, Annotation annotation);
+ public void visitAnnotation(Clazz clazz, Method method, CodeAttribute codeAttribute, Annotation annotation);
}
diff --git a/src/proguard/classfile/attribute/annotation/visitor/ElementValueVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/ElementValueVisitor.java
index 2d3a20d..453c14b 100644
--- a/src/proguard/classfile/attribute/annotation/visitor/ElementValueVisitor.java
+++ b/src/proguard/classfile/attribute/annotation/visitor/ElementValueVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/annotation/visitor/TypeAnnotationVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/TypeAnnotationVisitor.java
new file mode 100644
index 0000000..3a01887
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/visitor/TypeAnnotationVisitor.java
@@ -0,0 +1,41 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.visitor;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.annotation.*;
+
+/**
+ * This interface specifies the methods for a visitor of
+ * TypeAnnotation instances. Note that there is only a single
+ * implementation of TypeAnnotation, such that this interface
+ * is not strictly necessary as a visitor.
+ *
+ * @author Eric Lafortune
+ */
+public interface TypeAnnotationVisitor
+{
+ public void visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation);
+ public void visitTypeAnnotation(Clazz clazz, Field field, TypeAnnotation typeAnnotation);
+ public void visitTypeAnnotation(Clazz clazz, Method method, TypeAnnotation typeAnnotation);
+ public void visitTypeAnnotation(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation);
+}
diff --git a/src/proguard/classfile/attribute/annotation/visitor/TypePathInfoVisitor.java b/src/proguard/classfile/attribute/annotation/visitor/TypePathInfoVisitor.java
new file mode 100644
index 0000000..ab7d51b
--- /dev/null
+++ b/src/proguard/classfile/attribute/annotation/visitor/TypePathInfoVisitor.java
@@ -0,0 +1,41 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.annotation.visitor;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.CodeAttribute;
+import proguard.classfile.attribute.annotation.*;
+
+/**
+ * This interface specifies the methods for a visitor of
+ * TypePathInfo instances. Note that there is only a single
+ * implementation of TypePathInfo, such that this interface
+ * is not strictly necessary as a visitor.
+ *
+ * @author Eric Lafortune
+ */
+public interface TypePathInfoVisitor
+{
+ public void visitTypePathInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo);
+ public void visitTypePathInfo(Clazz clazz, Field field, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo);
+ public void visitTypePathInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo);
+ public void visitTypePathInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo);
+}
diff --git a/src/proguard/classfile/attribute/preverification/DoubleType.java b/src/proguard/classfile/attribute/preverification/DoubleType.java
index 1bc3e5d..1f0478d 100644
--- a/src/proguard/classfile/attribute/preverification/DoubleType.java
+++ b/src/proguard/classfile/attribute/preverification/DoubleType.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/FloatType.java b/src/proguard/classfile/attribute/preverification/FloatType.java
index c58cd0a..ee0fe94 100644
--- a/src/proguard/classfile/attribute/preverification/FloatType.java
+++ b/src/proguard/classfile/attribute/preverification/FloatType.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/FullFrame.java b/src/proguard/classfile/attribute/preverification/FullFrame.java
index 4f0d72e..09890f2 100644
--- a/src/proguard/classfile/attribute/preverification/FullFrame.java
+++ b/src/proguard/classfile/attribute/preverification/FullFrame.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/IntegerType.java b/src/proguard/classfile/attribute/preverification/IntegerType.java
index 9c43cae..9d8144a 100644
--- a/src/proguard/classfile/attribute/preverification/IntegerType.java
+++ b/src/proguard/classfile/attribute/preverification/IntegerType.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/LessZeroFrame.java b/src/proguard/classfile/attribute/preverification/LessZeroFrame.java
index f722d73..681c9ab 100644
--- a/src/proguard/classfile/attribute/preverification/LessZeroFrame.java
+++ b/src/proguard/classfile/attribute/preverification/LessZeroFrame.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/LongType.java b/src/proguard/classfile/attribute/preverification/LongType.java
index c986165..dafac5a 100644
--- a/src/proguard/classfile/attribute/preverification/LongType.java
+++ b/src/proguard/classfile/attribute/preverification/LongType.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/MoreZeroFrame.java b/src/proguard/classfile/attribute/preverification/MoreZeroFrame.java
index be74df0..be4e08d 100644
--- a/src/proguard/classfile/attribute/preverification/MoreZeroFrame.java
+++ b/src/proguard/classfile/attribute/preverification/MoreZeroFrame.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/NullType.java b/src/proguard/classfile/attribute/preverification/NullType.java
index fe0d85f..00b27a7 100644
--- a/src/proguard/classfile/attribute/preverification/NullType.java
+++ b/src/proguard/classfile/attribute/preverification/NullType.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/ObjectType.java b/src/proguard/classfile/attribute/preverification/ObjectType.java
index 4ea370a..6b54277 100644
--- a/src/proguard/classfile/attribute/preverification/ObjectType.java
+++ b/src/proguard/classfile/attribute/preverification/ObjectType.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/SameOneFrame.java b/src/proguard/classfile/attribute/preverification/SameOneFrame.java
index 4384aae..63b9058 100644
--- a/src/proguard/classfile/attribute/preverification/SameOneFrame.java
+++ b/src/proguard/classfile/attribute/preverification/SameOneFrame.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/SameZeroFrame.java b/src/proguard/classfile/attribute/preverification/SameZeroFrame.java
index a3bd824..694ed2a 100644
--- a/src/proguard/classfile/attribute/preverification/SameZeroFrame.java
+++ b/src/proguard/classfile/attribute/preverification/SameZeroFrame.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/StackMapAttribute.java b/src/proguard/classfile/attribute/preverification/StackMapAttribute.java
index 51e69fb..9b7bbfd 100644
--- a/src/proguard/classfile/attribute/preverification/StackMapAttribute.java
+++ b/src/proguard/classfile/attribute/preverification/StackMapAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/StackMapFrame.java b/src/proguard/classfile/attribute/preverification/StackMapFrame.java
index 01890f3..9b2f43b 100644
--- a/src/proguard/classfile/attribute/preverification/StackMapFrame.java
+++ b/src/proguard/classfile/attribute/preverification/StackMapFrame.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/StackMapTableAttribute.java b/src/proguard/classfile/attribute/preverification/StackMapTableAttribute.java
index 3de059f..a6f9ca6 100644
--- a/src/proguard/classfile/attribute/preverification/StackMapTableAttribute.java
+++ b/src/proguard/classfile/attribute/preverification/StackMapTableAttribute.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/TopType.java b/src/proguard/classfile/attribute/preverification/TopType.java
index 02dd1a2..9804c53 100644
--- a/src/proguard/classfile/attribute/preverification/TopType.java
+++ b/src/proguard/classfile/attribute/preverification/TopType.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/UninitializedThisType.java b/src/proguard/classfile/attribute/preverification/UninitializedThisType.java
index 7b2bfa9..fcbcd7d 100644
--- a/src/proguard/classfile/attribute/preverification/UninitializedThisType.java
+++ b/src/proguard/classfile/attribute/preverification/UninitializedThisType.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/UninitializedType.java b/src/proguard/classfile/attribute/preverification/UninitializedType.java
index 7e4a0fd..1b9de74 100644
--- a/src/proguard/classfile/attribute/preverification/UninitializedType.java
+++ b/src/proguard/classfile/attribute/preverification/UninitializedType.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/VerificationType.java b/src/proguard/classfile/attribute/preverification/VerificationType.java
index 02c3872..22ad72f 100644
--- a/src/proguard/classfile/attribute/preverification/VerificationType.java
+++ b/src/proguard/classfile/attribute/preverification/VerificationType.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/VerificationTypeFactory.java b/src/proguard/classfile/attribute/preverification/VerificationTypeFactory.java
index ada9ce8..71d2c3e 100644
--- a/src/proguard/classfile/attribute/preverification/VerificationTypeFactory.java
+++ b/src/proguard/classfile/attribute/preverification/VerificationTypeFactory.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/visitor/StackMapFrameVisitor.java b/src/proguard/classfile/attribute/preverification/visitor/StackMapFrameVisitor.java
index 5e4cf88..f269f6e 100644
--- a/src/proguard/classfile/attribute/preverification/visitor/StackMapFrameVisitor.java
+++ b/src/proguard/classfile/attribute/preverification/visitor/StackMapFrameVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/preverification/visitor/VerificationTypeVisitor.java b/src/proguard/classfile/attribute/preverification/visitor/VerificationTypeVisitor.java
index 2a3e9e7..cf39ca2 100644
--- a/src/proguard/classfile/attribute/preverification/visitor/VerificationTypeVisitor.java
+++ b/src/proguard/classfile/attribute/preverification/visitor/VerificationTypeVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/visitor/AllAttributeVisitor.java b/src/proguard/classfile/attribute/visitor/AllAttributeVisitor.java
index 9d8801c..701451e 100644
--- a/src/proguard/classfile/attribute/visitor/AllAttributeVisitor.java
+++ b/src/proguard/classfile/attribute/visitor/AllAttributeVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/visitor/AllBootstrapMethodInfoVisitor.java b/src/proguard/classfile/attribute/visitor/AllBootstrapMethodInfoVisitor.java
index d70803c..6110325 100644
--- a/src/proguard/classfile/attribute/visitor/AllBootstrapMethodInfoVisitor.java
+++ b/src/proguard/classfile/attribute/visitor/AllBootstrapMethodInfoVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,7 +20,7 @@
*/
package proguard.classfile.attribute.visitor;
-import proguard.classfile.*;
+import proguard.classfile.Clazz;
import proguard.classfile.attribute.*;
import proguard.classfile.util.SimplifiedVisitor;
diff --git a/src/proguard/classfile/attribute/visitor/AllExceptionInfoVisitor.java b/src/proguard/classfile/attribute/visitor/AllExceptionInfoVisitor.java
index 927bfd9..9b6c9de 100644
--- a/src/proguard/classfile/attribute/visitor/AllExceptionInfoVisitor.java
+++ b/src/proguard/classfile/attribute/visitor/AllExceptionInfoVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/visitor/AllInnerClassesInfoVisitor.java b/src/proguard/classfile/attribute/visitor/AllInnerClassesInfoVisitor.java
index 2422218..b1005c8 100644
--- a/src/proguard/classfile/attribute/visitor/AllInnerClassesInfoVisitor.java
+++ b/src/proguard/classfile/attribute/visitor/AllInnerClassesInfoVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,7 +20,7 @@
*/
package proguard.classfile.attribute.visitor;
-import proguard.classfile.*;
+import proguard.classfile.Clazz;
import proguard.classfile.attribute.*;
import proguard.classfile.util.SimplifiedVisitor;
diff --git a/src/proguard/classfile/attribute/visitor/AttributeNameFilter.java b/src/proguard/classfile/attribute/visitor/AttributeNameFilter.java
index 0db77d5..14c1edc 100644
--- a/src/proguard/classfile/attribute/visitor/AttributeNameFilter.java
+++ b/src/proguard/classfile/attribute/visitor/AttributeNameFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -93,7 +93,7 @@ implements AttributeVisitor
{
if (accepted(clazz, unknownAttribute))
{
- unknownAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitUnknownAttribute(clazz, unknownAttribute);
}
}
@@ -102,7 +102,7 @@ implements AttributeVisitor
{
if (accepted(clazz, bootstrapMethodsAttribute))
{
- bootstrapMethodsAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitBootstrapMethodsAttribute(clazz, bootstrapMethodsAttribute);
}
}
@@ -111,7 +111,7 @@ implements AttributeVisitor
{
if (accepted(clazz, sourceFileAttribute))
{
- sourceFileAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitSourceFileAttribute(clazz, sourceFileAttribute);
}
}
@@ -120,7 +120,7 @@ implements AttributeVisitor
{
if (accepted(clazz, sourceDirAttribute))
{
- sourceDirAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitSourceDirAttribute(clazz, sourceDirAttribute);
}
}
@@ -129,7 +129,7 @@ implements AttributeVisitor
{
if (accepted(clazz, innerClassesAttribute))
{
- innerClassesAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitInnerClassesAttribute(clazz, innerClassesAttribute);
}
}
@@ -138,7 +138,7 @@ implements AttributeVisitor
{
if (accepted(clazz, enclosingMethodAttribute))
{
- enclosingMethodAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitEnclosingMethodAttribute(clazz, enclosingMethodAttribute);
}
}
@@ -147,7 +147,7 @@ implements AttributeVisitor
{
if (accepted(clazz, deprecatedAttribute))
{
- deprecatedAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitDeprecatedAttribute(clazz, deprecatedAttribute);
}
}
@@ -156,7 +156,7 @@ implements AttributeVisitor
{
if (accepted(clazz, deprecatedAttribute))
{
- deprecatedAttribute.accept(clazz, field, attributeVisitor);
+ attributeVisitor.visitDeprecatedAttribute(clazz, field, deprecatedAttribute);
}
}
@@ -165,7 +165,7 @@ implements AttributeVisitor
{
if (accepted(clazz, deprecatedAttribute))
{
- deprecatedAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitDeprecatedAttribute(clazz, method, deprecatedAttribute);
}
}
@@ -174,7 +174,7 @@ implements AttributeVisitor
{
if (accepted(clazz, syntheticAttribute))
{
- syntheticAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitSyntheticAttribute(clazz, syntheticAttribute);
}
}
@@ -183,7 +183,7 @@ implements AttributeVisitor
{
if (accepted(clazz, syntheticAttribute))
{
- syntheticAttribute.accept(clazz, field, attributeVisitor);
+ attributeVisitor.visitSyntheticAttribute(clazz, field, syntheticAttribute);
}
}
@@ -192,7 +192,7 @@ implements AttributeVisitor
{
if (accepted(clazz, syntheticAttribute))
{
- syntheticAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitSyntheticAttribute(clazz, method, syntheticAttribute);
}
}
@@ -201,7 +201,7 @@ implements AttributeVisitor
{
if (accepted(clazz, signatureAttribute))
{
- signatureAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitSignatureAttribute(clazz, signatureAttribute);
}
}
@@ -210,7 +210,7 @@ implements AttributeVisitor
{
if (accepted(clazz, signatureAttribute))
{
- signatureAttribute.accept(clazz, field, attributeVisitor);
+ attributeVisitor.visitSignatureAttribute(clazz, field, signatureAttribute);
}
}
@@ -219,7 +219,7 @@ implements AttributeVisitor
{
if (accepted(clazz, signatureAttribute))
{
- signatureAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitSignatureAttribute(clazz, method, signatureAttribute);
}
}
@@ -228,7 +228,16 @@ implements AttributeVisitor
{
if (accepted(clazz, constantValueAttribute))
{
- constantValueAttribute.accept(clazz, field, attributeVisitor);
+ attributeVisitor.visitConstantValueAttribute(clazz, field, constantValueAttribute);
+ }
+ }
+
+
+ public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute exceptionsAttribute)
+ {
+ if (accepted(clazz, exceptionsAttribute))
+ {
+ attributeVisitor.visitMethodParametersAttribute(clazz, method, exceptionsAttribute);
}
}
@@ -237,7 +246,7 @@ implements AttributeVisitor
{
if (accepted(clazz, exceptionsAttribute))
{
- exceptionsAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitExceptionsAttribute(clazz, method, exceptionsAttribute);
}
}
@@ -246,7 +255,7 @@ implements AttributeVisitor
{
if (accepted(clazz, codeAttribute))
{
- codeAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitCodeAttribute(clazz, method, codeAttribute);
}
}
@@ -255,7 +264,7 @@ implements AttributeVisitor
{
if (accepted(clazz, stackMapAttribute))
{
- stackMapAttribute.accept(clazz, method, codeAttribute, attributeVisitor);
+ attributeVisitor.visitStackMapAttribute(clazz, method, codeAttribute, stackMapAttribute);
}
}
@@ -264,7 +273,7 @@ implements AttributeVisitor
{
if (accepted(clazz, stackMapTableAttribute))
{
- stackMapTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor);
+ attributeVisitor.visitStackMapTableAttribute(clazz, method, codeAttribute, stackMapTableAttribute);
}
}
@@ -273,7 +282,7 @@ implements AttributeVisitor
{
if (accepted(clazz, lineNumberTableAttribute))
{
- lineNumberTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor);
+ attributeVisitor.visitLineNumberTableAttribute(clazz, method, codeAttribute, lineNumberTableAttribute);
}
}
@@ -282,7 +291,7 @@ implements AttributeVisitor
{
if (accepted(clazz, localVariableTableAttribute))
{
- localVariableTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor);
+ attributeVisitor.visitLocalVariableTableAttribute(clazz, method, codeAttribute, localVariableTableAttribute);
}
}
@@ -291,7 +300,7 @@ implements AttributeVisitor
{
if (accepted(clazz, localVariableTypeTableAttribute))
{
- localVariableTypeTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor);
+ attributeVisitor.visitLocalVariableTypeTableAttribute(clazz, method, codeAttribute, localVariableTypeTableAttribute);
}
}
@@ -300,7 +309,7 @@ implements AttributeVisitor
{
if (accepted(clazz, runtimeVisibleAnnotationsAttribute))
{
- runtimeVisibleAnnotationsAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, runtimeVisibleAnnotationsAttribute);
}
}
@@ -309,7 +318,7 @@ implements AttributeVisitor
{
if (accepted(clazz, runtimeVisibleAnnotationsAttribute))
{
- runtimeVisibleAnnotationsAttribute.accept(clazz, field, attributeVisitor);
+ attributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, field, runtimeVisibleAnnotationsAttribute);
}
}
@@ -318,7 +327,7 @@ implements AttributeVisitor
{
if (accepted(clazz, runtimeVisibleAnnotationsAttribute))
{
- runtimeVisibleAnnotationsAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, method, runtimeVisibleAnnotationsAttribute);
}
}
@@ -327,7 +336,7 @@ implements AttributeVisitor
{
if (accepted(clazz, runtimeInvisibleAnnotationsAttribute))
{
- runtimeInvisibleAnnotationsAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, runtimeInvisibleAnnotationsAttribute);
}
}
@@ -336,7 +345,7 @@ implements AttributeVisitor
{
if (accepted(clazz, runtimeInvisibleAnnotationsAttribute))
{
- runtimeInvisibleAnnotationsAttribute.accept(clazz, field, attributeVisitor);
+ attributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, field, runtimeInvisibleAnnotationsAttribute);
}
}
@@ -345,7 +354,7 @@ implements AttributeVisitor
{
if (accepted(clazz, runtimeInvisibleAnnotationsAttribute))
{
- runtimeInvisibleAnnotationsAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, method, runtimeInvisibleAnnotationsAttribute);
}
}
@@ -354,7 +363,7 @@ implements AttributeVisitor
{
if (accepted(clazz, runtimeVisibleParameterAnnotationsAttribute))
{
- runtimeVisibleParameterAnnotationsAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitRuntimeVisibleParameterAnnotationsAttribute(clazz, method, runtimeVisibleParameterAnnotationsAttribute);
}
}
@@ -363,7 +372,79 @@ implements AttributeVisitor
{
if (accepted(clazz, runtimeInvisibleParameterAnnotationsAttribute))
{
- runtimeInvisibleParameterAnnotationsAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitRuntimeInvisibleParameterAnnotationsAttribute(clazz, method, runtimeInvisibleParameterAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ if (accepted(clazz, runtimeVisibleTypeAnnotationsAttribute))
+ {
+ attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ if (accepted(clazz, runtimeVisibleTypeAnnotationsAttribute))
+ {
+ attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, field, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ if (accepted(clazz, runtimeVisibleTypeAnnotationsAttribute))
+ {
+ attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ if (accepted(clazz, runtimeVisibleTypeAnnotationsAttribute))
+ {
+ attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ if (accepted(clazz, runtimeInvisibleTypeAnnotationsAttribute))
+ {
+ attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ if (accepted(clazz, runtimeInvisibleTypeAnnotationsAttribute))
+ {
+ attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, field, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ if (accepted(clazz, runtimeInvisibleTypeAnnotationsAttribute))
+ {
+ attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ if (accepted(clazz, runtimeInvisibleTypeAnnotationsAttribute))
+ {
+ attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeInvisibleTypeAnnotationsAttribute);
}
}
@@ -372,7 +453,7 @@ implements AttributeVisitor
{
if (accepted(clazz, annotationDefaultAttribute))
{
- annotationDefaultAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitAnnotationDefaultAttribute(clazz, method, annotationDefaultAttribute);
}
}
diff --git a/src/proguard/classfile/attribute/visitor/AttributeVisitor.java b/src/proguard/classfile/attribute/visitor/AttributeVisitor.java
index 76c1ab9..a9fc6b6 100644
--- a/src/proguard/classfile/attribute/visitor/AttributeVisitor.java
+++ b/src/proguard/classfile/attribute/visitor/AttributeVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -62,8 +62,9 @@ public interface AttributeVisitor
// Attributes that are attached to methods.
- public void visitExceptionsAttribute( Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute);
- public void visitCodeAttribute( Clazz clazz, Method method, CodeAttribute codeAttribute);
+ public void visitMethodParametersAttribute( Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute);
+ public void visitExceptionsAttribute( Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute);
+ public void visitCodeAttribute( Clazz clazz, Method method, CodeAttribute codeAttribute);
// Attributes that are attached to code attributes.
@@ -86,5 +87,15 @@ public interface AttributeVisitor
public void visitRuntimeVisibleParameterAnnotationsAttribute( Clazz clazz, Method method, RuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute);
public void visitRuntimeInvisibleParameterAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleParameterAnnotationsAttribute runtimeInvisibleParameterAnnotationsAttribute);
+ public void visitRuntimeVisibleTypeAnnotationsAttribute( Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute);
+ public void visitRuntimeVisibleTypeAnnotationsAttribute( Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute);
+ public void visitRuntimeVisibleTypeAnnotationsAttribute( Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute);
+ public void visitRuntimeVisibleTypeAnnotationsAttribute( Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute);
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute( Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute);
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute( Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute);
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute( Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute);
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute( Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute);
+
public void visitAnnotationDefaultAttribute( Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute);
}
diff --git a/src/proguard/classfile/attribute/visitor/BootstrapMethodInfoVisitor.java b/src/proguard/classfile/attribute/visitor/BootstrapMethodInfoVisitor.java
index 9aab92e..fb2a9d6 100755
--- a/src/proguard/classfile/attribute/visitor/BootstrapMethodInfoVisitor.java
+++ b/src/proguard/classfile/attribute/visitor/BootstrapMethodInfoVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,10 +20,8 @@
*/
package proguard.classfile.attribute.visitor;
-import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-
-import java.beans.MethodDescriptor;
+import proguard.classfile.Clazz;
+import proguard.classfile.attribute.BootstrapMethodInfo;
/**
diff --git a/src/proguard/classfile/attribute/visitor/ExceptionInfoVisitor.java b/src/proguard/classfile/attribute/visitor/ExceptionInfoVisitor.java
index 4a765f2..953dc06 100644
--- a/src/proguard/classfile/attribute/visitor/ExceptionInfoVisitor.java
+++ b/src/proguard/classfile/attribute/visitor/ExceptionInfoVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/visitor/InnerClassesInfoVisitor.java b/src/proguard/classfile/attribute/visitor/InnerClassesInfoVisitor.java
index b373493..f9e1a03 100644
--- a/src/proguard/classfile/attribute/visitor/InnerClassesInfoVisitor.java
+++ b/src/proguard/classfile/attribute/visitor/InnerClassesInfoVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/visitor/LineNumberInfoVisitor.java b/src/proguard/classfile/attribute/visitor/LineNumberInfoVisitor.java
index 189b3d0..5a6400d 100644
--- a/src/proguard/classfile/attribute/visitor/LineNumberInfoVisitor.java
+++ b/src/proguard/classfile/attribute/visitor/LineNumberInfoVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/visitor/LocalVariableInfoVisitor.java b/src/proguard/classfile/attribute/visitor/LocalVariableInfoVisitor.java
index c888d63..dd17bea 100644
--- a/src/proguard/classfile/attribute/visitor/LocalVariableInfoVisitor.java
+++ b/src/proguard/classfile/attribute/visitor/LocalVariableInfoVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/visitor/LocalVariableTypeInfoVisitor.java b/src/proguard/classfile/attribute/visitor/LocalVariableTypeInfoVisitor.java
index f992e6d..c37e9d7 100644
--- a/src/proguard/classfile/attribute/visitor/LocalVariableTypeInfoVisitor.java
+++ b/src/proguard/classfile/attribute/visitor/LocalVariableTypeInfoVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/attribute/visitor/MultiAttributeVisitor.java b/src/proguard/classfile/attribute/visitor/MultiAttributeVisitor.java
index 37c0639..968f852 100644
--- a/src/proguard/classfile/attribute/visitor/MultiAttributeVisitor.java
+++ b/src/proguard/classfile/attribute/visitor/MultiAttributeVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -220,6 +220,15 @@ public class MultiAttributeVisitor implements AttributeVisitor
}
+ public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute)
+ {
+ for (int index = 0; index < attributeVisitors.length; index++)
+ {
+ attributeVisitors[index].visitMethodParametersAttribute(clazz, method, methodParametersAttribute);
+ }
+ }
+
+
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
for (int index = 0; index < attributeVisitors.length; index++)
@@ -355,6 +364,78 @@ public class MultiAttributeVisitor implements AttributeVisitor
}
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ for (int index = 0; index < attributeVisitors.length; index++)
+ {
+ attributeVisitors[index].visitRuntimeVisibleTypeAnnotationsAttribute(clazz, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ for (int index = 0; index < attributeVisitors.length; index++)
+ {
+ attributeVisitors[index].visitRuntimeVisibleTypeAnnotationsAttribute(clazz, field, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ for (int index = 0; index < attributeVisitors.length; index++)
+ {
+ attributeVisitors[index].visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ for (int index = 0; index < attributeVisitors.length; index++)
+ {
+ attributeVisitors[index].visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ for (int index = 0; index < attributeVisitors.length; index++)
+ {
+ attributeVisitors[index].visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ for (int index = 0; index < attributeVisitors.length; index++)
+ {
+ attributeVisitors[index].visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, field, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ for (int index = 0; index < attributeVisitors.length; index++)
+ {
+ attributeVisitors[index].visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ for (int index = 0; index < attributeVisitors.length; index++)
+ {
+ attributeVisitors[index].visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
public void visitAnnotationDefaultAttribute(Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute)
{
for (int index = 0; index < attributeVisitors.length; index++)
diff --git a/src/proguard/classfile/attribute/visitor/NonEmptyAttributeFilter.java b/src/proguard/classfile/attribute/visitor/NonEmptyAttributeFilter.java
index 2ccc09c..4a54f75 100644
--- a/src/proguard/classfile/attribute/visitor/NonEmptyAttributeFilter.java
+++ b/src/proguard/classfile/attribute/visitor/NonEmptyAttributeFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -24,7 +24,6 @@ import proguard.classfile.*;
import proguard.classfile.attribute.*;
import proguard.classfile.attribute.annotation.*;
import proguard.classfile.attribute.preverification.*;
-import proguard.util.StringMatcher;
/**
* This AttributeVisitor delegates its visits another AttributeVisitor, but
@@ -54,7 +53,7 @@ implements AttributeVisitor
public void visitUnknownAttribute(Clazz clazz, UnknownAttribute unknownAttribute)
{
- unknownAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitUnknownAttribute(clazz, unknownAttribute);
}
@@ -62,20 +61,20 @@ implements AttributeVisitor
{
if (bootstrapMethodsAttribute.u2bootstrapMethodsCount > 0)
{
- bootstrapMethodsAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitBootstrapMethodsAttribute(clazz, bootstrapMethodsAttribute);
}
}
public void visitSourceFileAttribute(Clazz clazz, SourceFileAttribute sourceFileAttribute)
{
- sourceFileAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitSourceFileAttribute(clazz, sourceFileAttribute);
}
public void visitSourceDirAttribute(Clazz clazz, SourceDirAttribute sourceDirAttribute)
{
- sourceDirAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitSourceDirAttribute(clazz, sourceDirAttribute);
}
@@ -83,74 +82,83 @@ implements AttributeVisitor
{
if (innerClassesAttribute.u2classesCount > 0)
{
- innerClassesAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitInnerClassesAttribute(clazz, innerClassesAttribute);
}
}
public void visitEnclosingMethodAttribute(Clazz clazz, EnclosingMethodAttribute enclosingMethodAttribute)
{
- enclosingMethodAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitEnclosingMethodAttribute(clazz, enclosingMethodAttribute);
}
public void visitDeprecatedAttribute(Clazz clazz, DeprecatedAttribute deprecatedAttribute)
{
- deprecatedAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitDeprecatedAttribute(clazz, deprecatedAttribute);
}
public void visitDeprecatedAttribute(Clazz clazz, Field field, DeprecatedAttribute deprecatedAttribute)
{
- deprecatedAttribute.accept(clazz, field, attributeVisitor);
+ attributeVisitor.visitDeprecatedAttribute(clazz, field, deprecatedAttribute);
}
public void visitDeprecatedAttribute(Clazz clazz, Method method, DeprecatedAttribute deprecatedAttribute)
{
- deprecatedAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitDeprecatedAttribute(clazz, method, deprecatedAttribute);
}
public void visitSyntheticAttribute(Clazz clazz, SyntheticAttribute syntheticAttribute)
{
- syntheticAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitSyntheticAttribute(clazz, syntheticAttribute);
}
public void visitSyntheticAttribute(Clazz clazz, Field field, SyntheticAttribute syntheticAttribute)
{
- syntheticAttribute.accept(clazz, field, attributeVisitor);
+ attributeVisitor.visitSyntheticAttribute(clazz, field, syntheticAttribute);
}
public void visitSyntheticAttribute(Clazz clazz, Method method, SyntheticAttribute syntheticAttribute)
{
- syntheticAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitSyntheticAttribute(clazz, method, syntheticAttribute);
}
public void visitSignatureAttribute(Clazz clazz, SignatureAttribute signatureAttribute)
{
- signatureAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitSignatureAttribute(clazz, signatureAttribute);
}
public void visitSignatureAttribute(Clazz clazz, Field field, SignatureAttribute signatureAttribute)
{
- signatureAttribute.accept(clazz, field, attributeVisitor);
+ attributeVisitor.visitSignatureAttribute(clazz, field, signatureAttribute);
}
public void visitSignatureAttribute(Clazz clazz, Method method, SignatureAttribute signatureAttribute)
{
- signatureAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitSignatureAttribute(clazz, method, signatureAttribute);
}
public void visitConstantValueAttribute(Clazz clazz, Field field, ConstantValueAttribute constantValueAttribute)
{
- constantValueAttribute.accept(clazz, field, attributeVisitor);
+ attributeVisitor.visitConstantValueAttribute(clazz, field, constantValueAttribute);
+ }
+
+
+ public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute exceptionsAttribute)
+ {
+ if (exceptionsAttribute.u1parametersCount > 0)
+ {
+ attributeVisitor.visitMethodParametersAttribute(clazz, method, exceptionsAttribute);
+ }
}
@@ -158,14 +166,14 @@ implements AttributeVisitor
{
if (exceptionsAttribute.u2exceptionIndexTableLength > 0)
{
- exceptionsAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitExceptionsAttribute(clazz, method, exceptionsAttribute);
}
}
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
{
- codeAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitCodeAttribute(clazz, method, codeAttribute);
}
@@ -173,7 +181,7 @@ implements AttributeVisitor
{
if (stackMapAttribute.u2stackMapFramesCount > 0)
{
- stackMapAttribute.accept(clazz, method, codeAttribute, attributeVisitor);
+ attributeVisitor.visitStackMapAttribute(clazz, method, codeAttribute, stackMapAttribute);
}
}
@@ -182,7 +190,7 @@ implements AttributeVisitor
{
if (stackMapTableAttribute.u2stackMapFramesCount > 0)
{
- stackMapTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor);
+ attributeVisitor.visitStackMapTableAttribute(clazz, method, codeAttribute, stackMapTableAttribute);
}
}
@@ -191,7 +199,7 @@ implements AttributeVisitor
{
if (lineNumberTableAttribute.u2lineNumberTableLength > 0)
{
- lineNumberTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor);
+ attributeVisitor.visitLineNumberTableAttribute(clazz, method, codeAttribute, lineNumberTableAttribute);
}
}
@@ -200,7 +208,7 @@ implements AttributeVisitor
{
if (localVariableTableAttribute.u2localVariableTableLength > 0)
{
- localVariableTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor);
+ attributeVisitor.visitLocalVariableTableAttribute(clazz, method, codeAttribute, localVariableTableAttribute);
}
}
@@ -209,7 +217,7 @@ implements AttributeVisitor
{
if (localVariableTypeTableAttribute.u2localVariableTypeTableLength > 0)
{
- localVariableTypeTableAttribute.accept(clazz, method, codeAttribute, attributeVisitor);
+ attributeVisitor.visitLocalVariableTypeTableAttribute(clazz, method, codeAttribute, localVariableTypeTableAttribute);
}
}
@@ -218,7 +226,7 @@ implements AttributeVisitor
{
if (runtimeVisibleAnnotationsAttribute.u2annotationsCount > 0)
{
- runtimeVisibleAnnotationsAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, runtimeVisibleAnnotationsAttribute);
}
}
@@ -227,7 +235,7 @@ implements AttributeVisitor
{
if (runtimeVisibleAnnotationsAttribute.u2annotationsCount > 0)
{
- runtimeVisibleAnnotationsAttribute.accept(clazz, field, attributeVisitor);
+ attributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, field, runtimeVisibleAnnotationsAttribute);
}
}
@@ -236,7 +244,7 @@ implements AttributeVisitor
{
if (runtimeVisibleAnnotationsAttribute.u2annotationsCount > 0)
{
- runtimeVisibleAnnotationsAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, method, runtimeVisibleAnnotationsAttribute);
}
}
@@ -245,7 +253,7 @@ implements AttributeVisitor
{
if (runtimeInvisibleAnnotationsAttribute.u2annotationsCount > 0)
{
- runtimeInvisibleAnnotationsAttribute.accept(clazz, attributeVisitor);
+ attributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, runtimeInvisibleAnnotationsAttribute);
}
}
@@ -254,7 +262,7 @@ implements AttributeVisitor
{
if (runtimeInvisibleAnnotationsAttribute.u2annotationsCount > 0)
{
- runtimeInvisibleAnnotationsAttribute.accept(clazz, field, attributeVisitor);
+ attributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, field, runtimeInvisibleAnnotationsAttribute);
}
}
@@ -263,31 +271,103 @@ implements AttributeVisitor
{
if (runtimeInvisibleAnnotationsAttribute.u2annotationsCount > 0)
{
- runtimeInvisibleAnnotationsAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, method, runtimeInvisibleAnnotationsAttribute);
}
}
public void visitRuntimeVisibleParameterAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute)
{
- if (runtimeVisibleParameterAnnotationsAttribute.u2parametersCount > 0)
+ if (runtimeVisibleParameterAnnotationsAttribute.u1parametersCount > 0)
{
- runtimeVisibleParameterAnnotationsAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitRuntimeVisibleParameterAnnotationsAttribute(clazz, method, runtimeVisibleParameterAnnotationsAttribute);
}
}
public void visitRuntimeInvisibleParameterAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleParameterAnnotationsAttribute runtimeInvisibleParameterAnnotationsAttribute)
{
- if (runtimeInvisibleParameterAnnotationsAttribute.u2parametersCount > 0)
+ if (runtimeInvisibleParameterAnnotationsAttribute.u1parametersCount > 0)
+ {
+ attributeVisitor.visitRuntimeInvisibleParameterAnnotationsAttribute(clazz, method, runtimeInvisibleParameterAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ if (runtimeVisibleTypeAnnotationsAttribute.u2annotationsCount > 0)
+ {
+ attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ if (runtimeVisibleTypeAnnotationsAttribute.u2annotationsCount > 0)
+ {
+ attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, field, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ if (runtimeVisibleTypeAnnotationsAttribute.u2annotationsCount > 0)
+ {
+ attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ if (runtimeVisibleTypeAnnotationsAttribute.u2annotationsCount > 0)
+ {
+ attributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ if (runtimeInvisibleTypeAnnotationsAttribute.u2annotationsCount > 0)
+ {
+ attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ if (runtimeInvisibleTypeAnnotationsAttribute.u2annotationsCount > 0)
+ {
+ attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, field, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ if (runtimeInvisibleTypeAnnotationsAttribute.u2annotationsCount > 0)
+ {
+ attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ if (runtimeInvisibleTypeAnnotationsAttribute.u2annotationsCount > 0)
{
- runtimeInvisibleParameterAnnotationsAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeInvisibleTypeAnnotationsAttribute);
}
}
public void visitAnnotationDefaultAttribute(Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute)
{
- annotationDefaultAttribute.accept(clazz, method, attributeVisitor);
+ attributeVisitor.visitAnnotationDefaultAttribute(clazz, method, annotationDefaultAttribute);
}
}
diff --git a/src/proguard/classfile/attribute/visitor/ParameterInfoVisitor.java b/src/proguard/classfile/attribute/visitor/ParameterInfoVisitor.java
new file mode 100644
index 0000000..9f91c5b
--- /dev/null
+++ b/src/proguard/classfile/attribute/visitor/ParameterInfoVisitor.java
@@ -0,0 +1,37 @@
+/*
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
+ * of Java bytecode.
+ *
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package proguard.classfile.attribute.visitor;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.ParameterInfo;
+
+/**
+ * This interface specifies the method for a visitor of
+ * <code>ParameterInfo</code> objects. Note that there is only a single
+ * implementation of <code>ParameterInfo</code>, such that this interface
+ * is not strictly necessary as a visitor.
+ *
+ * @author Eric Lafortune
+ */
+public interface ParameterInfoVisitor
+{
+ public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo);
+}
diff --git a/src/proguard/classfile/attribute/visitor/RequiredAttributeFilter.java b/src/proguard/classfile/attribute/visitor/RequiredAttributeFilter.java
index 58e4e40..176846d 100644
--- a/src/proguard/classfile/attribute/visitor/RequiredAttributeFilter.java
+++ b/src/proguard/classfile/attribute/visitor/RequiredAttributeFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -77,7 +77,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- unknownAttribute.accept(clazz, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitUnknownAttribute(clazz, unknownAttribute);
}
}
@@ -86,7 +86,7 @@ implements AttributeVisitor
{
if (requiredAttributeVisitor != null)
{
- bootstrapMethodsAttribute.accept(clazz, requiredAttributeVisitor);
+ requiredAttributeVisitor.visitBootstrapMethodsAttribute(clazz, bootstrapMethodsAttribute);
}
}
@@ -95,7 +95,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- sourceFileAttribute.accept(clazz, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitSourceFileAttribute(clazz, sourceFileAttribute);
}
}
@@ -104,7 +104,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- sourceDirAttribute.accept(clazz, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitSourceDirAttribute(clazz, sourceDirAttribute);
}
}
@@ -113,7 +113,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- innerClassesAttribute.accept(clazz, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitInnerClassesAttribute(clazz, innerClassesAttribute);
}
}
@@ -122,7 +122,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- enclosingMethodAttribute.accept(clazz, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitEnclosingMethodAttribute(clazz, enclosingMethodAttribute);
}
}
@@ -131,7 +131,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- deprecatedAttribute.accept(clazz, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitDeprecatedAttribute(clazz, deprecatedAttribute);
}
}
@@ -140,7 +140,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- deprecatedAttribute.accept(clazz, field, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitDeprecatedAttribute(clazz, field, deprecatedAttribute);
}
}
@@ -149,7 +149,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- deprecatedAttribute.accept(clazz, method, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitDeprecatedAttribute(clazz, method, deprecatedAttribute);
}
}
@@ -158,7 +158,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- syntheticAttribute.accept(clazz, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitSyntheticAttribute(clazz, syntheticAttribute);
}
}
@@ -167,7 +167,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- syntheticAttribute.accept(clazz, field, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitSyntheticAttribute(clazz, field, syntheticAttribute);
}
}
@@ -176,7 +176,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- syntheticAttribute.accept(clazz, method, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitSyntheticAttribute(clazz, method, syntheticAttribute);
}
}
@@ -185,7 +185,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- signatureAttribute.accept(clazz, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitSignatureAttribute(clazz, signatureAttribute);
}
}
@@ -194,7 +194,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- signatureAttribute.accept(clazz, field, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitSignatureAttribute(clazz, field, signatureAttribute);
}
}
@@ -203,7 +203,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- signatureAttribute.accept(clazz, method, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitSignatureAttribute(clazz, method, signatureAttribute);
}
}
@@ -212,7 +212,16 @@ implements AttributeVisitor
{
if (requiredAttributeVisitor != null)
{
- constantValueAttribute.accept(clazz, field, requiredAttributeVisitor);
+ requiredAttributeVisitor.visitConstantValueAttribute(clazz, field, constantValueAttribute);
+ }
+ }
+
+
+ public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute exceptionsAttribute)
+ {
+ if (optionalAttributeVisitor != null)
+ {
+ optionalAttributeVisitor.visitMethodParametersAttribute(clazz, method, exceptionsAttribute);
}
}
@@ -221,7 +230,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- exceptionsAttribute.accept(clazz, method, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitExceptionsAttribute(clazz, method, exceptionsAttribute);
}
}
@@ -230,7 +239,7 @@ implements AttributeVisitor
{
if (requiredAttributeVisitor != null)
{
- codeAttribute.accept(clazz, method, requiredAttributeVisitor);
+ requiredAttributeVisitor.visitCodeAttribute(clazz, method, codeAttribute);
}
}
@@ -239,7 +248,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- stackMapAttribute.accept(clazz, method, codeAttribute, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitStackMapAttribute(clazz, method, codeAttribute, stackMapAttribute);
}
}
@@ -248,7 +257,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- stackMapTableAttribute.accept(clazz, method, codeAttribute, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitStackMapTableAttribute(clazz, method, codeAttribute, stackMapTableAttribute);
}
}
@@ -257,7 +266,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- lineNumberTableAttribute.accept(clazz, method, codeAttribute, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitLineNumberTableAttribute(clazz, method, codeAttribute, lineNumberTableAttribute);
}
}
@@ -266,7 +275,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- localVariableTableAttribute.accept(clazz, method, codeAttribute, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitLocalVariableTableAttribute(clazz, method, codeAttribute, localVariableTableAttribute);
}
}
@@ -275,7 +284,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- localVariableTypeTableAttribute.accept(clazz, method, codeAttribute, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitLocalVariableTypeTableAttribute(clazz, method, codeAttribute, localVariableTypeTableAttribute);
}
}
@@ -284,7 +293,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- runtimeVisibleAnnotationsAttribute.accept(clazz, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, runtimeVisibleAnnotationsAttribute);
}
}
@@ -293,7 +302,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- runtimeVisibleAnnotationsAttribute.accept(clazz, field, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, field, runtimeVisibleAnnotationsAttribute);
}
}
@@ -302,7 +311,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- runtimeVisibleAnnotationsAttribute.accept(clazz, method, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitRuntimeVisibleAnnotationsAttribute(clazz, method, runtimeVisibleAnnotationsAttribute);
}
}
@@ -311,7 +320,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- runtimeInvisibleAnnotationsAttribute.accept(clazz, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, runtimeInvisibleAnnotationsAttribute);
}
}
@@ -320,7 +329,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- runtimeInvisibleAnnotationsAttribute.accept(clazz, field, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, field, runtimeInvisibleAnnotationsAttribute);
}
}
@@ -329,7 +338,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- runtimeInvisibleAnnotationsAttribute.accept(clazz, method, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitRuntimeInvisibleAnnotationsAttribute(clazz, method, runtimeInvisibleAnnotationsAttribute);
}
}
@@ -338,7 +347,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- runtimeVisibleParameterAnnotationsAttribute.accept(clazz, method, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitRuntimeVisibleParameterAnnotationsAttribute(clazz, method, runtimeVisibleParameterAnnotationsAttribute);
}
}
@@ -347,7 +356,79 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- runtimeInvisibleParameterAnnotationsAttribute.accept(clazz, method, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitRuntimeInvisibleParameterAnnotationsAttribute(clazz, method, runtimeInvisibleParameterAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ if (optionalAttributeVisitor != null)
+ {
+ optionalAttributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ if (optionalAttributeVisitor != null)
+ {
+ optionalAttributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, field, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ if (optionalAttributeVisitor != null)
+ {
+ optionalAttributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ if (optionalAttributeVisitor != null)
+ {
+ optionalAttributeVisitor.visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeVisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ if (optionalAttributeVisitor != null)
+ {
+ optionalAttributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ if (optionalAttributeVisitor != null)
+ {
+ optionalAttributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, field, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ if (optionalAttributeVisitor != null)
+ {
+ optionalAttributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ if (optionalAttributeVisitor != null)
+ {
+ optionalAttributeVisitor.visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, codeAttribute, runtimeInvisibleTypeAnnotationsAttribute);
}
}
@@ -356,7 +437,7 @@ implements AttributeVisitor
{
if (optionalAttributeVisitor != null)
{
- annotationDefaultAttribute.accept(clazz, method, optionalAttributeVisitor);
+ optionalAttributeVisitor.visitAnnotationDefaultAttribute(clazz, method, annotationDefaultAttribute);
}
}
}
diff --git a/src/proguard/classfile/attribute/visitor/StackSizeComputer.java b/src/proguard/classfile/attribute/visitor/StackSizeComputer.java
index b5e02e2..d5cd99d 100644
--- a/src/proguard/classfile/attribute/visitor/StackSizeComputer.java
+++ b/src/proguard/classfile/attribute/visitor/StackSizeComputer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,11 +21,11 @@
package proguard.classfile.attribute.visitor;
import proguard.classfile.*;
-import proguard.classfile.visitor.ClassPrinter;
import proguard.classfile.attribute.*;
import proguard.classfile.instruction.*;
import proguard.classfile.instruction.visitor.InstructionVisitor;
import proguard.classfile.util.SimplifiedVisitor;
+import proguard.classfile.visitor.ClassPrinter;
import java.util.Arrays;
diff --git a/src/proguard/classfile/constant/ClassConstant.java b/src/proguard/classfile/constant/ClassConstant.java
index bbd9b31..fedfefe 100644
--- a/src/proguard/classfile/constant/ClassConstant.java
+++ b/src/proguard/classfile/constant/ClassConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/Constant.java b/src/proguard/classfile/constant/Constant.java
index b4168ce..72d495a 100644
--- a/src/proguard/classfile/constant/Constant.java
+++ b/src/proguard/classfile/constant/Constant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/DoubleConstant.java b/src/proguard/classfile/constant/DoubleConstant.java
index a4c64cf..9a6f292 100644
--- a/src/proguard/classfile/constant/DoubleConstant.java
+++ b/src/proguard/classfile/constant/DoubleConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/FieldrefConstant.java b/src/proguard/classfile/constant/FieldrefConstant.java
index d552d47..5755b75 100644
--- a/src/proguard/classfile/constant/FieldrefConstant.java
+++ b/src/proguard/classfile/constant/FieldrefConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/FloatConstant.java b/src/proguard/classfile/constant/FloatConstant.java
index 1709fcb..7d89b39 100644
--- a/src/proguard/classfile/constant/FloatConstant.java
+++ b/src/proguard/classfile/constant/FloatConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/IntegerConstant.java b/src/proguard/classfile/constant/IntegerConstant.java
index 5f0d7f9..9b244ee 100644
--- a/src/proguard/classfile/constant/IntegerConstant.java
+++ b/src/proguard/classfile/constant/IntegerConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/InterfaceMethodrefConstant.java b/src/proguard/classfile/constant/InterfaceMethodrefConstant.java
index 52f1852..6d4901d 100644
--- a/src/proguard/classfile/constant/InterfaceMethodrefConstant.java
+++ b/src/proguard/classfile/constant/InterfaceMethodrefConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/InvokeDynamicConstant.java b/src/proguard/classfile/constant/InvokeDynamicConstant.java
index 57474aa..1ad3954 100755
--- a/src/proguard/classfile/constant/InvokeDynamicConstant.java
+++ b/src/proguard/classfile/constant/InvokeDynamicConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -22,7 +22,7 @@ package proguard.classfile.constant;
import proguard.classfile.*;
import proguard.classfile.constant.visitor.*;
-import proguard.classfile.visitor.*;
+import proguard.classfile.visitor.ClassVisitor;
/**
* This Constant represents an invoke dynamic constant in the constant pool.
diff --git a/src/proguard/classfile/constant/LongConstant.java b/src/proguard/classfile/constant/LongConstant.java
index 2416f01..2fd1daf 100644
--- a/src/proguard/classfile/constant/LongConstant.java
+++ b/src/proguard/classfile/constant/LongConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/MethodHandleConstant.java b/src/proguard/classfile/constant/MethodHandleConstant.java
index 6cffd9a..09efddd 100755
--- a/src/proguard/classfile/constant/MethodHandleConstant.java
+++ b/src/proguard/classfile/constant/MethodHandleConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -38,7 +38,7 @@ public class MethodHandleConstant extends Constant
* An extra field pointing to the java.lang.invoke.MethodHandle Clazz object.
* This field is typically filled out by the <code>{@link
* proguard.classfile.util.ClassReferenceInitializer
- * ClassReferenceInitializer}</code>..
+ * ClassReferenceInitializer}</code>.
*/
public Clazz javaLangInvokeMethodHandleClass;
@@ -94,6 +94,14 @@ public class MethodHandleConstant extends Constant
/**
+ * Returns the class name.
+ */
+ public String getClassName(Clazz clazz)
+ {
+ return clazz.getRefClassName(u2referenceIndex);
+ }
+
+ /**
* Returns the method/field name.
*/
public String getName(Clazz clazz)
diff --git a/src/proguard/classfile/constant/MethodTypeConstant.java b/src/proguard/classfile/constant/MethodTypeConstant.java
index 96c136f..5efd0fe 100644
--- a/src/proguard/classfile/constant/MethodTypeConstant.java
+++ b/src/proguard/classfile/constant/MethodTypeConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -22,6 +22,7 @@ package proguard.classfile.constant;
import proguard.classfile.*;
import proguard.classfile.constant.visitor.ConstantVisitor;
+import proguard.classfile.visitor.ClassVisitor;
/**
* This Constant represents a method handle constant in the constant pool.
@@ -43,6 +44,15 @@ public class MethodTypeConstant extends Constant
/**
+ * An extra field pointing to the Clazz objects referenced in the
+ * descriptor string. This field is filled out by the <code>{@link
+ * proguard.classfile.util.ClassReferenceInitializer ClassReferenceInitializer}</code>.
+ * References to primitive types are ignored.
+ */
+ public Clazz[] referencedClasses;
+
+
+ /**
* Creates an uninitialized MethodTypeConstant.
*/
public MethodTypeConstant()
@@ -79,6 +89,25 @@ public class MethodTypeConstant extends Constant
}
+ /**
+ * Lets the Clazz objects referenced in the descriptor string
+ * accept the given visitor.
+ */
+ public void referencedClassesAccept(ClassVisitor classVisitor)
+ {
+ if (referencedClasses != null)
+ {
+ for (int index = 0; index < referencedClasses.length; index++)
+ {
+ if (referencedClasses[index] != null)
+ {
+ referencedClasses[index].accept(classVisitor);
+ }
+ }
+ }
+ }
+
+
// Implementations for Constant.
public int getTag()
diff --git a/src/proguard/classfile/constant/MethodrefConstant.java b/src/proguard/classfile/constant/MethodrefConstant.java
index 1ffa236..cb43efc 100644
--- a/src/proguard/classfile/constant/MethodrefConstant.java
+++ b/src/proguard/classfile/constant/MethodrefConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/NameAndTypeConstant.java b/src/proguard/classfile/constant/NameAndTypeConstant.java
index 2a4dd66..c82e57e 100644
--- a/src/proguard/classfile/constant/NameAndTypeConstant.java
+++ b/src/proguard/classfile/constant/NameAndTypeConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/RefConstant.java b/src/proguard/classfile/constant/RefConstant.java
index 0a8fb78..50ac976 100644
--- a/src/proguard/classfile/constant/RefConstant.java
+++ b/src/proguard/classfile/constant/RefConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/StringConstant.java b/src/proguard/classfile/constant/StringConstant.java
index 9b83745..c3475a5 100644
--- a/src/proguard/classfile/constant/StringConstant.java
+++ b/src/proguard/classfile/constant/StringConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/Utf8Constant.java b/src/proguard/classfile/constant/Utf8Constant.java
index 3707ba9..4eaf304 100644
--- a/src/proguard/classfile/constant/Utf8Constant.java
+++ b/src/proguard/classfile/constant/Utf8Constant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/visitor/AllConstantVisitor.java b/src/proguard/classfile/constant/visitor/AllConstantVisitor.java
index 3c36609..940ad45 100644
--- a/src/proguard/classfile/constant/visitor/AllConstantVisitor.java
+++ b/src/proguard/classfile/constant/visitor/AllConstantVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/visitor/BootstrapMethodArgumentVisitor.java b/src/proguard/classfile/constant/visitor/BootstrapMethodArgumentVisitor.java
new file mode 100644
index 0000000..a5bfb2e
--- /dev/null
+++ b/src/proguard/classfile/constant/visitor/BootstrapMethodArgumentVisitor.java
@@ -0,0 +1,56 @@
+/*
+ * 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.constant.visitor;
+
+import proguard.classfile.Clazz;
+import proguard.classfile.attribute.BootstrapMethodInfo;
+import proguard.classfile.attribute.visitor.BootstrapMethodInfoVisitor;
+
+/**
+ * This BootstrapMethodInfoVisitor lets a given ConstantVisitor visit all
+ * constant pool entries of the bootstrap methods it visits.
+ *
+ *
+ * @author Eric Lafortune
+ */
+public class BootstrapMethodArgumentVisitor
+implements BootstrapMethodInfoVisitor
+{
+ private ConstantVisitor constantVisitor;
+
+ /**
+ * Creates a new BootstrapMethodArgumentVisitor that will delegate to the
+ * given constant visitor.
+ */
+ public BootstrapMethodArgumentVisitor(ConstantVisitor constantVisitor)
+ {
+ this.constantVisitor = constantVisitor;
+ }
+
+
+ // Implementations for BootstrapMethodInfoVisitor.
+
+ public void visitBootstrapMethodInfo(Clazz clazz, BootstrapMethodInfo bootstrapMethodInfo)
+ {
+ // Check bootstrap method.
+ bootstrapMethodInfo.methodArgumentsAccept(clazz, constantVisitor);
+ }
+}
diff --git a/src/proguard/classfile/constant/visitor/BootstrapMethodHandleTraveler.java b/src/proguard/classfile/constant/visitor/BootstrapMethodHandleTraveler.java
index 6dce6c5..cfd6c1a 100644
--- a/src/proguard/classfile/constant/visitor/BootstrapMethodHandleTraveler.java
+++ b/src/proguard/classfile/constant/visitor/BootstrapMethodHandleTraveler.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,15 +20,11 @@
*/
package proguard.classfile.constant.visitor;
-import proguard.classfile.*;
+import proguard.classfile.Clazz;
import proguard.classfile.attribute.*;
import proguard.classfile.attribute.visitor.*;
import proguard.classfile.constant.*;
-import proguard.classfile.instruction.*;
-import proguard.classfile.instruction.visitor.InstructionVisitor;
import proguard.classfile.util.SimplifiedVisitor;
-import proguard.classfile.visitor.*;
-import proguard.optimize.info.MethodOptimizationInfo;
/**
* This ConstantVisitor and BootstrapMethodInfoVisitor travels from any invoke
diff --git a/src/proguard/classfile/constant/visitor/ConstantTagFilter.java b/src/proguard/classfile/constant/visitor/ConstantTagFilter.java
index a3fcc8a..ffff4b3 100644
--- a/src/proguard/classfile/constant/visitor/ConstantTagFilter.java
+++ b/src/proguard/classfile/constant/visitor/ConstantTagFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,7 +21,7 @@
package proguard.classfile.constant.visitor;
import proguard.classfile.Clazz;
-import proguard.classfile.constant.*;
+import proguard.classfile.constant.Constant;
import proguard.classfile.util.SimplifiedVisitor;
/**
diff --git a/src/proguard/classfile/constant/visitor/ConstantVisitor.java b/src/proguard/classfile/constant/visitor/ConstantVisitor.java
index 362d54d..11528b8 100644
--- a/src/proguard/classfile/constant/visitor/ConstantVisitor.java
+++ b/src/proguard/classfile/constant/visitor/ConstantVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/constant/visitor/ExceptClassConstantFilter.java b/src/proguard/classfile/constant/visitor/ExceptClassConstantFilter.java
index bff4d1e..82f180d 100644
--- a/src/proguard/classfile/constant/visitor/ExceptClassConstantFilter.java
+++ b/src/proguard/classfile/constant/visitor/ExceptClassConstantFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,13 +20,8 @@
*/
package proguard.classfile.constant.visitor;
-import proguard.classfile.*;
-import proguard.classfile.editor.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.annotation.*;
-import proguard.classfile.attribute.preverification.*;
+import proguard.classfile.Clazz;
import proguard.classfile.constant.ClassConstant;
-import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.util.SimplifiedVisitor;
/**
diff --git a/src/proguard/classfile/constant/visitor/MethodrefTraveler.java b/src/proguard/classfile/constant/visitor/MethodrefTraveler.java
index acd1bc8..f5fffbc 100644
--- a/src/proguard/classfile/constant/visitor/MethodrefTraveler.java
+++ b/src/proguard/classfile/constant/visitor/MethodrefTraveler.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,7 +21,6 @@
package proguard.classfile.constant.visitor;
import proguard.classfile.Clazz;
-import proguard.classfile.attribute.*;
import proguard.classfile.constant.*;
import proguard.classfile.util.SimplifiedVisitor;
diff --git a/src/proguard/classfile/editor/AccessFixer.java b/src/proguard/classfile/editor/AccessFixer.java
index d770531..3c41159 100644
--- a/src/proguard/classfile/editor/AccessFixer.java
+++ b/src/proguard/classfile/editor/AccessFixer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,160 +21,196 @@
package proguard.classfile.editor;
import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.visitor.*;
import proguard.classfile.constant.*;
-import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.util.*;
import proguard.classfile.visitor.*;
/**
- * This ConstantVisitor fixes the access modifiers of all classes and class
- * members that are referenced by the constants that it visits.
+ * This ClassVisitor fixes the access modifiers of all classes and class
+ * members that are referenced by the classes that it visits.
*
* @author Eric Lafortune
*/
public class AccessFixer
-extends SimplifiedVisitor
-implements ConstantVisitor,
- ClassVisitor,
- MemberVisitor
+extends ReferencedClassVisitor
+implements ClassVisitor
{
- private MyReferencedClassFinder referencedClassFinder = new MyReferencedClassFinder();
+ /**
+ * Creates a new AccessFixer.
+ */
+ public AccessFixer()
+ {
+ // Unfortunately, the inner class must be static to be passed to the
+ // super constructor. We therefore can't let it refer to this class;
+ // we'll let this class refer to the inner class instead.
+ super(new MyAccessFixer());
+ }
- private Clazz referencingClass;
- private Clazz referencedClass;
+ // Overridden methods for ClassVisitor.
- // Implementations for ConstantVisitor.
+ public void visitProgramClass(ProgramClass programClass)
+ {
+ // Remember the referencing class.
+ ((MyAccessFixer)classVisitor).referencingClass = programClass;
- public void visitAnyConstant(Clazz clazz, Constant constant) {}
+ // Start visiting and fixing the referenced classes and class members.
+ super.visitProgramClass(programClass);
+ }
- public void visitStringConstant(Clazz clazz, StringConstant stringConstant)
+ public void visitLibraryClass(LibraryClass libraryClass)
{
- referencingClass = clazz;
- referencedClass = stringConstant.referencedClass;
+ // Remember the referencing class.
+ ((MyAccessFixer)classVisitor).referencingClass = libraryClass;
- // Make sure the access flags of the referenced class or class member,
- // if any, are acceptable.
- stringConstant.referencedClassAccept(this);
- stringConstant.referencedMemberAccept(this);
+ // Start visiting and fixing the referenced classes and class members.
+ super.visitLibraryClass(libraryClass);
}
- public void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant)
+ // Overridden methods for MemberVisitor.
+
+ public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
- // Check the bootstrap method.
- invokeDynamicConstant.bootstrapMethodHandleAccept(clazz, this);
+ // Fix the referenced classes and class members.
+ super.visitProgramMember(programClass, programMethod);
+
+ // Fix overridden or implemented methods higher up the hierarchy.
+ // We can ignore private and static methods and initializers.
+ if ((programMethod.getAccessFlags() & (ClassConstants.ACC_PRIVATE |
+ ClassConstants.ACC_STATIC)) == 0 &&
+ !ClassUtil.isInitializer(programMethod.getName(programClass)))
+ {
+ programClass.hierarchyAccept(false, true, false, false,
+ new NamedMethodVisitor(programMethod.getName(programClass),
+ programMethod.getDescriptor(programClass),
+ new MemberAccessFilter(0, ClassConstants.ACC_PRIVATE |
+ ClassConstants.ACC_STATIC,
+ (MemberVisitor)classVisitor)));
+ }
}
- public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant)
+ public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
{
- // Check the method reference.
- clazz.constantPoolEntryAccept(methodHandleConstant.u2referenceIndex, this);
+ // Fix the referenced classes and class members.
+ super.visitLibraryMember(libraryClass, libraryMethod);
+
+ // Fix overridden or implemented methods higher up the hierarchy.
+ // We can ignore private and static methods and initializers.
+ if ((libraryMethod.getAccessFlags() & (ClassConstants.ACC_PRIVATE |
+ ClassConstants.ACC_STATIC)) == 0 &&
+ !ClassUtil.isInitializer(libraryMethod.getName(libraryClass)))
+ {
+ libraryClass.hierarchyAccept(false, true, false, false,
+ new NamedMethodVisitor(libraryMethod.getName(libraryClass),
+ libraryMethod.getDescriptor(libraryClass),
+ new MemberAccessFilter(0, ClassConstants.ACC_PRIVATE |
+ ClassConstants.ACC_STATIC,
+ (MemberVisitor)classVisitor)));
+ }
}
- public void visitAnyRefConstant(Clazz clazz, RefConstant refConstant)
- {
- referencingClass = clazz;
+ // Overridden methods for ConstantVisitor.
- // Remember the specified class, since it might be different from
- // the referenced class that actually contains the class member.
- clazz.constantPoolEntryAccept(refConstant.u2classIndex, referencedClassFinder);
+ public void visitStringConstant(Clazz clazz, StringConstant stringConstant)
+ {
+ // Fix the access flags of the referenced class, if any.
+ super.visitStringConstant(clazz, stringConstant);
- // Make sure the access flags of the referenced class member are
- // acceptable.
- refConstant.referencedMemberAccept(this);
+ // Fix the access flags of the referenced class member, if any.
+ stringConstant.referencedMemberAccept((MemberVisitor)classVisitor);
}
- public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
+ public void visitAnyRefConstant(Clazz clazz, RefConstant refConstant)
{
- referencingClass = clazz;
+ // Fix the access flags of the referenced class.
+ super.visitAnyRefConstant(clazz, refConstant);
- // Make sure the access flags of the referenced class are acceptable.
- classConstant.referencedClassAccept(this);
+ // Fix the access flags of the referenced class member.
+ refConstant.referencedMemberAccept((MemberVisitor)classVisitor);
}
- // Implementations for ClassVisitor.
+ /**
+ * This ClassVisitor and MemberVisitor fixes the access flags of the
+ * classes and class members that it visits, relative to the referencing
+ * class.
+ */
+ private static class MyAccessFixer
+ extends SimplifiedVisitor
+ implements ClassVisitor,
+ MemberVisitor
+ {
+ private Clazz referencingClass;
- public void visitLibraryClass(LibraryClass libraryClass) {}
+ // Implementations for ClassVisitor.
- public void visitProgramClass(ProgramClass programClass)
- {
- int currentAccessFlags = programClass.getAccessFlags();
- int currentAccessLevel = AccessUtil.accessLevel(currentAccessFlags);
+ public void visitLibraryClass(LibraryClass libraryClass) {}
- // Compute the required access level.
- Clazz referencingClass = this.referencingClass;
- int requiredAccessLevel =
- inSamePackage(programClass, referencingClass) ? AccessUtil.PACKAGE_VISIBLE :
- AccessUtil.PUBLIC;
- // Fix the class access flags if necessary.
- if (currentAccessLevel < requiredAccessLevel)
+ public void visitProgramClass(ProgramClass programClass)
{
- programClass.u2accessFlags =
- AccessUtil.replaceAccessFlags(currentAccessFlags,
- AccessUtil.accessFlags(requiredAccessLevel));
+ int currentAccessFlags = programClass.getAccessFlags();
+ int currentAccessLevel = AccessUtil.accessLevel(currentAccessFlags);
+
+ // Compute the required access level.
+ int requiredAccessLevel =
+ inSamePackage(programClass, referencingClass) ?
+ AccessUtil.PACKAGE_VISIBLE :
+ AccessUtil.PUBLIC;
+
+ // Fix the class access flags if necessary.
+ if (currentAccessLevel < requiredAccessLevel)
+ {
+ programClass.u2accessFlags =
+ AccessUtil.replaceAccessFlags(currentAccessFlags,
+ AccessUtil.accessFlags(requiredAccessLevel));
+ }
}
- }
- // Implementations for MemberVisitor.
+ // Implementations for MemberVisitor.
- public void visitLibraryMember(LibraryClass libraryClass, LibraryMember libraryMember) {}
+ public void visitLibraryMember(LibraryClass libraryClass, LibraryMember libraryMember) {}
- public void visitProgramMember(ProgramClass programClass, ProgramMember programMember)
- {
- int currentAccessFlags = programMember.getAccessFlags();
- int currentAccessLevel = AccessUtil.accessLevel(currentAccessFlags);
-
- // Compute the required access level.
- int requiredAccessLevel =
- programClass.equals(referencingClass) ? AccessUtil.PRIVATE :
- inSamePackage(programClass, referencingClass) ? AccessUtil.PACKAGE_VISIBLE :
- referencedClass.extends_(referencingClass) &&
- referencingClass.extends_(programClass) ? AccessUtil.PROTECTED :
- AccessUtil.PUBLIC;
-
- // Fix the class member access flags if necessary.
- if (currentAccessLevel < requiredAccessLevel)
+ public void visitProgramMember(ProgramClass programClass, ProgramMember programMember)
{
- programMember.u2accessFlags =
- AccessUtil.replaceAccessFlags(currentAccessFlags,
- AccessUtil.accessFlags(requiredAccessLevel));
+ int currentAccessFlags = programMember.getAccessFlags();
+ int currentAccessLevel = AccessUtil.accessLevel(currentAccessFlags);
+
+ // Compute the required access level.
+ int requiredAccessLevel =
+ programClass.equals(referencingClass) ? AccessUtil.PRIVATE :
+ inSamePackage(programClass, referencingClass) ? AccessUtil.PACKAGE_VISIBLE :
+ programClass.extends_(referencingClass) &&
+ referencingClass.extends_(programClass) ? AccessUtil.PROTECTED :
+ AccessUtil.PUBLIC;
+
+ // Fix the class member access flags if necessary.
+ if (currentAccessLevel < requiredAccessLevel)
+ {
+ programMember.u2accessFlags =
+ AccessUtil.replaceAccessFlags(currentAccessFlags,
+ AccessUtil.accessFlags(requiredAccessLevel));
+ }
}
- }
- /**
- * This ConstantVisitor returns the referenced class of the class constant
- * that it visits.
- */
- private class MyReferencedClassFinder
- extends SimplifiedVisitor
- implements ConstantVisitor
- {
- // Implementations for ConstantVisitor.
- public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
+ // Small utility methods.
+
+ /**
+ * Returns whether the two given classes are in the same package.
+ */
+ private boolean inSamePackage(ProgramClass class1, Clazz class2)
{
- referencedClass = classConstant.referencedClass;
+ return ClassUtil.internalPackageName(class1.getName()).equals(
+ ClassUtil.internalPackageName(class2.getName()));
}
}
-
-
- // Small utility methods.
-
- private boolean inSamePackage(ProgramClass class1, Clazz class2)
- {
- return ClassUtil.internalPackageName(class1.getName()).equals(
- ClassUtil.internalPackageName(class2.getName()));
- }
}
diff --git a/src/proguard/classfile/editor/AnnotationAdder.java b/src/proguard/classfile/editor/AnnotationAdder.java
index 0389ab1..3a3fad0 100644
--- a/src/proguard/classfile/editor/AnnotationAdder.java
+++ b/src/proguard/classfile/editor/AnnotationAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/AnnotationsAttributeEditor.java b/src/proguard/classfile/editor/AnnotationsAttributeEditor.java
index a175c33..53cee40 100644
--- a/src/proguard/classfile/editor/AnnotationsAttributeEditor.java
+++ b/src/proguard/classfile/editor/AnnotationsAttributeEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/AttributeAdder.java b/src/proguard/classfile/editor/AttributeAdder.java
index ad4ecc0..9abea45 100644
--- a/src/proguard/classfile/editor/AttributeAdder.java
+++ b/src/proguard/classfile/editor/AttributeAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -27,6 +27,9 @@ import proguard.classfile.attribute.preverification.*;
import proguard.classfile.attribute.visitor.AttributeVisitor;
import proguard.classfile.util.SimplifiedVisitor;
+import java.lang.reflect.Array;
+import java.util.Arrays;
+
/**
* This AttributeVisitor adds all attributes that it visits to the given
* target class, class member, or attribute.
@@ -41,6 +44,7 @@ implements AttributeVisitor
private static final int[] EMPTY_INTS = new int[0];
private static final Attribute[] EMPTY_ATTRIBUTES = new Attribute[0];
private static final ExceptionInfo[] EMPTY_EXCEPTIONS = new ExceptionInfo[0];
+ private static final Annotation[] EMPTY_ANNOTATIONS = new Annotation[0];
private final ProgramClass targetClass;
@@ -214,6 +218,24 @@ implements AttributeVisitor
}
+ public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute)
+ {
+ // Create a new local variable table attribute.
+ MethodParametersAttribute newMethodParametersAttribute =
+ new MethodParametersAttribute(constantAdder.addConstant(clazz, methodParametersAttribute.u2attributeNameIndex),
+ methodParametersAttribute.u1parametersCount,
+ new ParameterInfo[methodParametersAttribute.u1parametersCount]);
+
+ // Add the local variables.
+ methodParametersAttribute.parametersAccept(clazz,
+ method,
+ new ParameterInfoAdder(targetClass, newMethodParametersAttribute));
+
+ // Add it to the target.
+ attributesEditor.addAttribute(newMethodParametersAttribute);
+ }
+
+
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
// Create a new exceptions attribute.
@@ -399,11 +421,16 @@ implements AttributeVisitor
public void visitRuntimeVisibleParameterAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute)
{
// Create a new annotations attribute.
+ Annotation[][] parameterAnnotations =
+ new Annotation[runtimeVisibleParameterAnnotationsAttribute.u1parametersCount][];
+
+ Arrays.fill(parameterAnnotations, EMPTY_ANNOTATIONS);
+
RuntimeVisibleParameterAnnotationsAttribute newParameterAnnotationsAttribute =
new RuntimeVisibleParameterAnnotationsAttribute(constantAdder.addConstant(clazz, runtimeVisibleParameterAnnotationsAttribute.u2attributeNameIndex),
0,
- new int[runtimeVisibleParameterAnnotationsAttribute.u2parametersCount],
- new Annotation[runtimeVisibleParameterAnnotationsAttribute.u2parametersCount][]);
+ new int[runtimeVisibleParameterAnnotationsAttribute.u1parametersCount],
+ parameterAnnotations);
// Add the annotations.
runtimeVisibleParameterAnnotationsAttribute.annotationsAccept(clazz,
@@ -419,11 +446,16 @@ implements AttributeVisitor
public void visitRuntimeInvisibleParameterAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleParameterAnnotationsAttribute runtimeInvisibleParameterAnnotationsAttribute)
{
// Create a new annotations attribute.
+ Annotation[][] parameterAnnotations =
+ new Annotation[runtimeInvisibleParameterAnnotationsAttribute.u1parametersCount][];
+
+ Arrays.fill(parameterAnnotations, EMPTY_ANNOTATIONS);
+
RuntimeInvisibleParameterAnnotationsAttribute newParameterAnnotationsAttribute =
new RuntimeInvisibleParameterAnnotationsAttribute(constantAdder.addConstant(clazz, runtimeInvisibleParameterAnnotationsAttribute.u2attributeNameIndex),
0,
- new int[runtimeInvisibleParameterAnnotationsAttribute.u2parametersCount],
- new Annotation[runtimeInvisibleParameterAnnotationsAttribute.u2parametersCount][]);
+ new int[runtimeInvisibleParameterAnnotationsAttribute.u1parametersCount],
+ parameterAnnotations);
// Add the annotations.
runtimeInvisibleParameterAnnotationsAttribute.annotationsAccept(clazz,
diff --git a/src/proguard/classfile/editor/AttributeSorter.java b/src/proguard/classfile/editor/AttributeSorter.java
index 23fe027..8f1f414 100644
--- a/src/proguard/classfile/editor/AttributeSorter.java
+++ b/src/proguard/classfile/editor/AttributeSorter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/AttributesEditor.java b/src/proguard/classfile/editor/AttributesEditor.java
index f50b8f1..ce38a6b 100644
--- a/src/proguard/classfile/editor/AttributesEditor.java
+++ b/src/proguard/classfile/editor/AttributesEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -79,6 +79,27 @@ public class AttributesEditor
/**
+ * Finds the specified attribute in the target.
+ */
+ public Attribute findAttribute(String attributeName)
+ {
+ // What's the target?
+ return
+ targetAttribute != null ?
+ findAttribute(targetAttribute.u2attributesCount,
+ targetAttribute.attributes,
+ attributeName) :
+ targetMember != null ?
+ findAttribute(targetMember.u2attributesCount,
+ targetMember.attributes,
+ attributeName) :
+ findAttribute(targetClass.u2attributesCount,
+ targetClass.attributes,
+ attributeName);
+ }
+
+
+ /**
* Adds the given attribute to the target.
*/
public void addAttribute(Attribute attribute)
@@ -171,17 +192,17 @@ public class AttributesEditor
// Small utility methods.
/**
- * Tries put the given attribute in place of an existing attribute of the
- * same name, returning whether it was present.
+ * Tries to put the given attribute in place of an existing attribute of
+ * the same name, returning whether it was present.
*/
private boolean replaceAttribute(int attributesCount,
Attribute[] attributes,
Attribute attribute)
{
// Find the attribute with the same name.
- int index = findAttribute(attributesCount,
- attributes,
- attribute.getAttributeName(targetClass));
+ int index = findAttributeIndex(attributesCount,
+ attributes,
+ attribute.getAttributeName(targetClass));
if (index < 0)
{
return false;
@@ -228,9 +249,9 @@ public class AttributesEditor
String attributeName)
{
// Find the attribute.
- int index = findAttribute(attributesCount,
- attributes,
- attributeName);
+ int index = findAttributeIndex(attributesCount,
+ attributes,
+ attributeName);
if (index < 0)
{
return attributesCount;
@@ -252,13 +273,15 @@ public class AttributesEditor
* Finds the index of the attribute with the given name in the given
* array of attributes.
*/
- private int findAttribute(int attributesCount,
- Attribute[] attributes,
- String attributeName)
+ private int findAttributeIndex(int attributesCount,
+ Attribute[] attributes,
+ String attributeName)
{
for (int index = 0; index < attributesCount; index++)
{
- if (attributes[index].getAttributeName(targetClass).equals(attributeName))
+ Attribute attribute = attributes[index];
+
+ if (attribute.getAttributeName(targetClass).equals(attributeName))
{
return index;
}
@@ -266,4 +289,26 @@ public class AttributesEditor
return -1;
}
+
+
+ /**
+ * Finds the attribute with the given name in the given
+ * array of attributes.
+ */
+ private Attribute findAttribute(int attributesCount,
+ Attribute[] attributes,
+ String attributeName)
+ {
+ for (int index = 0; index < attributesCount; index++)
+ {
+ Attribute attribute = attributes[index];
+
+ if (attribute.getAttributeName(targetClass).equals(attributeName))
+ {
+ return attribute;
+ }
+ }
+
+ return null;
+ }
}
diff --git a/src/proguard/classfile/editor/BootstrapMethodInfoAdder.java b/src/proguard/classfile/editor/BootstrapMethodInfoAdder.java
new file mode 100644
index 0000000..260a561
--- /dev/null
+++ b/src/proguard/classfile/editor/BootstrapMethodInfoAdder.java
@@ -0,0 +1,86 @@
+/*
+ * 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.editor;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.*;
+import proguard.classfile.attribute.visitor.BootstrapMethodInfoVisitor;
+
+/**
+ * This BootstrapMethodInfoVisitor adds all bootstrap methods that it visits to
+ * the given target bootstrap methods attribute.
+ */
+public class BootstrapMethodInfoAdder
+implements BootstrapMethodInfoVisitor
+{
+ private final ConstantAdder constantAdder;
+ private final BootstrapMethodsAttributeEditor bootstrapMethodsAttributeEditor;
+
+ private int bootstrapMethodIndex;
+
+
+ /**
+ * Creates a new BootstrapMethodInfoAdder that will copy bootstrap methods
+ * into the given bootstrap methods attribute.
+ */
+ public BootstrapMethodInfoAdder(ProgramClass targetClass,
+ BootstrapMethodsAttribute targetBootstrapMethodsAttribute)
+ {
+ this.constantAdder = new ConstantAdder(targetClass);
+ this.bootstrapMethodsAttributeEditor = new BootstrapMethodsAttributeEditor(targetBootstrapMethodsAttribute);
+ }
+
+
+ /**
+ * Returns the index of the most recently added bootstrap method.
+ */
+ public int getBootstrapMethodIndex()
+ {
+ return bootstrapMethodIndex;
+ }
+
+
+ // Implementations for BootstrapMethodInfoVisitor.
+
+ public void visitBootstrapMethodInfo(Clazz clazz, BootstrapMethodInfo bootstrapMethodInfo)
+ {
+ // Copy the method arguments.
+ int methodArgumentCount = bootstrapMethodInfo.u2methodArgumentCount;
+ int[] methodArguments = bootstrapMethodInfo.u2methodArguments;
+ int[] newMethodArguments = new int[methodArgumentCount];
+
+ for (int index = 0; index < methodArgumentCount; index++)
+ {
+ newMethodArguments[index] =
+ constantAdder.addConstant(clazz, methodArguments[index]);
+ }
+
+ // Create a new bootstrap method.
+ BootstrapMethodInfo newBootstrapMethodInfo =
+ new BootstrapMethodInfo(constantAdder.addConstant(clazz, bootstrapMethodInfo.u2methodHandleIndex),
+ methodArgumentCount,
+ newMethodArguments);
+
+ // Add it to the target.
+ bootstrapMethodIndex =
+ bootstrapMethodsAttributeEditor.addBootstrapMethodInfo(newBootstrapMethodInfo);
+ }
+} \ No newline at end of file
diff --git a/src/proguard/classfile/editor/BootstrapMethodRemapper.java b/src/proguard/classfile/editor/BootstrapMethodRemapper.java
new file mode 100644
index 0000000..76d2766
--- /dev/null
+++ b/src/proguard/classfile/editor/BootstrapMethodRemapper.java
@@ -0,0 +1,88 @@
+/*
+ * 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.editor;
+
+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.*;
+import proguard.classfile.constant.visitor.ConstantVisitor;
+import proguard.classfile.instruction.*;
+import proguard.classfile.instruction.visitor.InstructionVisitor;
+import proguard.classfile.util.SimplifiedVisitor;
+import proguard.classfile.visitor.*;
+
+/**
+ * This ConstantVisitor remaps all possible indices of bootstrap methods
+ * of the constants that it visits, based on a given index map.
+ *
+ * @author Eric Lafortune
+ */
+public class BootstrapMethodRemapper
+extends SimplifiedVisitor
+implements ConstantVisitor
+{
+ private int[] constantIndexMap;
+
+
+ /**
+ * Sets the given mapping of old constant pool entry indexes to their new
+ * indexes.
+ */
+ public void setConstantIndexMap(int[] constantIndexMap)
+ {
+ this.constantIndexMap = constantIndexMap;
+ }
+
+
+ // Implementations for ConstantVisitor.
+
+ public void visitAnyConstant(Clazz clazz, Constant constant) {}
+
+
+ public void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant)
+ {
+ invokeDynamicConstant.u2bootstrapMethodAttributeIndex =
+ remapConstantIndex(invokeDynamicConstant.u2bootstrapMethodAttributeIndex);
+ }
+
+
+ // Small utility methods.
+
+ /**
+ * Returns the new bootstrap method index of the entry at the
+ * given index.
+ */
+ private int remapConstantIndex(int constantIndex)
+ {
+ int remappedConstantIndex = constantIndexMap[constantIndex];
+ if (remappedConstantIndex < 0)
+ {
+ throw new IllegalArgumentException("Can't remap constant index ["+constantIndex+"]");
+ }
+
+ return remappedConstantIndex;
+ }
+}
diff --git a/src/proguard/classfile/editor/BootstrapMethodsAttributeAdder.java b/src/proguard/classfile/editor/BootstrapMethodsAttributeAdder.java
new file mode 100644
index 0000000..1488b9b
--- /dev/null
+++ b/src/proguard/classfile/editor/BootstrapMethodsAttributeAdder.java
@@ -0,0 +1,91 @@
+/*
+ * 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.editor;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.*;
+import proguard.classfile.attribute.visitor.BootstrapMethodInfoVisitor;
+
+/**
+ * This BootstrapMethodInfoVisitor adds all bootstrap methods that it visits to
+ * the given target class, creating a bootstrap methods attribute if necessary.
+ */
+public class BootstrapMethodsAttributeAdder
+implements BootstrapMethodInfoVisitor
+{
+ private final ProgramClass targetClass;
+ private final ConstantPoolEditor constantPoolEditor;
+ private BootstrapMethodInfoAdder bootstrapMethodInfoAdder;
+
+
+ /**
+ * Creates a new BootstrapMethodsAttributeAdder that will copy bootstrap
+ * methods into the given target class/
+ */
+ public BootstrapMethodsAttributeAdder(ProgramClass targetClass)
+ {
+ this.targetClass = targetClass;
+ this.constantPoolEditor = new ConstantPoolEditor(targetClass);
+ }
+
+
+ /**
+ * Returns the index of the most recently added bootstrap method.
+ */
+ public int getBootstrapMethodIndex()
+ {
+ return bootstrapMethodInfoAdder.getBootstrapMethodIndex();
+ }
+
+
+ // Implementations for BootstrapMethodInfoVisitor.
+
+ public void visitBootstrapMethodInfo(Clazz clazz, BootstrapMethodInfo bootstrapMethodInfo)
+ {
+ // Make sure we have a bootstrap methods attribute adder.
+ if (bootstrapMethodInfoAdder == null)
+ {
+ // Make sure we have a target bootstrap methods attribute.
+ AttributesEditor attributesEditor =
+ new AttributesEditor(targetClass, false);
+
+ BootstrapMethodsAttribute targetBootstrapMethodsAttribute =
+ (BootstrapMethodsAttribute)attributesEditor.findAttribute(ClassConstants.ATTR_BootstrapMethods);
+
+ if (targetBootstrapMethodsAttribute == null)
+ {
+ targetBootstrapMethodsAttribute =
+ new BootstrapMethodsAttribute(constantPoolEditor.addUtf8Constant(ClassConstants.ATTR_BootstrapMethods),
+ 0,
+ new BootstrapMethodInfo[0]);
+
+ attributesEditor.addAttribute(targetBootstrapMethodsAttribute);
+ }
+
+ // Create a bootstrap method adder for it.
+ bootstrapMethodInfoAdder = new BootstrapMethodInfoAdder(targetClass,
+ targetBootstrapMethodsAttribute);
+ }
+
+ // Delegate to the bootstrap method adder.
+ bootstrapMethodInfoAdder.visitBootstrapMethodInfo(clazz, bootstrapMethodInfo);
+ }
+} \ No newline at end of file
diff --git a/src/proguard/classfile/editor/BootstrapMethodsAttributeEditor.java b/src/proguard/classfile/editor/BootstrapMethodsAttributeEditor.java
new file mode 100644
index 0000000..d00d47a
--- /dev/null
+++ b/src/proguard/classfile/editor/BootstrapMethodsAttributeEditor.java
@@ -0,0 +1,60 @@
+/*
+ * 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.editor;
+
+import proguard.classfile.attribute.*;
+import proguard.util.ArrayUtil;
+
+/**
+ * This class can add bootstrap methods to a given bootstrap methods attribute.
+ * Bootstrap methods to be added must have been filled out beforehand.
+ *
+ * @author Eric Lafortune
+ */
+public class BootstrapMethodsAttributeEditor
+{
+ private BootstrapMethodsAttribute targetBootstrapMethodsAttribute;
+
+
+ /**
+ * Creates a new BootstrapMethodsAttributeEditor that will edit bootstrap
+ * methods in the given bootstrap methods attribute.
+ */
+ public BootstrapMethodsAttributeEditor(BootstrapMethodsAttribute targetBootstrapMethodsAttribute)
+ {
+ this.targetBootstrapMethodsAttribute = targetBootstrapMethodsAttribute;
+ }
+
+
+ /**
+ * Adds a given bootstrap method to the bootstrap methods attribute.
+ * @return the index of the bootstrap method.
+ */
+ public int addBootstrapMethodInfo(BootstrapMethodInfo bootstrapMethodInfo)
+ {
+ targetBootstrapMethodsAttribute.bootstrapMethods =
+ (BootstrapMethodInfo[])ArrayUtil.add(targetBootstrapMethodsAttribute.bootstrapMethods,
+ targetBootstrapMethodsAttribute.u2bootstrapMethodsCount,
+ bootstrapMethodInfo);
+
+ return targetBootstrapMethodsAttribute.u2bootstrapMethodsCount++;
+ }
+} \ No newline at end of file
diff --git a/src/proguard/classfile/editor/BridgeMethodFixer.java b/src/proguard/classfile/editor/BridgeMethodFixer.java
index 2f1120d..5699b8e 100644
--- a/src/proguard/classfile/editor/BridgeMethodFixer.java
+++ b/src/proguard/classfile/editor/BridgeMethodFixer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -23,12 +23,12 @@ package proguard.classfile.editor;
import proguard.classfile.*;
import proguard.classfile.attribute.*;
import proguard.classfile.attribute.visitor.AttributeVisitor;
-import proguard.classfile.constant.*;
+import proguard.classfile.constant.RefConstant;
import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.instruction.*;
import proguard.classfile.instruction.visitor.InstructionVisitor;
-import proguard.classfile.util.*;
-import proguard.classfile.visitor.*;
+import proguard.classfile.util.SimplifiedVisitor;
+import proguard.classfile.visitor.MemberVisitor;
/**
* This MemberVisitor fixes all inappropriate bridge access flags of the
@@ -57,7 +57,7 @@ implements MemberVisitor,
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
- if ((programMethod.getAccessFlags() & ClassConstants.INTERNAL_ACC_BRIDGE) != 0)
+ if ((programMethod.getAccessFlags() & ClassConstants.ACC_BRIDGE) != 0)
{
programMethod.attributesAccept(programClass, this);
}
@@ -101,7 +101,7 @@ implements MemberVisitor,
}
// Clear the bridge flag.
- ((ProgramMethod)method).u2accessFlags &= ~ClassConstants.INTERNAL_ACC_BRIDGE;
+ ((ProgramMethod)method).u2accessFlags &= ~ClassConstants.ACC_BRIDGE;
}
break;
}
diff --git a/src/proguard/classfile/editor/ClassEditor.java b/src/proguard/classfile/editor/ClassEditor.java
index 7703c9d..4d9055b 100644
--- a/src/proguard/classfile/editor/ClassEditor.java
+++ b/src/proguard/classfile/editor/ClassEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/ClassElementSorter.java b/src/proguard/classfile/editor/ClassElementSorter.java
index 9875a29..c514471 100644
--- a/src/proguard/classfile/editor/ClassElementSorter.java
+++ b/src/proguard/classfile/editor/ClassElementSorter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/ClassMemberSorter.java b/src/proguard/classfile/editor/ClassMemberSorter.java
index ed0b5b1..7ebe12e 100644
--- a/src/proguard/classfile/editor/ClassMemberSorter.java
+++ b/src/proguard/classfile/editor/ClassMemberSorter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/ClassReferenceFixer.java b/src/proguard/classfile/editor/ClassReferenceFixer.java
index 1f8b396..0570084 100644
--- a/src/proguard/classfile/editor/ClassReferenceFixer.java
+++ b/src/proguard/classfile/editor/ClassReferenceFixer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -173,8 +173,11 @@ implements ClassVisitor,
String newDescriptor = newDescriptor(descriptor,
libraryMethod.referencedClasses);
- // Update the descriptor.
- libraryMethod.descriptor = newDescriptor;
+ if (!descriptor.equals(newDescriptor))
+ {
+ // Update the descriptor.
+ libraryMethod.descriptor = newDescriptor;
+ }
}
@@ -200,7 +203,12 @@ implements ClassVisitor,
// Update the String entry if required.
if (!newInternalClassName.equals(internalClassName))
{
- String newExternalClassName = ClassUtil.externalClassName(newInternalClassName);
+ // Only convert to an external class name if the original was
+ // an external class name too.
+ String newExternalClassName =
+ externalClassName.indexOf(JavaConstants.PACKAGE_SEPARATOR) >= 0 ?
+ ClassUtil.externalClassName(newInternalClassName) :
+ newInternalClassName;
// Refer to a new Utf8 entry.
stringConstant.u2stringIndex =
@@ -210,6 +218,24 @@ implements ClassVisitor,
}
+ public void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant)
+ {
+ // Has the descriptor changed?
+ String descriptor = invokeDynamicConstant.getType(clazz);
+ String newDescriptor = newDescriptor(descriptor,
+ invokeDynamicConstant.referencedClasses);
+
+ if (!descriptor.equals(newDescriptor))
+ {
+ String name = invokeDynamicConstant.getName(clazz);
+
+ // Refer to a new NameAndType entry.
+ invokeDynamicConstant.u2nameAndTypeIndex =
+ new ConstantPoolEditor((ProgramClass)clazz).addNameAndTypeConstant(name, newDescriptor);
+ }
+ }
+
+
public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
{
// Do we know the referenced class?
@@ -228,6 +254,23 @@ implements ClassVisitor,
}
}
+
+ public void visitMethodTypeConstant(Clazz clazz, MethodTypeConstant methodTypeConstant)
+ {
+ // Has the descriptor changed?
+ String descriptor = methodTypeConstant.getType(clazz);
+ String newDescriptor = newDescriptor(descriptor,
+ methodTypeConstant.referencedClasses);
+
+ if (!descriptor.equals(newDescriptor))
+ {
+ // Update the descriptor.
+ methodTypeConstant.u2descriptorIndex =
+ new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newDescriptor);
+ }
+ }
+
+
// Implementations for AttributeVisitor.
public void visitAnyAttribute(Clazz clazz, Attribute attribute) {}
@@ -263,13 +306,14 @@ implements ClassVisitor,
public void visitSignatureAttribute(Clazz clazz, SignatureAttribute signatureAttribute)
{
- // Compute the new signature.
- String signature = clazz.getString(signatureAttribute.u2signatureIndex);
+ // Has the signature changed?
+ String signature = signatureAttribute.getSignature(clazz);
String newSignature = newDescriptor(signature,
signatureAttribute.referencedClasses);
if (!signature.equals(newSignature))
{
+ // Update the signature.
signatureAttribute.u2signatureIndex =
new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSignature);
}
@@ -308,7 +352,7 @@ implements ClassVisitor,
innerNameIndex != 0)
{
String newInnerName = clazz.getClassName(innerClassIndex);
- int index = newInnerName.lastIndexOf(ClassConstants.INTERNAL_INNER_CLASS_SEPARATOR);
+ int index = newInnerName.lastIndexOf(ClassConstants.INNER_CLASS_SEPARATOR);
if (index >= 0)
{
innerClassesInfo.u2innerNameIndex =
@@ -323,7 +367,7 @@ implements ClassVisitor,
public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
{
// Has the descriptor changed?
- String descriptor = clazz.getString(localVariableInfo.u2descriptorIndex);
+ String descriptor = localVariableInfo.getDescriptor(clazz);
String newDescriptor = newDescriptor(descriptor,
localVariableInfo.referencedClass);
@@ -340,12 +384,13 @@ implements ClassVisitor,
public void visitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo)
{
// Has the signature changed?
- String signature = clazz.getString(localVariableTypeInfo.u2signatureIndex);
+ String signature = localVariableTypeInfo.getSignature(clazz);
String newSignature = newDescriptor(signature,
localVariableTypeInfo.referencedClasses);
if (!signature.equals(newSignature))
{
+ // Update the signature.
localVariableTypeInfo.u2signatureIndex =
new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSignature);
}
@@ -355,14 +400,14 @@ implements ClassVisitor,
public void visitAnnotation(Clazz clazz, Annotation annotation)
{
- // Compute the new type name.
- String typeName = clazz.getString(annotation.u2typeIndex);
+ // Has the type changed?
+ String typeName = annotation.getType(clazz);
String newTypeName = newDescriptor(typeName,
annotation.referencedClasses);
if (!typeName.equals(newTypeName))
{
- // Refer to a new Utf8 entry.
+ // Update the type.
annotation.u2typeIndex =
new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newTypeName);
}
@@ -381,14 +426,14 @@ implements ClassVisitor,
public void visitEnumConstantElementValue(Clazz clazz, Annotation annotation, EnumConstantElementValue enumConstantElementValue)
{
- // Compute the new type name.
- String typeName = clazz.getString(enumConstantElementValue.u2typeNameIndex);
+ // Has the type name chamged?
+ String typeName = enumConstantElementValue.getTypeName(clazz);
String newTypeName = newDescriptor(typeName,
enumConstantElementValue.referencedClasses);
if (!typeName.equals(newTypeName))
{
- // Refer to a new Utf8 entry.
+ // Update the type name.
enumConstantElementValue.u2typeNameIndex =
new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newTypeName);
}
@@ -397,14 +442,14 @@ implements ClassVisitor,
public void visitClassElementValue(Clazz clazz, Annotation annotation, ClassElementValue classElementValue)
{
- // Compute the new class name.
- String className = clazz.getString(classElementValue.u2classInfoIndex);
+ // Has the class info changed?
+ String className = classElementValue.getClassName(clazz);
String newClassName = newDescriptor(className,
classElementValue.referencedClasses);
if (!className.equals(newClassName))
{
- // Refer to a new Utf8 entry.
+ // Update the class info.
classElementValue.u2classInfoIndex =
new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newClassName);
}
@@ -492,7 +537,7 @@ implements ClassVisitor,
if (isInnerClassName)
{
newClassName =
- newClassName.substring(newClassName.lastIndexOf(ClassConstants.INTERNAL_INNER_CLASS_SEPARATOR)+1);
+ newClassName.substring(newClassName.lastIndexOf(ClassConstants.INNER_CLASS_SEPARATOR)+1);
}
newDescriptorBuffer.append(newClassName);
@@ -508,8 +553,8 @@ implements ClassVisitor,
*/
private String newUniqueMemberName(String name, String descriptor)
{
- return name.equals(ClassConstants.INTERNAL_METHOD_NAME_INIT) ?
- ClassConstants.INTERNAL_METHOD_NAME_INIT :
+ return name.equals(ClassConstants.METHOD_NAME_INIT) ?
+ ClassConstants.METHOD_NAME_INIT :
name + ClassConstants.SPECIAL_MEMBER_SEPARATOR + Long.toHexString(Math.abs((descriptor).hashCode()));
}
@@ -532,13 +577,13 @@ implements ClassVisitor,
String newClassName = referencedClass.getName();
// Is it an array type?
- if (className.charAt(0) == ClassConstants.INTERNAL_TYPE_ARRAY)
+ if (className.charAt(0) == ClassConstants.TYPE_ARRAY)
{
// Add the array prefixes and suffix "[L...;".
newClassName =
- className.substring(0, className.indexOf(ClassConstants.INTERNAL_TYPE_CLASS_START)+1) +
+ className.substring(0, className.indexOf(ClassConstants.TYPE_CLASS_START)+1) +
newClassName +
- ClassConstants.INTERNAL_TYPE_CLASS_END;
+ ClassConstants.TYPE_CLASS_END;
}
return newClassName;
diff --git a/src/proguard/classfile/editor/CodeAttributeComposer.java b/src/proguard/classfile/editor/CodeAttributeComposer.java
index c59b712..eaa8015 100644
--- a/src/proguard/classfile/editor/CodeAttributeComposer.java
+++ b/src/proguard/classfile/editor/CodeAttributeComposer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -60,6 +60,7 @@ implements AttributeVisitor,
private static final int INVALID = -1;
+ private final boolean allowExternalBranchTargets;
private final boolean allowExternalExceptionHandlers;
private final boolean shrinkInstructions;
@@ -85,17 +86,21 @@ implements AttributeVisitor,
/**
- * Creates a new CodeAttributeComposer that doesn't allow external exception
- * handlers and that automatically shrinks instructions.
+ * Creates a new CodeAttributeComposer that doesn't allow external branch
+ * targets or exception handlers and that automatically shrinks
+ * instructions.
*/
public CodeAttributeComposer()
{
- this(false, true);
+ this(false, false, true);
}
/**
* Creates a new CodeAttributeComposer.
+ * @param allowExternalBranchTargets specifies whether branch targets
+ * can lie outside the code fragment
+ * of the branch instructions.
* @param allowExternalExceptionHandlers specifies whether exception
* handlers can lie outside the code
* fragment in which exceptions are
@@ -104,9 +109,11 @@ implements AttributeVisitor,
* should automatically be shrunk
* before being written.
*/
- public CodeAttributeComposer(boolean allowExternalExceptionHandlers,
+ public CodeAttributeComposer(boolean allowExternalBranchTargets,
+ boolean allowExternalExceptionHandlers,
boolean shrinkInstructions)
{
+ this.allowExternalBranchTargets = allowExternalBranchTargets;
this.allowExternalExceptionHandlers = allowExternalExceptionHandlers;
this.shrinkInstructions = shrinkInstructions;
}
@@ -122,7 +129,9 @@ implements AttributeVisitor,
exceptionTableLength = 0;
level = -1;
- instructionWriter.reset(ClassConstants.TYPICAL_CODE_LENGTH);
+ // Make sure the instruction writer has at least the same buffer size
+ // as the local arrays.
+ instructionWriter.reset(code.length);
}
@@ -362,9 +371,6 @@ implements AttributeVisitor,
instructionOffset,
instructionWriter);
//instruction.write(code, codeLength);
-
- // Don't remap this instruction again.
- oldInstructionOffsets[instructionOffset] = -1;
}
// Continue remapping at the next instruction offset.
@@ -532,21 +538,48 @@ implements AttributeVisitor,
public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
{
- // Adjust the branch offset.
- branchInstruction.branchOffset = newBranchOffset(offset,
- branchInstruction.branchOffset);
+ try
+ {
+ // Adjust the branch offset.
+ branchInstruction.branchOffset =
+ newBranchOffset(offset, branchInstruction.branchOffset);
+
+ // Don't remap this instruction again.
+ oldInstructionOffsets[offset] = -1;
+ }
+ catch (IllegalArgumentException e)
+ {
+ if (level == 0 || !allowExternalBranchTargets)
+ {
+ throw e;
+ }
+ }
}
public void visitAnySwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SwitchInstruction switchInstruction)
{
- // Adjust the default jump offset.
- switchInstruction.defaultOffset = newBranchOffset(offset,
- switchInstruction.defaultOffset);
+ try
+ {
+ // TODO: We're assuming we can adjust no offsets or all offsets at once.
+ // Adjust the default jump offset.
+ switchInstruction.defaultOffset =
+ newBranchOffset(offset, switchInstruction.defaultOffset);
+
+ // Adjust the jump offsets.
+ updateJumpOffsets(offset,
+ switchInstruction.jumpOffsets);
- // Adjust the jump offsets.
- updateJumpOffsets(offset,
- switchInstruction.jumpOffsets);
+ // Don't remap this instruction again.
+ oldInstructionOffsets[offset] = -1;
+ }
+ catch (IllegalArgumentException e)
+ {
+ if (level == 0 || !allowExternalBranchTargets)
+ {
+ throw e;
+ }
+ }
}
@@ -719,8 +752,10 @@ implements AttributeVisitor,
int oldInstructionOffset = oldInstructionOffsets[newInstructionOffset];
+ // For ordinary branch instructions, we can compute the offset
+ // relative to the instruction itself.
return newInstructionOffset(oldInstructionOffset + oldBranchOffset) -
- newInstructionOffset(oldInstructionOffset);
+ newInstructionOffset;
}
diff --git a/src/proguard/classfile/editor/CodeAttributeEditor.java b/src/proguard/classfile/editor/CodeAttributeEditor.java
index 337e0d4..41b7471 100644
--- a/src/proguard/classfile/editor/CodeAttributeEditor.java
+++ b/src/proguard/classfile/editor/CodeAttributeEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -22,6 +22,10 @@ package proguard.classfile.editor;
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.TypeAnnotationVisitor;
import proguard.classfile.attribute.preverification.*;
import proguard.classfile.attribute.preverification.visitor.*;
import proguard.classfile.attribute.visitor.*;
@@ -47,7 +51,10 @@ implements AttributeVisitor,
VerificationTypeVisitor,
LineNumberInfoVisitor,
LocalVariableInfoVisitor,
- LocalVariableTypeInfoVisitor
+ LocalVariableTypeInfoVisitor,
+ TypeAnnotationVisitor,
+ TargetInfoVisitor,
+ LocalVariableTargetElementVisitor
{
//*
private static final boolean DEBUG = false;
@@ -179,7 +186,6 @@ implements AttributeVisitor,
modified = true;
simple = false;
-
}
@@ -206,7 +212,6 @@ implements AttributeVisitor,
modified = true;
simple = false;
-
}
@@ -512,6 +517,12 @@ implements AttributeVisitor,
}
+ public void visitAnyTypeAnnotationsAttribute(Clazz clazz, TypeAnnotationsAttribute typeAnnotationsAttribute)
+ {
+ typeAnnotationsAttribute.typeAnnotationsAccept(clazz, this);
+ }
+
+
/**
* Checks if it is possible to modifies the given code without having to
* update any offsets.
@@ -840,9 +851,9 @@ implements AttributeVisitor,
public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
{
- // Adjust the branch offset.
- branchInstruction.branchOffset = newBranchOffset(offset,
- branchInstruction.branchOffset);
+ // Update the branch offset, relative to the precise new offset.
+ branchInstruction.branchOffset =
+ newBranchOffset(offset, branchInstruction.branchOffset, newOffset);
// Write out the instruction.
instructionWriter.visitBranchInstruction(clazz,
@@ -857,13 +868,14 @@ implements AttributeVisitor,
public void visitTableSwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, TableSwitchInstruction tableSwitchInstruction)
{
- // Adjust the default jump offset.
- tableSwitchInstruction.defaultOffset = newBranchOffset(offset,
- tableSwitchInstruction.defaultOffset);
+ // Update the default jump offset, relative to the precise new offset.
+ tableSwitchInstruction.defaultOffset =
+ newBranchOffset(offset, tableSwitchInstruction.defaultOffset, newOffset);
- // Adjust the jump offsets.
+ // Update the jump offsets, relative to the precise new offset.
newJumpOffsets(offset,
- tableSwitchInstruction.jumpOffsets);
+ tableSwitchInstruction.jumpOffsets,
+ newOffset);
// Write out the instruction.
instructionWriter.visitTableSwitchInstruction(clazz,
@@ -878,13 +890,14 @@ implements AttributeVisitor,
public void visitLookUpSwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, LookUpSwitchInstruction lookUpSwitchInstruction)
{
- // Adjust the default jump offset.
- lookUpSwitchInstruction.defaultOffset = newBranchOffset(offset,
- lookUpSwitchInstruction.defaultOffset);
+ // Update the default jump offset, relative to the precise new offset.
+ lookUpSwitchInstruction.defaultOffset =
+ newBranchOffset(offset, lookUpSwitchInstruction.defaultOffset, newOffset);
- // Adjust the jump offsets.
+ // Update the jump offsets, relative to the precise new offset.
newJumpOffsets(offset,
- lookUpSwitchInstruction.jumpOffsets);
+ lookUpSwitchInstruction.jumpOffsets,
+ newOffset);
// Write out the instruction.
instructionWriter.visitLookUpSwitchInstruction(clazz,
@@ -901,8 +914,8 @@ implements AttributeVisitor,
public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
{
- // Update the code offsets. Note that the instruction offset map also has
- // an entry for the first offset after the code, for u2endPC.
+ // Update the code offsets. Note that the instruction offset map also
+ // has an entry for the first offset after the code, for u2endPC.
exceptionInfo.u2startPC = newInstructionOffset(exceptionInfo.u2startPC);
exceptionInfo.u2endPC = newInstructionOffset(exceptionInfo.u2endPC);
exceptionInfo.u2handlerPC = newInstructionOffset(exceptionInfo.u2handlerPC);
@@ -988,12 +1001,9 @@ implements AttributeVisitor,
public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
{
// Update the code offset and length.
- int newStartPC = newInstructionOffset(localVariableInfo.u2startPC);
- int newEndPC = newInstructionOffset(localVariableInfo.u2startPC +
- localVariableInfo.u2length);
-
- localVariableInfo.u2length = newEndPC - newStartPC;
- localVariableInfo.u2startPC = newStartPC;
+ // Be careful to update the length first.
+ localVariableInfo.u2length = newBranchOffset(localVariableInfo.u2startPC, localVariableInfo.u2length);
+ localVariableInfo.u2startPC = newInstructionOffset(localVariableInfo.u2startPC);
}
@@ -1002,41 +1012,99 @@ implements AttributeVisitor,
public void visitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo)
{
// Update the code offset and length.
- int newStartPC = newInstructionOffset(localVariableTypeInfo.u2startPC);
- int newEndPC = newInstructionOffset(localVariableTypeInfo.u2startPC +
- localVariableTypeInfo.u2length);
+ // Be careful to update the length first.
+ localVariableTypeInfo.u2length = newBranchOffset(localVariableTypeInfo.u2startPC, localVariableTypeInfo.u2length);
+ localVariableTypeInfo.u2startPC = newInstructionOffset(localVariableTypeInfo.u2startPC);
+ }
+
+
+ // Implementations for TypeAnnotationVisitor.
+
+ public void visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation)
+ {
+ // Update all local variable targets.
+ typeAnnotation.targetInfoAccept(clazz, this);
+ }
+
+
+ // Implementations for TargetInfoVisitor.
+
+ public void visitAnyTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfo targetInfo) {}
+
- localVariableTypeInfo.u2length = newEndPC - newStartPC;
- localVariableTypeInfo.u2startPC = newStartPC;
+ public void visitLocalVariableTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo)
+ {
+ // Update the offsets of the variables.
+ localVariableTargetInfo.targetElementsAccept(clazz, method, codeAttribute, typeAnnotation, this);
+ }
+
+
+ public void visitOffsetTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, OffsetTargetInfo offsetTargetInfo)
+ {
+ // Update the offset.
+ offsetTargetInfo.u2offset = newInstructionOffset(offsetTargetInfo.u2offset);
+ }
+
+
+ // Implementations for LocalVariableTargetElementVisitor.
+
+ public void visitLocalVariableTargetElement(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo, LocalVariableTargetElement localVariableTargetElement)
+ {
+ // Update the variable start offset and length.
+ // Be careful to update the length first.
+ localVariableTargetElement.u2length = newBranchOffset(localVariableTargetElement.u2startPC, localVariableTargetElement.u2length);
+ localVariableTargetElement.u2startPC = newInstructionOffset(localVariableTargetElement.u2startPC);
}
// Small utility methods.
/**
- * Adjusts the given jump offsets for the instruction at the given offset.
+ * Updates the given jump offsets for the instruction at the given offset,
+ * relative to the given new offset.
*/
- private void newJumpOffsets(int oldInstructionOffset, int[] oldJumpOffsets)
+ private void newJumpOffsets(int oldInstructionOffset,
+ int[] oldJumpOffsets,
+ int newInstructionOffset)
{
for (int index = 0; index < oldJumpOffsets.length; index++)
{
- oldJumpOffsets[index] = newBranchOffset(oldInstructionOffset, oldJumpOffsets[index]);
+ oldJumpOffsets[index] = newBranchOffset(oldInstructionOffset,
+ oldJumpOffsets[index],
+ newInstructionOffset);
}
}
/**
* Computes the new branch offset for the instruction at the given offset
- * with the given branch offset.
+ * with the given branch offset, relative to the new instruction (block)
+ * offset.
+ */
+ private int newBranchOffset(int oldInstructionOffset,
+ int oldBranchOffset)
+ {
+ return newInstructionOffset(oldInstructionOffset + oldBranchOffset) -
+ newInstructionOffset(oldInstructionOffset);
+ }
+
+
+ /**
+ * Computes the new branch offset for the instruction at the given offset
+ * with the given branch offset, relative to the given new offset.
*/
- private int newBranchOffset(int oldInstructionOffset, int oldBranchOffset)
+ private int newBranchOffset(int oldInstructionOffset,
+ int oldBranchOffset,
+ int newInstructionOffset)
{
- return newInstructionOffset(oldInstructionOffset + oldBranchOffset) - newOffset;
+ return newInstructionOffset(oldInstructionOffset + oldBranchOffset) -
+ newInstructionOffset;
}
/**
- * Computes the new instruction offset for the instruction at the given offset.
+ * Computes the new instruction offset for the instruction at the given
+ * offset.
*/
private int newInstructionOffset(int oldInstructionOffset)
{
diff --git a/src/proguard/classfile/editor/CodeAttributeEditorResetter.java b/src/proguard/classfile/editor/CodeAttributeEditorResetter.java
index 8f767c7..88e700b 100644
--- a/src/proguard/classfile/editor/CodeAttributeEditorResetter.java
+++ b/src/proguard/classfile/editor/CodeAttributeEditorResetter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/ComparableConstant.java b/src/proguard/classfile/editor/ComparableConstant.java
index 476edd6..cd2a810 100644
--- a/src/proguard/classfile/editor/ComparableConstant.java
+++ b/src/proguard/classfile/editor/ComparableConstant.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -148,7 +148,7 @@ implements Comparable, ConstantVisitor
}
public void visitDoubleConstant(Clazz clazz, DoubleConstant doubleConstant)
- {
+ {
result = Double.compare(doubleConstant.getValue(),
((DoubleConstant)otherConstant).getValue());
}
@@ -172,11 +172,10 @@ implements Comparable, ConstantVisitor
result = index < otherIndex ? -1 :
index > otherIndex ? 1 :
- (invokeDynamicConstant.getName(clazz) + ' ' +
- invokeDynamicConstant.getType(clazz))
- .compareTo
- (otherInvokeDynamicConstant.getName(clazz) + ' ' +
- otherInvokeDynamicConstant.getType(clazz));
+ compare(invokeDynamicConstant.getName(clazz),
+ invokeDynamicConstant.getType(clazz),
+ otherInvokeDynamicConstant.getName(clazz),
+ otherInvokeDynamicConstant.getType(clazz));
}
public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant)
@@ -184,27 +183,27 @@ implements Comparable, ConstantVisitor
MethodHandleConstant otherMethodHandleConstant = (MethodHandleConstant)otherConstant;
int kind = methodHandleConstant.getReferenceKind();
- int otherKind = methodHandleConstant.getReferenceKind();
+ int otherKind = otherMethodHandleConstant.getReferenceKind();
result = kind < otherKind ? -1 :
kind > otherKind ? 1 :
- (methodHandleConstant.getName(clazz) + ' ' +
- methodHandleConstant.getType(clazz))
- .compareTo
- (otherMethodHandleConstant.getName(clazz) + ' ' +
- otherMethodHandleConstant.getType(clazz));
+ compare(methodHandleConstant.getClassName(clazz),
+ methodHandleConstant.getName(clazz),
+ methodHandleConstant.getType(clazz),
+ otherMethodHandleConstant.getClassName(clazz),
+ otherMethodHandleConstant.getName(clazz),
+ otherMethodHandleConstant.getType(clazz));
}
public void visitAnyRefConstant(Clazz clazz, RefConstant refConstant)
{
RefConstant otherRefConstant = (RefConstant)otherConstant;
- result = (refConstant.getClassName(clazz) + ' ' +
- refConstant.getName(clazz) + ' ' +
- refConstant.getType(clazz))
- .compareTo
- (otherRefConstant.getClassName(clazz) + ' ' +
- otherRefConstant.getName(clazz) + ' ' +
- otherRefConstant.getType(clazz));
+ result = compare(refConstant.getClassName(clazz),
+ refConstant.getName(clazz),
+ refConstant.getType(clazz),
+ otherRefConstant.getClassName(clazz),
+ otherRefConstant.getName(clazz),
+ otherRefConstant.getType(clazz));
}
public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
@@ -223,11 +222,10 @@ implements Comparable, ConstantVisitor
public void visitNameAndTypeConstant(Clazz clazz, NameAndTypeConstant nameAndTypeConstant)
{
NameAndTypeConstant otherNameAndTypeConstant = (NameAndTypeConstant)otherConstant;
- result = (nameAndTypeConstant.getName(clazz) + ' ' +
- nameAndTypeConstant.getType(clazz))
- .compareTo
- (otherNameAndTypeConstant.getName(clazz) + ' ' +
- otherNameAndTypeConstant.getType(clazz));
+ result = compare(nameAndTypeConstant.getName(clazz),
+ nameAndTypeConstant.getType(clazz),
+ otherNameAndTypeConstant.getName(clazz),
+ otherNameAndTypeConstant.getType(clazz));
}
@@ -246,4 +244,33 @@ implements Comparable, ConstantVisitor
{
return this.getClass().hashCode();
}
+
+
+ // Small utility methods.
+
+ /**
+ * Compares the given two pairs of strings.
+ */
+ private int compare(String string1a, String string1b,
+ String string2a, String string2b)
+ {
+ int comparison;
+ return
+ (comparison = string1a.compareTo(string2a)) != 0 ? comparison :
+ string1b.compareTo(string2b);
+ }
+
+
+ /**
+ * Compares the given two triplets of strings.
+ */
+ private int compare(String string1a, String string1b, String string1c,
+ String string2a, String string2b, String string2c)
+ {
+ int comparison;
+ return
+ (comparison = string1a.compareTo(string2a)) != 0 ? comparison :
+ (comparison = string1b.compareTo(string2b)) != 0 ? comparison :
+ string1c.compareTo(string2c);
+ }
}
diff --git a/src/proguard/classfile/editor/ConstantAdder.java b/src/proguard/classfile/editor/ConstantAdder.java
index 9d20199..9f326ad 100644
--- a/src/proguard/classfile/editor/ConstantAdder.java
+++ b/src/proguard/classfile/editor/ConstantAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,20 +21,24 @@
package proguard.classfile.editor;
import proguard.classfile.*;
+import proguard.classfile.attribute.*;
import proguard.classfile.constant.*;
import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.util.ListUtil;
/**
* This ConstantVisitor adds all constants that it visits to the constant pool
* of a given target class.
*
+ * Bootstrap methods attributes are automatically updated for invokedynamic
+ * constants.
+ *
* @author Eric Lafortune
*/
public class ConstantAdder
implements ConstantVisitor
{
- private final ConstantPoolEditor constantPoolEditor;
+ private final ConstantPoolEditor constantPoolEditor;
+ private final BootstrapMethodsAttributeAdder bootstrapMethodsAttributeAdder;
private int constantIndex;
@@ -45,7 +49,8 @@ implements ConstantVisitor
*/
public ConstantAdder(ProgramClass targetClass)
{
- constantPoolEditor = new ConstantPoolEditor(targetClass);
+ constantPoolEditor = new ConstantPoolEditor(targetClass);
+ bootstrapMethodsAttributeAdder = new BootstrapMethodsAttributeAdder(targetClass);
}
@@ -131,7 +136,14 @@ implements ConstantVisitor
public void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant)
{
- // First add the name and type constant.
+ // Find the bootstrap methods attribute.
+ AttributesEditor attributesEditor =
+ new AttributesEditor((ProgramClass)clazz, false);
+
+ BootstrapMethodsAttribute bootstrapMethodsAttribute =
+ (BootstrapMethodsAttribute)attributesEditor.findAttribute(ClassConstants.ATTR_BootstrapMethods);
+
+ // Add the name and type constant.
clazz.constantPoolEntryAccept(invokeDynamicConstant.u2nameAndTypeIndex, this);
// Copy the referenced classes.
@@ -145,9 +157,13 @@ implements ConstantVisitor
referencedClasses.length);
}
+ bootstrapMethodsAttribute.bootstrapMethodEntryAccept(clazz,
+ invokeDynamicConstant.getBootstrapMethodAttributeIndex(),
+ bootstrapMethodsAttributeAdder);
+
// Then add the actual invoke dynamic constant.
constantIndex =
- constantPoolEditor.addInvokeDynamicConstant(invokeDynamicConstant.getBootstrapMethodAttributeIndex(),
+ constantPoolEditor.addInvokeDynamicConstant(bootstrapMethodsAttributeAdder.getBootstrapMethodIndex(),
constantIndex,
referencedClassesCopy);
}
diff --git a/src/proguard/classfile/editor/ConstantPoolEditor.java b/src/proguard/classfile/editor/ConstantPoolEditor.java
index 7adbc44..23f34fe 100644
--- a/src/proguard/classfile/editor/ConstantPoolEditor.java
+++ b/src/proguard/classfile/editor/ConstantPoolEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/ConstantPoolRemapper.java b/src/proguard/classfile/editor/ConstantPoolRemapper.java
index eaf7653..e033c30 100644
--- a/src/proguard/classfile/editor/ConstantPoolRemapper.java
+++ b/src/proguard/classfile/editor/ConstantPoolRemapper.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -53,6 +53,7 @@ implements ClassVisitor,
InstructionVisitor,
StackMapFrameVisitor,
VerificationTypeVisitor,
+ ParameterInfoVisitor,
LocalVariableInfoVisitor,
LocalVariableTypeInfoVisitor,
AnnotationVisitor,
@@ -333,6 +334,16 @@ implements ClassVisitor,
}
+ public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute)
+ {
+ methodParametersAttribute.u2attributeNameIndex =
+ remapConstantIndex(methodParametersAttribute.u2attributeNameIndex);
+
+ // Remap the constant pool references of the parameter information.
+ methodParametersAttribute.parametersAccept(clazz, method, this);
+ }
+
+
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
exceptionsAttribute.u2attributeNameIndex =
@@ -552,6 +563,15 @@ implements ClassVisitor,
}
+ // Implementations for ParameterInfoVisitor.
+
+ public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo)
+ {
+ parameterInfo.u2nameIndex =
+ remapConstantIndex(parameterInfo.u2nameIndex);
+ }
+
+
// Implementations for LocalVariableInfoVisitor.
public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
@@ -569,7 +589,7 @@ implements ClassVisitor,
{
localVariableTypeInfo.u2nameIndex =
remapConstantIndex(localVariableTypeInfo.u2nameIndex);
- localVariableTypeInfo.u2signatureIndex =
+ localVariableTypeInfo.u2signatureIndex =
remapConstantIndex(localVariableTypeInfo.u2signatureIndex);
}
@@ -637,8 +657,6 @@ implements ClassVisitor,
}
- // Small utility methods.
-
/**
* Remaps all constant pool indices in the given array.
*/
@@ -650,6 +668,8 @@ implements ClassVisitor,
}
}
+ // Small utility methods.
+
/**
* Returns the new constant pool index of the entry at the
@@ -657,6 +677,12 @@ implements ClassVisitor,
*/
private int remapConstantIndex(int constantIndex)
{
- return constantIndexMap[constantIndex];
+ int remappedConstantIndex = constantIndexMap[constantIndex];
+ if (remappedConstantIndex < 0)
+ {
+ throw new IllegalArgumentException("Can't remap constant index ["+constantIndex+"]");
+ }
+
+ return remappedConstantIndex;
}
}
diff --git a/src/proguard/classfile/editor/ConstantPoolShrinker.java b/src/proguard/classfile/editor/ConstantPoolShrinker.java
index ee309a0..0172321 100644
--- a/src/proguard/classfile/editor/ConstantPoolShrinker.java
+++ b/src/proguard/classfile/editor/ConstantPoolShrinker.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -52,6 +52,7 @@ implements ClassVisitor,
ExceptionInfoVisitor,
StackMapFrameVisitor,
VerificationTypeVisitor,
+ ParameterInfoVisitor,
LocalVariableInfoVisitor,
LocalVariableTypeInfoVisitor,
AnnotationVisitor,
@@ -251,6 +252,15 @@ implements ClassVisitor,
}
+ public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute)
+ {
+ markConstant(clazz, methodParametersAttribute.u2attributeNameIndex);
+
+ // Mark the constant pool entries referenced by the parameter information.
+ methodParametersAttribute.parametersAccept(clazz, method, this);
+ }
+
+
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
markConstant(clazz, exceptionsAttribute.u2attributeNameIndex);
@@ -405,6 +415,14 @@ implements ClassVisitor,
}
+ // Implementations for ParameterInfoVisitor.
+
+ public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo)
+ {
+ markConstant(clazz, parameterInfo.u2nameIndex);
+ }
+
+
// Implementations for LocalVariableInfoVisitor.
public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
@@ -554,11 +572,10 @@ implements ClassVisitor,
// Shift the used constant pool entries together.
for (int index = 1; index < length; index++)
{
- constantIndexMap[index] = counter;
-
Constant constant = constantPool[index];
- // Don't update the flag if this is the second half of a long entry.
+ // Is the constant being used? Don't update the flag if this is the
+ // second half of a long entry.
if (constant != null)
{
isUsed = isUsed(constant);
@@ -566,8 +583,17 @@ implements ClassVisitor,
if (isUsed)
{
+ // Remember the new index.
+ constantIndexMap[index] = counter;
+
+ // Shift the constant pool entry.
constantPool[counter++] = constant;
}
+ else
+ {
+ // Remember an invalid index.
+ constantIndexMap[index] = -1;
+ }
}
// Clear the remaining constant pool elements.
diff --git a/src/proguard/classfile/editor/ConstantPoolSorter.java b/src/proguard/classfile/editor/ConstantPoolSorter.java
index b578624..742bed2 100644
--- a/src/proguard/classfile/editor/ConstantPoolSorter.java
+++ b/src/proguard/classfile/editor/ConstantPoolSorter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/ElementValueAdder.java b/src/proguard/classfile/editor/ElementValueAdder.java
index 9c8b3f9..5a99b01 100644
--- a/src/proguard/classfile/editor/ElementValueAdder.java
+++ b/src/proguard/classfile/editor/ElementValueAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/ElementValuesEditor.java b/src/proguard/classfile/editor/ElementValuesEditor.java
index 57671e6..c4add27 100644
--- a/src/proguard/classfile/editor/ElementValuesEditor.java
+++ b/src/proguard/classfile/editor/ElementValuesEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,7 +20,7 @@
*/
package proguard.classfile.editor;
-import proguard.classfile.*;
+import proguard.classfile.ProgramClass;
import proguard.classfile.attribute.annotation.*;
/**
diff --git a/src/proguard/classfile/editor/ExceptionAdder.java b/src/proguard/classfile/editor/ExceptionAdder.java
index 152a065..2ba0bb6 100644
--- a/src/proguard/classfile/editor/ExceptionAdder.java
+++ b/src/proguard/classfile/editor/ExceptionAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/ExceptionInfoAdder.java b/src/proguard/classfile/editor/ExceptionInfoAdder.java
index c1c20fa..4798f84 100644
--- a/src/proguard/classfile/editor/ExceptionInfoAdder.java
+++ b/src/proguard/classfile/editor/ExceptionInfoAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/ExceptionsAttributeEditor.java b/src/proguard/classfile/editor/ExceptionsAttributeEditor.java
index 98bb79e..8dd2e3c 100644
--- a/src/proguard/classfile/editor/ExceptionsAttributeEditor.java
+++ b/src/proguard/classfile/editor/ExceptionsAttributeEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/InnerClassesAccessFixer.java b/src/proguard/classfile/editor/InnerClassesAccessFixer.java
index 5a5e8a5..fdfdce5 100644
--- a/src/proguard/classfile/editor/InnerClassesAccessFixer.java
+++ b/src/proguard/classfile/editor/InnerClassesAccessFixer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,12 +21,12 @@
package proguard.classfile.editor;
import proguard.classfile.*;
-import proguard.classfile.attribute.visitor.InnerClassesInfoVisitor;
import proguard.classfile.attribute.InnerClassesInfo;
+import proguard.classfile.attribute.visitor.InnerClassesInfoVisitor;
import proguard.classfile.constant.*;
import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.util.*;
-import proguard.classfile.visitor.*;
+import proguard.classfile.visitor.ClassVisitor;
/**
* This InnerClassesInfoVisitor fixes the inner class access flags of the
diff --git a/src/proguard/classfile/editor/InstructionAdder.java b/src/proguard/classfile/editor/InstructionAdder.java
index 422a348..4a20e59 100644
--- a/src/proguard/classfile/editor/InstructionAdder.java
+++ b/src/proguard/classfile/editor/InstructionAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,9 +21,9 @@
package proguard.classfile.editor;
import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.instruction.visitor.InstructionVisitor;
+import proguard.classfile.attribute.CodeAttribute;
import proguard.classfile.instruction.*;
+import proguard.classfile.instruction.visitor.InstructionVisitor;
import proguard.classfile.util.SimplifiedVisitor;
/**
diff --git a/src/proguard/classfile/editor/InstructionWriter.java b/src/proguard/classfile/editor/InstructionWriter.java
index c4a9b09..cafdd87 100644
--- a/src/proguard/classfile/editor/InstructionWriter.java
+++ b/src/proguard/classfile/editor/InstructionWriter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/InterfaceAdder.java b/src/proguard/classfile/editor/InterfaceAdder.java
index 1ad67dc..a7113b4 100644
--- a/src/proguard/classfile/editor/InterfaceAdder.java
+++ b/src/proguard/classfile/editor/InterfaceAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,9 +21,6 @@
package proguard.classfile.editor;
import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-import proguard.classfile.attribute.annotation.*;
-import proguard.classfile.attribute.preverification.*;
import proguard.classfile.constant.ClassConstant;
import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.util.SimplifiedVisitor;
diff --git a/src/proguard/classfile/editor/InterfaceDeleter.java b/src/proguard/classfile/editor/InterfaceDeleter.java
new file mode 100644
index 0000000..6fd22b6
--- /dev/null
+++ b/src/proguard/classfile/editor/InterfaceDeleter.java
@@ -0,0 +1,190 @@
+/*
+ * 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.editor;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.*;
+import proguard.classfile.attribute.visitor.AttributeVisitor;
+import proguard.classfile.constant.Utf8Constant;
+import proguard.classfile.util.*;
+import proguard.classfile.visitor.ClassVisitor;
+
+import java.util.Arrays;
+
+/**
+ * This ClassVisitor removes specified interfaces from the classes and class
+ * signatures that it visits.
+ *
+ * @author Eric Lafortune
+ */
+public class InterfaceDeleter
+extends SimplifiedVisitor
+implements ClassVisitor,
+ AttributeVisitor
+{
+ private static final boolean DEBUG = false;
+
+
+ private final boolean[] delete;
+
+
+ /**
+ * Creates a new InterfaceDeleter to remove the specified interfaces.
+ * @param delete an array that corresponds to the interfaces of a class
+ * and that specifies the ones to be removed.
+ */
+ public InterfaceDeleter(boolean[] delete)
+ {
+ this.delete = delete;
+ }
+
+
+ // Implementations for ClassVisitor.
+
+ public void visitProgramClass(ProgramClass programClass)
+ {
+ int[] interfaces = programClass.u2interfaces;
+ int interfacesCount = programClass.u2interfacesCount;
+
+ if (DEBUG)
+ {
+ System.out.println("InterfaceDeleter: "+programClass.getName()+" ("+interfacesCount+" interfaces)");
+ }
+
+ // Copy the interfaces that aren't deleted.
+ int newInterfacesCount = 0;
+ for (int index = 0; index < interfacesCount; index++)
+ {
+ if (DEBUG)
+ {
+ System.out.println("InterfaceDeleter: "+(delete[index]?"- ":"+ ")+programClass.getInterfaceName(index));
+ }
+
+ if (!delete[index])
+ {
+ interfaces[newInterfacesCount++] = interfaces[index];
+ }
+ }
+
+ // Update the signature.
+ if (newInterfacesCount < interfacesCount)
+ {
+ programClass.u2interfacesCount = newInterfacesCount;
+
+ programClass.attributesAccept(this);
+ }
+ }
+
+
+ // Implementations for AttributeVisitor.
+
+ public void visitAnyAttribute(Clazz clazz, Attribute attribute) {}
+
+
+ public void visitSignatureAttribute(Clazz clazz, SignatureAttribute signatureAttribute)
+ {
+ Clazz[] referencedClasses = signatureAttribute.referencedClasses;
+ if (referencedClasses != null)
+ {
+ // Process the generic definitions, superclass, and implemented
+ // interfaces.
+ InternalTypeEnumeration internalTypeEnumeration =
+ new InternalTypeEnumeration(signatureAttribute.getSignature(clazz));
+
+ // Recompose the signature types in a string buffer.
+ StringBuffer newSignatureBuffer = new StringBuffer();
+
+ // Also update the array with referenced classes.
+ int referencedClassIndex = 0;
+ int newReferencedClassIndex = 0;
+
+ // Copy the variable type declarations and the super class type.
+ while (internalTypeEnumeration.hasMoreTypes())
+ {
+ String internalType = internalTypeEnumeration.nextType();
+
+ // Append the type.
+ newSignatureBuffer.append(internalType);
+
+ // Copy any referenced classes.
+ int classCount =
+ new DescriptorClassEnumeration(internalType).classCount();
+
+ for (int counter = 0; counter < classCount; counter++)
+ {
+ referencedClasses[newReferencedClassIndex++] =
+ referencedClasses[referencedClassIndex++];
+ }
+
+ if (DEBUG)
+ {
+ System.out.println("InterfaceDeleter: type = " + internalType + " (" + classCount + " referenced classes)");
+ }
+
+ if (ClassUtil.isInternalClassType(internalType))
+ {
+ break;
+ }
+ }
+
+ // Copy the interface types.
+ int index = 0;
+ while (internalTypeEnumeration.hasMoreTypes())
+ {
+ String internalType = internalTypeEnumeration.nextType();
+
+ int classCount =
+ new DescriptorClassEnumeration(internalType).classCount();
+
+ if (DEBUG)
+ {
+ System.out.println("InterfaceDeleter: type " + (delete[index] ? "- " : "+ ") + internalType + " (" + classCount + " referenced classes)");
+ }
+
+ if (!delete[index++])
+ {
+ // Append the type.
+ newSignatureBuffer.append(internalType);
+
+ // Copy any referenced classes.
+ for (int counter = 0; counter < classCount; counter++)
+ {
+ referencedClasses[newReferencedClassIndex++] =
+ referencedClasses[referencedClassIndex++];
+ }
+ }
+ else
+ {
+ referencedClassIndex += classCount;
+ }
+ }
+
+ // Update the signature.
+ ((Utf8Constant)((ProgramClass)clazz).constantPool[signatureAttribute.u2signatureIndex]).setString(newSignatureBuffer.toString());
+
+ // Clear the remaining referenced classes.
+ Arrays.fill(referencedClasses,
+ newReferencedClassIndex,
+ referencedClassIndex,
+ null);
+ }
+ }
+}
diff --git a/src/proguard/classfile/editor/InterfaceSorter.java b/src/proguard/classfile/editor/InterfaceSorter.java
index 0d1f28c..a67b0a2 100644
--- a/src/proguard/classfile/editor/InterfaceSorter.java
+++ b/src/proguard/classfile/editor/InterfaceSorter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -23,12 +23,11 @@ package proguard.classfile.editor;
import proguard.classfile.*;
import proguard.classfile.attribute.*;
import proguard.classfile.attribute.visitor.AttributeVisitor;
-import proguard.classfile.constant.*;
-import proguard.classfile.constant.visitor.ConstantVisitor;
+import proguard.classfile.constant.Utf8Constant;
import proguard.classfile.util.*;
import proguard.classfile.visitor.ClassVisitor;
-import java.util.*;
+import java.util.Arrays;
/**
* This ClassVisitor sorts the interfaces of the program classes that it visits.
@@ -52,27 +51,30 @@ implements ClassVisitor,
// Sort the interfaces.
Arrays.sort(interfaces, 0, interfacesCount);
+ // Update the signature.
+ programClass.attributesAccept(this);
+
// Remove any duplicate entries.
- int newInterfacesCount = 0;
- int previousInterfaceIndex = 0;
- for (int index = 0; index < interfacesCount; index++)
+ boolean[] delete = null;
+ for (int index = 1; index < interfacesCount; index++)
{
- int interfaceIndex = interfaces[index];
-
- // Isn't this a duplicate of the previous interface?
- if (interfaceIndex != previousInterfaceIndex)
+ Clazz interfaceClass = programClass.getInterface(index);
+ if (interfaces[index] == interfaces[index - 1])
{
- interfaces[newInterfacesCount++] = interfaceIndex;
+ // Lazily create the array.
+ if (delete == null)
+ {
+ delete = new boolean[interfacesCount];
+ }
- // Remember the interface.
- previousInterfaceIndex = interfaceIndex;
+ delete[index] = true;
}
}
- programClass.u2interfacesCount = newInterfacesCount;
-
- // Update the signature, if any
- programClass.attributesAccept(this);
+ if (delete != null)
+ {
+ new InterfaceDeleter(delete).visitProgramClass(programClass);
+ }
}
}
@@ -86,7 +88,7 @@ implements ClassVisitor,
{
// Process the generic definitions, superclass, and implemented
// interfaces.
- String signature = clazz.getString(signatureAttribute.u2signatureIndex);
+ String signature = signatureAttribute.getSignature(clazz);
// Count the signature types.
InternalTypeEnumeration internalTypeEnumeration =
@@ -127,13 +129,7 @@ implements ClassVisitor,
for (int index = 0; index < count; index++)
{
- // Is this not an interface type, or an interface type that isn't
- // a duplicate of the previous interface type?
- if (index < count - interfacesCount ||
- !internalTypes[index].equals(internalTypes[index-1]))
- {
- newSignatureBuffer.append(internalTypes[index]);
- }
+ newSignatureBuffer.append(internalTypes[index]);
}
String newSignature = newSignatureBuffer.toString();
diff --git a/src/proguard/classfile/editor/InterfacesEditor.java b/src/proguard/classfile/editor/InterfacesEditor.java
index 8765e36..4de2b2b 100644
--- a/src/proguard/classfile/editor/InterfacesEditor.java
+++ b/src/proguard/classfile/editor/InterfacesEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,10 +20,8 @@
*/
package proguard.classfile.editor;
-import proguard.classfile.*;
-import proguard.classfile.attribute.*;
-
-import java.util.Arrays;
+import proguard.classfile.ProgramClass;
+import proguard.util.ArrayUtil;
/**
* This class can add and delete interfaces to and from classes. References to
@@ -54,22 +52,11 @@ public class InterfacesEditor
// Is the interface not yet present?
if (findInterfaceIndex(interfaceConstantIndex) < 0)
{
- int interfacesCount = targetClass.u2interfacesCount++;
- int[] interfaces = targetClass.u2interfaces;
-
- // Is the array too small to contain the additional interface?
- if (interfaces.length <= interfacesCount)
- {
- // Create a new array and copy the interfaces into it.
- int[] newinterfaces = new int[interfacesCount + 1];
- System.arraycopy(interfaces, 0, newinterfaces, 0, interfacesCount);
- interfaces = newinterfaces;
-
- targetClass.u2interfaces = interfaces;
- }
-
// Append the interface.
- interfaces[interfacesCount] = interfaceConstantIndex;
+ targetClass.u2interfaces =
+ ArrayUtil.add(targetClass.u2interfaces,
+ targetClass.u2interfacesCount++,
+ interfaceConstantIndex);
}
}
@@ -112,9 +99,9 @@ public class InterfacesEditor
for (int index = 0; index < interfacesCount; index++)
{
if (interfaces[index] == interfaceConstantIndex)
- {
- return index;
- }
+ {
+ return index;
+ }
}
return -1;
diff --git a/src/proguard/classfile/editor/LineNumberInfoAdder.java b/src/proguard/classfile/editor/LineNumberInfoAdder.java
index e1bd14a..c53fc26 100644
--- a/src/proguard/classfile/editor/LineNumberInfoAdder.java
+++ b/src/proguard/classfile/editor/LineNumberInfoAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,9 +20,9 @@
*/
package proguard.classfile.editor;
-import proguard.classfile.attribute.visitor.LineNumberInfoVisitor;
-import proguard.classfile.attribute.*;
import proguard.classfile.*;
+import proguard.classfile.attribute.*;
+import proguard.classfile.attribute.visitor.LineNumberInfoVisitor;
/**
* This LineNumberInfoVisitor adds all line numbers that it visits to the given
diff --git a/src/proguard/classfile/editor/LineNumberTableAttributeEditor.java b/src/proguard/classfile/editor/LineNumberTableAttributeEditor.java
index f712d46..5c2cdf3 100644
--- a/src/proguard/classfile/editor/LineNumberTableAttributeEditor.java
+++ b/src/proguard/classfile/editor/LineNumberTableAttributeEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/LocalVariableInfoAdder.java b/src/proguard/classfile/editor/LocalVariableInfoAdder.java
index a270fcf..cfbb570 100644
--- a/src/proguard/classfile/editor/LocalVariableInfoAdder.java
+++ b/src/proguard/classfile/editor/LocalVariableInfoAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,13 +20,13 @@
*/
package proguard.classfile.editor;
-import proguard.classfile.attribute.visitor.LocalVariableInfoVisitor;
-import proguard.classfile.attribute.*;
import proguard.classfile.*;
+import proguard.classfile.attribute.*;
+import proguard.classfile.attribute.visitor.LocalVariableInfoVisitor;
/**
- * This LocalVariableInfoVisitor adds all line numbers that it visits to the given
- * target line number attribute.
+ * This LocalVariableInfoVisitor adds all local variables that it visits to the
+ * given target local variable table attribute.
*/
public class LocalVariableInfoAdder
implements LocalVariableInfoVisitor
@@ -36,8 +36,8 @@ implements LocalVariableInfoVisitor
/**
- * Creates a new LocalVariableInfoAdder that will copy line numbers into the
- * given target line number table.
+ * Creates a new LocalVariableInfoAdder that will copy local variables
+ * into the given target local variable table.
*/
public LocalVariableInfoAdder(ProgramClass targetClass,
LocalVariableTableAttribute targetLocalVariableTableAttribute)
@@ -51,7 +51,7 @@ implements LocalVariableInfoVisitor
public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
{
- // Create a new line number.
+ // Create a new local variable.
LocalVariableInfo newLocalVariableInfo =
new LocalVariableInfo(localVariableInfo.u2startPC,
localVariableInfo.u2length,
diff --git a/src/proguard/classfile/editor/LocalVariableTableAttributeEditor.java b/src/proguard/classfile/editor/LocalVariableTableAttributeEditor.java
index b9e601f..d26f937 100644
--- a/src/proguard/classfile/editor/LocalVariableTableAttributeEditor.java
+++ b/src/proguard/classfile/editor/LocalVariableTableAttributeEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,6 +21,7 @@
package proguard.classfile.editor;
import proguard.classfile.attribute.*;
+import proguard.util.ArrayUtil;
/**
* This class can add local variables to a given local variable table attribute.
@@ -30,12 +31,12 @@ import proguard.classfile.attribute.*;
*/
public class LocalVariableTableAttributeEditor
{
- private LocalVariableTableAttribute targetLocalVariableTableAttribute;
+ private final LocalVariableTableAttribute targetLocalVariableTableAttribute;
/**
- * Creates a new LocalVariableTableAttributeEditor that will edit line numbers
- * in the given line number table attribute.
+ * Creates a new LocalVariableTableAttributeEditor that will edit local
+ * variables in the given local variable table attribute.
*/
public LocalVariableTableAttributeEditor(LocalVariableTableAttribute targetLocalVariableTableAttribute)
{
@@ -48,20 +49,9 @@ public class LocalVariableTableAttributeEditor
*/
public void addLocalVariableInfo(LocalVariableInfo localVariableInfo)
{
- int localVariableTableLength = targetLocalVariableTableAttribute.u2localVariableTableLength;
- LocalVariableInfo[] localVariableTable = targetLocalVariableTableAttribute.localVariableTable;
-
- // Make sure there is enough space for the new localVariableInfo.
- if (localVariableTable.length <= localVariableTableLength)
- {
- targetLocalVariableTableAttribute.localVariableTable = new LocalVariableInfo[localVariableTableLength+1];
- System.arraycopy(localVariableTable, 0,
- targetLocalVariableTableAttribute.localVariableTable, 0,
- localVariableTableLength);
- localVariableTable = targetLocalVariableTableAttribute.localVariableTable;
- }
-
- // Add the localVariableInfo.
- localVariableTable[targetLocalVariableTableAttribute.u2localVariableTableLength++] = localVariableInfo;
+ targetLocalVariableTableAttribute.localVariableTable =
+ (LocalVariableInfo[])ArrayUtil.add(targetLocalVariableTableAttribute.localVariableTable,
+ targetLocalVariableTableAttribute.u2localVariableTableLength++,
+ localVariableInfo);
}
} \ No newline at end of file
diff --git a/src/proguard/classfile/editor/LocalVariableTypeInfoAdder.java b/src/proguard/classfile/editor/LocalVariableTypeInfoAdder.java
index bed1366..94a5f2a 100644
--- a/src/proguard/classfile/editor/LocalVariableTypeInfoAdder.java
+++ b/src/proguard/classfile/editor/LocalVariableTypeInfoAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,13 +20,13 @@
*/
package proguard.classfile.editor;
-import proguard.classfile.attribute.visitor.LocalVariableTypeInfoVisitor;
-import proguard.classfile.attribute.*;
import proguard.classfile.*;
+import proguard.classfile.attribute.*;
+import proguard.classfile.attribute.visitor.LocalVariableTypeInfoVisitor;
/**
- * This LocalVariableTypeInfoVisitor adds all line numbers that it visits to the given
- * target line number attribute.
+ * This LocalVariableTypeInfoVisitor adds all local variable types that it
+ * visits to the given target local variable type attribute.
*/
public class LocalVariableTypeInfoAdder
implements LocalVariableTypeInfoVisitor
@@ -36,8 +36,8 @@ implements LocalVariableTypeInfoVisitor
/**
- * Creates a new LocalVariableTypeInfoAdder that will copy line numbers into the
- * given target line number table.
+ * Creates a new LocalVariableTypeInfoAdder that will copy local variable
+ * types into the given target local variable type table.
*/
public LocalVariableTypeInfoAdder(ProgramClass targetClass,
LocalVariableTypeTableAttribute targetLocalVariableTypeTableAttribute)
@@ -51,7 +51,7 @@ implements LocalVariableTypeInfoVisitor
public void visitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo)
{
- // Create a new line number.
+ // Create a new local variable type.
LocalVariableTypeInfo newLocalVariableTypeInfo =
new LocalVariableTypeInfo(localVariableTypeInfo.u2startPC,
localVariableTypeInfo.u2length,
diff --git a/src/proguard/classfile/editor/LocalVariableTypeTableAttributeEditor.java b/src/proguard/classfile/editor/LocalVariableTypeTableAttributeEditor.java
index 00f7ef3..724b7b0 100644
--- a/src/proguard/classfile/editor/LocalVariableTypeTableAttributeEditor.java
+++ b/src/proguard/classfile/editor/LocalVariableTypeTableAttributeEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,6 +21,7 @@
package proguard.classfile.editor;
import proguard.classfile.attribute.*;
+import proguard.util.ArrayUtil;
/**
* This class can add local variables to a given local variable type table
@@ -31,12 +32,12 @@ import proguard.classfile.attribute.*;
*/
public class LocalVariableTypeTableAttributeEditor
{
- private LocalVariableTypeTableAttribute targetLocalVariableTypeTableAttribute;
+ private final LocalVariableTypeTableAttribute targetLocalVariableTypeTableAttribute;
/**
- * Creates a new LocalVariableTypeTableAttributeEditor that will edit line numbers
- * in the given line number table attribute.
+ * Creates a new LocalVariableTypeTableAttributeEditor that will edit local
+ * variable types in the given local variable type table attribute.
*/
public LocalVariableTypeTableAttributeEditor(LocalVariableTypeTableAttribute targetLocalVariableTypeTableAttribute)
{
@@ -45,24 +46,13 @@ public class LocalVariableTypeTableAttributeEditor
/**
- * Adds a given line number to the line number table attribute.
+ * Adds a given local variable type to the local variable type table attribute.
*/
public void addLocalVariableTypeInfo(LocalVariableTypeInfo localVariableTypeInfo)
{
- int localVariableTypeTableLength = targetLocalVariableTypeTableAttribute.u2localVariableTypeTableLength;
- LocalVariableTypeInfo[] localVariableTypeTable = targetLocalVariableTypeTableAttribute.localVariableTypeTable;
-
- // Make sure there is enough space for the new localVariableTypeInfo.
- if (localVariableTypeTable.length <= localVariableTypeTableLength)
- {
- targetLocalVariableTypeTableAttribute.localVariableTypeTable = new LocalVariableTypeInfo[localVariableTypeTableLength+1];
- System.arraycopy(localVariableTypeTable, 0,
- targetLocalVariableTypeTableAttribute.localVariableTypeTable, 0,
- localVariableTypeTableLength);
- localVariableTypeTable = targetLocalVariableTypeTableAttribute.localVariableTypeTable;
- }
-
- // Add the localVariableTypeInfo.
- localVariableTypeTable[targetLocalVariableTypeTableAttribute.u2localVariableTypeTableLength++] = localVariableTypeInfo;
+ targetLocalVariableTypeTableAttribute.localVariableTypeTable =
+ (LocalVariableTypeInfo[])ArrayUtil.add(targetLocalVariableTypeTableAttribute.localVariableTypeTable,
+ targetLocalVariableTypeTableAttribute.u2localVariableTypeTableLength++,
+ localVariableTypeInfo);
}
} \ No newline at end of file
diff --git a/src/proguard/classfile/editor/MemberAdder.java b/src/proguard/classfile/editor/MemberAdder.java
index 811acae..2a93016 100644
--- a/src/proguard/classfile/editor/MemberAdder.java
+++ b/src/proguard/classfile/editor/MemberAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -110,8 +110,8 @@ implements MemberVisitor
// // Is the field private or static?
// int targetAccessFlags = targetField.getAccessFlags();
// if ((targetAccessFlags &
- // (ClassConstants.INTERNAL_ACC_PRIVATE |
- // ClassConstants.INTERNAL_ACC_STATIC)) != 0)
+ // (ClassConstants.ACC_PRIVATE |
+ // ClassConstants.ACC_STATIC)) != 0)
// {
// if (DEBUG)
// {
@@ -192,7 +192,7 @@ implements MemberVisitor
if (targetMethod != null)
{
// is this source method abstract?
- if ((accessFlags & ClassConstants.INTERNAL_ACC_ABSTRACT) != 0)
+ if ((accessFlags & ClassConstants.ACC_ABSTRACT) != 0)
{
// Keep the target method.
if (DEBUG)
@@ -206,7 +206,7 @@ implements MemberVisitor
// Is the target method abstract?
int targetAccessFlags = targetMethod.getAccessFlags();
- if ((targetAccessFlags & ClassConstants.INTERNAL_ACC_ABSTRACT) != 0)
+ if ((targetAccessFlags & ClassConstants.ACC_ABSTRACT) != 0)
{
// Keep the abstract method, but update its contents, in order
// to keep any references to it valid.
@@ -217,7 +217,7 @@ implements MemberVisitor
// Replace the access flags.
targetMethod.u2accessFlags =
- accessFlags & ~ClassConstants.INTERNAL_ACC_FINAL;
+ accessFlags & ~ClassConstants.ACC_FINAL;
// Add and replace the attributes.
programMethod.attributesAccept(programClass,
@@ -249,7 +249,7 @@ implements MemberVisitor
// Create a copy of the method.
ProgramMethod newProgramMethod =
- new ProgramMethod(accessFlags & ~ClassConstants.INTERNAL_ACC_FINAL,
+ new ProgramMethod(accessFlags & ~ClassConstants.ACC_FINAL,
constantAdder.addConstant(programClass, programMethod.u2nameIndex),
constantAdder.addConstant(programClass, programMethod.u2descriptorIndex),
0,
@@ -287,8 +287,8 @@ implements MemberVisitor
*/
private String newUniqueMemberName(String name, String descriptor)
{
- return name.equals(ClassConstants.INTERNAL_METHOD_NAME_INIT) ?
- ClassConstants.INTERNAL_METHOD_NAME_INIT :
+ return name.equals(ClassConstants.METHOD_NAME_INIT) ?
+ ClassConstants.METHOD_NAME_INIT :
name + ClassConstants.SPECIAL_MEMBER_SEPARATOR + Long.toHexString(Math.abs((descriptor).hashCode()));
}
}
diff --git a/src/proguard/classfile/editor/MemberReferenceFixer.java b/src/proguard/classfile/editor/MemberReferenceFixer.java
index b623047..3a32963 100644
--- a/src/proguard/classfile/editor/MemberReferenceFixer.java
+++ b/src/proguard/classfile/editor/MemberReferenceFixer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -271,7 +271,7 @@ implements ClassVisitor,
Clazz referencedClass = classConstant.referencedClass;
if (referencedClass != null)
{
- isInterfaceMethod = (referencedClass.getAccessFlags() & ClassConstants.INTERNAL_ACC_INTERFACE) != 0;
+ isInterfaceMethod = (referencedClass.getAccessFlags() & ClassConstants.ACC_INTERFACE) != 0;
}
}
}
diff --git a/src/proguard/classfile/editor/MethodInvocationFixer.java b/src/proguard/classfile/editor/MethodInvocationFixer.java
index e457e63..81b33ea 100644
--- a/src/proguard/classfile/editor/MethodInvocationFixer.java
+++ b/src/proguard/classfile/editor/MethodInvocationFixer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -92,7 +92,7 @@ implements AttributeVisitor,
byte opcode = constantInstruction.opcode;
// Is the method static?
- if ((referencedMethod.getAccessFlags() & ClassConstants.INTERNAL_ACC_STATIC) != 0)
+ if ((referencedMethod.getAccessFlags() & ClassConstants.ACC_STATIC) != 0)
{
// But is it not a static invocation?
if (opcode != InstructionConstants.OP_INVOKESTATIC)
@@ -112,8 +112,8 @@ implements AttributeVisitor,
}
// Is the method private, or an instance initializer?
- else if ((referencedMethod.getAccessFlags() & ClassConstants.INTERNAL_ACC_PRIVATE) != 0 ||
- referencedMethod.getName(referencedMethodClass).equals(ClassConstants.INTERNAL_METHOD_NAME_INIT))
+ else if ((referencedMethod.getAccessFlags() & ClassConstants.ACC_PRIVATE) != 0 ||
+ referencedMethod.getName(referencedMethodClass).equals(ClassConstants.METHOD_NAME_INIT))
{
// But is it not a special invocation?
if (opcode != InstructionConstants.OP_INVOKESPECIAL)
@@ -133,7 +133,7 @@ implements AttributeVisitor,
}
// Is the method an interface method?
- else if ((referencedClass.getAccessFlags() & ClassConstants.INTERNAL_ACC_INTERFACE) != 0)
+ else if ((referencedClass.getAccessFlags() & ClassConstants.ACC_INTERFACE) != 0)
{
int invokeinterfaceConstant =
(ClassUtil.internalMethodParameterSize(referencedMethod.getDescriptor(referencedMethodClass), false)) << 8;
@@ -234,7 +234,7 @@ implements AttributeVisitor,
System.out.println(" Instruction = "+constantInstruction.toString(offset));
System.out.println(" -> Class = "+referencedClass);
System.out.println(" Method = "+referencedMethod);
- if ((referencedClass.getAccessFlags() & ClassConstants.INTERNAL_ACC_INTERFACE) != 0)
+ if ((referencedClass.getAccessFlags() & ClassConstants.ACC_INTERFACE) != 0)
{
System.out.println(" Parameter size = "+(ClassUtil.internalMethodParameterSize(referencedMethod.getDescriptor(referencedMethodClass), false)));
}
diff --git a/src/proguard/classfile/editor/NameAndTypeShrinker.java b/src/proguard/classfile/editor/NameAndTypeShrinker.java
index 650f9ba..40181b2 100644
--- a/src/proguard/classfile/editor/NameAndTypeShrinker.java
+++ b/src/proguard/classfile/editor/NameAndTypeShrinker.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -25,7 +25,6 @@ import proguard.classfile.attribute.*;
import proguard.classfile.attribute.visitor.AttributeVisitor;
import proguard.classfile.constant.*;
import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.classfile.editor.ConstantPoolRemapper;
import proguard.classfile.util.SimplifiedVisitor;
import proguard.classfile.visitor.ClassVisitor;
@@ -163,11 +162,10 @@ implements ClassVisitor,
// Shift the used constant pool entries together.
for (int index = 1; index < length; index++)
{
- constantIndexMap[index] = counter;
-
Constant constant = constantPool[index];
- // Don't update the flag if this is the second half of a long entry.
+ // Is the constant being used? Don't update the flag if this is the
+ // second half of a long entry.
if (constant != null)
{
isUsed = constant.getTag() != ClassConstants.CONSTANT_NameAndType ||
@@ -176,8 +174,17 @@ implements ClassVisitor,
if (isUsed)
{
+ // Remember the new index.
+ constantIndexMap[index] = counter;
+
+ // Shift the constant pool entry.
constantPool[counter++] = constant;
}
+ else
+ {
+ // Remember an invalid index.
+ constantIndexMap[index] = -1;
+ }
}
// Clear the remaining constant pool elements.
diff --git a/src/proguard/classfile/editor/NamedAttributeDeleter.java b/src/proguard/classfile/editor/NamedAttributeDeleter.java
index 6aa5cdf..c02ba84 100644
--- a/src/proguard/classfile/editor/NamedAttributeDeleter.java
+++ b/src/proguard/classfile/editor/NamedAttributeDeleter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,17 +21,23 @@
package proguard.classfile.editor;
import proguard.classfile.*;
+import proguard.classfile.attribute.*;
+import proguard.classfile.attribute.visitor.AttributeVisitor;
+import proguard.classfile.util.SimplifiedVisitor;
import proguard.classfile.visitor.*;
-import proguard.util.StringMatcher;
/**
* This ClassVisitor deletes attributes with a given name in the program
- * classes that it visits.
+ * classes, fields, methods, or code attributes that it visits.
*
* @author Eric Lafortune
*/
-public class NamedAttributeDeleter implements ClassVisitor
+public class NamedAttributeDeleter
+extends SimplifiedVisitor
+implements ClassVisitor,
+ MemberVisitor,
+ AttributeVisitor
{
private final String attributeName;
@@ -51,4 +57,26 @@ public class NamedAttributeDeleter implements ClassVisitor
{
new AttributesEditor(programClass, false).deleteAttribute(attributeName);
}
+
+
+ // Implementations for MemberVisitor.
+
+ public void visitLibraryMember(LibraryClass libraryClass, LibraryMember libraryMember) {}
+
+
+ public void visitProgramMember(ProgramClass programClass, ProgramMember programMember)
+ {
+ new AttributesEditor(programClass, programMember, false).deleteAttribute(attributeName);
+ }
+
+
+ // Implementations for AttributeVisitor.
+
+ public void visitAnyAttribute(Clazz clazz, Attribute attribute) {}
+
+
+ public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
+ {
+ new AttributesEditor((ProgramClass)clazz, (ProgramMember)method, codeAttribute, false).deleteAttribute(attributeName);
+ }
} \ No newline at end of file
diff --git a/src/proguard/classfile/editor/ParameterAnnotationsAttributeEditor.java b/src/proguard/classfile/editor/ParameterAnnotationsAttributeEditor.java
index 232747f..b7d29f7 100644
--- a/src/proguard/classfile/editor/ParameterAnnotationsAttributeEditor.java
+++ b/src/proguard/classfile/editor/ParameterAnnotationsAttributeEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,6 +21,7 @@
package proguard.classfile.editor;
import proguard.classfile.attribute.annotation.*;
+import proguard.util.ArrayUtil;
/**
* This class can add annotations to a given parameter annotations attribute.
@@ -48,24 +49,8 @@ public class ParameterAnnotationsAttributeEditor
*/
public void addAnnotation(int parameterIndex, Annotation annotation)
{
- int annotationsCount = targetParameterAnnotationsAttribute.u2parameterAnnotationsCount[parameterIndex];
- Annotation[] annotations = targetParameterAnnotationsAttribute.parameterAnnotations[parameterIndex];
-
- // Make sure there is enough space for the new annotation.
- if (annotations == null ||
- annotations.length <= annotationsCount)
- {
- targetParameterAnnotationsAttribute.parameterAnnotations[parameterIndex] = new Annotation[annotationsCount+1];
- if (annotations != null)
- {
- System.arraycopy(annotations, 0,
- targetParameterAnnotationsAttribute.parameterAnnotations[parameterIndex], 0,
- annotationsCount);
- }
- annotations = targetParameterAnnotationsAttribute.parameterAnnotations[parameterIndex];
- }
-
- // Add the annotation.
- annotations[targetParameterAnnotationsAttribute.u2parameterAnnotationsCount[parameterIndex]++] = annotation;
+ ArrayUtil.add(targetParameterAnnotationsAttribute.parameterAnnotations[parameterIndex],
+ targetParameterAnnotationsAttribute.u2parameterAnnotationsCount[parameterIndex]++,
+ annotation);
}
} \ No newline at end of file
diff --git a/src/proguard/classfile/editor/ParameterInfoAdder.java b/src/proguard/classfile/editor/ParameterInfoAdder.java
new file mode 100644
index 0000000..50d35b2
--- /dev/null
+++ b/src/proguard/classfile/editor/ParameterInfoAdder.java
@@ -0,0 +1,62 @@
+/*
+ * 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.editor;
+
+import proguard.classfile.*;
+import proguard.classfile.attribute.*;
+import proguard.classfile.attribute.visitor.ParameterInfoVisitor;
+
+/**
+ * This ParameterInfoVisitor adds all parameter information that it visits to
+ * the given target method parameters attribute.
+ */
+public class ParameterInfoAdder
+implements ParameterInfoVisitor
+{
+ private final ConstantAdder constantAdder;
+ private final MethodParametersAttribute targetMethodParametersAttribute;
+
+
+ /**
+ * Creates a new ParameterInfoAdder that will copy parameter information
+ * into the given target method parameters attribute.
+ */
+ public ParameterInfoAdder(ProgramClass targetClass,
+ MethodParametersAttribute targetMethodParametersAttribute)
+ {
+ this.constantAdder = new ConstantAdder(targetClass);
+ this.targetMethodParametersAttribute = targetMethodParametersAttribute;
+ }
+
+
+ // Implementations for ParameterInfoVisitor.
+
+ public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo)
+ {
+ // Create a new parameter.
+ ParameterInfo newParameterInfo =
+ new ParameterInfo(constantAdder.addConstant(clazz, parameterInfo.u2nameIndex),
+ parameterInfo.u2accessFlags);
+
+ // Add it to the target.
+ targetMethodParametersAttribute.parameters[parameterIndex] = newParameterInfo;
+ }
+} \ No newline at end of file
diff --git a/src/proguard/classfile/editor/StackSizeUpdater.java b/src/proguard/classfile/editor/StackSizeUpdater.java
index d90b3d0..d49e53c 100644
--- a/src/proguard/classfile/editor/StackSizeUpdater.java
+++ b/src/proguard/classfile/editor/StackSizeUpdater.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/SubclassAdder.java b/src/proguard/classfile/editor/SubclassAdder.java
index 717bb1c..d7f179a 100644
--- a/src/proguard/classfile/editor/SubclassAdder.java
+++ b/src/proguard/classfile/editor/SubclassAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/SubclassToAdder.java b/src/proguard/classfile/editor/SubclassToAdder.java
index 109152b..dc6de07 100644
--- a/src/proguard/classfile/editor/SubclassToAdder.java
+++ b/src/proguard/classfile/editor/SubclassToAdder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/Utf8Shrinker.java b/src/proguard/classfile/editor/Utf8Shrinker.java
index eda5826..35626d7 100644
--- a/src/proguard/classfile/editor/Utf8Shrinker.java
+++ b/src/proguard/classfile/editor/Utf8Shrinker.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -28,7 +28,6 @@ import proguard.classfile.attribute.preverification.*;
import proguard.classfile.attribute.visitor.*;
import proguard.classfile.constant.*;
import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.classfile.editor.ConstantPoolRemapper;
import proguard.classfile.util.SimplifiedVisitor;
import proguard.classfile.visitor.*;
@@ -47,6 +46,7 @@ implements ClassVisitor,
ConstantVisitor,
AttributeVisitor,
InnerClassesInfoVisitor,
+ ParameterInfoVisitor,
LocalVariableInfoVisitor,
LocalVariableTypeInfoVisitor,
AnnotationVisitor,
@@ -198,6 +198,15 @@ implements ClassVisitor,
}
+ public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute)
+ {
+ markCpUtf8Entry(clazz, methodParametersAttribute.u2attributeNameIndex);
+
+ // Mark the UTF-8 entries referenced by the parameter information.
+ methodParametersAttribute.parametersAccept(clazz, method, this);
+ }
+
+
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
markCpUtf8Entry(clazz, exceptionsAttribute.u2attributeNameIndex);
@@ -287,6 +296,17 @@ implements ClassVisitor,
}
+ // Implementations for ParameterInfoVisitor.
+
+ public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo)
+ {
+ if (parameterInfo.u2nameIndex != 0)
+ {
+ markCpUtf8Entry(clazz, parameterInfo.u2nameIndex);
+ }
+ }
+
+
// Implementations for LocalVariableInfoVisitor.
public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
@@ -430,11 +450,10 @@ implements ClassVisitor,
// Shift the used constant pool entries together.
for (int index = 1; index < length; index++)
{
- constantIndexMap[index] = counter;
-
Constant constant = constantPool[index];
- // Don't update the flag if this is the second half of a long entry.
+ // Is the constant being used? Don't update the flag if this is the
+ // second half of a long entry.
if (constant != null)
{
isUsed = constant.getTag() != ClassConstants.CONSTANT_Utf8 ||
@@ -443,8 +462,17 @@ implements ClassVisitor,
if (isUsed)
{
+ // Remember the new index.
+ constantIndexMap[index] = counter;
+
+ // Shift the constant pool entry.
constantPool[counter++] = constant;
}
+ else
+ {
+ // Remember an invalid index.
+ constantIndexMap[index] = -1;
+ }
}
// Clear the remaining constant pool elements.
diff --git a/src/proguard/classfile/editor/VariableCleaner.java b/src/proguard/classfile/editor/VariableCleaner.java
index 63b7d4a..be67e05 100644
--- a/src/proguard/classfile/editor/VariableCleaner.java
+++ b/src/proguard/classfile/editor/VariableCleaner.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/VariableEditor.java b/src/proguard/classfile/editor/VariableEditor.java
index b5143b5..2fd5471 100644
--- a/src/proguard/classfile/editor/VariableEditor.java
+++ b/src/proguard/classfile/editor/VariableEditor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/editor/VariableRemapper.java b/src/proguard/classfile/editor/VariableRemapper.java
index ca9d88a..1ca1cb5 100644
--- a/src/proguard/classfile/editor/VariableRemapper.java
+++ b/src/proguard/classfile/editor/VariableRemapper.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -22,6 +22,10 @@ package proguard.classfile.editor;
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.TypeAnnotationVisitor;
import proguard.classfile.attribute.visitor.*;
import proguard.classfile.instruction.*;
import proguard.classfile.instruction.visitor.InstructionVisitor;
@@ -38,7 +42,10 @@ extends SimplifiedVisitor
implements AttributeVisitor,
InstructionVisitor,
LocalVariableInfoVisitor,
- LocalVariableTypeInfoVisitor
+ LocalVariableTypeInfoVisitor,
+ TypeAnnotationVisitor,
+ TargetInfoVisitor,
+ LocalVariableTargetElementVisitor
{
private static final boolean DEBUG = false;
@@ -63,6 +70,22 @@ implements AttributeVisitor,
public void visitAnyAttribute(Clazz clazz, Attribute attribute) {}
+ public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute)
+ {
+ // Reorder the array with parameter information.
+ ParameterInfo[] oldParameters = methodParametersAttribute.parameters;
+ ParameterInfo[] newParameters =
+ new ParameterInfo[methodParametersAttribute.u1parametersCount];
+
+ for (int index = 0; index < methodParametersAttribute.u1parametersCount; index++)
+ {
+ newParameters[remapVariable(index)] = oldParameters[index];
+ }
+
+ methodParametersAttribute.parameters = newParameters;
+ }
+
+
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
{
if (DEBUG)
@@ -103,6 +126,13 @@ implements AttributeVisitor,
}
+ public void visitAnyTypeAnnotationsAttribute(Clazz clazz, TypeAnnotationsAttribute typeAnnotationsAttribute)
+ {
+ // Remap the variable references of local variable type annotations.
+ typeAnnotationsAttribute.typeAnnotationsAccept(clazz, this);
+ }
+
+
// Implementations for LocalVariableInfoVisitor.
public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
@@ -121,6 +151,34 @@ implements AttributeVisitor,
}
+ // Implementations for TypeAnnotationVisitor.
+
+ public void visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation)
+ {
+ typeAnnotation.targetInfoAccept(clazz, this);
+ }
+
+
+ // Implementations for TargetInfoVisitor.
+
+ public void visitAnyTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfo targetInfo) {}
+
+
+ public void visitLocalVariableTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo)
+ {
+ localVariableTargetInfo.targetElementsAccept(clazz, method, codeAttribute, typeAnnotation, this);
+ }
+
+
+ // Implementations for LocalVariableTargetElementVisitor.
+
+ public void visitLocalVariableTargetElement(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo, LocalVariableTargetElement localVariableTargetElement)
+ {
+ localVariableTargetElement.u2index =
+ remapVariable(localVariableTargetElement.u2index);
+ }
+
+
// Implementations for InstructionVisitor.
public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction) {}
diff --git a/src/proguard/classfile/editor/VariableSizeUpdater.java b/src/proguard/classfile/editor/VariableSizeUpdater.java
index 2feaa9d..f364f92 100644
--- a/src/proguard/classfile/editor/VariableSizeUpdater.java
+++ b/src/proguard/classfile/editor/VariableSizeUpdater.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/BranchInstruction.java b/src/proguard/classfile/instruction/BranchInstruction.java
index f3a7080..8099186 100644
--- a/src/proguard/classfile/instruction/BranchInstruction.java
+++ b/src/proguard/classfile/instruction/BranchInstruction.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/ConstantInstruction.java b/src/proguard/classfile/instruction/ConstantInstruction.java
index 42d1523..42db94f 100644
--- a/src/proguard/classfile/instruction/ConstantInstruction.java
+++ b/src/proguard/classfile/instruction/ConstantInstruction.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/Instruction.java b/src/proguard/classfile/instruction/Instruction.java
index 33e705d..ecdc05c 100644
--- a/src/proguard/classfile/instruction/Instruction.java
+++ b/src/proguard/classfile/instruction/Instruction.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -31,6 +31,214 @@ import proguard.classfile.instruction.visitor.InstructionVisitor;
*/
public abstract class Instruction
{
+ // An array for marking instructions that may throw exceptions.
+ private static final boolean[] MAY_THROW_EXCEPTIONS = new boolean[]
+ {
+ false, // nop
+ false, // aconst_null
+ false, // iconst_m1
+ false, // iconst_0
+ false, // iconst_1
+ false, // iconst_2
+ false, // iconst_3
+ false, // iconst_4
+ false, // iconst_5
+ false, // lconst_0
+ false, // lconst_1
+ false, // fconst_0
+ false, // fconst_1
+ false, // fconst_2
+ false, // dconst_0
+ false, // dconst_1
+ false, // bipush
+ false, // sipush
+ false, // ldc
+ false, // ldc_w
+ false, // ldc2_w
+ false, // iload
+ false, // lload
+ false, // fload
+ false, // dload
+ false, // aload
+ false, // iload_0
+ false, // iload_1
+ false, // iload_2
+ false, // iload_3
+ false, // lload_0
+ false, // lload_1
+ false, // lload_2
+ false, // lload_3
+ false, // fload_0
+ false, // fload_1
+ false, // fload_2
+ false, // fload_3
+ false, // dload_0
+ false, // dload_1
+ false, // dload_2
+ false, // dload_3
+ false, // aload_0
+ false, // aload_1
+ false, // aload_2
+ false, // aload_3
+ true, // iaload
+ true, // laload
+ true, // faload
+ true, // daload
+ true, // aaload
+ true, // baload
+ true, // caload
+ true, // saload
+ false, // istore
+ false, // lstore
+ false, // fstore
+ false, // dstore
+ false, // astore
+ false, // istore_0
+ false, // istore_1
+ false, // istore_2
+ false, // istore_3
+ false, // lstore_0
+ false, // lstore_1
+ false, // lstore_2
+ false, // lstore_3
+ false, // fstore_0
+ false, // fstore_1
+ false, // fstore_2
+ false, // fstore_3
+ false, // dstore_0
+ false, // dstore_1
+ false, // dstore_2
+ false, // dstore_3
+ false, // astore_0
+ false, // astore_1
+ false, // astore_2
+ false, // astore_3
+ true, // iastore
+ true, // lastore
+ true, // fastore
+ true, // dastore
+ true, // aastore
+ true, // bastore
+ true, // castore
+ true, // sastore
+ false, // pop
+ false, // pop2
+ false, // dup
+ false, // dup_x1
+ false, // dup_x2
+ false, // dup2
+ false, // dup2_x1
+ false, // dup2_x2
+ false, // swap
+ false, // iadd
+ false, // ladd
+ false, // fadd
+ false, // dadd
+ false, // isub
+ false, // lsub
+ false, // fsub
+ false, // dsub
+ false, // imul
+ false, // lmul
+ false, // fmul
+ false, // dmul
+ true, // idiv
+ true, // ldiv
+ false, // fdiv
+ false, // ddiv
+ true, // irem
+ true, // lrem
+ false, // frem
+ false, // drem
+ false, // ineg
+ false, // lneg
+ false, // fneg
+ false, // dneg
+ false, // ishl
+ false, // lshl
+ false, // ishr
+ false, // lshr
+ false, // iushr
+ false, // lushr
+ false, // iand
+ false, // land
+ false, // ior
+ false, // lor
+ false, // ixor
+ false, // lxor
+ false, // iinc
+ false, // i2l
+ false, // i2f
+ false, // i2d
+ false, // l2i
+ false, // l2f
+ false, // l2d
+ false, // f2i
+ false, // f2l
+ false, // f2d
+ false, // d2i
+ false, // d2l
+ false, // d2f
+ false, // i2b
+ false, // i2c
+ false, // i2s
+ false, // lcmp
+ false, // fcmpl
+ false, // fcmpg
+ false, // dcmpl
+ false, // dcmpg
+ false, // ifeq
+ false, // ifne
+ false, // iflt
+ false, // ifge
+ false, // ifgt
+ false, // ifle
+ false, // ificmpeq
+ false, // ificmpne
+ false, // ificmplt
+ false, // ificmpge
+ false, // ificmpgt
+ false, // ificmple
+ false, // ifacmpeq
+ false, // ifacmpne
+ false, // goto
+ false, // jsr
+ false, // ret
+ false, // tableswitch
+ false, // lookupswitch
+ false, // ireturn
+ false, // lreturn
+ false, // freturn
+ false, // dreturn
+ false, // areturn
+ false, // return
+ true, // getstatic
+ true, // putstatic
+ true, // getfield
+ true, // putfield
+ true, // invokevirtual
+ true, // invokespecial
+ true, // invokestatic
+ true, // invokeinterface
+ true, // invokedynamic
+ true, // new
+ true, // newarray
+ true, // anewarray
+ true, // arraylength
+ true, // athrow
+ true, // checkcast
+ false, // instanceof
+ true, // monitorenter
+ true, // monitorexit
+ false, // wide
+ true, // multianewarray
+ false, // ifnull
+ false, // ifnonnull
+ false, // goto_w
+ false, // jsr_w
+ };
+
+
// An array for marking Category 2 instructions.
private static final boolean[] IS_CATEGORY2 = new boolean[]
{
@@ -759,6 +967,15 @@ public abstract class Instruction
/**
+ * Returns whether the instruction may throw exceptions.
+ */
+ public boolean mayThrowExceptions()
+ {
+ return MAY_THROW_EXCEPTIONS[opcode & 0xff];
+ }
+
+
+ /**
* Returns whether the instruction is a Category 2 instruction. This means
* that it operates on long or double arguments.
*/
diff --git a/src/proguard/classfile/instruction/InstructionConstants.java b/src/proguard/classfile/instruction/InstructionConstants.java
index d8cbd98..0cc1928 100644
--- a/src/proguard/classfile/instruction/InstructionConstants.java
+++ b/src/proguard/classfile/instruction/InstructionConstants.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/InstructionFactory.java b/src/proguard/classfile/instruction/InstructionFactory.java
index 89d498c..6e08141 100644
--- a/src/proguard/classfile/instruction/InstructionFactory.java
+++ b/src/proguard/classfile/instruction/InstructionFactory.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/InstructionUtil.java b/src/proguard/classfile/instruction/InstructionUtil.java
index c6ae99b..f7d8888 100644
--- a/src/proguard/classfile/instruction/InstructionUtil.java
+++ b/src/proguard/classfile/instruction/InstructionUtil.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -40,27 +40,27 @@ public class InstructionUtil
* <code>InstructionConstants.ARRAY_T_LONG</code>,
* <code>InstructionConstants.ARRAY_T_FLOAT</code>, or
* <code>InstructionConstants.ARRAY_T_DOUBLE</code>.
- * @return <code>ClassConstants.INTERNAL_TYPE_BOOLEAN</code>,
- * <code>ClassConstants.INTERNAL_TYPE_BYTE</code>,
- * <code>ClassConstants.INTERNAL_TYPE_CHAR</code>,
- * <code>ClassConstants.INTERNAL_TYPE_SHORT</code>,
- * <code>ClassConstants.INTERNAL_TYPE_INT</code>,
- * <code>ClassConstants.INTERNAL_TYPE_LONG</code>,
- * <code>ClassConstants.INTERNAL_TYPE_FLOAT</code>, or
- * <code>ClassConstants.INTERNAL_TYPE_DOUBLE</code>.
+ * @return <code>ClassConstants.TYPE_BOOLEAN</code>,
+ * <code>ClassConstants.TYPE_BYTE</code>,
+ * <code>ClassConstants.TYPE_CHAR</code>,
+ * <code>ClassConstants.TYPE_SHORT</code>,
+ * <code>ClassConstants.TYPE_INT</code>,
+ * <code>ClassConstants.TYPE_LONG</code>,
+ * <code>ClassConstants.TYPE_FLOAT</code>, or
+ * <code>ClassConstants.TYPE_DOUBLE</code>.
*/
public static char internalTypeFromArrayType(byte arrayType)
{
switch (arrayType)
{
- case InstructionConstants.ARRAY_T_BOOLEAN: return ClassConstants.INTERNAL_TYPE_BOOLEAN;
- case InstructionConstants.ARRAY_T_CHAR: return ClassConstants.INTERNAL_TYPE_CHAR;
- case InstructionConstants.ARRAY_T_FLOAT: return ClassConstants.INTERNAL_TYPE_FLOAT;
- case InstructionConstants.ARRAY_T_DOUBLE: return ClassConstants.INTERNAL_TYPE_DOUBLE;
- case InstructionConstants.ARRAY_T_BYTE: return ClassConstants.INTERNAL_TYPE_BYTE;
- case InstructionConstants.ARRAY_T_SHORT: return ClassConstants.INTERNAL_TYPE_SHORT;
- case InstructionConstants.ARRAY_T_INT: return ClassConstants.INTERNAL_TYPE_INT;
- case InstructionConstants.ARRAY_T_LONG: return ClassConstants.INTERNAL_TYPE_LONG;
+ case InstructionConstants.ARRAY_T_BOOLEAN: return ClassConstants.TYPE_BOOLEAN;
+ case InstructionConstants.ARRAY_T_CHAR: return ClassConstants.TYPE_CHAR;
+ case InstructionConstants.ARRAY_T_FLOAT: return ClassConstants.TYPE_FLOAT;
+ case InstructionConstants.ARRAY_T_DOUBLE: return ClassConstants.TYPE_DOUBLE;
+ case InstructionConstants.ARRAY_T_BYTE: return ClassConstants.TYPE_BYTE;
+ case InstructionConstants.ARRAY_T_SHORT: return ClassConstants.TYPE_SHORT;
+ case InstructionConstants.ARRAY_T_INT: return ClassConstants.TYPE_INT;
+ case InstructionConstants.ARRAY_T_LONG: return ClassConstants.TYPE_LONG;
default: throw new IllegalArgumentException("Unknown array type ["+arrayType+"]");
}
}
diff --git a/src/proguard/classfile/instruction/LookUpSwitchInstruction.java b/src/proguard/classfile/instruction/LookUpSwitchInstruction.java
index 807c0cc..fa18f3d 100644
--- a/src/proguard/classfile/instruction/LookUpSwitchInstruction.java
+++ b/src/proguard/classfile/instruction/LookUpSwitchInstruction.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/SimpleInstruction.java b/src/proguard/classfile/instruction/SimpleInstruction.java
index c9a2957..aecb56c 100644
--- a/src/proguard/classfile/instruction/SimpleInstruction.java
+++ b/src/proguard/classfile/instruction/SimpleInstruction.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/SwitchInstruction.java b/src/proguard/classfile/instruction/SwitchInstruction.java
index 3706ba0..c4a0f9a 100644
--- a/src/proguard/classfile/instruction/SwitchInstruction.java
+++ b/src/proguard/classfile/instruction/SwitchInstruction.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/TableSwitchInstruction.java b/src/proguard/classfile/instruction/TableSwitchInstruction.java
index 45490e5..6abff8f 100644
--- a/src/proguard/classfile/instruction/TableSwitchInstruction.java
+++ b/src/proguard/classfile/instruction/TableSwitchInstruction.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/VariableInstruction.java b/src/proguard/classfile/instruction/VariableInstruction.java
index 6390e0a..1574240 100644
--- a/src/proguard/classfile/instruction/VariableInstruction.java
+++ b/src/proguard/classfile/instruction/VariableInstruction.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/visitor/AllInstructionVisitor.java b/src/proguard/classfile/instruction/visitor/AllInstructionVisitor.java
index 4d739c2..5b606cd 100644
--- a/src/proguard/classfile/instruction/visitor/AllInstructionVisitor.java
+++ b/src/proguard/classfile/instruction/visitor/AllInstructionVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/visitor/InstructionConstantVisitor.java b/src/proguard/classfile/instruction/visitor/InstructionConstantVisitor.java
index 6b24e98..bdc0ac5 100644
--- a/src/proguard/classfile/instruction/visitor/InstructionConstantVisitor.java
+++ b/src/proguard/classfile/instruction/visitor/InstructionConstantVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -22,10 +22,8 @@ package proguard.classfile.instruction.visitor;
import proguard.classfile.*;
import proguard.classfile.attribute.CodeAttribute;
-import proguard.classfile.constant.ClassConstant;
import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.instruction.*;
-import proguard.classfile.instruction.visitor.InstructionVisitor;
import proguard.classfile.util.SimplifiedVisitor;
/**
diff --git a/src/proguard/classfile/instruction/visitor/InstructionCounter.java b/src/proguard/classfile/instruction/visitor/InstructionCounter.java
index 5623498..6d2609d 100644
--- a/src/proguard/classfile/instruction/visitor/InstructionCounter.java
+++ b/src/proguard/classfile/instruction/visitor/InstructionCounter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/visitor/InstructionVisitor.java b/src/proguard/classfile/instruction/visitor/InstructionVisitor.java
index cffb15e..a200f9f 100644
--- a/src/proguard/classfile/instruction/visitor/InstructionVisitor.java
+++ b/src/proguard/classfile/instruction/visitor/InstructionVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/instruction/visitor/MultiInstructionVisitor.java b/src/proguard/classfile/instruction/visitor/MultiInstructionVisitor.java
index 444fd57..7d2eb0b 100644
--- a/src/proguard/classfile/instruction/visitor/MultiInstructionVisitor.java
+++ b/src/proguard/classfile/instruction/visitor/MultiInstructionVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/io/LibraryClassReader.java b/src/proguard/classfile/io/LibraryClassReader.java
index d1eab3e..a9a4e8e 100644
--- a/src/proguard/classfile/io/LibraryClassReader.java
+++ b/src/proguard/classfile/io/LibraryClassReader.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -355,7 +355,7 @@ implements ClassVisitor,
case ClassConstants.CONSTANT_Methodref: return new MethodrefConstant();
case ClassConstants.CONSTANT_InterfaceMethodref: return new InterfaceMethodrefConstant();
case ClassConstants.CONSTANT_Class: return new ClassConstant();
- case ClassConstants.CONSTANT_MethodType : return new MethodTypeConstant();
+ case ClassConstants.CONSTANT_MethodType: return new MethodTypeConstant();
case ClassConstants.CONSTANT_NameAndType: return new NameAndTypeConstant();
default: throw new RuntimeException("Unknown constant type ["+u1tag+"] in constant pool");
diff --git a/src/proguard/classfile/io/ProgramClassReader.java b/src/proguard/classfile/io/ProgramClassReader.java
index 80a38f7..d6a8c36 100644
--- a/src/proguard/classfile/io/ProgramClassReader.java
+++ b/src/proguard/classfile/io/ProgramClassReader.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -23,6 +23,8 @@ package proguard.classfile.io;
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.*;
@@ -52,9 +54,14 @@ implements ClassVisitor,
StackMapFrameVisitor,
VerificationTypeVisitor,
LineNumberInfoVisitor,
+ ParameterInfoVisitor,
LocalVariableInfoVisitor,
LocalVariableTypeInfoVisitor,
AnnotationVisitor,
+ TypeAnnotationVisitor,
+ TargetInfoVisitor,
+ TypePathInfoVisitor,
+ LocalVariableTargetElementVisitor,
ElementValueVisitor
{
private final RuntimeDataInput dataInput;
@@ -375,6 +382,21 @@ implements ClassVisitor,
}
+ public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute)
+ {
+ // Read the parameter information.
+ methodParametersAttribute.u1parametersCount = dataInput.readUnsignedByte();
+
+ methodParametersAttribute.parameters = new ParameterInfo[methodParametersAttribute.u1parametersCount];
+ for (int index = 0; index < methodParametersAttribute.u1parametersCount; index++)
+ {
+ ParameterInfo parameterInfo = new ParameterInfo();
+ visitParameterInfo(clazz, method, index, parameterInfo);
+ methodParametersAttribute.parameters[index] = parameterInfo;
+ }
+ }
+
+
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
// Read the exceptions.
@@ -518,23 +540,23 @@ implements ClassVisitor,
public void visitAnyParameterAnnotationsAttribute(Clazz clazz, Method method, ParameterAnnotationsAttribute parameterAnnotationsAttribute)
{
// Read the parameter annotations.
- parameterAnnotationsAttribute.u2parametersCount = dataInput.readUnsignedByte();
+ parameterAnnotationsAttribute.u1parametersCount = dataInput.readUnsignedByte();
// The java compilers of JDK 1.5, JDK 1.6, and Eclipse all count the
// number of parameters of constructors of non-static inner classes
// incorrectly. Fix it right here.
int parameterStart = 0;
- if (method.getName(clazz).equals(ClassConstants.INTERNAL_METHOD_NAME_INIT))
+ if (method.getName(clazz).equals(ClassConstants.METHOD_NAME_INIT))
{
int realParametersCount = ClassUtil.internalMethodParameterCount(method.getDescriptor(clazz));
- parameterStart = realParametersCount - parameterAnnotationsAttribute.u2parametersCount;
- parameterAnnotationsAttribute.u2parametersCount = realParametersCount;
+ parameterStart = realParametersCount - parameterAnnotationsAttribute.u1parametersCount;
+ parameterAnnotationsAttribute.u1parametersCount = realParametersCount;
}
- parameterAnnotationsAttribute.u2parameterAnnotationsCount = new int[parameterAnnotationsAttribute.u2parametersCount];
- parameterAnnotationsAttribute.parameterAnnotations = new Annotation[parameterAnnotationsAttribute.u2parametersCount][];
+ parameterAnnotationsAttribute.u2parameterAnnotationsCount = new int[parameterAnnotationsAttribute.u1parametersCount];
+ parameterAnnotationsAttribute.parameterAnnotations = new Annotation[parameterAnnotationsAttribute.u1parametersCount][];
- for (int parameterIndex = parameterStart; parameterIndex < parameterAnnotationsAttribute.u2parametersCount; parameterIndex++)
+ for (int parameterIndex = parameterStart; parameterIndex < parameterAnnotationsAttribute.u1parametersCount; parameterIndex++)
{
// Read the parameter annotations of the given parameter.
int u2annotationsCount = dataInput.readUnsignedShort();
@@ -554,6 +576,21 @@ implements ClassVisitor,
}
+ public void visitAnyTypeAnnotationsAttribute(Clazz clazz, TypeAnnotationsAttribute typeAnnotationsAttribute)
+ {
+ // Read the type annotations.
+ typeAnnotationsAttribute.u2annotationsCount = dataInput.readUnsignedShort();
+
+ typeAnnotationsAttribute.annotations = new TypeAnnotation[typeAnnotationsAttribute.u2annotationsCount];
+ for (int index = 0; index < typeAnnotationsAttribute.u2annotationsCount; index++)
+ {
+ TypeAnnotation typeAnnotation = new TypeAnnotation();
+ visitTypeAnnotation(clazz, typeAnnotation);
+ typeAnnotationsAttribute.annotations[index] = typeAnnotation;
+ }
+ }
+
+
public void visitAnnotationDefaultAttribute(Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute)
{
// Read the default element value.
@@ -702,6 +739,15 @@ implements ClassVisitor,
}
+ // Implementations for ParameterInfoVisitor.
+
+ public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo)
+ {
+ parameterInfo.u2nameIndex = dataInput.readUnsignedShort();
+ parameterInfo.u2accessFlags = dataInput.readUnsignedShort();
+ }
+
+
// Implementations for LocalVariableInfoVisitor.
public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
@@ -748,6 +794,122 @@ implements ClassVisitor,
}
+ // Implementations for TypeAnnotationVisitor.
+
+ public void visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation)
+ {
+ // Read the target info.
+ TargetInfo targetInfo = createTargetInfo();
+ targetInfo.accept(clazz, typeAnnotation, this);
+ typeAnnotation.targetInfo = targetInfo;
+
+ // Read the type path.
+ int u1pathLength = dataInput.readUnsignedByte();
+
+ typeAnnotation.typePath = new TypePathInfo[u1pathLength];
+ for (int index = 0; index < u1pathLength; index++)
+ {
+ TypePathInfo typePathInfo = new TypePathInfo();
+ visitTypePathInfo(clazz, typeAnnotation, typePathInfo);
+ typeAnnotation.typePath[index] = typePathInfo;
+ }
+
+ // Read the actual annotation.
+ visitAnnotation(clazz, typeAnnotation);
+ }
+
+
+ // Implementations for TargetInfoVisitor.
+
+ public void visitTypeParameterTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterTargetInfo typeParameterTargetInfo)
+ {
+ typeParameterTargetInfo.u1typeParameterIndex = dataInput.readUnsignedByte();
+ }
+
+
+ public void visitSuperTypeTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, SuperTypeTargetInfo superTypeTargetInfo)
+ {
+ superTypeTargetInfo.u2superTypeIndex = dataInput.readUnsignedShort();
+ }
+
+
+ public void visitTypeParameterBoundTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo)
+ {
+ typeParameterBoundTargetInfo.u1typeParameterIndex = dataInput.readUnsignedByte();
+ typeParameterBoundTargetInfo.u1boundIndex = dataInput.readUnsignedByte();
+ }
+
+
+ public void visitEmptyTargetInfo(Clazz clazz, Member member, TypeAnnotation typeAnnotation, EmptyTargetInfo emptyTargetInfo)
+ {
+ }
+
+
+ public void visitFormalParameterTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, FormalParameterTargetInfo formalParameterTargetInfo)
+ {
+ formalParameterTargetInfo.u1formalParameterIndex = dataInput.readUnsignedByte();
+ }
+
+
+ public void visitThrowsTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, ThrowsTargetInfo throwsTargetInfo)
+ {
+ throwsTargetInfo.u2throwsTypeIndex = dataInput.readUnsignedShort();
+ }
+
+
+ public void visitLocalVariableTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo)
+ {
+ // Read the local variable target elements.
+ localVariableTargetInfo.u2tableLength = dataInput.readUnsignedShort();
+
+ localVariableTargetInfo.table = new LocalVariableTargetElement[localVariableTargetInfo.u2tableLength];
+ for (int index = 0; index < localVariableTargetInfo.u2tableLength; index++)
+ {
+ LocalVariableTargetElement element = new LocalVariableTargetElement();
+ visitLocalVariableTargetElement(clazz, method, codeAttribute, typeAnnotation, localVariableTargetInfo, element);
+ localVariableTargetInfo.table[index] = element;
+ }
+ }
+
+
+ public void visitCatchTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, CatchTargetInfo catchTargetInfo)
+ {
+ catchTargetInfo.u2exceptionTableIndex = dataInput.readUnsignedShort();
+ }
+
+
+ public void visitOffsetTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, OffsetTargetInfo offsetTargetInfo)
+ {
+ offsetTargetInfo.u2offset = dataInput.readUnsignedShort();
+ }
+
+
+ public void visitTypeArgumentTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TypeArgumentTargetInfo typeArgumentTargetInfo)
+ {
+ typeArgumentTargetInfo.u2offset = dataInput.readUnsignedShort();
+ typeArgumentTargetInfo.u1typeArgumentIndex = dataInput.readUnsignedByte();
+ }
+
+
+ // Implementations for TypePathInfoVisitor.
+
+ public void visitTypePathInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo)
+ {
+ typePathInfo.u1typePathKind = dataInput.readUnsignedByte();
+ typePathInfo.u1typeArgumentIndex = dataInput.readUnsignedByte();
+ }
+
+
+ // Implementations for LocalVariableTargetElementVisitor.
+
+ public void visitLocalVariableTargetElement(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo, LocalVariableTargetElement localVariableTargetElement)
+ {
+ localVariableTargetElement.u2startPC = dataInput.readShort();
+ localVariableTargetElement.u2length = dataInput.readShort();
+ localVariableTargetElement.u2index = dataInput.readShort();
+ }
+
+
// Implementations for ElementValueVisitor.
public void visitConstantElementValue(Clazz clazz, Annotation annotation, ConstantElementValue constantElementValue)
@@ -813,7 +975,7 @@ implements ClassVisitor,
case ClassConstants.CONSTANT_Methodref: return new MethodrefConstant();
case ClassConstants.CONSTANT_InterfaceMethodref: return new InterfaceMethodrefConstant();
case ClassConstants.CONSTANT_Class: return new ClassConstant();
- case ClassConstants.CONSTANT_MethodType : return new MethodTypeConstant();
+ case ClassConstants.CONSTANT_MethodType: return new MethodTypeConstant();
case ClassConstants.CONSTANT_NameAndType: return new NameAndTypeConstant();
default: throw new RuntimeException("Unknown constant type ["+u1tag+"] in constant pool");
@@ -837,6 +999,7 @@ implements ClassVisitor,
attributeName.equals(ClassConstants.ATTR_Synthetic) ? (Attribute)new SyntheticAttribute():
attributeName.equals(ClassConstants.ATTR_Signature) ? (Attribute)new SignatureAttribute():
attributeName.equals(ClassConstants.ATTR_ConstantValue) ? (Attribute)new ConstantValueAttribute():
+ attributeName.equals(ClassConstants.ATTR_MethodParameters) ? (Attribute)new MethodParametersAttribute():
attributeName.equals(ClassConstants.ATTR_Exceptions) ? (Attribute)new ExceptionsAttribute():
attributeName.equals(ClassConstants.ATTR_Code) ? (Attribute)new CodeAttribute():
attributeName.equals(ClassConstants.ATTR_StackMap) ? (Attribute)new StackMapAttribute():
@@ -848,8 +1011,10 @@ implements ClassVisitor,
attributeName.equals(ClassConstants.ATTR_RuntimeInvisibleAnnotations) ? (Attribute)new RuntimeInvisibleAnnotationsAttribute():
attributeName.equals(ClassConstants.ATTR_RuntimeVisibleParameterAnnotations) ? (Attribute)new RuntimeVisibleParameterAnnotationsAttribute():
attributeName.equals(ClassConstants.ATTR_RuntimeInvisibleParameterAnnotations) ? (Attribute)new RuntimeInvisibleParameterAnnotationsAttribute():
+ attributeName.equals(ClassConstants.ATTR_RuntimeVisibleTypeAnnotations) ? (Attribute)new RuntimeVisibleTypeAnnotationsAttribute():
+ attributeName.equals(ClassConstants.ATTR_RuntimeInvisibleTypeAnnotations) ? (Attribute)new RuntimeInvisibleTypeAnnotationsAttribute():
attributeName.equals(ClassConstants.ATTR_AnnotationDefault) ? (Attribute)new AnnotationDefaultAttribute():
- (Attribute)new UnknownAttribute(u4attributeLength);
+ (Attribute)new UnknownAttribute(u2attributeNameIndex, u4attributeLength);
attribute.u2attributeNameIndex = u2attributeNameIndex;
return attribute;
@@ -892,20 +1057,54 @@ implements ClassVisitor,
}
+ private TargetInfo createTargetInfo()
+ {
+ byte u1targetType = dataInput.readByte();
+
+ switch (u1targetType)
+ {
+ case ClassConstants.ANNOTATION_TARGET_ParameterGenericClass:
+ case ClassConstants.ANNOTATION_TARGET_ParameterGenericMethod: return new TypeParameterTargetInfo(u1targetType);
+ case ClassConstants.ANNOTATION_TARGET_Extends: return new SuperTypeTargetInfo(u1targetType);
+ case ClassConstants.ANNOTATION_TARGET_BoundGenericClass:
+ case ClassConstants.ANNOTATION_TARGET_BoundGenericMethod: return new TypeParameterBoundTargetInfo(u1targetType);
+ case ClassConstants.ANNOTATION_TARGET_Field:
+ case ClassConstants.ANNOTATION_TARGET_Return:
+ case ClassConstants.ANNOTATION_TARGET_Receiver: return new EmptyTargetInfo(u1targetType);
+ case ClassConstants.ANNOTATION_TARGET_Parameter: return new FormalParameterTargetInfo(u1targetType);
+ case ClassConstants.ANNOTATION_TARGET_Throws: return new ThrowsTargetInfo(u1targetType);
+ case ClassConstants.ANNOTATION_TARGET_LocalVariable:
+ case ClassConstants.ANNOTATION_TARGET_ResourceVariable: return new LocalVariableTargetInfo(u1targetType);
+ case ClassConstants.ANNOTATION_TARGET_Catch: return new CatchTargetInfo(u1targetType);
+ case ClassConstants.ANNOTATION_TARGET_InstanceOf:
+ case ClassConstants.ANNOTATION_TARGET_New:
+ case ClassConstants.ANNOTATION_TARGET_MethodReferenceNew:
+ case ClassConstants.ANNOTATION_TARGET_MethodReference: return new OffsetTargetInfo(u1targetType);
+ case ClassConstants.ANNOTATION_TARGET_Cast:
+ case ClassConstants.ANNOTATION_TARGET_ArgumentGenericMethodNew:
+ case ClassConstants.ANNOTATION_TARGET_ArgumentGenericMethod:
+ case ClassConstants.ANNOTATION_TARGET_ArgumentGenericMethodReferenceNew:
+ case ClassConstants.ANNOTATION_TARGET_ArgumentGenericMethodReference: return new TypeArgumentTargetInfo(u1targetType);
+
+ default: throw new RuntimeException("Unknown annotation target type ["+u1targetType+"]");
+ }
+ }
+
+
private ElementValue createElementValue()
{
int u1tag = dataInput.readUnsignedByte();
switch (u1tag)
{
- case ClassConstants.INTERNAL_TYPE_BOOLEAN:
- case ClassConstants.INTERNAL_TYPE_BYTE:
- case ClassConstants.INTERNAL_TYPE_CHAR:
- case ClassConstants.INTERNAL_TYPE_SHORT:
- case ClassConstants.INTERNAL_TYPE_INT:
- case ClassConstants.INTERNAL_TYPE_FLOAT:
- case ClassConstants.INTERNAL_TYPE_LONG:
- case ClassConstants.INTERNAL_TYPE_DOUBLE:
+ case ClassConstants.TYPE_BOOLEAN:
+ case ClassConstants.TYPE_BYTE:
+ case ClassConstants.TYPE_CHAR:
+ case ClassConstants.TYPE_SHORT:
+ case ClassConstants.TYPE_INT:
+ case ClassConstants.TYPE_FLOAT:
+ case ClassConstants.TYPE_LONG:
+ case ClassConstants.TYPE_DOUBLE:
case ClassConstants.ELEMENT_VALUE_STRING_CONSTANT: return new ConstantElementValue((char)u1tag);
case ClassConstants.ELEMENT_VALUE_ENUM_CONSTANT: return new EnumConstantElementValue();
diff --git a/src/proguard/classfile/io/ProgramClassWriter.java b/src/proguard/classfile/io/ProgramClassWriter.java
index dbf1de3..bcc3403 100644
--- a/src/proguard/classfile/io/ProgramClassWriter.java
+++ b/src/proguard/classfile/io/ProgramClassWriter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -23,6 +23,8 @@ package proguard.classfile.io;
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.*;
@@ -289,9 +291,14 @@ implements ClassVisitor,
StackMapFrameVisitor,
VerificationTypeVisitor,
LineNumberInfoVisitor,
+ ParameterInfoVisitor,
LocalVariableInfoVisitor,
LocalVariableTypeInfoVisitor,
AnnotationVisitor,
+ TypeAnnotationVisitor,
+ TargetInfoVisitor,
+ TypePathInfoVisitor,
+ LocalVariableTargetElementVisitor,
ElementValueVisitor
{
// Implementations for AttributeVisitor.
@@ -364,6 +371,15 @@ implements ClassVisitor,
}
+ public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute)
+ {
+ // Write the parameter information.
+ dataOutput.writeByte(methodParametersAttribute.u1parametersCount);
+
+ methodParametersAttribute.parametersAccept(clazz, method, this);
+ }
+
+
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
// Write the exceptions.
@@ -456,9 +472,9 @@ implements ClassVisitor,
public void visitAnyParameterAnnotationsAttribute(Clazz clazz, Method method, ParameterAnnotationsAttribute parameterAnnotationsAttribute)
{
// Write the parameter annotations.
- dataOutput.writeByte(parameterAnnotationsAttribute.u2parametersCount);
+ dataOutput.writeByte(parameterAnnotationsAttribute.u1parametersCount);
- for (int parameterIndex = 0; parameterIndex < parameterAnnotationsAttribute.u2parametersCount; parameterIndex++)
+ for (int parameterIndex = 0; parameterIndex < parameterAnnotationsAttribute.u1parametersCount; parameterIndex++)
{
// Write the parameter annotations of the given parameter.
int u2annotationsCount = parameterAnnotationsAttribute.u2parameterAnnotationsCount[parameterIndex];
@@ -475,6 +491,15 @@ implements ClassVisitor,
}
+ public void visitAnyTypeAnnotationsAttribute(Clazz clazz, TypeAnnotationsAttribute typeAnnotationsAttribute)
+ {
+ // Write the type annotations.
+ dataOutput.writeShort(typeAnnotationsAttribute.u2annotationsCount);
+
+ typeAnnotationsAttribute.typeAnnotationsAccept(clazz, this);
+ }
+
+
public void visitAnnotationDefaultAttribute(Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute)
{
// Write the default element value.
@@ -541,6 +566,15 @@ implements ClassVisitor,
}
+ // Implementations for ParameterInfoVisitor.
+
+ public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo)
+ {
+ dataOutput.writeShort(parameterInfo.u2nameIndex);
+ dataOutput.writeShort(parameterInfo.u2accessFlags);
+ }
+
+
// Implementations for LocalVariableInfoVisitor.
public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
@@ -579,6 +613,110 @@ implements ClassVisitor,
}
+ // Implementations for TypeAnnotationVisitor.
+
+ public void visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation)
+ {
+ // Write the target info.
+ dataOutput.writeByte(typeAnnotation.targetInfo.u1targetType);
+
+ typeAnnotation.targetInfoAccept(clazz, this);
+
+ // Write the type path.
+ dataOutput.writeByte(typeAnnotation.typePath.length);
+
+ typeAnnotation.typePathInfosAccept(clazz, this);
+
+ // Write the actual annotation.
+ visitAnnotation(clazz, typeAnnotation);
+ }
+
+
+ // Implementations for TargetInfoVisitor.
+
+ public void visitTypeParameterTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterTargetInfo typeParameterTargetInfo)
+ {
+ dataOutput.writeByte(typeParameterTargetInfo.u1typeParameterIndex);
+ }
+
+
+ public void visitSuperTypeTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, SuperTypeTargetInfo superTypeTargetInfo)
+ {
+ dataOutput.writeShort(superTypeTargetInfo.u2superTypeIndex);
+ }
+
+
+ public void visitTypeParameterBoundTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo)
+ {
+ dataOutput.writeByte(typeParameterBoundTargetInfo.u1typeParameterIndex);
+ dataOutput.writeByte(typeParameterBoundTargetInfo.u1boundIndex);
+ }
+
+
+ public void visitEmptyTargetInfo(Clazz clazz, Member member, TypeAnnotation typeAnnotation, EmptyTargetInfo emptyTargetInfo)
+ {
+ }
+
+
+ public void visitFormalParameterTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, FormalParameterTargetInfo formalParameterTargetInfo)
+ {
+ dataOutput.writeByte(formalParameterTargetInfo.u1formalParameterIndex);
+ }
+
+
+ public void visitThrowsTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, ThrowsTargetInfo throwsTargetInfo)
+ {
+ dataOutput.writeShort(throwsTargetInfo.u2throwsTypeIndex);
+ }
+
+
+ public void visitLocalVariableTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo)
+ {
+ // Write the local variable target elements.
+ dataOutput.writeShort(localVariableTargetInfo.u2tableLength);
+
+ localVariableTargetInfo.targetElementsAccept(clazz, method, codeAttribute, typeAnnotation, this);
+ }
+
+
+ public void visitCatchTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, CatchTargetInfo catchTargetInfo)
+ {
+ dataOutput.writeShort(catchTargetInfo.u2exceptionTableIndex);
+ }
+
+
+ public void visitOffsetTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, OffsetTargetInfo offsetTargetInfo)
+ {
+ dataOutput.writeShort(offsetTargetInfo.u2offset);
+ }
+
+
+ public void visitTypeArgumentTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TypeArgumentTargetInfo typeArgumentTargetInfo)
+ {
+ dataOutput.writeShort(typeArgumentTargetInfo.u2offset);
+ dataOutput.writeByte(typeArgumentTargetInfo.u1typeArgumentIndex);
+ }
+
+
+ // Implementations for TypePathInfoVisitor.
+
+ public void visitTypePathInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo)
+ {
+ dataOutput.writeByte(typePathInfo.u1typePathKind);
+ dataOutput.writeByte(typePathInfo.u1typeArgumentIndex);
+ }
+
+
+ // Implementations for LocalVariableTargetElementVisitor.
+
+ public void visitLocalVariableTargetElement(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo, LocalVariableTargetElement localVariableTargetElement)
+ {
+ dataOutput.writeShort(localVariableTargetElement.u2startPC);
+ dataOutput.writeShort(localVariableTargetElement.u2length);
+ dataOutput.writeShort(localVariableTargetElement.u2index);
+ }
+
+
// Implementations for ElementValueVisitor.
public void visitAnyElementValue(Clazz clazz, Annotation annotation, ElementValue elementValue)
diff --git a/src/proguard/classfile/io/RuntimeDataInput.java b/src/proguard/classfile/io/RuntimeDataInput.java
index ce2d1a5..905d828 100644
--- a/src/proguard/classfile/io/RuntimeDataInput.java
+++ b/src/proguard/classfile/io/RuntimeDataInput.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/io/RuntimeDataOutput.java b/src/proguard/classfile/io/RuntimeDataOutput.java
index 44acc70..9d89332 100644
--- a/src/proguard/classfile/io/RuntimeDataOutput.java
+++ b/src/proguard/classfile/io/RuntimeDataOutput.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/util/AccessUtil.java b/src/proguard/classfile/util/AccessUtil.java
index d16f576..97fda89 100644
--- a/src/proguard/classfile/util/AccessUtil.java
+++ b/src/proguard/classfile/util/AccessUtil.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -40,9 +40,9 @@ public class AccessUtil
// The mask of access flags.
private static final int ACCESS_MASK =
- ClassConstants.INTERNAL_ACC_PUBLIC |
- ClassConstants.INTERNAL_ACC_PRIVATE |
- ClassConstants.INTERNAL_ACC_PROTECTED;
+ ClassConstants.ACC_PUBLIC |
+ ClassConstants.ACC_PRIVATE |
+ ClassConstants.ACC_PROTECTED;
/**
@@ -56,10 +56,10 @@ public class AccessUtil
{
switch (accessFlags & ACCESS_MASK)
{
- case ClassConstants.INTERNAL_ACC_PRIVATE: return PRIVATE;
- default: return PACKAGE_VISIBLE;
- case ClassConstants.INTERNAL_ACC_PROTECTED: return PROTECTED;
- case ClassConstants.INTERNAL_ACC_PUBLIC: return PUBLIC;
+ case ClassConstants.ACC_PRIVATE: return PRIVATE;
+ default: return PACKAGE_VISIBLE;
+ case ClassConstants.ACC_PROTECTED: return PROTECTED;
+ case ClassConstants.ACC_PUBLIC: return PUBLIC;
}
}
@@ -78,10 +78,10 @@ public class AccessUtil
{
switch (accessLevel)
{
- case PRIVATE: return ClassConstants.INTERNAL_ACC_PRIVATE;
+ case PRIVATE: return ClassConstants.ACC_PRIVATE;
default: return 0;
- case PROTECTED: return ClassConstants.INTERNAL_ACC_PROTECTED;
- case PUBLIC: return ClassConstants.INTERNAL_ACC_PUBLIC;
+ case PROTECTED: return ClassConstants.ACC_PROTECTED;
+ case PUBLIC: return ClassConstants.ACC_PUBLIC;
}
}
@@ -94,9 +94,9 @@ public class AccessUtil
public static int replaceAccessFlags(int accessFlags, int newAccessFlags)
{
// A private class member should not be explicitly final.
- if (newAccessFlags == ClassConstants.INTERNAL_ACC_PRIVATE)
+ if (newAccessFlags == ClassConstants.ACC_PRIVATE)
{
- accessFlags &= ~ClassConstants.INTERNAL_ACC_FINAL;
+ accessFlags &= ~ClassConstants.ACC_FINAL;
}
return (accessFlags & ~ACCESS_MASK) |
diff --git a/src/proguard/classfile/util/AllParameterVisitor.java b/src/proguard/classfile/util/AllParameterVisitor.java
new file mode 100644
index 0000000..3695dbb
--- /dev/null
+++ b/src/proguard/classfile/util/AllParameterVisitor.java
@@ -0,0 +1,239 @@
+/*
+ * 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.util;
+
+import proguard.classfile.*;
+import proguard.classfile.visitor.*;
+
+/**
+ * This MemberVisitor lets a given parameter visitor visit all the parameters
+ * of the methods that it visits. The parameters do not include or count the
+ * 'this' parameter or the return value.
+ *
+ * @author Eric Lafortune
+ */
+public class AllParameterVisitor
+implements MemberVisitor
+{
+ private final ParameterVisitor parameterVisitor;
+
+
+ /**
+ * Creates a new AllParameterVisitor for the given parameter
+ * visitor.
+ */
+ public AllParameterVisitor(ParameterVisitor parameterVisitor)
+ {
+ this.parameterVisitor = parameterVisitor;
+ }
+
+
+ // Implementations for MemberVisitor.
+
+ public void visitProgramField(ProgramClass programClass, ProgramField programField)
+ {
+ visitFieldType(programClass,
+ programField,
+ programField.referencedClass);
+ }
+
+
+ public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
+ {
+ visitFieldType(libraryClass,
+ libraryField,
+ libraryField.referencedClass);
+ }
+
+
+ public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
+ {
+ visitParameters(programClass,
+ programMethod,
+ programMethod.referencedClasses);
+ }
+
+
+ public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
+ {
+ visitParameters(libraryClass,
+ libraryMethod,
+ libraryMethod.referencedClasses);
+ }
+
+
+ // Small utility methods.
+
+ /**
+ * Lets the parameter visitor visit the type of the given field.
+ */
+ private void visitFieldType(Clazz clazz,
+ Field field,
+ Clazz referencedClass)
+ {
+ String descriptor = field.getDescriptor(clazz);
+ parameterVisitor.visitParameter(clazz,
+ field,
+ 0,
+ 1,
+ 0,
+ ClassUtil.internalTypeSize(descriptor),
+ descriptor,
+ referencedClass);
+ }
+
+
+ /**
+ * Lets the parameter visitor visit the parameters of the given method.
+ */
+ private void visitParameters(Clazz clazz,
+ Method method,
+ Clazz[] referencedClasses)
+ {
+ String descriptor = method.getDescriptor(clazz);
+
+ // Count the number of parameters and their total size.
+ int parameterCount = 0;
+ int parameterSize = 0;
+
+ int index = 1;
+
+ loop: while (true)
+ {
+ char c = descriptor.charAt(index++);
+ switch (c)
+ {
+ case ClassConstants.TYPE_LONG:
+ case ClassConstants.TYPE_DOUBLE:
+ {
+ // Long and double primitive types.
+ parameterSize++;
+ break;
+ }
+ default:
+ {
+ // All other primitive types.
+ break;
+ }
+ case ClassConstants.TYPE_CLASS_START:
+ {
+ // Class types.
+ // Skip the class name.
+ index = descriptor.indexOf(ClassConstants.TYPE_CLASS_END, index) + 1;
+ break;
+ }
+ case ClassConstants.TYPE_ARRAY:
+ {
+ // Array types.
+ // Skip all array characters.
+ while ((c = descriptor.charAt(index++)) == ClassConstants.TYPE_ARRAY) {}
+
+ if (c == ClassConstants.TYPE_CLASS_START)
+ {
+ // Skip the class type.
+ index = descriptor.indexOf(ClassConstants.TYPE_CLASS_END, index) + 1;
+ }
+ break;
+ }
+ case ClassConstants.METHOD_ARGUMENTS_CLOSE:
+ {
+ break loop;
+ }
+ }
+
+ parameterCount++;
+ parameterSize++;
+ }
+
+ // Visit the parameters.
+ int parameterIndex = 0;
+ int parameterOffset = 0;
+ int referenceClassIndex = 0;
+
+ index = 1;
+
+ while (true)
+ {
+ int newIndex = index + 1;
+ int thisParameterSize = 1;
+ Clazz referencedClass = null;
+
+ char c = descriptor.charAt(index);
+ switch (c)
+ {
+ case ClassConstants.TYPE_LONG:
+ case ClassConstants.TYPE_DOUBLE:
+ {
+ // Long and double primitive types.
+ thisParameterSize = 2;
+ break;
+ }
+ default:
+ {
+ // All other primitive types.
+ break;
+ }
+ case ClassConstants.TYPE_CLASS_START:
+ {
+ // Class types.
+ // Skip the class name.
+ newIndex = descriptor.indexOf(ClassConstants.TYPE_CLASS_END, newIndex) + 1;
+ referencedClass = referencedClasses == null ? null :
+ referencedClasses[referenceClassIndex++];
+ break;
+ }
+ case ClassConstants.TYPE_ARRAY:
+ {
+ // Array types.
+ // Skip all array characters.
+ while ((c = descriptor.charAt(newIndex++)) == ClassConstants.TYPE_ARRAY) {}
+
+ if (c == ClassConstants.TYPE_CLASS_START)
+ {
+ // Skip the class type.
+ newIndex = descriptor.indexOf(ClassConstants.TYPE_CLASS_END, newIndex) + 1;
+ referencedClass = referencedClasses == null ? null :
+ referencedClasses[referenceClassIndex++];
+ }
+ break;
+ }
+ case ClassConstants.METHOD_ARGUMENTS_CLOSE:
+ {
+ // End of the method parameters.
+ return;
+ }
+ }
+
+ parameterVisitor.visitParameter(clazz,
+ method,
+ parameterIndex++,
+ parameterCount,
+ parameterOffset,
+ parameterSize,
+ descriptor.substring(index, newIndex),
+ referencedClass);
+
+ // Continue with the next parameter.
+ index = newIndex;
+ parameterOffset += thisParameterSize;
+ }
+ }
+}
diff --git a/src/proguard/classfile/util/ClassReferenceInitializer.java b/src/proguard/classfile/util/ClassReferenceInitializer.java
index a5748ee..3baf422 100644
--- a/src/proguard/classfile/util/ClassReferenceInitializer.java
+++ b/src/proguard/classfile/util/ClassReferenceInitializer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -165,7 +165,15 @@ implements ClassVisitor,
{
// Fill out the String class.
stringConstant.javaLangStringClass =
- findClass(clazz.getName(), ClassConstants.INTERNAL_NAME_JAVA_LANG_STRING);
+ findClass(clazz.getName(), ClassConstants.NAME_JAVA_LANG_STRING);
+ }
+
+
+ public void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant)
+ {
+ invokeDynamicConstant.referencedClasses =
+ findReferencedClasses(clazz.getName(),
+ invokeDynamicConstant.getType(clazz));
}
@@ -173,7 +181,7 @@ implements ClassVisitor,
{
// Fill out the MethodHandle class.
methodHandleConstant.javaLangInvokeMethodHandleClass =
- findClass(clazz.getName(), ClassConstants.INTERNAL_NAME_JAVA_LANG_INVOKE_METHOD_HANDLE);
+ findClass(clazz.getName(), ClassConstants.NAME_JAVA_LANG_INVOKE_METHOD_HANDLE);
}
@@ -184,7 +192,7 @@ implements ClassVisitor,
// Methods for array types should be found in the Object class.
if (ClassUtil.isInternalArrayType(className))
{
- className = ClassConstants.INTERNAL_NAME_JAVA_LANG_OBJECT;
+ className = ClassConstants.NAME_JAVA_LANG_OBJECT;
}
// See if we can find the referenced class.
@@ -246,7 +254,7 @@ implements ClassVisitor,
// Fill out the Class class.
classConstant.javaLangClassClass =
- findClass(className, ClassConstants.INTERNAL_NAME_JAVA_LANG_CLASS);
+ findClass(className, ClassConstants.NAME_JAVA_LANG_CLASS);
}
@@ -254,7 +262,11 @@ implements ClassVisitor,
{
// Fill out the MethodType class.
methodTypeConstant.javaLangInvokeMethodTypeClass =
- findClass(clazz.getName(), ClassConstants.INTERNAL_NAME_JAVA_LANG_INVOKE_METHOD_TYPE);
+ findClass(clazz.getName(), ClassConstants.NAME_JAVA_LANG_INVOKE_METHOD_TYPE);
+
+ methodTypeConstant.referencedClasses =
+ findReferencedClasses(clazz.getName(),
+ methodTypeConstant.getType(clazz));
}
@@ -327,7 +339,7 @@ implements ClassVisitor,
{
signatureAttribute.referencedClasses =
findReferencedClasses(clazz.getName(),
- clazz.getString(signatureAttribute.u2signatureIndex));
+ signatureAttribute.getSignature(clazz));
}
@@ -358,7 +370,7 @@ implements ClassVisitor,
{
localVariableInfo.referencedClass =
findReferencedClass(clazz.getName(),
- clazz.getString(localVariableInfo.u2descriptorIndex));
+ localVariableInfo.getDescriptor(clazz));
}
@@ -368,7 +380,7 @@ implements ClassVisitor,
{
localVariableTypeInfo.referencedClasses =
findReferencedClasses(clazz.getName(),
- clazz.getString(localVariableTypeInfo.u2signatureIndex));
+ localVariableTypeInfo.getSignature(clazz));
}
@@ -378,7 +390,7 @@ implements ClassVisitor,
{
annotation.referencedClasses =
findReferencedClasses(clazz.getName(),
- clazz.getString(annotation.u2typeIndex));
+ annotation.getType(clazz));
// Initialize the element values.
annotation.elementValuesAccept(clazz, this);
@@ -399,7 +411,7 @@ implements ClassVisitor,
enumConstantElementValue.referencedClasses =
findReferencedClasses(clazz.getName(),
- clazz.getString(enumConstantElementValue.u2typeNameIndex));
+ enumConstantElementValue.getTypeName(clazz));
}
@@ -409,7 +421,7 @@ implements ClassVisitor,
classElementValue.referencedClasses =
findReferencedClasses(clazz.getName(),
- clazz.getString(classElementValue.u2classInfoIndex));
+ classElementValue.getClassName(clazz));
}
@@ -443,7 +455,7 @@ implements ClassVisitor,
{
// See if we can find the method in the referenced class
// (ignoring the descriptor).
- String name = clazz.getString(elementValue.u2elementNameIndex);
+ String name = elementValue.getMethodName(clazz);
Clazz referencedClass = annotation.referencedClasses[0];
elementValue.referencedClass = referencedClass;
diff --git a/src/proguard/classfile/util/ClassSubHierarchyInitializer.java b/src/proguard/classfile/util/ClassSubHierarchyInitializer.java
index 993a559..8a0e45e 100644
--- a/src/proguard/classfile/util/ClassSubHierarchyInitializer.java
+++ b/src/proguard/classfile/util/ClassSubHierarchyInitializer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/util/ClassSuperHierarchyInitializer.java b/src/proguard/classfile/util/ClassSuperHierarchyInitializer.java
index fb431b8..1e765cb 100644
--- a/src/proguard/classfile/util/ClassSuperHierarchyInitializer.java
+++ b/src/proguard/classfile/util/ClassSuperHierarchyInitializer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/util/ClassUtil.java b/src/proguard/classfile/util/ClassUtil.java
index fb38616..037d31a 100644
--- a/src/proguard/classfile/util/ClassUtil.java
+++ b/src/proguard/classfile/util/ClassUtil.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,7 +20,7 @@
*/
package proguard.classfile.util;
-import proguard.classfile.ClassConstants;
+import proguard.classfile.*;
import java.util.List;
@@ -91,18 +91,20 @@ public class ClassUtil
public static int internalClassVersion(String classVersion)
{
return
- classVersion.equals(ClassConstants.EXTERNAL_CLASS_VERSION_1_0) ||
- classVersion.equals(ClassConstants.EXTERNAL_CLASS_VERSION_1_1) ? ClassConstants.INTERNAL_CLASS_VERSION_1_0 :
- classVersion.equals(ClassConstants.EXTERNAL_CLASS_VERSION_1_2) ? ClassConstants.INTERNAL_CLASS_VERSION_1_2 :
- classVersion.equals(ClassConstants.EXTERNAL_CLASS_VERSION_1_3) ? ClassConstants.INTERNAL_CLASS_VERSION_1_3 :
- classVersion.equals(ClassConstants.EXTERNAL_CLASS_VERSION_1_4) ? ClassConstants.INTERNAL_CLASS_VERSION_1_4 :
- classVersion.equals(ClassConstants.EXTERNAL_CLASS_VERSION_1_5_ALIAS) ||
- classVersion.equals(ClassConstants.EXTERNAL_CLASS_VERSION_1_5) ? ClassConstants.INTERNAL_CLASS_VERSION_1_5 :
- classVersion.equals(ClassConstants.EXTERNAL_CLASS_VERSION_1_6_ALIAS) ||
- classVersion.equals(ClassConstants.EXTERNAL_CLASS_VERSION_1_6) ? ClassConstants.INTERNAL_CLASS_VERSION_1_6 :
- classVersion.equals(ClassConstants.EXTERNAL_CLASS_VERSION_1_7_ALIAS) ||
- classVersion.equals(ClassConstants.EXTERNAL_CLASS_VERSION_1_7) ? ClassConstants.INTERNAL_CLASS_VERSION_1_7 :
- 0;
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_0) ||
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_1) ? ClassConstants.CLASS_VERSION_1_0 :
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_2) ? ClassConstants.CLASS_VERSION_1_2 :
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_3) ? ClassConstants.CLASS_VERSION_1_3 :
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_4) ? ClassConstants.CLASS_VERSION_1_4 :
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_5_ALIAS) ||
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_5) ? ClassConstants.CLASS_VERSION_1_5 :
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_6_ALIAS) ||
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_6) ? ClassConstants.CLASS_VERSION_1_6 :
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_7_ALIAS) ||
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_7) ? ClassConstants.CLASS_VERSION_1_7 :
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_8_ALIAS) ||
+ classVersion.equals(JavaConstants.CLASS_VERSION_1_8) ? ClassConstants.CLASS_VERSION_1_8 :
+ 0;
}
@@ -115,14 +117,15 @@ public class ClassUtil
{
switch (classVersion)
{
- case ClassConstants.INTERNAL_CLASS_VERSION_1_0: return ClassConstants.EXTERNAL_CLASS_VERSION_1_0;
- case ClassConstants.INTERNAL_CLASS_VERSION_1_2: return ClassConstants.EXTERNAL_CLASS_VERSION_1_2;
- case ClassConstants.INTERNAL_CLASS_VERSION_1_3: return ClassConstants.EXTERNAL_CLASS_VERSION_1_3;
- case ClassConstants.INTERNAL_CLASS_VERSION_1_4: return ClassConstants.EXTERNAL_CLASS_VERSION_1_4;
- case ClassConstants.INTERNAL_CLASS_VERSION_1_5: return ClassConstants.EXTERNAL_CLASS_VERSION_1_5;
- case ClassConstants.INTERNAL_CLASS_VERSION_1_6: return ClassConstants.EXTERNAL_CLASS_VERSION_1_6;
- case ClassConstants.INTERNAL_CLASS_VERSION_1_7: return ClassConstants.EXTERNAL_CLASS_VERSION_1_7;
- default: return null;
+ case ClassConstants.CLASS_VERSION_1_0: return JavaConstants.CLASS_VERSION_1_0;
+ case ClassConstants.CLASS_VERSION_1_2: return JavaConstants.CLASS_VERSION_1_2;
+ case ClassConstants.CLASS_VERSION_1_3: return JavaConstants.CLASS_VERSION_1_3;
+ case ClassConstants.CLASS_VERSION_1_4: return JavaConstants.CLASS_VERSION_1_4;
+ case ClassConstants.CLASS_VERSION_1_5: return JavaConstants.CLASS_VERSION_1_5;
+ case ClassConstants.CLASS_VERSION_1_6: return JavaConstants.CLASS_VERSION_1_6;
+ case ClassConstants.CLASS_VERSION_1_7: return JavaConstants.CLASS_VERSION_1_7;
+ case ClassConstants.CLASS_VERSION_1_8: return JavaConstants.CLASS_VERSION_1_8;
+ default: return null;
}
}
@@ -134,15 +137,15 @@ public class ClassUtil
*/
public static void checkVersionNumbers(int classVersion) throws UnsupportedOperationException
{
- if (classVersion < ClassConstants.INTERNAL_CLASS_VERSION_1_0 ||
- classVersion > ClassConstants.INTERNAL_CLASS_VERSION_1_7)
+ if (classVersion < ClassConstants.CLASS_VERSION_1_0 ||
+ classVersion > ClassConstants.CLASS_VERSION_1_8)
{
throw new UnsupportedOperationException("Unsupported class version number ["+
internalMajorClassVersion(classVersion)+"."+
internalMinorClassVersion(classVersion)+"] (maximum "+
- ClassConstants.INTERNAL_CLASS_VERSION_1_7_MAJOR+"."+
- ClassConstants.INTERNAL_CLASS_VERSION_1_7_MINOR+", Java "+
- ClassConstants.EXTERNAL_CLASS_VERSION_1_7+")");
+ ClassConstants.CLASS_VERSION_1_8_MAJOR+"."+
+ ClassConstants.CLASS_VERSION_1_8_MINOR+", Java "+
+ JavaConstants.CLASS_VERSION_1_8+")");
}
}
@@ -156,8 +159,8 @@ public class ClassUtil
*/
public static String internalClassName(String externalClassName)
{
- return externalClassName.replace(ClassConstants.EXTERNAL_PACKAGE_SEPARATOR,
- ClassConstants.INTERNAL_PACKAGE_SEPARATOR);
+ return externalClassName.replace(JavaConstants.PACKAGE_SEPARATOR,
+ ClassConstants.PACKAGE_SEPARATOR);
}
@@ -186,11 +189,11 @@ public class ClassUtil
*/
public static String externalClassName(String internalClassName)
{
- return //internalClassName.startsWith(ClassConstants.INTERNAL_PACKAGE_JAVA_LANG) &&
- //internalClassName.indexOf(ClassConstants.INTERNAL_PACKAGE_SEPARATOR, ClassConstants.INTERNAL_PACKAGE_JAVA_LANG.length() + 1) < 0 ?
- //internalClassName.substring(ClassConstants.INTERNAL_PACKAGE_JAVA_LANG.length()) :
- internalClassName.replace(ClassConstants.INTERNAL_PACKAGE_SEPARATOR,
- ClassConstants.EXTERNAL_PACKAGE_SEPARATOR);
+ return //internalClassName.startsWith(ClassConstants.PACKAGE_JAVA_LANG) &&
+ //internalClassName.indexOf(ClassConstants.PACKAGE_SEPARATOR, ClassConstants.PACKAGE_JAVA_LANG.length() + 1) < 0 ?
+ //internalClassName.substring(ClassConstants.PACKAGE_JAVA_LANG.length()) :
+ internalClassName.replace(ClassConstants.PACKAGE_SEPARATOR,
+ JavaConstants.PACKAGE_SEPARATOR);
}
@@ -204,7 +207,7 @@ public class ClassUtil
*/
public static String externalBaseType(String externalArrayType)
{
- int index = externalArrayType.indexOf(ClassConstants.EXTERNAL_TYPE_ARRAY);
+ int index = externalArrayType.indexOf(JavaConstants.TYPE_ARRAY);
return index >= 0 ?
externalArrayType.substring(0, index) :
externalArrayType;
@@ -221,7 +224,7 @@ public class ClassUtil
*/
public static String externalShortClassName(String externalClassName)
{
- int index = externalClassName.lastIndexOf(ClassConstants.EXTERNAL_PACKAGE_SEPARATOR);
+ int index = externalClassName.lastIndexOf(JavaConstants.PACKAGE_SEPARATOR);
return externalClassName.substring(index+1);
}
@@ -236,7 +239,7 @@ public class ClassUtil
public static boolean isInternalArrayType(String internalType)
{
return internalType.length() > 1 &&
- internalType.charAt(0) == ClassConstants.INTERNAL_TYPE_ARRAY;
+ internalType.charAt(0) == ClassConstants.TYPE_ARRAY;
}
@@ -249,7 +252,7 @@ public class ClassUtil
public static int internalArrayTypeDimensionCount(String internalType)
{
int dimensions = 0;
- while (internalType.charAt(dimensions) == ClassConstants.INTERNAL_TYPE_ARRAY)
+ while (internalType.charAt(dimensions) == ClassConstants.TYPE_ARRAY)
{
dimensions++;
}
@@ -270,9 +273,9 @@ public class ClassUtil
*/
public static boolean isInternalArrayInterfaceName(String internalClassName)
{
- return ClassConstants.INTERNAL_NAME_JAVA_LANG_OBJECT.equals(internalClassName) ||
- ClassConstants.INTERNAL_NAME_JAVA_LANG_CLONEABLE.equals(internalClassName) ||
- ClassConstants.INTERNAL_NAME_JAVA_IO_SERIALIZABLE.equals(internalClassName);
+ return ClassConstants.NAME_JAVA_LANG_OBJECT.equals(internalClassName) ||
+ ClassConstants.NAME_JAVA_LANG_CLONEABLE.equals(internalClassName) ||
+ ClassConstants.NAME_JAVA_IO_SERIALIZABLE.equals(internalClassName);
}
@@ -286,14 +289,14 @@ public class ClassUtil
*/
public static boolean isInternalPrimitiveType(char internalType)
{
- return internalType == ClassConstants.INTERNAL_TYPE_BOOLEAN ||
- internalType == ClassConstants.INTERNAL_TYPE_BYTE ||
- internalType == ClassConstants.INTERNAL_TYPE_CHAR ||
- internalType == ClassConstants.INTERNAL_TYPE_SHORT ||
- internalType == ClassConstants.INTERNAL_TYPE_INT ||
- internalType == ClassConstants.INTERNAL_TYPE_FLOAT ||
- internalType == ClassConstants.INTERNAL_TYPE_LONG ||
- internalType == ClassConstants.INTERNAL_TYPE_DOUBLE;
+ return internalType == ClassConstants.TYPE_BOOLEAN ||
+ internalType == ClassConstants.TYPE_BYTE ||
+ internalType == ClassConstants.TYPE_CHAR ||
+ internalType == ClassConstants.TYPE_SHORT ||
+ internalType == ClassConstants.TYPE_INT ||
+ internalType == ClassConstants.TYPE_FLOAT ||
+ internalType == ClassConstants.TYPE_LONG ||
+ internalType == ClassConstants.TYPE_DOUBLE;
}
@@ -307,8 +310,8 @@ public class ClassUtil
public static boolean isInternalCategory2Type(String internalType)
{
return internalType.length() == 1 &&
- (internalType.charAt(0) == ClassConstants.INTERNAL_TYPE_LONG ||
- internalType.charAt(0) == ClassConstants.INTERNAL_TYPE_DOUBLE);
+ (internalType.charAt(0) == ClassConstants.TYPE_LONG ||
+ internalType.charAt(0) == ClassConstants.TYPE_DOUBLE);
}
@@ -324,8 +327,8 @@ public class ClassUtil
{
int length = internalType.length();
return length > 1 &&
-// internalType.charAt(0) == ClassConstants.INTERNAL_TYPE_CLASS_START &&
- internalType.charAt(length-1) == ClassConstants.INTERNAL_TYPE_CLASS_END;
+// internalType.charAt(0) == ClassConstants.TYPE_CLASS_START &&
+ internalType.charAt(length-1) == ClassConstants.TYPE_CLASS_END;
}
@@ -359,12 +362,12 @@ public class ClassUtil
for (int dimension = 0; dimension < dimensionCount; dimension++)
{
- buffer.append(ClassConstants.INTERNAL_TYPE_ARRAY);
+ buffer.append(ClassConstants.TYPE_ARRAY);
}
- return buffer.append(ClassConstants.INTERNAL_TYPE_CLASS_START)
+ return buffer.append(ClassConstants.TYPE_CLASS_START)
.append(internalClassName)
- .append(ClassConstants.INTERNAL_TYPE_CLASS_END)
+ .append(ClassConstants.TYPE_CLASS_END)
.toString();
}
@@ -380,7 +383,7 @@ public class ClassUtil
*/
public static String internalTypeFromArrayType(String internalArrayType)
{
- int index = internalArrayType.lastIndexOf(ClassConstants.INTERNAL_TYPE_ARRAY);
+ int index = internalArrayType.lastIndexOf(ClassConstants.TYPE_ARRAY);
return internalArrayType.substring(index+1);
}
@@ -399,7 +402,7 @@ public class ClassUtil
public static String internalClassNameFromClassType(String internalClassType)
{
return isInternalClassType(internalClassType) ?
- internalClassType.substring(internalClassType.indexOf(ClassConstants.INTERNAL_TYPE_CLASS_START)+1,
+ internalClassType.substring(internalClassType.indexOf(ClassConstants.TYPE_CLASS_START)+1,
internalClassType.length()-1) :
internalClassType;
}
@@ -442,8 +445,8 @@ public class ClassUtil
*/
public static boolean isInitializer(String internalMethodName)
{
- return internalMethodName.equals(ClassConstants.INTERNAL_METHOD_NAME_CLINIT) ||
- internalMethodName.equals(ClassConstants.INTERNAL_METHOD_NAME_INIT);
+ return internalMethodName.equals(ClassConstants.METHOD_NAME_CLINIT) ||
+ internalMethodName.equals(ClassConstants.METHOD_NAME_INIT);
}
@@ -456,7 +459,7 @@ public class ClassUtil
*/
public static String internalMethodReturnType(String internalMethodDescriptor)
{
- int index = internalMethodDescriptor.indexOf(ClassConstants.INTERNAL_METHOD_ARGUMENTS_CLOSE);
+ int index = internalMethodDescriptor.indexOf(ClassConstants.METHOD_ARGUMENTS_CLOSE);
return internalMethodDescriptor.substring(index + 1);
}
@@ -470,18 +473,38 @@ public class ClassUtil
*/
public static int internalMethodParameterCount(String internalMethodDescriptor)
{
- InternalTypeEnumeration internalTypeEnumeration =
- new InternalTypeEnumeration(internalMethodDescriptor);
-
int counter = 0;
- while (internalTypeEnumeration.hasMoreTypes())
- {
- internalTypeEnumeration.nextType();
+ int index = 1;
- counter++;
+ while (true)
+ {
+ char c = internalMethodDescriptor.charAt(index++);
+ switch (c)
+ {
+ case ClassConstants.TYPE_ARRAY:
+ {
+ // Just ignore all array characters.
+ break;
+ }
+ case ClassConstants.TYPE_CLASS_START:
+ {
+ counter++;
+
+ // Skip the class name.
+ index = internalMethodDescriptor.indexOf(ClassConstants.TYPE_CLASS_END, index) + 1;
+ break;
+ }
+ default:
+ {
+ counter++;
+ break;
+ }
+ case ClassConstants.METHOD_ARGUMENTS_CLOSE:
+ {
+ return counter;
+ }
+ }
}
-
- return counter;
}
@@ -516,7 +539,7 @@ public class ClassUtil
int accessFlags)
{
return internalMethodParameterSize(internalMethodDescriptor,
- (accessFlags & ClassConstants.INTERNAL_ACC_STATIC) != 0);
+ (accessFlags & ClassConstants.ACC_STATIC) != 0);
}
@@ -535,18 +558,53 @@ public class ClassUtil
public static int internalMethodParameterSize(String internalMethodDescriptor,
boolean isStatic)
{
- InternalTypeEnumeration internalTypeEnumeration =
- new InternalTypeEnumeration(internalMethodDescriptor);
+ int size = isStatic ? 0 : 1;
+ int index = 1;
- int size = isStatic ? 0 : 1;
- while (internalTypeEnumeration.hasMoreTypes())
+ while (true)
{
- String internalType = internalTypeEnumeration.nextType();
-
- size += internalTypeSize(internalType);
+ char c = internalMethodDescriptor.charAt(index++);
+ switch (c)
+ {
+ case ClassConstants.TYPE_LONG:
+ case ClassConstants.TYPE_DOUBLE:
+ {
+ size += 2;
+ break;
+ }
+ case ClassConstants.TYPE_CLASS_START:
+ {
+ size++;
+
+ // Skip the class name.
+ index = internalMethodDescriptor.indexOf(ClassConstants.TYPE_CLASS_END, index) + 1;
+ break;
+ }
+ case ClassConstants.TYPE_ARRAY:
+ {
+ size++;
+
+ // Skip all array characters.
+ while ((c = internalMethodDescriptor.charAt(index++)) == ClassConstants.TYPE_ARRAY) {}
+
+ if (c == ClassConstants.TYPE_CLASS_START)
+ {
+ // Skip the class type.
+ index = internalMethodDescriptor.indexOf(ClassConstants.TYPE_CLASS_END, index) + 1;
+ }
+ break;
+ }
+ default:
+ {
+ size++;
+ break;
+ }
+ case ClassConstants.METHOD_ARGUMENTS_CLOSE:
+ {
+ return size;
+ }
+ }
}
-
- return size;
}
@@ -564,12 +622,12 @@ public class ClassUtil
if (internalType.length() == 1)
{
char internalPrimitiveType = internalType.charAt(0);
- if (internalPrimitiveType == ClassConstants.INTERNAL_TYPE_LONG ||
- internalPrimitiveType == ClassConstants.INTERNAL_TYPE_DOUBLE)
+ if (internalPrimitiveType == ClassConstants.TYPE_LONG ||
+ internalPrimitiveType == ClassConstants.TYPE_DOUBLE)
{
return 2;
}
- else if (internalPrimitiveType == ClassConstants.INTERNAL_TYPE_VOID)
+ else if (internalPrimitiveType == ClassConstants.TYPE_VOID)
{
return 0;
}
@@ -594,43 +652,33 @@ public class ClassUtil
int dimensionCount = externalArrayTypeDimensionCount(externalType);
if (dimensionCount > 0)
{
- externalType = externalType.substring(0, externalType.length() - dimensionCount * ClassConstants.EXTERNAL_TYPE_ARRAY.length());
+ externalType = externalType.substring(0, externalType.length() - dimensionCount * JavaConstants.TYPE_ARRAY.length());
}
// Analyze the actual type part.
char internalTypeChar =
- externalType.equals(ClassConstants.EXTERNAL_TYPE_VOID ) ?
- ClassConstants.INTERNAL_TYPE_VOID :
- externalType.equals(ClassConstants.EXTERNAL_TYPE_BOOLEAN) ?
- ClassConstants.INTERNAL_TYPE_BOOLEAN :
- externalType.equals(ClassConstants.EXTERNAL_TYPE_BYTE ) ?
- ClassConstants.INTERNAL_TYPE_BYTE :
- externalType.equals(ClassConstants.EXTERNAL_TYPE_CHAR ) ?
- ClassConstants.INTERNAL_TYPE_CHAR :
- externalType.equals(ClassConstants.EXTERNAL_TYPE_SHORT ) ?
- ClassConstants.INTERNAL_TYPE_SHORT :
- externalType.equals(ClassConstants.EXTERNAL_TYPE_INT ) ?
- ClassConstants.INTERNAL_TYPE_INT :
- externalType.equals(ClassConstants.EXTERNAL_TYPE_FLOAT ) ?
- ClassConstants.INTERNAL_TYPE_FLOAT :
- externalType.equals(ClassConstants.EXTERNAL_TYPE_LONG ) ?
- ClassConstants.INTERNAL_TYPE_LONG :
- externalType.equals(ClassConstants.EXTERNAL_TYPE_DOUBLE ) ?
- ClassConstants.INTERNAL_TYPE_DOUBLE :
- externalType.equals("%" ) ?
- '%' :
- (char)0;
+ externalType.equals(JavaConstants.TYPE_VOID ) ? ClassConstants.TYPE_VOID :
+ externalType.equals(JavaConstants.TYPE_BOOLEAN) ? ClassConstants.TYPE_BOOLEAN :
+ externalType.equals(JavaConstants.TYPE_BYTE ) ? ClassConstants.TYPE_BYTE :
+ externalType.equals(JavaConstants.TYPE_CHAR ) ? ClassConstants.TYPE_CHAR :
+ externalType.equals(JavaConstants.TYPE_SHORT ) ? ClassConstants.TYPE_SHORT :
+ externalType.equals(JavaConstants.TYPE_INT ) ? ClassConstants.TYPE_INT :
+ externalType.equals(JavaConstants.TYPE_FLOAT ) ? ClassConstants.TYPE_FLOAT :
+ externalType.equals(JavaConstants.TYPE_LONG ) ? ClassConstants.TYPE_LONG :
+ externalType.equals(JavaConstants.TYPE_DOUBLE ) ? ClassConstants.TYPE_DOUBLE :
+ externalType.equals("%" ) ? '%' :
+ (char)0;
String internalType =
internalTypeChar != 0 ? String.valueOf(internalTypeChar) :
- ClassConstants.INTERNAL_TYPE_CLASS_START +
+ ClassConstants.TYPE_CLASS_START +
internalClassName(externalType) +
- ClassConstants.INTERNAL_TYPE_CLASS_END;
+ ClassConstants.TYPE_CLASS_END;
// Prepend the array part, if any.
for (int count = 0; count < dimensionCount; count++)
{
- internalType = ClassConstants.INTERNAL_TYPE_ARRAY + internalType;
+ internalType = ClassConstants.TYPE_ARRAY + internalType;
}
return internalType;
@@ -646,10 +694,10 @@ public class ClassUtil
public static int externalArrayTypeDimensionCount(String externalType)
{
int dimensions = 0;
- int length = ClassConstants.EXTERNAL_TYPE_ARRAY.length();
+ int length = JavaConstants.TYPE_ARRAY.length();
int offset = externalType.length() - length;
while (externalType.regionMatches(offset,
- ClassConstants.EXTERNAL_TYPE_ARRAY,
+ JavaConstants.TYPE_ARRAY,
0,
length))
{
@@ -683,29 +731,18 @@ public class ClassUtil
char internalTypeChar = internalType.charAt(0);
String externalType =
- internalTypeChar == ClassConstants.INTERNAL_TYPE_VOID ?
- ClassConstants.EXTERNAL_TYPE_VOID :
- internalTypeChar == ClassConstants.INTERNAL_TYPE_BOOLEAN ?
- ClassConstants.EXTERNAL_TYPE_BOOLEAN :
- internalTypeChar == ClassConstants.INTERNAL_TYPE_BYTE ?
- ClassConstants.EXTERNAL_TYPE_BYTE :
- internalTypeChar == ClassConstants.INTERNAL_TYPE_CHAR ?
- ClassConstants.EXTERNAL_TYPE_CHAR :
- internalTypeChar == ClassConstants.INTERNAL_TYPE_SHORT ?
- ClassConstants.EXTERNAL_TYPE_SHORT :
- internalTypeChar == ClassConstants.INTERNAL_TYPE_INT ?
- ClassConstants.EXTERNAL_TYPE_INT :
- internalTypeChar == ClassConstants.INTERNAL_TYPE_FLOAT ?
- ClassConstants.EXTERNAL_TYPE_FLOAT :
- internalTypeChar == ClassConstants.INTERNAL_TYPE_LONG ?
- ClassConstants.EXTERNAL_TYPE_LONG :
- internalTypeChar == ClassConstants.INTERNAL_TYPE_DOUBLE ?
- ClassConstants.EXTERNAL_TYPE_DOUBLE :
- internalTypeChar == '%' ?
- "%" :
- internalTypeChar == ClassConstants.INTERNAL_TYPE_CLASS_START ?
- externalClassName(internalType.substring(1, internalType.indexOf(ClassConstants.INTERNAL_TYPE_CLASS_END))) :
- null;
+ internalTypeChar == ClassConstants.TYPE_VOID ? JavaConstants.TYPE_VOID :
+ internalTypeChar == ClassConstants.TYPE_BOOLEAN ? JavaConstants.TYPE_BOOLEAN :
+ internalTypeChar == ClassConstants.TYPE_BYTE ? JavaConstants.TYPE_BYTE :
+ internalTypeChar == ClassConstants.TYPE_CHAR ? JavaConstants.TYPE_CHAR :
+ internalTypeChar == ClassConstants.TYPE_SHORT ? JavaConstants.TYPE_SHORT :
+ internalTypeChar == ClassConstants.TYPE_INT ? JavaConstants.TYPE_INT :
+ internalTypeChar == ClassConstants.TYPE_FLOAT ? JavaConstants.TYPE_FLOAT :
+ internalTypeChar == ClassConstants.TYPE_LONG ? JavaConstants.TYPE_LONG :
+ internalTypeChar == ClassConstants.TYPE_DOUBLE ? JavaConstants.TYPE_DOUBLE :
+ internalTypeChar == '%' ? "%" :
+ internalTypeChar == ClassConstants.TYPE_CLASS_START ? externalClassName(internalType.substring(1, internalType.indexOf(ClassConstants.TYPE_CLASS_END))) :
+ null;
if (externalType == null)
{
@@ -715,7 +752,7 @@ public class ClassUtil
// Append the array part, if any.
for (int count = 0; count < dimensionCount; count++)
{
- externalType += ClassConstants.EXTERNAL_TYPE_ARRAY;
+ externalType += JavaConstants.TYPE_ARRAY;
}
return externalType;
@@ -732,7 +769,7 @@ public class ClassUtil
*/
public static boolean isInternalMethodDescriptor(String internalDescriptor)
{
- return internalDescriptor.charAt(0) == ClassConstants.INTERNAL_METHOD_ARGUMENTS_OPEN;
+ return internalDescriptor.charAt(0) == ClassConstants.METHOD_ARGUMENTS_OPEN;
}
@@ -747,7 +784,7 @@ public class ClassUtil
*/
public static boolean isExternalMethodNameAndArguments(String externalMemberNameAndArguments)
{
- return externalMemberNameAndArguments.indexOf(ClassConstants.EXTERNAL_METHOD_ARGUMENTS_OPEN) > 0;
+ return externalMemberNameAndArguments.indexOf(JavaConstants.METHOD_ARGUMENTS_OPEN) > 0;
}
@@ -780,7 +817,7 @@ public class ClassUtil
String externalMethodNameAndArguments)
{
StringBuffer internalMethodDescriptor = new StringBuffer();
- internalMethodDescriptor.append(ClassConstants.INTERNAL_METHOD_ARGUMENTS_OPEN);
+ internalMethodDescriptor.append(ClassConstants.METHOD_ARGUMENTS_OPEN);
ExternalTypeEnumeration externalTypeEnumeration =
new ExternalTypeEnumeration(externalMethodNameAndArguments);
@@ -790,7 +827,7 @@ public class ClassUtil
internalMethodDescriptor.append(internalType(externalTypeEnumeration.nextType()));
}
- internalMethodDescriptor.append(ClassConstants.INTERNAL_METHOD_ARGUMENTS_CLOSE);
+ internalMethodDescriptor.append(ClassConstants.METHOD_ARGUMENTS_CLOSE);
internalMethodDescriptor.append(internalType(externalReturnType));
return internalMethodDescriptor.toString();
@@ -811,14 +848,14 @@ public class ClassUtil
List externalArguments)
{
StringBuffer internalMethodDescriptor = new StringBuffer();
- internalMethodDescriptor.append(ClassConstants.INTERNAL_METHOD_ARGUMENTS_OPEN);
+ internalMethodDescriptor.append(ClassConstants.METHOD_ARGUMENTS_OPEN);
for (int index = 0; index < externalArguments.size(); index++)
{
internalMethodDescriptor.append(internalType((String)externalArguments.get(index)));
}
- internalMethodDescriptor.append(ClassConstants.INTERNAL_METHOD_ARGUMENTS_CLOSE);
+ internalMethodDescriptor.append(ClassConstants.METHOD_ARGUMENTS_CLOSE);
internalMethodDescriptor.append(internalType(externalReturnType));
return internalMethodDescriptor.toString();
@@ -869,9 +906,9 @@ public class ClassUtil
externalMethodReturnTypeAndName(internalClassName,
internalMethodName,
internalMethodDescriptor) +
- ClassConstants.EXTERNAL_METHOD_ARGUMENTS_OPEN +
+ JavaConstants.METHOD_ARGUMENTS_OPEN +
externalMethodArguments(internalMethodDescriptor) +
- ClassConstants.EXTERNAL_METHOD_ARGUMENTS_CLOSE;
+ JavaConstants.METHOD_ARGUMENTS_CLOSE;
}
@@ -903,48 +940,48 @@ public class ClassUtil
StringBuffer string = new StringBuffer(50);
- if ((accessFlags & ClassConstants.INTERNAL_ACC_PUBLIC) != 0)
+ if ((accessFlags & ClassConstants.ACC_PUBLIC) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_PUBLIC).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_PUBLIC).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_PRIVATE) != 0)
+ if ((accessFlags & ClassConstants.ACC_PRIVATE) != 0)
{
// Only in InnerClasses attributes.
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_PRIVATE).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_PRIVATE).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_PROTECTED) != 0)
+ if ((accessFlags & ClassConstants.ACC_PROTECTED) != 0)
{
// Only in InnerClasses attributes.
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_PROTECTED).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_PROTECTED).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_STATIC) != 0)
+ if ((accessFlags & ClassConstants.ACC_STATIC) != 0)
{
// Only in InnerClasses attributes.
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_STATIC).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_STATIC).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_FINAL) != 0)
+ if ((accessFlags & ClassConstants.ACC_FINAL) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_FINAL).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_FINAL).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_ANNOTATTION) != 0)
+ if ((accessFlags & ClassConstants.ACC_ANNOTATTION) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_ANNOTATION);
+ string.append(prefix).append(JavaConstants.ACC_ANNOTATION);
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_INTERFACE) != 0)
+ if ((accessFlags & ClassConstants.ACC_INTERFACE) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_INTERFACE).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_INTERFACE).append(' ');
}
- else if ((accessFlags & ClassConstants.INTERNAL_ACC_ENUM) != 0)
+ else if ((accessFlags & ClassConstants.ACC_ENUM) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_ENUM).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_ENUM).append(' ');
}
- else if ((accessFlags & ClassConstants.INTERNAL_ACC_ABSTRACT) != 0)
+ else if ((accessFlags & ClassConstants.ACC_ABSTRACT) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_ABSTRACT).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_ABSTRACT).append(' ');
}
- else if ((accessFlags & ClassConstants.INTERNAL_ACC_SYNTHETIC) != 0)
+ else if ((accessFlags & ClassConstants.ACC_SYNTHETIC) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_SYNTHETIC).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_SYNTHETIC).append(' ');
}
return string.toString();
@@ -979,37 +1016,37 @@ public class ClassUtil
StringBuffer string = new StringBuffer(50);
- if ((accessFlags & ClassConstants.INTERNAL_ACC_PUBLIC) != 0)
+ if ((accessFlags & ClassConstants.ACC_PUBLIC) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_PUBLIC).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_PUBLIC).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_PRIVATE) != 0)
+ if ((accessFlags & ClassConstants.ACC_PRIVATE) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_PRIVATE).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_PRIVATE).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_PROTECTED) != 0)
+ if ((accessFlags & ClassConstants.ACC_PROTECTED) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_PROTECTED).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_PROTECTED).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_STATIC) != 0)
+ if ((accessFlags & ClassConstants.ACC_STATIC) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_STATIC).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_STATIC).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_FINAL) != 0)
+ if ((accessFlags & ClassConstants.ACC_FINAL) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_FINAL).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_FINAL).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_VOLATILE) != 0)
+ if ((accessFlags & ClassConstants.ACC_VOLATILE) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_VOLATILE).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_VOLATILE).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_TRANSIENT) != 0)
+ if ((accessFlags & ClassConstants.ACC_TRANSIENT) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_TRANSIENT).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_TRANSIENT).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_SYNTHETIC) != 0)
+ if ((accessFlags & ClassConstants.ACC_SYNTHETIC) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_SYNTHETIC).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_SYNTHETIC).append(' ');
}
return string.toString();
@@ -1044,53 +1081,100 @@ public class ClassUtil
StringBuffer string = new StringBuffer(50);
- if ((accessFlags & ClassConstants.INTERNAL_ACC_PUBLIC) != 0)
+ if ((accessFlags & ClassConstants.ACC_PUBLIC) != 0)
+ {
+ string.append(prefix).append(JavaConstants.ACC_PUBLIC).append(' ');
+ }
+ if ((accessFlags & ClassConstants.ACC_PRIVATE) != 0)
+ {
+ string.append(prefix).append(JavaConstants.ACC_PRIVATE).append(' ');
+ }
+ if ((accessFlags & ClassConstants.ACC_PROTECTED) != 0)
+ {
+ string.append(prefix).append(JavaConstants.ACC_PROTECTED).append(' ');
+ }
+ if ((accessFlags & ClassConstants.ACC_STATIC) != 0)
+ {
+ string.append(prefix).append(JavaConstants.ACC_STATIC).append(' ');
+ }
+ if ((accessFlags & ClassConstants.ACC_FINAL) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_PUBLIC).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_FINAL).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_PRIVATE) != 0)
+ if ((accessFlags & ClassConstants.ACC_SYNCHRONIZED) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_PRIVATE).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_SYNCHRONIZED).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_PROTECTED) != 0)
+ if ((accessFlags & ClassConstants.ACC_BRIDGE) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_PROTECTED).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_BRIDGE).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_STATIC) != 0)
+ if ((accessFlags & ClassConstants.ACC_VARARGS) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_STATIC).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_VARARGS).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_FINAL) != 0)
+ if ((accessFlags & ClassConstants.ACC_NATIVE) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_FINAL).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_NATIVE).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_SYNCHRONIZED) != 0)
+ if ((accessFlags & ClassConstants.ACC_ABSTRACT) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_SYNCHRONIZED).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_ABSTRACT).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_BRIDGE) != 0)
+ if ((accessFlags & ClassConstants.ACC_STRICT) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_BRIDGE).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_STRICT).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_VARARGS) != 0)
+ if ((accessFlags & ClassConstants.ACC_SYNTHETIC) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_VARARGS).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_SYNTHETIC).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_NATIVE) != 0)
+
+ return string.toString();
+ }
+
+
+ /**
+ * Converts internal method parameter access flags into an external access
+ * description.
+ * @param accessFlags the method parameter access flags.
+ * @return the external method parameter access description,
+ * e.g. "<code>final mandated </code>".
+ */
+ public static String externalParameterAccessFlags(int accessFlags)
+ {
+ return externalParameterAccessFlags(accessFlags, "");
+ }
+
+
+ /**
+ * Converts internal method parameter access flags into an external access
+ * description.
+ * @param accessFlags the method parameter access flags.
+ * @param prefix a prefix that is added to each access modifier.
+ * @return the external method parameter access description,
+ * e.g. "final mandated ".
+ */
+ public static String externalParameterAccessFlags(int accessFlags, String prefix)
+ {
+ if (accessFlags == 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_NATIVE).append(' ');
+ return EMPTY_STRING;
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_ABSTRACT) != 0)
+
+ StringBuffer string = new StringBuffer(50);
+
+ if ((accessFlags & ClassConstants.ACC_FINAL) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_ABSTRACT).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_FINAL).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_STRICT) != 0)
+ if ((accessFlags & ClassConstants.ACC_SYNTHETIC) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_STRICT).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_SYNTHETIC).append(' ');
}
- if ((accessFlags & ClassConstants.INTERNAL_ACC_SYNTHETIC) != 0)
+ if ((accessFlags & ClassConstants.ACC_MANDATED) != 0)
{
- string.append(prefix).append(ClassConstants.EXTERNAL_ACC_SYNTHETIC).append(' ');
+ string.append(prefix).append(JavaConstants.ACC_MANDATED).append(' ');
}
return string.toString();
@@ -1128,7 +1212,7 @@ public class ClassUtil
String internalMethodName,
String internalMethodDescriptor)
{
- return internalMethodName.equals(ClassConstants.INTERNAL_METHOD_NAME_INIT) ?
+ return internalMethodName.equals(ClassConstants.METHOD_NAME_INIT) ?
externalShortClassName(externalClassName(internalClassName)) :
(externalMethodReturnType(internalMethodDescriptor) +
' ' +
@@ -1156,7 +1240,7 @@ public class ClassUtil
externalMethodNameAndArguments.append(externalType(internalTypeEnumeration.nextType()));
if (internalTypeEnumeration.hasMoreTypes())
{
- externalMethodNameAndArguments.append(ClassConstants.EXTERNAL_METHOD_ARGUMENTS_SEPARATOR);
+ externalMethodNameAndArguments.append(JavaConstants.METHOD_ARGUMENTS_SEPARATOR);
}
}
@@ -1190,7 +1274,7 @@ public class ClassUtil
*/
public static String internalPackagePrefix(String internalClassName)
{
- return internalClassName.substring(0, internalClassName.lastIndexOf(ClassConstants.INTERNAL_PACKAGE_SEPARATOR,
+ return internalClassName.substring(0, internalClassName.lastIndexOf(ClassConstants.PACKAGE_SEPARATOR,
internalClassName.length() - 2) + 1);
}
@@ -1221,7 +1305,7 @@ public class ClassUtil
*/
public static String externalPackagePrefix(String externalClassName)
{
- return externalClassName.substring(0, externalClassName.lastIndexOf(ClassConstants.EXTERNAL_PACKAGE_SEPARATOR,
+ return externalClassName.substring(0, externalClassName.lastIndexOf(JavaConstants.PACKAGE_SEPARATOR,
externalClassName.length() - 2) + 1);
}
}
diff --git a/src/proguard/classfile/util/DescriptorClassEnumeration.java b/src/proguard/classfile/util/DescriptorClassEnumeration.java
index 81590fa..b15d470 100644
--- a/src/proguard/classfile/util/DescriptorClassEnumeration.java
+++ b/src/proguard/classfile/util/DescriptorClassEnumeration.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,7 +20,7 @@
*/
package proguard.classfile.util;
-import proguard.classfile.ClassConstants;
+import proguard.classfile.*;
import java.util.Stack;
@@ -58,6 +58,8 @@ public class DescriptorClassEnumeration
{
int count = 0;
+ reset();
+
nextFluff();
while (hasMoreClassNames())
{
@@ -67,13 +69,26 @@ public class DescriptorClassEnumeration
nextFluff();
}
- index = 0;
+ reset();
return count;
}
/**
+ * Resets the enumeration.
+ */
+ private void reset()
+ {
+ index = 0;
+ nestingLevel = 0;
+ isInnerClassName = false;
+ accumulatedClassName = null;
+ accumulatedClassNames = null;
+ }
+
+
+ /**
* Returns whether the enumeration can provide more class names from the
* descriptor.
*/
@@ -95,7 +110,7 @@ public class DescriptorClassEnumeration
{
switch (descriptor.charAt(index++))
{
- case ClassConstants.INTERNAL_TYPE_GENERIC_START:
+ case ClassConstants.TYPE_GENERIC_START:
{
nestingLevel++;
@@ -110,7 +125,7 @@ public class DescriptorClassEnumeration
break;
}
- case ClassConstants.INTERNAL_TYPE_GENERIC_END:
+ case ClassConstants.TYPE_GENERIC_END:
{
nestingLevel--;
@@ -120,42 +135,42 @@ public class DescriptorClassEnumeration
continue loop;
}
- case ClassConstants.INTERNAL_TYPE_GENERIC_BOUND:
+ case ClassConstants.TYPE_GENERIC_BOUND:
{
continue loop;
}
- case ClassConstants.INTERNAL_TYPE_CLASS_START:
+ case ClassConstants.TYPE_CLASS_START:
{
// We've found the start of an ordinary class name.
nestingLevel += 2;
isInnerClassName = false;
break loop;
}
- case ClassConstants.INTERNAL_TYPE_CLASS_END:
+ case ClassConstants.TYPE_CLASS_END:
{
nestingLevel -= 2;
break;
}
- case ClassConstants.EXTERNAL_INNER_CLASS_SEPARATOR:
+ case JavaConstants.INNER_CLASS_SEPARATOR:
{
// We've found the start of an inner class name in a signature.
isInnerClassName = true;
break loop;
}
- case ClassConstants.INTERNAL_TYPE_GENERIC_VARIABLE_START:
+ case ClassConstants.TYPE_GENERIC_VARIABLE_START:
{
// We've found the start of a type identifier. Skip to the end.
- while (descriptor.charAt(index++) != ClassConstants.INTERNAL_TYPE_CLASS_END);
+ while (descriptor.charAt(index++) != ClassConstants.TYPE_CLASS_END);
break;
}
}
if (nestingLevel == 1 &&
- descriptor.charAt(index) != ClassConstants.INTERNAL_TYPE_GENERIC_END)
+ descriptor.charAt(index) != ClassConstants.TYPE_GENERIC_END)
{
// We're at the start of a type parameter. Skip to the start
// of the bounds.
- while (descriptor.charAt(index++) != ClassConstants.INTERNAL_TYPE_GENERIC_BOUND);
+ while (descriptor.charAt(index++) != ClassConstants.TYPE_GENERIC_BOUND);
}
}
@@ -175,9 +190,9 @@ public class DescriptorClassEnumeration
{
switch (descriptor.charAt(index))
{
- case ClassConstants.INTERNAL_TYPE_GENERIC_START:
- case ClassConstants.INTERNAL_TYPE_CLASS_END:
- case ClassConstants.EXTERNAL_INNER_CLASS_SEPARATOR:
+ case ClassConstants.TYPE_GENERIC_START:
+ case ClassConstants.TYPE_CLASS_END:
+ case JavaConstants.INNER_CLASS_SEPARATOR:
{
break loop;
}
@@ -190,7 +205,7 @@ public class DescriptorClassEnumeration
// Recompose the inner class name if necessary.
accumulatedClassName = isInnerClassName ?
- accumulatedClassName + ClassConstants.INTERNAL_INNER_CLASS_SEPARATOR + className :
+ accumulatedClassName + ClassConstants.INNER_CLASS_SEPARATOR + className :
className;
return accumulatedClassName;
diff --git a/src/proguard/classfile/util/DynamicClassReferenceInitializer.java b/src/proguard/classfile/util/DynamicClassReferenceInitializer.java
index 865e094..413d885 100644
--- a/src/proguard/classfile/util/DynamicClassReferenceInitializer.java
+++ b/src/proguard/classfile/util/DynamicClassReferenceInitializer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -66,21 +66,21 @@ implements InstructionVisitor,
new MethodrefConstant(1, 2, null, null),
new ClassConstant(3, null),
new NameAndTypeConstant(4, 5),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_LANG_CLASS),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_CLASS_FOR_NAME),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_CLASS_FOR_NAME),
+ new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
+ new Utf8Constant(ClassConstants.METHOD_NAME_CLASS_FOR_NAME),
+ new Utf8Constant(ClassConstants.METHOD_TYPE_CLASS_FOR_NAME),
// 6
new MethodrefConstant(1, 7, null, null),
new NameAndTypeConstant(8, 9),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_NEW_INSTANCE),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_NEW_INSTANCE),
+ new Utf8Constant(ClassConstants.METHOD_NAME_NEW_INSTANCE),
+ new Utf8Constant(ClassConstants.METHOD_TYPE_NEW_INSTANCE),
// 10
new MethodrefConstant(1, 11, null, null),
new NameAndTypeConstant(12, 13),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_CLASS_GET_COMPONENT_TYPE),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_CLASS_GET_COMPONENT_TYPE),
+ new Utf8Constant(ClassConstants.METHOD_NAME_CLASS_GET_COMPONENT_TYPE),
+ new Utf8Constant(ClassConstants.METHOD_TYPE_CLASS_GET_COMPONENT_TYPE),
};
// Class.forName("SomeClass").
@@ -103,15 +103,15 @@ implements InstructionVisitor,
// {
// new MethodrefConstant(A, 1, null, null),
// new NameAndTypeConstant(2, 3),
-// new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_DOT_CLASS_JAVAC),
-// new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_DOT_CLASS_JAVAC),
+// new Utf8Constant(ClassConstants.METHOD_NAME_DOT_CLASS_JAVAC),
+// new Utf8Constant(ClassConstants.METHOD_TYPE_DOT_CLASS_JAVAC),
// };
private final Constant[] DOT_CLASS_JAVAC_CONSTANTS = new Constant[]
{
new MethodrefConstant(A, 1, null, null),
new NameAndTypeConstant(B, 2),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_DOT_CLASS_JAVAC),
+ new Utf8Constant(ClassConstants.METHOD_TYPE_DOT_CLASS_JAVAC),
};
// SomeClass.class = class$("SomeClass") (javac).
@@ -126,15 +126,15 @@ implements InstructionVisitor,
// {
// new MethodrefConstant(A, 1, null, null),
// new NameAndTypeConstant(2, 3),
-// new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_DOT_CLASS_JIKES),
-// new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_DOT_CLASS_JIKES),
+// new Utf8Constant(ClassConstants.METHOD_NAME_DOT_CLASS_JIKES),
+// new Utf8Constant(ClassConstants.METHOD_TYPE_DOT_CLASS_JIKES),
// };
private final Constant[] DOT_CLASS_JIKES_CONSTANTS = new Constant[]
{
new MethodrefConstant(A, 1, null, null),
new NameAndTypeConstant(B, 2),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_DOT_CLASS_JIKES),
+ new Utf8Constant(ClassConstants.METHOD_TYPE_DOT_CLASS_JIKES),
};
// SomeClass.class = class("SomeClass", false) (jikes).
@@ -240,6 +240,19 @@ implements InstructionVisitor,
public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction)
{
+ // Try to match the (SomeClass)Class.forName(someName).newInstance()
+ // construct. Apply this matcher first, so the next matcher can still
+ // reset it after the first instruction.
+ instruction.accept(clazz, method, codeAttribute, offset,
+ classForNameCastMatcher);
+
+ // Did we find a match?
+ if (classForNameCastMatcher.isMatching())
+ {
+ // Print out a note about the construct.
+ clazz.constantPoolEntryAccept(classForNameCastMatcher.matchedConstantIndex(X), this);
+ }
+
// Try to match the Class.forName("SomeClass") construct.
instruction.accept(clazz, method, codeAttribute, offset,
constantClassForNameMatcher);
@@ -254,18 +267,6 @@ implements InstructionVisitor,
classForNameCastMatcher.reset();
}
- // Try to match the (SomeClass)Class.forName(someName).newInstance()
- // construct.
- instruction.accept(clazz, method, codeAttribute, offset,
- classForNameCastMatcher);
-
- // Did we find a match?
- if (classForNameCastMatcher.isMatching())
- {
- // Print out a note about the construct.
- clazz.constantPoolEntryAccept(classForNameCastMatcher.matchedConstantIndex(X), this);
- }
-
// Try to match the javac .class construct.
instruction.accept(clazz, method, codeAttribute, offset,
dotClassJavacMatcher);
@@ -336,15 +337,15 @@ implements InstructionVisitor,
String methodType = methodrefConstant.getType(clazz);
// Do the method's class and type match?
- if (methodType.equals(ClassConstants.INTERNAL_METHOD_TYPE_DOT_CLASS_JAVAC) ||
- methodType.equals(ClassConstants.INTERNAL_METHOD_TYPE_DOT_CLASS_JIKES))
+ if (methodType.equals(ClassConstants.METHOD_TYPE_DOT_CLASS_JAVAC) ||
+ methodType.equals(ClassConstants.METHOD_TYPE_DOT_CLASS_JIKES))
{
String methodName = methodrefConstant.getName(clazz);
// Does the method's name match one of the special names?
isClassForNameInvocation =
- methodName.equals(ClassConstants.INTERNAL_METHOD_NAME_DOT_CLASS_JAVAC) ||
- methodName.equals(ClassConstants.INTERNAL_METHOD_NAME_DOT_CLASS_JIKES);
+ methodName.equals(ClassConstants.METHOD_NAME_DOT_CLASS_JAVAC) ||
+ methodName.equals(ClassConstants.METHOD_NAME_DOT_CLASS_JIKES);
if (isClassForNameInvocation)
{
diff --git a/src/proguard/classfile/util/DynamicMemberReferenceInitializer.java b/src/proguard/classfile/util/DynamicMemberReferenceInitializer.java
index 23c8d40..e35063c 100644
--- a/src/proguard/classfile/util/DynamicMemberReferenceInitializer.java
+++ b/src/proguard/classfile/util/DynamicMemberReferenceInitializer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -22,7 +22,6 @@ package proguard.classfile.util;
import proguard.classfile.*;
import proguard.classfile.attribute.CodeAttribute;
-import proguard.classfile.attribute.visitor.AttributeVisitor;
import proguard.classfile.constant.*;
import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.instruction.*;
@@ -54,10 +53,10 @@ implements InstructionVisitor,
ConstantVisitor,
MemberVisitor
{
- /*
- private static boolean DEBUG = true;
- /*/
+ //*
private static final boolean DEBUG = false;
+ /*/
+ private static boolean DEBUG = true;
//*/
public static final int CLASS_INDEX = InstructionSequenceMatcher.X;
@@ -75,9 +74,9 @@ implements InstructionVisitor,
new MethodrefConstant(1, 2, null, null),
new ClassConstant(3, null),
new NameAndTypeConstant(4, 5),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_LANG_CLASS),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_CLASS_GET_FIELD),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_CLASS_GET_FIELD),
+ new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
+ new Utf8Constant(ClassConstants.METHOD_NAME_CLASS_GET_FIELD),
+ new Utf8Constant(ClassConstants.METHOD_TYPE_CLASS_GET_FIELD),
};
private final Constant[] GET_DECLARED_FIELD_CONSTANTS = new Constant[]
@@ -85,9 +84,9 @@ implements InstructionVisitor,
new MethodrefConstant(1, 2, null, null),
new ClassConstant(3, null),
new NameAndTypeConstant(4, 5),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_LANG_CLASS),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_CLASS_GET_DECLARED_FIELD),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_CLASS_GET_DECLARED_FIELD),
+ new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
+ new Utf8Constant(ClassConstants.METHOD_NAME_CLASS_GET_DECLARED_FIELD),
+ new Utf8Constant(ClassConstants.METHOD_TYPE_CLASS_GET_DECLARED_FIELD),
};
private final Constant[] GET_CONSTRUCTOR_CONSTANTS = new Constant[]
@@ -95,9 +94,9 @@ implements InstructionVisitor,
new MethodrefConstant(1, 2, null, null),
new ClassConstant(3, null),
new NameAndTypeConstant(4, 5),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_LANG_CLASS),
- new Utf8Constant(ClassConstants.INTERNAL_CONSTRUCTOR_NAME_CLASS_GET_CONSTRUCTOR),
- new Utf8Constant(ClassConstants.INTERNAL_CONSTRUCTOR_TYPE_CLASS_GET_CONSTRUCTOR),
+ new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
+ new Utf8Constant(ClassConstants.CONSTRUCTOR_NAME_CLASS_GET_CONSTRUCTOR),
+ new Utf8Constant(ClassConstants.CONSTRUCTOR_TYPE_CLASS_GET_CONSTRUCTOR),
};
private final Constant[] GET_DECLARED_CONSTRUCTOR_CONSTANTS = new Constant[]
@@ -105,9 +104,9 @@ implements InstructionVisitor,
new MethodrefConstant(1, 2, null, null),
new ClassConstant(3, null),
new NameAndTypeConstant(4, 5),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_LANG_CLASS),
- new Utf8Constant(ClassConstants.INTERNAL_CONSTRUCTOR_NAME_CLASS_GET_DECLARED_CONSTRUCTOR),
- new Utf8Constant(ClassConstants.INTERNAL_CONSTRUCTOR_TYPE_CLASS_GET_DECLARED_CONSTRUCTOR),
+ new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
+ new Utf8Constant(ClassConstants.CONSTRUCTOR_NAME_CLASS_GET_DECLARED_CONSTRUCTOR),
+ new Utf8Constant(ClassConstants.CONSTRUCTOR_TYPE_CLASS_GET_DECLARED_CONSTRUCTOR),
};
private final Constant[] GET_METHOD_CONSTANTS = new Constant[]
@@ -115,9 +114,9 @@ implements InstructionVisitor,
new MethodrefConstant(1, 2, null, null),
new ClassConstant(3, null),
new NameAndTypeConstant(4, 5),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_LANG_CLASS),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_CLASS_GET_METHOD),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_CLASS_GET_METHOD),
+ new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
+ new Utf8Constant(ClassConstants.METHOD_NAME_CLASS_GET_METHOD),
+ new Utf8Constant(ClassConstants.METHOD_TYPE_CLASS_GET_METHOD),
};
private final Constant[] GET_DECLARED_METHOD_CONSTANTS = new Constant[]
@@ -125,9 +124,9 @@ implements InstructionVisitor,
new MethodrefConstant(1, 2, null, null),
new ClassConstant(3, null),
new NameAndTypeConstant(4, 5),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_LANG_CLASS),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_CLASS_GET_DECLARED_METHOD),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_CLASS_GET_DECLARED_METHOD),
+ new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
+ new Utf8Constant(ClassConstants.METHOD_NAME_CLASS_GET_DECLARED_METHOD),
+ new Utf8Constant(ClassConstants.METHOD_TYPE_CLASS_GET_DECLARED_METHOD),
};
private final Constant[] NEW_INTEGER_UPDATER_CONSTANTS = new Constant[]
@@ -135,9 +134,9 @@ implements InstructionVisitor,
new MethodrefConstant(1, 2, null, null),
new ClassConstant(3, null),
new NameAndTypeConstant(4, 5),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_INTEGER_FIELD_UPDATER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_NEW_UPDATER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_NEW_INTEGER_UPDATER),
+ new Utf8Constant(ClassConstants.NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_INTEGER_FIELD_UPDATER),
+ new Utf8Constant(ClassConstants.METHOD_NAME_NEW_UPDATER),
+ new Utf8Constant(ClassConstants.METHOD_TYPE_NEW_INTEGER_UPDATER),
};
private final Constant[] NEW_LONG_UPDATER_CONSTANTS = new Constant[]
@@ -145,9 +144,9 @@ implements InstructionVisitor,
new MethodrefConstant(1, 2, null, null),
new ClassConstant(3, null),
new NameAndTypeConstant(4, 5),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_LONG_FIELD_UPDATER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_NEW_UPDATER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_NEW_LONG_UPDATER),
+ new Utf8Constant(ClassConstants.NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_LONG_FIELD_UPDATER),
+ new Utf8Constant(ClassConstants.METHOD_NAME_NEW_UPDATER),
+ new Utf8Constant(ClassConstants.METHOD_TYPE_NEW_LONG_UPDATER),
};
private final Constant[] NEW_REFERENCE_UPDATER_CONSTANTS = new Constant[]
@@ -155,9 +154,9 @@ implements InstructionVisitor,
new MethodrefConstant(1, 2, null, null),
new ClassConstant(3, null),
new NameAndTypeConstant(4, 5),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_REFERENCE_FIELD_UPDATER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_NEW_UPDATER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_NEW_REFERENCE_UPDATER),
+ new Utf8Constant(ClassConstants.NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_REFERENCE_FIELD_UPDATER),
+ new Utf8Constant(ClassConstants.METHOD_NAME_NEW_UPDATER),
+ new Utf8Constant(ClassConstants.METHOD_TYPE_NEW_REFERENCE_UPDATER),
};
// SomeClass.class.get[Declared]Field("someField").
@@ -549,42 +548,42 @@ implements InstructionVisitor,
// matchGetMember(clazz, method, codeAttribute, offset, instruction,
// cnull, //onstantGetConstructorMatcher0,
// getConstructorMatcher0, false, false,
-// ClassConstants.INTERNAL_METHOD_NAME_INIT, null);
+// ClassConstants.METHOD_NAME_INIT, null);
//
// // Try to match the SomeClass.class.getDeclaredConstructor(new Class[]
// // {}) construct.
// matchGetMember(clazz, method, codeAttribute, offset, instruction,
// null, //constantGetDeclaredConstructorMatcher0,
// getDeclaredConstructorMatcher0, false, true,
-// ClassConstants.INTERNAL_METHOD_NAME_INIT, null);
+// ClassConstants.METHOD_NAME_INIT, null);
// Try to match the SomeClass.class.getConstructor(new Class[]
// { A.class }) construct.
matchGetMember(clazz, method, codeAttribute, offset, instruction,
null, //constantGetConstructorMatcher1,
getConstructorMatcher1, false, false,
- ClassConstants.INTERNAL_METHOD_NAME_INIT, null);
+ ClassConstants.METHOD_NAME_INIT, null);
// Try to match the SomeClass.class.getDeclaredConstructor(new Class[]
// { A.class }) construct.
matchGetMember(clazz, method, codeAttribute, offset, instruction,
null, //constantGetDeclaredConstructorMatcher1,
getDeclaredConstructorMatcher1, false, true,
- ClassConstants.INTERNAL_METHOD_NAME_INIT, null);
+ ClassConstants.METHOD_NAME_INIT, null);
// Try to match the SomeClass.class.getConstructor(new Class[]
// { A.class, B.class }) construct.
matchGetMember(clazz, method, codeAttribute, offset, instruction,
null, //constantGetConstructorMatcher2,
getConstructorMatcher2, false, false,
- ClassConstants.INTERNAL_METHOD_NAME_INIT, null);
+ ClassConstants.METHOD_NAME_INIT, null);
// Try to match the SomeClass.class.getDeclaredConstructor(new Class[]
// { A.class, B.class }) construct.
matchGetMember(clazz, method, codeAttribute, offset, instruction,
null, //constantGetDeclaredConstructorMatcher2,
getDeclaredConstructorMatcher2, false, true,
- ClassConstants.INTERNAL_METHOD_NAME_INIT, null);
+ ClassConstants.METHOD_NAME_INIT, null);
// Try to match the SomeClass.class.getMethod("someMethod", new Class[]
// {}) construct.
@@ -627,14 +626,14 @@ implements InstructionVisitor,
matchGetMember(clazz, method, codeAttribute, offset, instruction,
constantGetIntegerUpdaterMatcher,
getIntegerUpdaterMatcher, true, false, null,
- "" + ClassConstants.INTERNAL_TYPE_INT);
+ "" + ClassConstants.TYPE_INT);
// Try to match the AtomicLongFieldUpdater.newUpdater(
// SomeClass.class, "someField") construct.
matchGetMember(clazz, method, codeAttribute, offset, instruction,
constantGetLongUpdaterMatcher,
getLongUpdaterMatcher, true, false, null,
- "" + ClassConstants.INTERNAL_TYPE_LONG);
+ "" + ClassConstants.TYPE_LONG);
// Try to match the AtomicReferenceFieldUpdater.newUpdater(
// SomeClass.class, SomeClass.class, "someField") construct.
@@ -840,7 +839,7 @@ implements InstructionVisitor,
" accesses a " +
(isDeclared ? "declared " : "") +
(isField ? "field" :
- memberName.equals(ClassConstants.INTERNAL_METHOD_NAME_INIT) ?
+ memberName.equals(ClassConstants.METHOD_NAME_INIT) ?
"constructor" : "method") +
" '" +
externalMemberDescription +
diff --git a/src/proguard/classfile/util/EnumFieldReferenceInitializer.java b/src/proguard/classfile/util/EnumFieldReferenceInitializer.java
index dae6db2..c856893 100644
--- a/src/proguard/classfile/util/EnumFieldReferenceInitializer.java
+++ b/src/proguard/classfile/util/EnumFieldReferenceInitializer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -24,13 +24,12 @@ import proguard.classfile.*;
import proguard.classfile.attribute.CodeAttribute;
import proguard.classfile.attribute.annotation.*;
import proguard.classfile.attribute.annotation.visitor.ElementValueVisitor;
-import proguard.classfile.attribute.visitor.*;
+import proguard.classfile.attribute.visitor.AllAttributeVisitor;
import proguard.classfile.constant.*;
import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.instruction.*;
import proguard.classfile.instruction.visitor.*;
-import proguard.classfile.visitor.*;
-import proguard.util.StringMatcher;
+import proguard.classfile.visitor.MemberVisitor;
/**
* This ElementValueVisitor initializes the field references of the
@@ -44,10 +43,10 @@ implements ElementValueVisitor,
InstructionVisitor,
ConstantVisitor
{
- /*
- private static boolean DEBUG = true;
- /*/
+ //*
private static final boolean DEBUG = false;
+ /*/
+ private static boolean DEBUG = true;
//*/
private MemberVisitor enumFieldFinder = new AllAttributeVisitor(
@@ -80,8 +79,8 @@ implements ElementValueVisitor,
enumTypeName = enumConstantElementValue.getTypeName(clazz);
enumConstantName = enumConstantElementValue.getConstantName(clazz);
referencedEnumField = null;
- referencedEnumClass.methodAccept(ClassConstants.INTERNAL_METHOD_NAME_CLINIT,
- ClassConstants.INTERNAL_METHOD_TYPE_CLINIT,
+ referencedEnumClass.methodAccept(ClassConstants.METHOD_NAME_CLINIT,
+ ClassConstants.METHOD_TYPE_CLINIT,
enumFieldFinder);
// Otherwise try to find the enum field through its name.
diff --git a/src/proguard/classfile/util/ExternalTypeEnumeration.java b/src/proguard/classfile/util/ExternalTypeEnumeration.java
index e5b7067..b96a80e 100644
--- a/src/proguard/classfile/util/ExternalTypeEnumeration.java
+++ b/src/proguard/classfile/util/ExternalTypeEnumeration.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,7 +20,7 @@
*/
package proguard.classfile.util;
-import proguard.classfile.ClassConstants;
+import proguard.classfile.*;
/**
@@ -61,7 +61,7 @@ public class ExternalTypeEnumeration
public void reset()
{
- index = descriptor.indexOf(ClassConstants.EXTERNAL_METHOD_ARGUMENTS_OPEN) + 1;
+ index = descriptor.indexOf(JavaConstants.METHOD_ARGUMENTS_OPEN) + 1;
if (index < 1)
{
@@ -81,13 +81,13 @@ public class ExternalTypeEnumeration
int startIndex = index;
// Find the next separating comma.
- index = descriptor.indexOf(ClassConstants.EXTERNAL_METHOD_ARGUMENTS_SEPARATOR,
+ index = descriptor.indexOf(JavaConstants.METHOD_ARGUMENTS_SEPARATOR,
startIndex);
// Otherwise find the closing parenthesis.
if (index < 0)
{
- index = descriptor.indexOf(ClassConstants.EXTERNAL_METHOD_ARGUMENTS_CLOSE,
+ index = descriptor.indexOf(JavaConstants.METHOD_ARGUMENTS_CLOSE,
startIndex);
if (index < 0)
{
@@ -101,6 +101,6 @@ public class ExternalTypeEnumeration
public String methodName()
{
- return descriptor.substring(0, descriptor.indexOf(ClassConstants.EXTERNAL_METHOD_ARGUMENTS_OPEN)).trim();
+ return descriptor.substring(0, descriptor.indexOf(JavaConstants.METHOD_ARGUMENTS_OPEN)).trim();
}
}
diff --git a/src/proguard/classfile/util/InstructionSequenceMatcher.java b/src/proguard/classfile/util/InstructionSequenceMatcher.java
index 8c529a9..dc021ee 100644
--- a/src/proguard/classfile/util/InstructionSequenceMatcher.java
+++ b/src/proguard/classfile/util/InstructionSequenceMatcher.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -41,12 +41,12 @@ extends SimplifiedVisitor
implements InstructionVisitor,
ConstantVisitor
{
- /*
- public static boolean DEBUG = true;
- public static boolean DEBUG_MORE = true;
- /*/
+ //*
private static final boolean DEBUG = false;
private static final boolean DEBUG_MORE = false;
+ /*/
+ public static boolean DEBUG = true;
+ public static boolean DEBUG_MORE = true;
//*/
public static final int X = 0x40000000;
diff --git a/src/proguard/classfile/util/InternalTypeEnumeration.java b/src/proguard/classfile/util/InternalTypeEnumeration.java
index 9c63ad9..53538d1 100644
--- a/src/proguard/classfile/util/InternalTypeEnumeration.java
+++ b/src/proguard/classfile/util/InternalTypeEnumeration.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -45,8 +45,8 @@ public class InternalTypeEnumeration
public InternalTypeEnumeration(String descriptor)
{
this.descriptor = descriptor;
- this.firstIndex = descriptor.indexOf(ClassConstants.INTERNAL_METHOD_ARGUMENTS_OPEN);
- this.lastIndex = descriptor.indexOf(ClassConstants.INTERNAL_METHOD_ARGUMENTS_CLOSE);
+ this.firstIndex = descriptor.indexOf(ClassConstants.METHOD_ARGUMENTS_OPEN);
+ this.lastIndex = descriptor.indexOf(ClassConstants.METHOD_ARGUMENTS_CLOSE);
this.index = firstIndex + 1;
if (lastIndex < 0)
@@ -57,6 +57,15 @@ public class InternalTypeEnumeration
/**
+ * Returns whether the type is a method signature.
+ */
+ public boolean isMethodSignature()
+ {
+ return firstIndex >= 0;
+ }
+
+
+ /**
* Returns the formal type parameters from the descriptor, assuming it's a
* method descriptor.
*/
@@ -88,13 +97,13 @@ public class InternalTypeEnumeration
char c = descriptor.charAt(index++);
switch (c)
{
- case ClassConstants.INTERNAL_TYPE_CLASS_START:
- case ClassConstants.INTERNAL_TYPE_GENERIC_VARIABLE_START:
+ case ClassConstants.TYPE_CLASS_START:
+ case ClassConstants.TYPE_GENERIC_VARIABLE_START:
{
skipClass();
break;
}
- case ClassConstants.INTERNAL_TYPE_GENERIC_START:
+ case ClassConstants.TYPE_GENERIC_START:
{
skipGeneric();
break;
@@ -119,7 +128,7 @@ public class InternalTypeEnumeration
private void skipArray()
{
- while (descriptor.charAt(index) == ClassConstants.INTERNAL_TYPE_ARRAY)
+ while (descriptor.charAt(index) == ClassConstants.TYPE_ARRAY)
{
index++;
}
@@ -133,11 +142,11 @@ public class InternalTypeEnumeration
char c = descriptor.charAt(index++);
switch (c)
{
- case ClassConstants.INTERNAL_TYPE_GENERIC_START:
+ case ClassConstants.TYPE_GENERIC_START:
skipGeneric();
break;
- case ClassConstants.INTERNAL_TYPE_CLASS_END:
+ case ClassConstants.TYPE_CLASS_END:
return;
}
}
@@ -153,11 +162,11 @@ public class InternalTypeEnumeration
char c = descriptor.charAt(index++);
switch (c)
{
- case ClassConstants.INTERNAL_TYPE_GENERIC_START:
+ case ClassConstants.TYPE_GENERIC_START:
nestingLevel++;
break;
- case ClassConstants.INTERNAL_TYPE_GENERIC_END:
+ case ClassConstants.TYPE_GENERIC_END:
nestingLevel--;
break;
}
diff --git a/src/proguard/classfile/util/MemberFinder.java b/src/proguard/classfile/util/MemberFinder.java
index 36c0003..dc2724e 100644
--- a/src/proguard/classfile/util/MemberFinder.java
+++ b/src/proguard/classfile/util/MemberFinder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -126,7 +126,7 @@ implements MemberVisitor
clazz.hierarchyAccept(false, false, false, true,
new NamedMethodVisitor(name, descriptor,
- new MemberAccessFilter(0, ClassConstants.INTERNAL_ACC_PRIVATE, this)));
+ new MemberAccessFilter(0, ClassConstants.ACC_PRIVATE, this)));
}
catch (MemberFoundException ex)
{
@@ -155,7 +155,7 @@ implements MemberVisitor
this.member = null;
clazz.hierarchyAccept(false, false, false, true,
new NamedFieldVisitor(name, descriptor,
- new MemberAccessFilter(0, ClassConstants.INTERNAL_ACC_PRIVATE, this)));
+ new MemberAccessFilter(0, ClassConstants.ACC_PRIVATE, this)));
}
catch (MemberFoundException ex)
{
diff --git a/src/proguard/classfile/util/MethodLinker.java b/src/proguard/classfile/util/MethodLinker.java
index 56b6723..4b4afa2 100644
--- a/src/proguard/classfile/util/MethodLinker.java
+++ b/src/proguard/classfile/util/MethodLinker.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -51,7 +51,7 @@ implements ClassVisitor,
// Collect all non-private members in this class hierarchy.
clazz.hierarchyAccept(true, true, true, false,
new AllMethodVisitor(
- new MemberAccessFilter(0, ClassConstants.INTERNAL_ACC_PRIVATE | ClassConstants.INTERNAL_ACC_STATIC,
+ new MemberAccessFilter(0, ClassConstants.ACC_PRIVATE | ClassConstants.ACC_STATIC,
this)));
// Clean up for the next class hierarchy.
@@ -69,8 +69,7 @@ implements ClassVisitor,
// Special cases: <clinit> and <init> are always kept unchanged.
// We can ignore them here.
- if (name.equals(ClassConstants.INTERNAL_METHOD_NAME_CLINIT) ||
- name.equals(ClassConstants.INTERNAL_METHOD_NAME_INIT))
+ if (ClassUtil.isInitializer(name))
{
return;
}
diff --git a/src/proguard/classfile/util/SimplifiedVisitor.java b/src/proguard/classfile/util/SimplifiedVisitor.java
index aed46eb..e662061 100644
--- a/src/proguard/classfile/util/SimplifiedVisitor.java
+++ b/src/proguard/classfile/util/SimplifiedVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -23,6 +23,7 @@ package proguard.classfile.util;
import proguard.classfile.*;
import proguard.classfile.attribute.*;
import proguard.classfile.attribute.annotation.*;
+import proguard.classfile.attribute.annotation.target.*;
import proguard.classfile.attribute.preverification.*;
import proguard.classfile.constant.*;
import proguard.classfile.instruction.*;
@@ -357,6 +358,12 @@ public abstract class SimplifiedVisitor
}
+ public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute)
+ {
+ visitAnyAttribute(clazz, methodParametersAttribute);
+ }
+
+
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
visitAnyAttribute(clazz, exceptionsAttribute);
@@ -483,6 +490,81 @@ public abstract class SimplifiedVisitor
}
+ /**
+ * Visits any type of TypeAnnotationsAttribute of a class.
+ */
+ public void visitAnyTypeAnnotationsAttribute(Clazz clazz, TypeAnnotationsAttribute typeAnnotationsAttribute)
+ {
+ visitAnyAnnotationsAttribute(clazz, typeAnnotationsAttribute);
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ visitAnyTypeAnnotationsAttribute(clazz, runtimeVisibleTypeAnnotationsAttribute);
+ }
+
+
+ /**
+ * Visits the given RuntimeVisibleTypeAnnotationsAttribute of any type of class member.
+ */
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Member member, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ visitRuntimeVisibleTypeAnnotationsAttribute(clazz, runtimeVisibleTypeAnnotationsAttribute);
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ visitRuntimeVisibleTypeAnnotationsAttribute(clazz, (Member)field, runtimeVisibleTypeAnnotationsAttribute);
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ visitRuntimeVisibleTypeAnnotationsAttribute(clazz, (Member)method, runtimeVisibleTypeAnnotationsAttribute);
+ }
+
+
+ public void visitRuntimeVisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute)
+ {
+ visitRuntimeVisibleTypeAnnotationsAttribute(clazz, method, runtimeVisibleTypeAnnotationsAttribute);
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ visitAnyTypeAnnotationsAttribute(clazz, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+
+
+ /**
+ * Visits the given RuntimeInvisibleTypeAnnotationsAttribute of any type of class member.
+ */
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Member member, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Field field, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, (Member)field, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, (Member)method, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+
+
+ public void visitRuntimeInvisibleTypeAnnotationsAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, RuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute)
+ {
+ visitRuntimeInvisibleTypeAnnotationsAttribute(clazz, method, runtimeInvisibleTypeAnnotationsAttribute);
+ }
+
+
public void visitAnnotationDefaultAttribute(Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute)
{
visitAnyAttribute(clazz, annotationDefaultAttribute);
@@ -795,8 +877,206 @@ public abstract class SimplifiedVisitor
}
+ public void visitAnnotation(Clazz clazz, Method method, CodeAttribute codeAttribute, Annotation annotation)
+ {
+ visitAnnotation(clazz, method, annotation);
+ }
+
+
+ // Simplifications for TypeAnnotationVisitor.
+
+ public void visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation)
+ {
+ throw new UnsupportedOperationException("Method must be overridden in ["+this.getClass().getName()+"] if ever called");
+ }
+
+
+ /**
+ * Visits the given TypeAnnotation of any type of class member.
+ */
+ public void visitTypeAnnotation(Clazz clazz, Member member, TypeAnnotation typeAnnotation)
+ {
+ visitTypeAnnotation(clazz, typeAnnotation);
+ }
+
+
+ public void visitTypeAnnotation(Clazz clazz, Field field, TypeAnnotation typeAnnotation)
+ {
+ visitTypeAnnotation(clazz, (Member)field, typeAnnotation);
+ }
+
+
+ public void visitTypeAnnotation(Clazz clazz, Method method, TypeAnnotation typeAnnotation)
+ {
+ visitTypeAnnotation(clazz, (Member)method, typeAnnotation);
+ }
+
+
+ public void visitTypeAnnotation(Clazz clazz, Method method, int parameterIndex, TypeAnnotation typeAnnotation)
+ {
+ visitTypeAnnotation(clazz, method, typeAnnotation);
+ }
+
+
+ public void visitTypeAnnotation(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation)
+ {
+ visitTypeAnnotation(clazz, method, typeAnnotation);
+ }
+
+
+ // Simplifications for TargetInfoVisitor.
+
+ /**
+ * Visits any type of TargetInfo.
+ */
+ public void visitAnyTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfo targetInfo)
+ {
+ throw new UnsupportedOperationException("Method must be overridden in ["+this.getClass().getName()+"] if ever called");
+ }
+
+
+ public void visitTypeParameterTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterTargetInfo typeParameterTargetInfo)
+ {
+ visitAnyTargetInfo(clazz, typeAnnotation, typeParameterTargetInfo);
+ }
+
+
+ public void visitTypeParameterTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TypeParameterTargetInfo typeParameterTargetInfo)
+ {
+ visitTypeParameterTargetInfo(clazz, typeAnnotation, typeParameterTargetInfo);
+ }
+
+
+ public void visitSuperTypeTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, SuperTypeTargetInfo superTypeTargetInfo)
+ {
+ visitAnyTargetInfo(clazz, typeAnnotation, superTypeTargetInfo);
+ }
+
+
+ public void visitTypeParameterBoundTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo)
+ {
+ visitAnyTargetInfo(clazz, typeAnnotation, typeParameterBoundTargetInfo);
+ }
+
+
+ /**
+ * Visits the given TypeParameterBoundTargetInfo of any type of class member.
+ */
+ public void visitTypeParameterBoundTargetInfo(Clazz clazz, Member member, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo)
+ {
+ visitTypeParameterBoundTargetInfo(clazz, typeAnnotation, typeParameterBoundTargetInfo);
+ }
+
+
+ public void visitTypeParameterBoundTargetInfo(Clazz clazz, Field field, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo)
+ {
+ visitTypeParameterBoundTargetInfo(clazz, (Member)field, typeAnnotation, typeParameterBoundTargetInfo);
+ }
+
+
+ public void visitTypeParameterBoundTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo)
+ {
+ visitTypeParameterBoundTargetInfo(clazz, (Member)method, typeAnnotation, typeParameterBoundTargetInfo);
+ }
+
+
+ /**
+ * Visits the given EmptyTargetInfo of any type of class member.
+ */
+ public void visitEmptyTargetInfo(Clazz clazz, Member member, TypeAnnotation typeAnnotation, EmptyTargetInfo emptyTargetInfo)
+ {
+ visitAnyTargetInfo(clazz, typeAnnotation, emptyTargetInfo);
+ }
+
+
+ public void visitEmptyTargetInfo(Clazz clazz, Field field, TypeAnnotation typeAnnotation, EmptyTargetInfo emptyTargetInfo)
+ {
+ visitEmptyTargetInfo(clazz, (Member)field, typeAnnotation, emptyTargetInfo);
+ }
+
+
+ public void visitEmptyTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, EmptyTargetInfo emptyTargetInfo)
+ {
+ visitEmptyTargetInfo(clazz, (Member)method, typeAnnotation, emptyTargetInfo);
+ }
+
+
+ public void visitFormalParameterTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, FormalParameterTargetInfo formalParameterTargetInfo)
+ {
+ visitAnyTargetInfo(clazz, typeAnnotation, formalParameterTargetInfo);
+ }
+
+
+ public void visitThrowsTargetInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, ThrowsTargetInfo throwsTargetInfo)
+ {
+ visitAnyTargetInfo(clazz, typeAnnotation, throwsTargetInfo);
+ }
+
+
+ public void visitLocalVariableTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo)
+ {
+ visitAnyTargetInfo(clazz, typeAnnotation, localVariableTargetInfo);
+ }
+
+
+ public void visitCatchTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, CatchTargetInfo catchTargetInfo)
+ {
+ visitAnyTargetInfo(clazz, typeAnnotation, catchTargetInfo);
+ }
+
+
+ public void visitOffsetTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, OffsetTargetInfo offsetTargetInfo)
+ {
+ visitAnyTargetInfo(clazz, typeAnnotation, offsetTargetInfo);
+ }
+
+
+ public void visitTypeArgumentTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TypeArgumentTargetInfo typeArgumentTargetInfo)
+ {
+ visitAnyTargetInfo(clazz, typeAnnotation, typeArgumentTargetInfo);
+ }
+
+
+ // Simplifications for TypePathInfoVisitor.
+
+ public void visitTypePathInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo)
+ {
+ throw new UnsupportedOperationException("Method must be overridden in ["+this.getClass().getName()+"] if ever called");
+ }
+
+
+ /**
+ * Visits the given TypePathInfo of any type of class member.
+ */
+ public void visitTypePathInfo(Clazz clazz, Member member, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo)
+ {
+ visitTypePathInfo(clazz, typeAnnotation, typePathInfo);
+ }
+
+
+ public void visitTypePathInfo(Clazz clazz, Field field, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo)
+ {
+ visitTypePathInfo(clazz, (Member)field, typeAnnotation, typePathInfo);
+ }
+
+
+ public void visitTypePathInfo(Clazz clazz, Method method, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo)
+ {
+ visitTypePathInfo(clazz, (Member)method, typeAnnotation, typePathInfo);
+ }
+
+
+ public void visitTypePathInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TypePathInfo typePathInfo)
+ {
+ visitTypePathInfo(clazz, method, typeAnnotation, typePathInfo);
+ }
+
+
// Simplifications for ElementValueVisitor.
+ /**
+ * Visits any type of ElementValue.
+ */
public void visitAnyElementValue(Clazz clazz, Annotation annotation, ElementValue elementValue)
{
throw new UnsupportedOperationException("Method must be overridden in ["+this.getClass().getName()+"] if ever called");
diff --git a/src/proguard/classfile/util/StringReferenceInitializer.java b/src/proguard/classfile/util/StringReferenceInitializer.java
index f00f0d3..4d96aa4 100644
--- a/src/proguard/classfile/util/StringReferenceInitializer.java
+++ b/src/proguard/classfile/util/StringReferenceInitializer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/util/StringSharer.java b/src/proguard/classfile/util/StringSharer.java
index dacb2d1..5ef231e 100644
--- a/src/proguard/classfile/util/StringSharer.java
+++ b/src/proguard/classfile/util/StringSharer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/util/WarningPrinter.java b/src/proguard/classfile/util/WarningPrinter.java
index 39172dd..4f5c477 100644
--- a/src/proguard/classfile/util/WarningPrinter.java
+++ b/src/proguard/classfile/util/WarningPrinter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/AllClassVisitor.java b/src/proguard/classfile/visitor/AllClassVisitor.java
index 5c6f3de..20c6349 100644
--- a/src/proguard/classfile/visitor/AllClassVisitor.java
+++ b/src/proguard/classfile/visitor/AllClassVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/AllFieldVisitor.java b/src/proguard/classfile/visitor/AllFieldVisitor.java
index 92c4b05..1860202 100644
--- a/src/proguard/classfile/visitor/AllFieldVisitor.java
+++ b/src/proguard/classfile/visitor/AllFieldVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/AllMemberVisitor.java b/src/proguard/classfile/visitor/AllMemberVisitor.java
index ab26bf3..c73df62 100644
--- a/src/proguard/classfile/visitor/AllMemberVisitor.java
+++ b/src/proguard/classfile/visitor/AllMemberVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/AllMethodVisitor.java b/src/proguard/classfile/visitor/AllMethodVisitor.java
index 5d8e6a3..a5d97e7 100644
--- a/src/proguard/classfile/visitor/AllMethodVisitor.java
+++ b/src/proguard/classfile/visitor/AllMethodVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/BottomClassFilter.java b/src/proguard/classfile/visitor/BottomClassFilter.java
index e094ce3..cf3244e 100644
--- a/src/proguard/classfile/visitor/BottomClassFilter.java
+++ b/src/proguard/classfile/visitor/BottomClassFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ClassAccessFilter.java b/src/proguard/classfile/visitor/ClassAccessFilter.java
index 1855662..09af6d9 100644
--- a/src/proguard/classfile/visitor/ClassAccessFilter.java
+++ b/src/proguard/classfile/visitor/ClassAccessFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ClassCleaner.java b/src/proguard/classfile/visitor/ClassCleaner.java
index a7ad1f6..bf20866 100644
--- a/src/proguard/classfile/visitor/ClassCleaner.java
+++ b/src/proguard/classfile/visitor/ClassCleaner.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -43,11 +43,16 @@ implements ClassVisitor,
ConstantVisitor,
MemberVisitor,
AttributeVisitor,
+ BootstrapMethodInfoVisitor,
ExceptionInfoVisitor,
InnerClassesInfoVisitor,
StackMapFrameVisitor,
VerificationTypeVisitor,
+ ParameterInfoVisitor,
+ LocalVariableInfoVisitor,
+ LocalVariableTypeInfoVisitor,
AnnotationVisitor,
+ TypeAnnotationVisitor,
ElementValueVisitor
{
// Implementations for ClassVisitor.
@@ -106,6 +111,14 @@ implements ClassVisitor,
}
+ public void visitBootstrapMethodsAttribute(Clazz clazz, BootstrapMethodsAttribute bootstrapMethodsAttribute)
+ {
+ clean(bootstrapMethodsAttribute);
+
+ bootstrapMethodsAttribute.bootstrapMethodEntriesAccept(clazz, this);
+ }
+
+
public void visitInnerClassesAttribute(Clazz clazz, InnerClassesAttribute innerClassesAttribute)
{
clean(innerClassesAttribute);
@@ -114,6 +127,14 @@ implements ClassVisitor,
}
+ 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);
@@ -147,6 +168,22 @@ implements ClassVisitor,
}
+ 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);
@@ -163,6 +200,14 @@ implements ClassVisitor,
}
+ public void visitAnyTypeAnnotationsAttribute(Clazz clazz, TypeAnnotationsAttribute typeAnnotationsAttribute)
+ {
+ clean(typeAnnotationsAttribute);
+
+ typeAnnotationsAttribute.typeAnnotationsAccept(clazz, this);
+ }
+
+
public void visitAnnotationDefaultAttribute(Clazz clazz, Method method, AnnotationDefaultAttribute annotationDefaultAttribute)
{
clean(annotationDefaultAttribute);
@@ -171,6 +216,14 @@ implements ClassVisitor,
}
+ // Implementations for BootstrapMethodInfoVisitor.
+
+ public void visitBootstrapMethodInfo(Clazz clazz, BootstrapMethodInfo bootstrapMethodInfo)
+ {
+ clean(bootstrapMethodInfo);
+ }
+
+
// Implementations for InnerClassesInfoVisitor.
public void visitInnerClassesInfo(Clazz clazz, InnerClassesInfo innerClassesInfo)
@@ -234,6 +287,30 @@ implements ClassVisitor,
}
+ // 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)
@@ -244,6 +321,18 @@ implements ClassVisitor,
}
+ // 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)
diff --git a/src/proguard/classfile/visitor/ClassCollector.java b/src/proguard/classfile/visitor/ClassCollector.java
index a24bb0b..05bb23b 100644
--- a/src/proguard/classfile/visitor/ClassCollector.java
+++ b/src/proguard/classfile/visitor/ClassCollector.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ClassCounter.java b/src/proguard/classfile/visitor/ClassCounter.java
index b6deef2..835f0bd 100644
--- a/src/proguard/classfile/visitor/ClassCounter.java
+++ b/src/proguard/classfile/visitor/ClassCounter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ClassHierarchyTraveler.java b/src/proguard/classfile/visitor/ClassHierarchyTraveler.java
index 38ba3d6..d459719 100644
--- a/src/proguard/classfile/visitor/ClassHierarchyTraveler.java
+++ b/src/proguard/classfile/visitor/ClassHierarchyTraveler.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ClassNameFilter.java b/src/proguard/classfile/visitor/ClassNameFilter.java
index bd66eb1..3415faa 100644
--- a/src/proguard/classfile/visitor/ClassNameFilter.java
+++ b/src/proguard/classfile/visitor/ClassNameFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ClassPoolFiller.java b/src/proguard/classfile/visitor/ClassPoolFiller.java
index ae234be..bd66a7d 100644
--- a/src/proguard/classfile/visitor/ClassPoolFiller.java
+++ b/src/proguard/classfile/visitor/ClassPoolFiller.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ClassPoolVisitor.java b/src/proguard/classfile/visitor/ClassPoolVisitor.java
index 821304a..a91a69d 100644
--- a/src/proguard/classfile/visitor/ClassPoolVisitor.java
+++ b/src/proguard/classfile/visitor/ClassPoolVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ClassPresenceFilter.java b/src/proguard/classfile/visitor/ClassPresenceFilter.java
index 0c55d1d..42df828 100644
--- a/src/proguard/classfile/visitor/ClassPresenceFilter.java
+++ b/src/proguard/classfile/visitor/ClassPresenceFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ClassPrinter.java b/src/proguard/classfile/visitor/ClassPrinter.java
index 3121e58..9af8f75 100644
--- a/src/proguard/classfile/visitor/ClassPrinter.java
+++ b/src/proguard/classfile/visitor/ClassPrinter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -23,6 +23,8 @@ 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.*;
@@ -54,9 +56,14 @@ implements ClassVisitor,
StackMapFrameVisitor,
VerificationTypeVisitor,
LineNumberInfoVisitor,
+ ParameterInfoVisitor,
LocalVariableInfoVisitor,
LocalVariableTypeInfoVisitor,
AnnotationVisitor,
+ TypeAnnotationVisitor,
+ TargetInfoVisitor,
+ LocalVariableTargetElementVisitor,
+ TypePathInfoVisitor,
ElementValueVisitor,
InstructionVisitor
{
@@ -100,10 +107,10 @@ implements ClassVisitor,
println(" = target " + ClassUtil.externalClassVersion(programClass.u4version));
println("Access flags: 0x" + Integer.toHexString(programClass.u2accessFlags));
println(" = " +
- ((programClass.u2accessFlags & ClassConstants.INTERNAL_ACC_ANNOTATTION) != 0 ? "@ " : "") +
+ ((programClass.u2accessFlags & ClassConstants.ACC_ANNOTATTION) != 0 ? "@ " : "") +
ClassUtil.externalClassAccessFlags(programClass.u2accessFlags) +
- ((programClass.u2accessFlags & ClassConstants.INTERNAL_ACC_ENUM) != 0 ? "enum " :
- (programClass.u2accessFlags & ClassConstants.INTERNAL_ACC_INTERFACE) == 0 ? "class " :
+ ((programClass.u2accessFlags & ClassConstants.ACC_ENUM) != 0 ? "enum " :
+ (programClass.u2accessFlags & ClassConstants.ACC_INTERFACE) == 0 ? "class " :
"") +
ClassUtil.externalClassName(programClass.getName()) +
(programClass.u2superClass == 0 ? "" : " extends " +
@@ -152,10 +159,10 @@ implements ClassVisitor,
println("Superclass: " + libraryClass.getSuperName());
println("Access flags: 0x" + Integer.toHexString(libraryClass.u2accessFlags));
println(" = " +
- ((libraryClass.u2accessFlags & ClassConstants.INTERNAL_ACC_ANNOTATTION) != 0 ? "@ " : "") +
+ ((libraryClass.u2accessFlags & ClassConstants.ACC_ANNOTATTION) != 0 ? "@ " : "") +
ClassUtil.externalClassAccessFlags(libraryClass.u2accessFlags) +
- ((libraryClass.u2accessFlags & ClassConstants.INTERNAL_ACC_ENUM) != 0 ? "enum " :
- (libraryClass.u2accessFlags & ClassConstants.INTERNAL_ACC_INTERFACE) == 0 ? "class " :
+ ((libraryClass.u2accessFlags & ClassConstants.ACC_ENUM) != 0 ? "enum " :
+ (libraryClass.u2accessFlags & ClassConstants.ACC_INTERFACE) == 0 ? "class " :
"") +
ClassUtil.externalClassName(libraryClass.getName()) +
(libraryClass.getSuperName() == null ? "" : " extends " +
@@ -214,7 +221,7 @@ implements ClassVisitor,
public void visitStringConstant(Clazz clazz, StringConstant stringConstant)
{
println(visitorInfo(stringConstant) + " String [" +
- clazz.getString(stringConstant.u2stringIndex) + "]");
+ stringConstant.getString(clazz) + "]");
}
@@ -275,22 +282,22 @@ implements ClassVisitor,
public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
{
println(visitorInfo(classConstant) + " Class [" +
- clazz.getString(classConstant.u2nameIndex) + "]");
+ classConstant.getName(clazz) + "]");
}
public void visitMethodTypeConstant(Clazz clazz, MethodTypeConstant methodTypeConstant)
{
println(visitorInfo(methodTypeConstant) + " MethodType [" +
- clazz.getString(methodTypeConstant.u2descriptorIndex) + "]");
+ methodTypeConstant.getType(clazz) + "]");
}
public void visitNameAndTypeConstant(Clazz clazz, NameAndTypeConstant nameAndTypeConstant)
{
println(visitorInfo(nameAndTypeConstant) + " NameAndType [" +
- clazz.getString(nameAndTypeConstant.u2nameIndex) + " " +
- clazz.getString(nameAndTypeConstant.u2descriptorIndex) + "]");
+ nameAndTypeConstant.getName(clazz) + " " +
+ nameAndTypeConstant.getType(clazz) + "]");
}
@@ -387,7 +394,7 @@ implements ClassVisitor,
public void visitUnknownAttribute(Clazz clazz, UnknownAttribute unknownAttribute)
{
println(visitorInfo(unknownAttribute) +
- " Unknown attribute (" + clazz.getString(unknownAttribute.u2attributeNameIndex) + ")");
+ " Unknown attribute (" + unknownAttribute.getAttributeName(clazz) + ")");
}
@@ -485,6 +492,17 @@ implements ClassVisitor,
}
+ 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) +
@@ -606,7 +624,7 @@ implements ClassVisitor,
public void visitRuntimeVisibleParameterAnnotationsAttribute(Clazz clazz, Method method, RuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute)
{
println(visitorInfo(runtimeVisibleParameterAnnotationsAttribute) +
- " Runtime visible parameter annotations attribute (parameter count = " + runtimeVisibleParameterAnnotationsAttribute.u2parametersCount + "):");
+ " Runtime visible parameter annotations attribute (parameter count = " + runtimeVisibleParameterAnnotationsAttribute.u1parametersCount + "):");
indent();
runtimeVisibleParameterAnnotationsAttribute.annotationsAccept(clazz, method, this);
@@ -617,7 +635,7 @@ implements ClassVisitor,
public void visitRuntimeInvisibleParameterAnnotationsAttribute(Clazz clazz, Method method, RuntimeInvisibleParameterAnnotationsAttribute runtimeInvisibleParameterAnnotationsAttribute)
{
println(visitorInfo(runtimeInvisibleParameterAnnotationsAttribute) +
- " Runtime invisible parameter annotations attribute (parameter count = " + runtimeInvisibleParameterAnnotationsAttribute.u2parametersCount + "):");
+ " Runtime invisible parameter annotations attribute (parameter count = " + runtimeInvisibleParameterAnnotationsAttribute.u1parametersCount + "):");
indent();
runtimeInvisibleParameterAnnotationsAttribute.annotationsAccept(clazz, method, this);
@@ -625,6 +643,28 @@ implements ClassVisitor,
}
+ 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) +
@@ -870,6 +910,16 @@ implements ClassVisitor,
}
+ // 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)
@@ -877,8 +927,8 @@ implements ClassVisitor,
println("v" + localVariableInfo.u2index + ": " +
localVariableInfo.u2startPC + " -> " +
(localVariableInfo.u2startPC + localVariableInfo.u2length) + " [" +
- clazz.getString(localVariableInfo.u2descriptorIndex) + " " +
- clazz.getString(localVariableInfo.u2nameIndex) + "]");
+ localVariableInfo.getDescriptor(clazz) + " " +
+ localVariableInfo.getName(clazz) + "]");
}
@@ -889,8 +939,8 @@ implements ClassVisitor,
println("v" + localVariableTypeInfo.u2index + ": " +
localVariableTypeInfo.u2startPC + " -> " +
(localVariableTypeInfo.u2startPC + localVariableTypeInfo.u2length) + " [" +
- clazz.getString(localVariableTypeInfo.u2signatureIndex) + " " +
- clazz.getString(localVariableTypeInfo.u2nameIndex) + "]");
+ localVariableTypeInfo.getSignature(clazz) + " " +
+ localVariableTypeInfo.getName(clazz) + "]");
}
@@ -899,7 +949,7 @@ implements ClassVisitor,
public void visitAnnotation(Clazz clazz, Annotation annotation)
{
println(visitorInfo(annotation) +
- " Annotation [" + clazz.getString(annotation.u2typeIndex) + "]:");
+ " Annotation [" + annotation.getType(clazz) + "]:");
indent();
annotation.elementValuesAccept(clazz, this);
@@ -907,6 +957,126 @@ implements ClassVisitor,
}
+ // 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)
@@ -914,7 +1084,7 @@ implements ClassVisitor,
println(visitorInfo(constantElementValue) +
" Constant element value [" +
(constantElementValue.u2elementNameIndex == 0 ? "(default)" :
- clazz.getString(constantElementValue.u2elementNameIndex)) + " '" +
+ constantElementValue.getMethodName(clazz)) + " '" +
constantElementValue.u1tag + "']");
indent();
@@ -928,9 +1098,9 @@ implements ClassVisitor,
println(visitorInfo(enumConstantElementValue) +
" Enum constant element value [" +
(enumConstantElementValue.u2elementNameIndex == 0 ? "(default)" :
- clazz.getString(enumConstantElementValue.u2elementNameIndex)) + ", " +
- clazz.getString(enumConstantElementValue.u2typeNameIndex) + ", " +
- clazz.getString(enumConstantElementValue.u2constantNameIndex) + "]");
+ enumConstantElementValue.getMethodName(clazz)) + ", " +
+ enumConstantElementValue.getTypeName(clazz) + ", " +
+ enumConstantElementValue.getConstantName(clazz) + "]");
}
@@ -939,8 +1109,8 @@ implements ClassVisitor,
println(visitorInfo(classElementValue) +
" Class element value [" +
(classElementValue.u2elementNameIndex == 0 ? "(default)" :
- clazz.getString(classElementValue.u2elementNameIndex)) + ", " +
- clazz.getString(classElementValue.u2classInfoIndex) + "]");
+ classElementValue.getMethodName(clazz)) + ", " +
+ classElementValue.getClassName(clazz) + "]");
}
@@ -949,7 +1119,7 @@ implements ClassVisitor,
println(visitorInfo(annotationElementValue) +
" Annotation element value [" +
(annotationElementValue.u2elementNameIndex == 0 ? "(default)" :
- clazz.getString(annotationElementValue.u2elementNameIndex)) + "]:");
+ annotationElementValue.getMethodName(clazz)) + "]:");
indent();
annotationElementValue.annotationAccept(clazz, this);
@@ -962,7 +1132,7 @@ implements ClassVisitor,
println(visitorInfo(arrayElementValue) +
" Array element value [" +
(arrayElementValue.u2elementNameIndex == 0 ? "(default)" :
- clazz.getString(arrayElementValue.u2elementNameIndex)) + "]:");
+ arrayElementValue.getMethodName(clazz)) + "]:");
indent();
arrayElementValue.elementValuesAccept(clazz, annotation, this);
diff --git a/src/proguard/classfile/visitor/ClassVersionFilter.java b/src/proguard/classfile/visitor/ClassVersionFilter.java
index 73bcc6a..0b80b10 100644
--- a/src/proguard/classfile/visitor/ClassVersionFilter.java
+++ b/src/proguard/classfile/visitor/ClassVersionFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ClassVersionSetter.java b/src/proguard/classfile/visitor/ClassVersionSetter.java
index d3f0183..3caf045 100644
--- a/src/proguard/classfile/visitor/ClassVersionSetter.java
+++ b/src/proguard/classfile/visitor/ClassVersionSetter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ClassVisitor.java b/src/proguard/classfile/visitor/ClassVisitor.java
index c423446..979b822 100644
--- a/src/proguard/classfile/visitor/ClassVisitor.java
+++ b/src/proguard/classfile/visitor/ClassVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ConcreteClassDownTraveler.java b/src/proguard/classfile/visitor/ConcreteClassDownTraveler.java
index 0b971f0..d82a674 100644
--- a/src/proguard/classfile/visitor/ConcreteClassDownTraveler.java
+++ b/src/proguard/classfile/visitor/ConcreteClassDownTraveler.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -53,8 +53,8 @@ implements ClassVisitor
{
// Is this an abstract class or an interface?
if ((programClass.getAccessFlags() &
- (ClassConstants.INTERNAL_ACC_INTERFACE |
- ClassConstants.INTERNAL_ACC_ABSTRACT)) != 0)
+ (ClassConstants.ACC_INTERFACE |
+ ClassConstants.ACC_ABSTRACT)) != 0)
{
// Travel down the hierarchy.
Clazz[] subClasses = programClass.subClasses;
@@ -78,8 +78,8 @@ implements ClassVisitor
{
// Is this an abstract class or interface?
if ((libraryClass.getAccessFlags() &
- (ClassConstants.INTERNAL_ACC_INTERFACE |
- ClassConstants.INTERNAL_ACC_ABSTRACT)) != 0)
+ (ClassConstants.ACC_INTERFACE |
+ ClassConstants.ACC_ABSTRACT)) != 0)
{
// Travel down the hierarchy.
Clazz[] subClasses = libraryClass.subClasses;
diff --git a/src/proguard/classfile/visitor/DotClassClassVisitor.java b/src/proguard/classfile/visitor/DotClassClassVisitor.java
index 979f846..5960ef6 100644
--- a/src/proguard/classfile/visitor/DotClassClassVisitor.java
+++ b/src/proguard/classfile/visitor/DotClassClassVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/DynamicReturnedClassVisitor.java b/src/proguard/classfile/visitor/DynamicReturnedClassVisitor.java
new file mode 100644
index 0000000..f9ac3cb
--- /dev/null
+++ b/src/proguard/classfile/visitor/DynamicReturnedClassVisitor.java
@@ -0,0 +1,68 @@
+/*
+ * 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
index 25c6e68..b216ba7 100644
--- a/src/proguard/classfile/visitor/ExceptClassFilter.java
+++ b/src/proguard/classfile/visitor/ExceptClassFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ExceptClassesFilter.java b/src/proguard/classfile/visitor/ExceptClassesFilter.java
index bdf72bd..acc758c 100644
--- a/src/proguard/classfile/visitor/ExceptClassesFilter.java
+++ b/src/proguard/classfile/visitor/ExceptClassesFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ExceptionCounter.java b/src/proguard/classfile/visitor/ExceptionCounter.java
index 5c476b6..a3071a6 100644
--- a/src/proguard/classfile/visitor/ExceptionCounter.java
+++ b/src/proguard/classfile/visitor/ExceptionCounter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ExceptionExcludedOffsetFilter.java b/src/proguard/classfile/visitor/ExceptionExcludedOffsetFilter.java
index 2fd18ae..c7b05db 100644
--- a/src/proguard/classfile/visitor/ExceptionExcludedOffsetFilter.java
+++ b/src/proguard/classfile/visitor/ExceptionExcludedOffsetFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ExceptionHandlerConstantVisitor.java b/src/proguard/classfile/visitor/ExceptionHandlerConstantVisitor.java
index de7139b..3a08892 100644
--- a/src/proguard/classfile/visitor/ExceptionHandlerConstantVisitor.java
+++ b/src/proguard/classfile/visitor/ExceptionHandlerConstantVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,9 +21,9 @@
package proguard.classfile.visitor;
import proguard.classfile.*;
-import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.attribute.*;
import proguard.classfile.attribute.visitor.ExceptionInfoVisitor;
+import proguard.classfile.constant.visitor.ConstantVisitor;
/**
* This <code>ExceptionInfoVisitor</code> lets a given
diff --git a/src/proguard/classfile/visitor/ExceptionHandlerFilter.java b/src/proguard/classfile/visitor/ExceptionHandlerFilter.java
index 36ead5e..25df0ac 100644
--- a/src/proguard/classfile/visitor/ExceptionHandlerFilter.java
+++ b/src/proguard/classfile/visitor/ExceptionHandlerFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ExceptionOffsetFilter.java b/src/proguard/classfile/visitor/ExceptionOffsetFilter.java
index c84473a..babee27 100644
--- a/src/proguard/classfile/visitor/ExceptionOffsetFilter.java
+++ b/src/proguard/classfile/visitor/ExceptionOffsetFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ExceptionRangeFilter.java b/src/proguard/classfile/visitor/ExceptionRangeFilter.java
index 626a32e..9ce10ef 100644
--- a/src/proguard/classfile/visitor/ExceptionRangeFilter.java
+++ b/src/proguard/classfile/visitor/ExceptionRangeFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ImplementedClassConstantFilter.java b/src/proguard/classfile/visitor/ImplementedClassConstantFilter.java
index 334b85f..ac05841 100644
--- a/src/proguard/classfile/visitor/ImplementedClassConstantFilter.java
+++ b/src/proguard/classfile/visitor/ImplementedClassConstantFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,9 +20,9 @@
*/
package proguard.classfile.visitor;
-import proguard.classfile.*;
-import proguard.classfile.constant.visitor.ConstantVisitor;
+import proguard.classfile.Clazz;
import proguard.classfile.constant.ClassConstant;
+import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.util.SimplifiedVisitor;
/**
diff --git a/src/proguard/classfile/visitor/ImplementedClassFilter.java b/src/proguard/classfile/visitor/ImplementedClassFilter.java
index abbacfb..accbb6a 100644
--- a/src/proguard/classfile/visitor/ImplementedClassFilter.java
+++ b/src/proguard/classfile/visitor/ImplementedClassFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ImplementingClassConstantFilter.java b/src/proguard/classfile/visitor/ImplementingClassConstantFilter.java
index 8e7010d..ee42fe2 100644
--- a/src/proguard/classfile/visitor/ImplementingClassConstantFilter.java
+++ b/src/proguard/classfile/visitor/ImplementingClassConstantFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,9 +20,9 @@
*/
package proguard.classfile.visitor;
-import proguard.classfile.*;
-import proguard.classfile.constant.visitor.ConstantVisitor;
+import proguard.classfile.Clazz;
import proguard.classfile.constant.ClassConstant;
+import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.util.SimplifiedVisitor;
/**
diff --git a/src/proguard/classfile/visitor/LibraryClassFilter.java b/src/proguard/classfile/visitor/LibraryClassFilter.java
index 7437ed3..894c029 100644
--- a/src/proguard/classfile/visitor/LibraryClassFilter.java
+++ b/src/proguard/classfile/visitor/LibraryClassFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/LibraryMemberFilter.java b/src/proguard/classfile/visitor/LibraryMemberFilter.java
index eae0698..c58798c 100644
--- a/src/proguard/classfile/visitor/LibraryMemberFilter.java
+++ b/src/proguard/classfile/visitor/LibraryMemberFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/MemberAccessFilter.java b/src/proguard/classfile/visitor/MemberAccessFilter.java
index 6bdc152..4041e77 100644
--- a/src/proguard/classfile/visitor/MemberAccessFilter.java
+++ b/src/proguard/classfile/visitor/MemberAccessFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -42,9 +42,9 @@ implements MemberVisitor
// 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.INTERNAL_ACC_PUBLIC |
- ClassConstants.INTERNAL_ACC_PRIVATE |
- ClassConstants.INTERNAL_ACC_PROTECTED;
+ ClassConstants.ACC_PUBLIC |
+ ClassConstants.ACC_PRIVATE |
+ ClassConstants.ACC_PROTECTED;
private final int requiredSetAccessFlags;
private final int requiredUnsetAccessFlags;
diff --git a/src/proguard/classfile/visitor/MemberClassAccessFilter.java b/src/proguard/classfile/visitor/MemberClassAccessFilter.java
index 3605407..40418f4 100644
--- a/src/proguard/classfile/visitor/MemberClassAccessFilter.java
+++ b/src/proguard/classfile/visitor/MemberClassAccessFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/MemberCollector.java b/src/proguard/classfile/visitor/MemberCollector.java
index 46665f8..d1a3d2e 100644
--- a/src/proguard/classfile/visitor/MemberCollector.java
+++ b/src/proguard/classfile/visitor/MemberCollector.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/MemberCounter.java b/src/proguard/classfile/visitor/MemberCounter.java
index 58df4a7..55df638 100644
--- a/src/proguard/classfile/visitor/MemberCounter.java
+++ b/src/proguard/classfile/visitor/MemberCounter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/MemberDescriptorFilter.java b/src/proguard/classfile/visitor/MemberDescriptorFilter.java
index cce515a..3c0a646 100644
--- a/src/proguard/classfile/visitor/MemberDescriptorFilter.java
+++ b/src/proguard/classfile/visitor/MemberDescriptorFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/MemberDescriptorReferencedClassVisitor.java b/src/proguard/classfile/visitor/MemberDescriptorReferencedClassVisitor.java
new file mode 100644
index 0000000..9ac1219
--- /dev/null
+++ b/src/proguard/classfile/visitor/MemberDescriptorReferencedClassVisitor.java
@@ -0,0 +1,65 @@
+/*
+ * 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
index 9996a4e..b40b208 100644
--- a/src/proguard/classfile/visitor/MemberNameFilter.java
+++ b/src/proguard/classfile/visitor/MemberNameFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/MemberToClassVisitor.java b/src/proguard/classfile/visitor/MemberToClassVisitor.java
index e82e52f..bb4bc03 100644
--- a/src/proguard/classfile/visitor/MemberToClassVisitor.java
+++ b/src/proguard/classfile/visitor/MemberToClassVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/MemberVisitor.java b/src/proguard/classfile/visitor/MemberVisitor.java
index 7b45662..51a675c 100644
--- a/src/proguard/classfile/visitor/MemberVisitor.java
+++ b/src/proguard/classfile/visitor/MemberVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/MethodImplementationFilter.java b/src/proguard/classfile/visitor/MethodImplementationFilter.java
index 893a699..be951df 100644
--- a/src/proguard/classfile/visitor/MethodImplementationFilter.java
+++ b/src/proguard/classfile/visitor/MethodImplementationFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/MethodImplementationTraveler.java b/src/proguard/classfile/visitor/MethodImplementationTraveler.java
index c9f942e..116b2af 100644
--- a/src/proguard/classfile/visitor/MethodImplementationTraveler.java
+++ b/src/proguard/classfile/visitor/MethodImplementationTraveler.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -86,8 +86,8 @@ implements MemberVisitor
new NamedMethodVisitor(programMethod.getName(programClass),
programMethod.getDescriptor(programClass),
new MemberAccessFilter(0,
- ClassConstants.INTERNAL_ACC_PRIVATE |
- ClassConstants.INTERNAL_ACC_STATIC,
+ ClassConstants.ACC_PRIVATE |
+ ClassConstants.ACC_STATIC,
memberVisitor)));
}
}
@@ -109,8 +109,8 @@ implements MemberVisitor
new NamedMethodVisitor(libraryMethod.getName(libraryClass),
libraryMethod.getDescriptor(libraryClass),
new MemberAccessFilter(0,
- ClassConstants.INTERNAL_ACC_PRIVATE |
- ClassConstants.INTERNAL_ACC_STATIC,
+ ClassConstants.ACC_PRIVATE |
+ ClassConstants.ACC_STATIC,
memberVisitor)));
}
}
@@ -121,8 +121,8 @@ implements MemberVisitor
private boolean isSpecial(Clazz clazz, Method method)
{
return (method.getAccessFlags() &
- (ClassConstants.INTERNAL_ACC_PRIVATE |
- ClassConstants.INTERNAL_ACC_STATIC)) != 0 ||
- method.getName(clazz).equals(ClassConstants.INTERNAL_METHOD_NAME_INIT);
+ (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
index 0e96cf1..17a084a 100644
--- a/src/proguard/classfile/visitor/MultiClassPoolVisitor.java
+++ b/src/proguard/classfile/visitor/MultiClassPoolVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/MultiClassVisitor.java b/src/proguard/classfile/visitor/MultiClassVisitor.java
index 059e9b7..cb79b7d 100644
--- a/src/proguard/classfile/visitor/MultiClassVisitor.java
+++ b/src/proguard/classfile/visitor/MultiClassVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/MultiMemberVisitor.java b/src/proguard/classfile/visitor/MultiMemberVisitor.java
index 800d65f..67bb53e 100644
--- a/src/proguard/classfile/visitor/MultiMemberVisitor.java
+++ b/src/proguard/classfile/visitor/MultiMemberVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/NamedClassVisitor.java b/src/proguard/classfile/visitor/NamedClassVisitor.java
index 79e14c9..52a0c5a 100644
--- a/src/proguard/classfile/visitor/NamedClassVisitor.java
+++ b/src/proguard/classfile/visitor/NamedClassVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/NamedFieldVisitor.java b/src/proguard/classfile/visitor/NamedFieldVisitor.java
index 685f62d..381c97c 100644
--- a/src/proguard/classfile/visitor/NamedFieldVisitor.java
+++ b/src/proguard/classfile/visitor/NamedFieldVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/NamedMethodVisitor.java b/src/proguard/classfile/visitor/NamedMethodVisitor.java
index c2baf19..397e16d 100644
--- a/src/proguard/classfile/visitor/NamedMethodVisitor.java
+++ b/src/proguard/classfile/visitor/NamedMethodVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ParameterVisitor.java b/src/proguard/classfile/visitor/ParameterVisitor.java
new file mode 100644
index 0000000..fc124ae
--- /dev/null
+++ b/src/proguard/classfile/visitor/ParameterVisitor.java
@@ -0,0 +1,56 @@
+/*
+ * 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
index 976658c..85f02a2 100644
--- a/src/proguard/classfile/visitor/ProgramClassFilter.java
+++ b/src/proguard/classfile/visitor/ProgramClassFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ProgramMemberFilter.java b/src/proguard/classfile/visitor/ProgramMemberFilter.java
index cf187fb..d3d88f8 100644
--- a/src/proguard/classfile/visitor/ProgramMemberFilter.java
+++ b/src/proguard/classfile/visitor/ProgramMemberFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/ReferencedClassVisitor.java b/src/proguard/classfile/visitor/ReferencedClassVisitor.java
index e7fe855..09449bc 100644
--- a/src/proguard/classfile/visitor/ReferencedClassVisitor.java
+++ b/src/proguard/classfile/visitor/ReferencedClassVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -48,7 +48,7 @@ implements ClassVisitor,
AnnotationVisitor,
ElementValueVisitor
{
- private final ClassVisitor classVisitor;
+ protected final ClassVisitor classVisitor;
public ReferencedClassVisitor(ClassVisitor classVisitor)
@@ -137,6 +137,13 @@ implements 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) {}
@@ -247,6 +254,13 @@ implements 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.
diff --git a/src/proguard/classfile/visitor/ReferencedMemberVisitor.java b/src/proguard/classfile/visitor/ReferencedMemberVisitor.java
index 3c59075..cb77b19 100644
--- a/src/proguard/classfile/visitor/ReferencedMemberVisitor.java
+++ b/src/proguard/classfile/visitor/ReferencedMemberVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/SimilarMemberVisitor.java b/src/proguard/classfile/visitor/SimilarMemberVisitor.java
index 5087f48..2649a2f 100644
--- a/src/proguard/classfile/visitor/SimilarMemberVisitor.java
+++ b/src/proguard/classfile/visitor/SimilarMemberVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/SimpleClassPrinter.java b/src/proguard/classfile/visitor/SimpleClassPrinter.java
index df630c7..073c635 100644
--- a/src/proguard/classfile/visitor/SimpleClassPrinter.java
+++ b/src/proguard/classfile/visitor/SimpleClassPrinter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/SubclassFilter.java b/src/proguard/classfile/visitor/SubclassFilter.java
index 6b6f84b..f50e498 100644
--- a/src/proguard/classfile/visitor/SubclassFilter.java
+++ b/src/proguard/classfile/visitor/SubclassFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/SubclassTraveler.java b/src/proguard/classfile/visitor/SubclassTraveler.java
index 32dccb7..8e80913 100644
--- a/src/proguard/classfile/visitor/SubclassTraveler.java
+++ b/src/proguard/classfile/visitor/SubclassTraveler.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/VariableClassVisitor.java b/src/proguard/classfile/visitor/VariableClassVisitor.java
index 17a5522..c8e1ee3 100644
--- a/src/proguard/classfile/visitor/VariableClassVisitor.java
+++ b/src/proguard/classfile/visitor/VariableClassVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/classfile/visitor/VariableMemberVisitor.java b/src/proguard/classfile/visitor/VariableMemberVisitor.java
index 34c39f3..fbaedec 100644
--- a/src/proguard/classfile/visitor/VariableMemberVisitor.java
+++ b/src/proguard/classfile/visitor/VariableMemberVisitor.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free