comparison src/main/gov/nasa/jpf/jvm/ClassFileReader.java @ 0:61d41facf527

initial v8 import (history reset)
author Peter Mehlitz <Peter.C.Mehlitz@nasa.gov>
date Fri, 23 Jan 2015 10:14:01 -0800
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:61d41facf527
1 /*
2 * Copyright (C) 2014, United States Government, as represented by the
3 * Administrator of the National Aeronautics and Space Administration.
4 * All rights reserved.
5 *
6 * The Java Pathfinder core (jpf-core) platform is licensed under the
7 * Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0.
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package gov.nasa.jpf.jvm;
20
21 import gov.nasa.jpf.vm.ClassParseException;
22
23 /**
24 * interface for classfile processors
25 *
26 * NOTE - all types are given ss descriptors, i.e. "Lx/y/Z;" or type codes such as "I"
27 *
28 * iteration groups always start with a
29 * setXCount(int xCount)
30 *
31 * followed by xCount notifications
32 * setX (int xIndex)
33 *
34 * with 0<=xIndex<xCount
35 */
36 public interface ClassFileReader {
37
38 void setClass(ClassFile cf, String clsName, String superClsName, int flags, int cpCount) throws ClassParseException;
39
40
41 //--- interfaces
42 void setInterfaceCount(ClassFile cf, int ifcCount);
43
44 void setInterface(ClassFile cf, int ifcIndex, String ifcName);
45
46 void setInterfacesDone(ClassFile cf);
47
48
49 //--- fields
50 void setFieldCount(ClassFile cf, int fieldCount);
51
52 void setField(ClassFile cf, int fieldIndex, int accessFlags, String name, String descriptor);
53
54 void setFieldAttributeCount(ClassFile cf, int fieldIndex, int attrCount);
55
56 void setFieldAttribute(ClassFile cf, int fieldIndex, int attrIndex, String name, int attrLength);
57
58 void setFieldAttributesDone(ClassFile cf, int fieldIndex);
59
60 void setFieldDone(ClassFile cf, int fieldIndex);
61
62 void setFieldsDone(ClassFile cf);
63
64
65 //--- standard field attributes
66 void setConstantValue(ClassFile cf, Object tag, Object value);
67
68
69 //--- methods
70 void setMethodCount(ClassFile cf, int methodCount);
71
72 void setMethod(ClassFile cf, int methodIndex, int accessFlags, String name, String descriptor);
73
74 void setMethodAttributeCount(ClassFile cf, int methodIndex, int attrCount);
75
76 void setMethodAttribute(ClassFile cf, int methodIndex, int attrIndex, String name, int attrLength);
77
78 void setMethodAttributesDone(ClassFile cf, int methodIndex);
79
80 void setMethodDone(ClassFile cf, int methodIndex);
81
82 void setMethodsDone(ClassFile cf);
83
84
85 //--- standard method attributes
86 void setExceptionCount (ClassFile cf, Object tag, int exceptionCount);
87
88 void setException (ClassFile cf, Object tag, int exceptionIndex, String exceptionType);
89
90 void setExceptionsDone(ClassFile cf, Object tag);
91
92 void setCode(ClassFile cf, Object tag, int maxStack, int maxLocals, int codeLength);
93
94 void setExceptionHandlerTableCount (ClassFile cf, Object tag, int exceptionTableCount);
95
96 void setExceptionHandler(ClassFile cf, Object tag, int exceptionIndex, int startPc, int endPc, int handlerPc, String catchType);
97
98 void setExceptionHandlerTableDone(ClassFile cf, Object tag);
99
100 void setCodeAttributeCount(ClassFile cf, Object tag, int attrCount);
101
102 void setCodeAttribute(ClassFile cf, Object tag, int attrIndex, String name, int attrLength);
103
104 void setCodeAttributesDone (ClassFile cf, Object tag);
105
106
107 //--- standard code attribute attributes (yes, attributes can be nested)
108 void setLineNumberTableCount(ClassFile cf, Object tag, int lineNumberCount);
109
110 void setLineNumber(ClassFile cf, Object tag, int lineIndex, int lineNumber, int startPc);
111
112 void setLineNumberTableDone(ClassFile cf, Object tag);
113
114
115 void setLocalVarTableCount(ClassFile cf, Object tag, int localVarCount);
116
117 void setLocalVar(ClassFile cf, Object tag, int localVarIndex, String varName, String descriptor,
118 int scopeStartPc, int scopeEndPc, int slotIndex);
119
120 void setLocalVarTableDone(ClassFile cf, Object tag);
121
122
123 void setClassAttributeCount(ClassFile cf, int attrCount);
124
125 void setClassAttribute(ClassFile cf, int attrIndex, String name, int attrLength);
126
127 void setClassAttributesDone(ClassFile cf);
128
129
130 //--- standard class attributes
131 void setSourceFile(ClassFile cf, Object tag, String pathName);
132
133 void setInnerClassCount(ClassFile cf, Object tag, int innerClsCount);
134 void setInnerClass(ClassFile cf, Object tag, int innerClsIndex, String outerName, String innerName, String innerSimpleName, int accessFlags);
135 void setInnerClassesDone (ClassFile cf, Object tag);
136
137 void setBootstrapMethodCount (ClassFile cf, Object tag, int count);
138 void setBootstrapMethod (ClassFile cf, Object tag, int idx, int refKind, String cls, String mth, String descriptor, int[] cpArgs);
139 void setBootstrapMethodsDone (ClassFile cf, Object tag);
140
141 void setEnclosingMethod(ClassFile cf, Object tag, String enclosingClass, String enclosingMethod, String descriptor);
142
143 //--- annotations
144 void setAnnotationCount(ClassFile cf, Object tag, int annotationCount);
145 void setAnnotation(ClassFile cf, Object tag, int annotationIndex, String annotationType);
146 void setAnnotationsDone(ClassFile cf, Object tag);
147
148
149 // Java 8 type annotations
150 void setTypeAnnotationCount(ClassFile cf, Object tag, int annotationCount);
151
152 void setTypeParameterAnnotation(ClassFile cf, Object tag, int annotationIndex, int targetType, int typeIndex, short[] typePath, String annotationType);
153 void setSuperTypeAnnotation(ClassFile cf, Object tag, int annotationIndex, int targetType, int superTypeIdx, short[] typePath, String annotationType);
154 void setTypeParameterBoundAnnotation(ClassFile cf, Object tag, int annotationIndex, int targetType, int typeParamIdx, int boundIdx, short[] typePath, String annotationType);
155 void setTypeAnnotation(ClassFile cf, Object tag, int annotationIndex, int targetType, short[] typePath, String annotationType);
156 void setFormalParameterAnnotation(ClassFile cf, Object tag, int annotationIndex, int targetType, int formalParamIndex, short[] typePath, String annotationType);
157 void setThrowsAnnotation(ClassFile cf, Object tag, int annotationIndex, int targetType, int throwsTypeIndex, short[] typePath, String annotationType);
158 void setVariableAnnotation(ClassFile cf, Object tag, int annotationIndex, int targetType, long[] scopeEntries, short[] typePath, String annotationType);
159 void setExceptionParameterAnnotation(ClassFile cf, Object tag, int annotationIndex, int targetType, int exceptionIndex, short[] typePath, String annotationType);
160 void setBytecodeAnnotation(ClassFile cf, Object tag, int annotationIndex, int targetType, int offset, short[] typePath, String annotationType);
161 void setBytecodeTypeParameterAnnotation(ClassFile cf, Object tag, int annotationIndex, int targetType, int offset, int typeArgIdx, short[] typePath, String annotationType);
162
163 void setTypeAnnotationsDone(ClassFile cf, Object tag);
164
165
166
167 void setAnnotationValueCount(ClassFile cf, Object tag, int annotationIndex, int nValuePairs);
168
169 void setPrimitiveAnnotationValue(ClassFile cf, Object tag, int annotationIndex, int valueIndex, String elementName, int arrayIndex, Object val);
170
171 void setStringAnnotationValue(ClassFile cf, Object tag, int annotationIndex, int valueIndex, String elementName, int arrayIndex, String s);
172
173 void setClassAnnotationValue(ClassFile cf, Object tag, int annotationIndex, int valueIndex, String elementName, int arrayIndex, String typeName);
174
175 void setEnumAnnotationValue(ClassFile cf, Object tag, int annotationIndex, int valueIndex, String elementName, int arrayIndex,
176 String enumType, String enumValue);
177
178 void setAnnotationValueElementCount(ClassFile cf, Object tag, int annotationIndex, int valueIndex, String elementName, int elementCount);
179
180 void setAnnotationValueElementsDone(ClassFile cf, Object tag, int annotationIndex, int valueIndex, String elementName);
181
182 void setAnnotationValuesDone(ClassFile cf, Object tag, int annotationIndex);
183
184 void setParameterCount(ClassFile cf, Object tag, int parameterCount);
185
186 void setParameterAnnotationCount(ClassFile cf, Object tag, int paramIndex, int annotationCount);
187
188 void setParameterAnnotation(ClassFile cf, Object tag, int annotationIndex, String annotationType);
189
190 void setParameterAnnotationsDone(ClassFile cf, Object tag, int paramIndex);
191
192 void setParametersDone(ClassFile cf, Object tag);
193
194
195 void setSignature(ClassFile cf, Object tag, String signature);
196 }