001: /* ===========================================================================
002: * $RCSfile: ClassConstants.java,v $
003: * ===========================================================================
004: *
005: * RetroGuard -- an obfuscation package for Java classfiles.
006: *
007: * Copyright (c) 1998-2006 Mark Welsh (markw@retrologic.com)
008: *
009: * This program can be redistributed and/or modified under the terms of the
010: * Version 2 of the GNU General Public License as published by the Free
011: * Software Foundation.
012: *
013: * This program is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: * GNU General Public License for more details.
017: *
018: */
019:
020: package COM.rl.obf.classfile;
021:
022: import java.io.*;
023: import java.util.*;
024:
025: /**
026: * Constants used in representing a Java class-file (*.class).
027: *
028: * @author Mark Welsh
029: */
030: public interface ClassConstants {
031: // Constants -------------------------------------------------------------
032: public static final int MAGIC = 0xCAFEBABE;
033:
034: public static final int MAJOR_VERSION = 0x32;
035: // Class Method Field
036: public static final int ACC_PUBLIC = 0x0001; // X X X
037: public static final int ACC_PRIVATE = 0x0002; // X X
038: public static final int ACC_PROTECTED = 0x0004; // X X
039: public static final int ACC_STATIC = 0x0008; // X X
040: public static final int ACC_FINAL = 0x0010; // X X X
041: public static final int ACC_SUPER = 0x0020; // X
042: public static final int ACC_SYNCHRONIZED = 0x0020; // X
043: public static final int ACC_BRIDGE = 0x0040; // X
044: public static final int ACC_VOLATILE = 0x0040; // X
045: public static final int ACC_VARARGS = 0x0080; // X
046: public static final int ACC_TRANSIENT = 0x0080; // X
047: public static final int ACC_NATIVE = 0x0100; // X
048: public static final int ACC_INTERFACE = 0x0200; // X
049: public static final int ACC_ABSTRACT = 0x0400; // X X
050: public static final int ACC_STRICT = 0x0800; // X
051: public static final int ACC_SYNTHETIC = 0x1000; // X
052: public static final int ACC_ANNOTATION = 0x2000; // X
053: public static final int ACC_ENUM = 0x4000; // X X
054:
055: public static final int CONSTANT_Utf8 = 1;
056: public static final int CONSTANT_Integer = 3;
057: public static final int CONSTANT_Float = 4;
058: public static final int CONSTANT_Long = 5;
059: public static final int CONSTANT_Double = 6;
060: public static final int CONSTANT_Class = 7;
061: public static final int CONSTANT_String = 8;
062: public static final int CONSTANT_Fieldref = 9;
063: public static final int CONSTANT_Methodref = 10;
064: public static final int CONSTANT_InterfaceMethodref = 11;
065: public static final int CONSTANT_NameAndType = 12;
066:
067: public static final String ATTR_Unknown = "Unknown";
068: public static final String ATTR_Code = "Code";
069: public static final String ATTR_ConstantValue = "ConstantValue";
070: public static final String ATTR_Exceptions = "Exceptions";
071: public static final String ATTR_LineNumberTable = "LineNumberTable";
072: public static final String ATTR_SourceFile = "SourceFile";
073: public static final String ATTR_LocalVariableTable = "LocalVariableTable";
074: public static final String ATTR_InnerClasses = "InnerClasses";
075: public static final String ATTR_Synthetic = "Synthetic";
076: public static final String ATTR_Deprecated = "Deprecated";
077: public static final String ATTR_Signature = "Signature";
078: public static final String ATTR_LocalVariableTypeTable = "LocalVariableTypeTable";
079: public static final String ATTR_RuntimeVisibleAnnotations = "RuntimeVisibleAnnotations";
080: public static final String ATTR_RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
081: public static final String ATTR_RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
082: public static final String ATTR_RuntimeInvisibleParameterAnnotations = "RuntimeInvisibleParameterAnnotations";
083: public static final String ATTR_AnnotationDefault = "AnnotationDefault";
084: public static final String ATTR_EnclosingMethod = "EnclosingMethod";
085: public static final String ATTR_StackMapTable = "StackMapTable";
086:
087: // List of known attributes
088: public static final String[] KNOWN_ATTRS = { ATTR_Code,
089: ATTR_ConstantValue, ATTR_Exceptions, ATTR_LineNumberTable,
090: ATTR_SourceFile, ATTR_LocalVariableTable,
091: ATTR_InnerClasses, ATTR_Synthetic, ATTR_Deprecated,
092: ATTR_Signature, ATTR_LocalVariableTypeTable,
093: ATTR_RuntimeVisibleAnnotations,
094: ATTR_RuntimeInvisibleAnnotations,
095: ATTR_RuntimeVisibleParameterAnnotations,
096: ATTR_RuntimeInvisibleParameterAnnotations,
097: ATTR_AnnotationDefault, ATTR_EnclosingMethod,
098: ATTR_StackMapTable, };
099:
100: // List of required attributes
101: public static final String[] REQUIRED_ATTRS = { ATTR_Code,
102: ATTR_ConstantValue, ATTR_Exceptions, ATTR_InnerClasses,
103: ATTR_Synthetic, ATTR_StackMapTable, };
104:
105: public static final String OPTION_Application = "Application";
106: public static final String OPTION_Applet = "Applet";
107: public static final String OPTION_Serializable = "Serializable";
108: public static final String OPTION_RMI = "RMI";
109: public static final String OPTION_Enumeration = "Enumeration";
110: public static final String OPTION_Annotations = "Annotations";
111: public static final String OPTION_RuntimeAnnotations = "RuntimeAnnotations";
112: public static final String OPTION_MapClassString = "MapClassString";
113: public static final String OPTION_DigestSHA = "DigestSHA";
114: public static final String OPTION_DigestMD5 = "DigestMD5";
115: public static final String OPTION_LineNumberDebug = "LineNumberDebug";
116: public static final String OPTION_Trim = "Trim";
117: public static final String OPTION_Repackage = "Repackage";
118: public static final String OPTION_Generic = "Generic";
119:
120: // List of known script options
121: public static final String[] KNOWN_OPTIONS = { OPTION_Application,
122: OPTION_Applet, OPTION_Serializable, OPTION_RMI,
123: OPTION_Enumeration, OPTION_Annotations,
124: OPTION_RuntimeAnnotations, OPTION_MapClassString,
125: OPTION_DigestSHA, OPTION_DigestMD5, OPTION_LineNumberDebug,
126: OPTION_Trim, OPTION_Repackage, OPTION_Generic, };
127: }
|