001: /* ===========================================================================
002: * $RCSfile: ClassConstants.java,v $
003: * ===========================================================================
004: *
005: * RetroGuard -- an obfuscation package for Java classfiles.
006: *
007: * Copyright (c) 1999 Mark Welsh (markw@retrologic.com)
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library; if not, write to the Free Software
021: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
022: *
023: * The author may be contacted at markw@retrologic.com
024: *
025: *
026: * $Date: 2007/04/25 07:40:30 $
027: * $Revision: 1.5.2.6 $
028: */
029: package com.yworks.yguard.obf.classfile;
030:
031: import java.io.*;
032: import java.util.*;
033:
034: /**
035: * Constants used in representing a Java class-file (*.class).
036: *
037: * @author Mark Welsh
038: */
039: public interface ClassConstants {
040: // Constants -------------------------------------------------------------
041: public static final int MAGIC = 0xCAFEBABE;
042:
043: public static final int MINOR_VERSION_MAX = 3;
044: public static final int MAJOR_VERSION = 0x32;
045:
046: public static final int ACC_PUBLIC = 0x0001;
047: public static final int ACC_PRIVATE = 0x0002;
048: public static final int ACC_PROTECTED = 0x0004;
049: public static final int ACC_STATIC = 0x0008;
050: public static final int ACC_FINAL = 0x0010;
051: public static final int ACC_SUPER = 0x0020;
052: public static final int ACC_SYNCHRONIZED = 0x0020;
053: public static final int ACC_VOLATILE = 0x0040;
054: public static final int ACC_TRANSIENT = 0x0080;
055: public static final int ACC_NATIVE = 0x0100;
056: public static final int ACC_INTERFACE = 0x0200;
057: public static final int ACC_ABSTRACT = 0x0400;
058: public static final int ACC_SYNTHETIC = 0x1000;
059: public static final int ACC_ANNOTATION = 0x2000;
060: public static final int ACC_ENUM = 0x4000;
061: public static final int ACC_BRIDGE = 0x0040;
062: public static final int ACC_VARARGS = 0x0080;
063:
064: public static final int CONSTANT_Utf8 = 1;
065: public static final int CONSTANT_Integer = 3;
066: public static final int CONSTANT_Float = 4;
067: public static final int CONSTANT_Long = 5;
068: public static final int CONSTANT_Double = 6;
069: public static final int CONSTANT_Class = 7;
070: public static final int CONSTANT_String = 8;
071: public static final int CONSTANT_Fieldref = 9;
072: public static final int CONSTANT_Methodref = 10;
073: public static final int CONSTANT_InterfaceMethodref = 11;
074: public static final int CONSTANT_NameAndType = 12;
075:
076: public static final String ATTR_Unknown = "Unknown";
077: public static final String ATTR_Code = "Code";
078: public static final String ATTR_ConstantValue = "ConstantValue";
079: public static final String ATTR_Exceptions = "Exceptions";
080: public static final String ATTR_StackMapTable = "StackMapTable";
081: public static final String ATTR_LineNumberTable = "LineNumberTable";
082: public static final String ATTR_SourceFile = "SourceFile";
083: public static final String ATTR_SourceDebug = "SourceDebug";
084: public static final String ATTR_LocalVariableTable = "LocalVariableTable";
085: public static final String ATTR_InnerClasses = "InnerClasses";
086: public static final String ATTR_Synthetic = "Synthetic";
087: public static final String ATTR_Deprecated = "Deprecated";
088: public static final String ATTR_LocalVariableTypeTable = "LocalVariableTypeTable";
089: public static final String ATTR_Signature = "Signature";
090: public static final String ATTR_EnclosingMethod = "EnclosingMethod";
091: public static final String ATTR_RuntimeVisibleAnnotations = "RuntimeVisibleAnnotations";
092: public static final String ATTR_RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
093: public static final String ATTR_RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
094: public static final String ATTR_RuntimeInvisibleParameterAnnotations = "RuntimeInvisibleParameterAnnotations";
095: public static final String ATTR_AnnotationDefault = "AnnotationDefault";
096: public static final String ATTR_Bridge = "Bridge";
097: public static final String ATTR_Enum = "Enum";
098: public static final String ATTR_Varargs = "Varargs";
099:
100: // List of known attributes
101: public static final String[] KNOWN_ATTRS = { ATTR_Code,
102: ATTR_ConstantValue, ATTR_Exceptions, ATTR_LineNumberTable,
103: ATTR_SourceFile, ATTR_LocalVariableTable,
104: ATTR_InnerClasses, ATTR_Synthetic, ATTR_Deprecated,
105: ATTR_Signature, ATTR_LocalVariableTypeTable,
106: ATTR_EnclosingMethod, ATTR_AnnotationDefault,
107: ATTR_RuntimeVisibleAnnotations,
108: ATTR_RuntimeInvisibleAnnotations,
109: ATTR_RuntimeVisibleParameterAnnotations,
110: ATTR_RuntimeInvisibleParameterAnnotations, ATTR_Bridge,
111: ATTR_Enum, ATTR_StackMapTable, ATTR_Varargs };
112:
113: // List of required attributes
114: public static final String[] REQUIRED_ATTRS = { ATTR_Code,
115: ATTR_ConstantValue, ATTR_Exceptions, ATTR_InnerClasses,
116: ATTR_Synthetic, ATTR_Signature,
117: ATTR_RuntimeVisibleAnnotations, ATTR_EnclosingMethod,
118: ATTR_AnnotationDefault,
119: ATTR_RuntimeInvisibleParameterAnnotations,
120: ATTR_RuntimeInvisibleAnnotations,
121: ATTR_RuntimeVisibleAnnotations,
122: ATTR_RuntimeVisibleParameterAnnotations,
123: ATTR_StackMapTable, };
124: }
|