KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > yworks > yguard > obf > classfile > ClassConstants


1 /* ===========================================================================
2  * $RCSfile: ClassConstants.java,v $
3  * ===========================================================================
4  *
5  * RetroGuard -- an obfuscation package for Java classfiles.
6  *
7  * Copyright (c) 1999 Mark Welsh (markw@retrologic.com)
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  *
23  * The author may be contacted at markw@retrologic.com
24  *
25  *
26  * $Date: 2007/04/25 07:40:30 $
27  * $Revision: 1.5.2.6 $
28  */

29 package com.yworks.yguard.obf.classfile;
30
31 import java.io.*;
32 import java.util.*;
33
34 /**
35  * Constants used in representing a Java class-file (*.class).
36  *
37  * @author Mark Welsh
38  */

39 public interface ClassConstants
40 {
41     // Constants -------------------------------------------------------------
42
public static final int MAGIC = 0xCAFEBABE;
43
44     public static final int MINOR_VERSION_MAX = 3;
45     public static final int MAJOR_VERSION = 0x32;
46
47     public static final int ACC_PUBLIC = 0x0001;
48     public static final int ACC_PRIVATE = 0x0002;
49     public static final int ACC_PROTECTED = 0x0004;
50     public static final int ACC_STATIC = 0x0008;
51     public static final int ACC_FINAL = 0x0010;
52     public static final int ACC_SUPER = 0x0020;
53     public static final int ACC_SYNCHRONIZED= 0x0020;
54     public static final int ACC_VOLATILE = 0x0040;
55     public static final int ACC_TRANSIENT = 0x0080;
56     public static final int ACC_NATIVE = 0x0100;
57     public static final int ACC_INTERFACE = 0x0200;
58     public static final int ACC_ABSTRACT = 0x0400;
59     public static final int ACC_SYNTHETIC = 0x1000;
60     public static final int ACC_ANNOTATION = 0x2000;
61     public static final int ACC_ENUM = 0x4000;
62     public static final int ACC_BRIDGE = 0x0040;
63     public static final int ACC_VARARGS = 0x0080;
64
65     public static final int CONSTANT_Utf8 = 1;
66     public static final int CONSTANT_Integer = 3;
67     public static final int CONSTANT_Float = 4;
68     public static final int CONSTANT_Long = 5;
69     public static final int CONSTANT_Double = 6;
70     public static final int CONSTANT_Class = 7;
71     public static final int CONSTANT_String = 8;
72     public static final int CONSTANT_Fieldref = 9;
73     public static final int CONSTANT_Methodref = 10;
74     public static final int CONSTANT_InterfaceMethodref = 11;
75     public static final int CONSTANT_NameAndType = 12;
76
77     public static final String JavaDoc ATTR_Unknown = "Unknown";
78     public static final String JavaDoc ATTR_Code = "Code";
79     public static final String JavaDoc ATTR_ConstantValue = "ConstantValue";
80     public static final String JavaDoc ATTR_Exceptions = "Exceptions";
81     public static final String JavaDoc ATTR_StackMapTable = "StackMapTable";
82     public static final String JavaDoc ATTR_LineNumberTable = "LineNumberTable";
83     public static final String JavaDoc ATTR_SourceFile = "SourceFile";
84     public static final String JavaDoc ATTR_SourceDebug = "SourceDebug";
85     public static final String JavaDoc ATTR_LocalVariableTable = "LocalVariableTable";
86     public static final String JavaDoc ATTR_InnerClasses = "InnerClasses";
87     public static final String JavaDoc ATTR_Synthetic = "Synthetic";
88     public static final String JavaDoc ATTR_Deprecated = "Deprecated";
89     public static final String JavaDoc ATTR_LocalVariableTypeTable = "LocalVariableTypeTable";
90     public static final String JavaDoc ATTR_Signature = "Signature";
91     public static final String JavaDoc ATTR_EnclosingMethod = "EnclosingMethod";
92     public static final String JavaDoc ATTR_RuntimeVisibleAnnotations = "RuntimeVisibleAnnotations";
93     public static final String JavaDoc ATTR_RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
94     public static final String JavaDoc ATTR_RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
95     public static final String JavaDoc ATTR_RuntimeInvisibleParameterAnnotations = "RuntimeInvisibleParameterAnnotations";
96     public static final String JavaDoc ATTR_AnnotationDefault = "AnnotationDefault";
97     public static final String JavaDoc ATTR_Bridge = "Bridge";
98     public static final String JavaDoc ATTR_Enum = "Enum";
99     public static final String JavaDoc ATTR_Varargs = "Varargs";
100
101     // List of known attributes
102
public static final String JavaDoc[] KNOWN_ATTRS = {ATTR_Code,
103                                                 ATTR_ConstantValue,
104                                                 ATTR_Exceptions,
105                                                 ATTR_LineNumberTable,
106                                                 ATTR_SourceFile,
107                                                 ATTR_LocalVariableTable,
108                                                 ATTR_InnerClasses,
109                                                 ATTR_Synthetic,
110                                                 ATTR_Deprecated,
111                                                 ATTR_Signature,
112                                                 ATTR_LocalVariableTypeTable,
113                                                 ATTR_EnclosingMethod,
114                                                 ATTR_AnnotationDefault,
115                                                 ATTR_RuntimeVisibleAnnotations,
116                                                 ATTR_RuntimeInvisibleAnnotations,
117                                                 ATTR_RuntimeVisibleParameterAnnotations,
118                                                 ATTR_RuntimeInvisibleParameterAnnotations,
119                                                 ATTR_Bridge,
120                                                 ATTR_Enum,
121                                                 ATTR_StackMapTable,
122                                                 ATTR_Varargs
123                                               };
124
125     // List of required attributes
126
public static final String JavaDoc[] REQUIRED_ATTRS = {ATTR_Code,
127                                                    ATTR_ConstantValue,
128                                                    ATTR_Exceptions,
129                                                    ATTR_InnerClasses,
130                                                    ATTR_Synthetic,
131                                                    ATTR_Signature,
132                                                    ATTR_RuntimeVisibleAnnotations,
133                                                    ATTR_EnclosingMethod,
134                                                    ATTR_AnnotationDefault,
135                                                    ATTR_RuntimeInvisibleParameterAnnotations,
136                                                    ATTR_RuntimeInvisibleAnnotations,
137                                                    ATTR_RuntimeVisibleAnnotations,
138                                                    ATTR_RuntimeVisibleParameterAnnotations,
139                                                    ATTR_StackMapTable,
140                                                   };
141 }
142
Popular Tags