Package com.yworks.yguard.obf.classfile
Class ClassItemInfo
- java.lang.Object
-
- com.yworks.yguard.obf.classfile.ClassItemInfo
-
- All Implemented Interfaces:
ClassConstants
- Direct Known Subclasses:
FieldInfo,MethodInfo
public abstract class ClassItemInfo extends java.lang.Object implements ClassConstants
Representation of a field or method from a class-file.
-
-
Field Summary
Fields Modifier and Type Field Description protected AttrInfo[]attributesThe Attributes.protected intu2attributesCountThe U 2 attributes count.-
Fields inherited from interface com.yworks.yguard.obf.classfile.ClassConstants
ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, ATTR_AnnotationDefault, ATTR_BootstrapMethods, ATTR_Bridge, ATTR_Code, ATTR_ConstantValue, ATTR_Deprecated, ATTR_EnclosingMethod, ATTR_Enum, ATTR_Exceptions, ATTR_InnerClasses, ATTR_LineNumberTable, ATTR_LocalVariableTable, ATTR_LocalVariableTypeTable, ATTR_MethodParameters, ATTR_Module, ATTR_ModuleMainClass, ATTR_ModulePackages, ATTR_NestHost, ATTR_NestMembers, ATTR_PermittedSubclasses, ATTR_Record, ATTR_RuntimeInvisibleAnnotations, ATTR_RuntimeInvisibleParameterAnnotations, ATTR_RuntimeInvisibleTypeAnnotations, ATTR_RuntimeVisibleAnnotations, ATTR_RuntimeVisibleParameterAnnotations, ATTR_RuntimeVisibleTypeAnnotations, ATTR_Signature, ATTR_SourceDebug, ATTR_SourceDebugExtension, ATTR_SourceFile, ATTR_StackMapTable, ATTR_Synthetic, ATTR_Unknown, ATTR_Varargs, CONSTANT_Class, CONSTANT_Double, CONSTANT_Dynamic, CONSTANT_Fieldref, CONSTANT_Float, CONSTANT_Integer, CONSTANT_InterfaceMethodref, CONSTANT_InvokeDynamic, CONSTANT_Long, CONSTANT_MethodHandle, CONSTANT_Methodref, CONSTANT_MethodType, CONSTANT_Module, CONSTANT_NameAndType, CONSTANT_Package, CONSTANT_String, CONSTANT_Utf8, KNOWN_ATTRS, MAGIC, MAJOR_VERSION, MINOR_VERSION_MAX, REF_getField, REF_getStatic, REF_invokeInterface, REF_invokeSpecial, REF_invokeStatic, REF_invokeVirtual, REF_newInvokeSpecial, REF_putField, REF_putStatic, REQUIRED_ATTRS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedClassItemInfo(ClassFile cf)Instantiates a new Class item info.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetAccessFlags()Return access flags.java.lang.StringgetDescriptor()Return descriptor string.protected intgetDescriptorIndex()Return method/field descriptor index into Constant Pool.java.lang.StringgetName()Return method/field string name.protected intgetNameIndex()Return method/field name index into Constant Pool.ObfuscationConfiggetObfuscationConfig()Gets obfuscation config.static ObfuscationConfiggetObfuscationConfig(java.lang.String name, AttrInfo[] attributes)Gets obfuscation config.booleanisSynthetic()Is the field or method 'Synthetic'?protected voidmarkUtf8Refs(ConstantPool pool)Check for Utf8 references to constant pool and mark them.protected voidread(java.io.DataInput din)Import the field or method data to internal representation.protected voidsetDescriptorIndex(int index)Set the method/field descriptor index.protected voidsetNameIndex(int index)Set the method/field name index.protected voidtrimAttrsExcept(java.lang.String[] keepAttrs)Trim attributes from the classfile ('Code', 'Exceptions', 'ConstantValue' are preserved, all others except the list in the String[] are killed).voidwrite(java.io.DataOutput dout)Export the representation to a DataOutput stream.
-
-
-
Field Detail
-
u2attributesCount
protected int u2attributesCount
The U 2 attributes count.
-
attributes
protected AttrInfo[] attributes
The Attributes.
-
-
Constructor Detail
-
ClassItemInfo
protected ClassItemInfo(ClassFile cf)
Instantiates a new Class item info.- Parameters:
cf- the cf
-
-
Method Detail
-
getObfuscationConfig
public static ObfuscationConfig getObfuscationConfig(java.lang.String name, AttrInfo[] attributes)
Gets obfuscation config.- Parameters:
name- the nameattributes- the attributes- Returns:
- the obfuscation config
-
isSynthetic
public boolean isSynthetic()
Is the field or method 'Synthetic'?- Returns:
- the boolean
-
getNameIndex
protected int getNameIndex()
Return method/field name index into Constant Pool.- Returns:
- the name index
-
setNameIndex
protected void setNameIndex(int index)
Set the method/field name index.- Parameters:
index- the index
-
getDescriptorIndex
protected int getDescriptorIndex()
Return method/field descriptor index into Constant Pool.- Returns:
- the descriptor index
-
setDescriptorIndex
protected void setDescriptorIndex(int index)
Set the method/field descriptor index.- Parameters:
index- the index
-
getName
public java.lang.String getName()
Return method/field string name.- Returns:
- the name
-
getDescriptor
public java.lang.String getDescriptor()
Return descriptor string.- Returns:
- the descriptor
-
getAccessFlags
public int getAccessFlags()
Return access flags.- Returns:
- the access flags
-
trimAttrsExcept
protected void trimAttrsExcept(java.lang.String[] keepAttrs)
Trim attributes from the classfile ('Code', 'Exceptions', 'ConstantValue' are preserved, all others except the list in the String[] are killed).- Parameters:
keepAttrs- the keep attrs
-
markUtf8Refs
protected void markUtf8Refs(ConstantPool pool)
Check for Utf8 references to constant pool and mark them.- Parameters:
pool- the pool
-
read
protected void read(java.io.DataInput din) throws java.io.IOExceptionImport the field or method data to internal representation.- Parameters:
din- the din- Throws:
java.io.IOException- the io exception
-
write
public void write(java.io.DataOutput dout) throws java.io.IOExceptionExport the representation to a DataOutput stream.- Parameters:
dout- the dout- Throws:
java.io.IOException- the io exception
-
getObfuscationConfig
public ObfuscationConfig getObfuscationConfig()
Gets obfuscation config.- Returns:
- the obfuscation config
-
-