aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/apache/bcel/visitors/CounterVisitor.java
blob: cd57853870fe10ec19d0b85b1b9e9587e82d5012 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */

package org.apache.commons.bcel6.visitors;

import org.apache.commons.bcel6.classfile.AnnotationDefault;
import org.apache.commons.bcel6.classfile.AnnotationEntry;
import org.apache.commons.bcel6.classfile.Annotations;
import org.apache.commons.bcel6.classfile.BootstrapMethods;
import org.apache.commons.bcel6.classfile.Code;
import org.apache.commons.bcel6.classfile.CodeException;
import org.apache.commons.bcel6.classfile.ConstantClass;
import org.apache.commons.bcel6.classfile.ConstantDouble;
import org.apache.commons.bcel6.classfile.ConstantFieldref;
import org.apache.commons.bcel6.classfile.ConstantFloat;
import org.apache.commons.bcel6.classfile.ConstantInteger;
import org.apache.commons.bcel6.classfile.ConstantInterfaceMethodref;
import org.apache.commons.bcel6.classfile.ConstantInvokeDynamic;
import org.apache.commons.bcel6.classfile.ConstantLong;
import org.apache.commons.bcel6.classfile.ConstantMethodHandle;
import org.apache.commons.bcel6.classfile.ConstantMethodType;
import org.apache.commons.bcel6.classfile.ConstantMethodref;
import org.apache.commons.bcel6.classfile.ConstantNameAndType;
import org.apache.commons.bcel6.classfile.ConstantPool;
import org.apache.commons.bcel6.classfile.ConstantString;
import org.apache.commons.bcel6.classfile.ConstantUtf8;
import org.apache.commons.bcel6.classfile.ConstantValue;
import org.apache.commons.bcel6.classfile.Deprecated;
import org.apache.commons.bcel6.classfile.EnclosingMethod;
import org.apache.commons.bcel6.classfile.ExceptionTable;
import org.apache.commons.bcel6.classfile.Field;
import org.apache.commons.bcel6.classfile.InnerClass;
import org.apache.commons.bcel6.classfile.InnerClasses;
import org.apache.commons.bcel6.classfile.JavaClass;
import org.apache.commons.bcel6.classfile.LineNumber;
import org.apache.commons.bcel6.classfile.LineNumberTable;
import org.apache.commons.bcel6.classfile.LocalVariable;
import org.apache.commons.bcel6.classfile.LocalVariableTable;
import org.apache.commons.bcel6.classfile.LocalVariableTypeTable;
import org.apache.commons.bcel6.classfile.Method;
import org.apache.commons.bcel6.classfile.MethodParameters;
import org.apache.commons.bcel6.classfile.ParameterAnnotationEntry;
import org.apache.commons.bcel6.classfile.ParameterAnnotations;
import org.apache.commons.bcel6.classfile.Signature;
import org.apache.commons.bcel6.classfile.SourceFile;
import org.apache.commons.bcel6.classfile.StackMap;
import org.apache.commons.bcel6.classfile.StackMapEntry;
import org.apache.commons.bcel6.classfile.Synthetic;
import org.apache.commons.bcel6.classfile.Unknown;
import org.apache.commons.bcel6.classfile.Visitor;

public class CounterVisitor implements Visitor
{
    // CHECKSTYLE:OFF (public mutable fields in test code)
    public int unknownCount = 0;

    public int syntheticCount = 0;

    public int stackMapEntryCount = 0;

    public int stackMapCount = 0;

    public int sourceFileCount = 0;

    public int signatureAnnotationCount = 0;

    public int parameterAnnotationCount = 0;

    public int methodCount = 0;

    public int localVariableTypeTableCount = 0;

    public int localVariableTableCount = 0;

    public int localVariableCount = 0;

    public int lineNumberTableCount = 0;

    public int lineNumberCount = 0;

    public int javaClassCount = 0;

    public int innerClassesCount = 0;

    public int innerClassCount = 0;

    public int fieldCount = 0;

    public int exceptionTableCount = 0;

    public int enclosingMethodCount = 0;

    public int deprecatedCount = 0;

    public int constantValueCount = 0;

    public int constantUtf8Count = 0;

    public int constantStringCount = 0;

    public int constantNameAndTypeCount = 0;

    public int constantPoolCount = 0;

    public int constantMethodrefCount = 0;

    public int constantLongCount = 0;

    public int constantIntegerCount = 0;

    public int constantInterfaceMethodrefCount = 0;

    public int constantFloatCount = 0;

    public int constantFieldrefCount = 0;

    public int constantClassCount = 0;

    public int constantDoubleCount = 0;

    public int codeExceptionCount = 0;

    public int codeCount = 0;

    public int annotationEntryCount = 0;

    public int annotationDefaultCount = 0;

    public int annotationCount = 0;

    /** @since 6.0 */
    public int bootstrapMethodsCount = 0;

    /** @since 6.0 */
    public int methodParametersCount = 0;

    /** @since 6.0 */
    public int constantInvokeDynamic = 0;
    // CHECKSTYLE:ON


    @Override
    public void visitAnnotation(final Annotations obj)
    {
        annotationCount++;
    }

    @Override
    public void visitAnnotationDefault(final AnnotationDefault obj)
    {
        annotationDefaultCount++;
    }

    @Override
    public void visitAnnotationEntry(final AnnotationEntry obj)
    {
        annotationEntryCount++;
    }

    @Override
    public void visitCode(final Code obj)
    {
        codeCount++;
    }

    @Override
    public void visitCodeException(final CodeException obj)
    {
        codeExceptionCount++;
    }

    @Override
    public void visitConstantClass(final ConstantClass obj)
    {
        constantClassCount++;
    }

    @Override
    public void visitConstantDouble(final ConstantDouble obj)
    {
        constantDoubleCount++;
    }

    @Override
    public void visitConstantFieldref(final ConstantFieldref obj)
    {
        constantFieldrefCount++;
    }

    @Override
    public void visitConstantFloat(final ConstantFloat obj)
    {
        constantFloatCount++;
    }

    @Override
    public void visitConstantInteger(final ConstantInteger obj)
    {
        constantIntegerCount++;
    }

    @Override
    public void visitConstantInterfaceMethodref(final ConstantInterfaceMethodref obj)
    {
        constantInterfaceMethodrefCount++;
    }

    @Override
    public void visitConstantLong(final ConstantLong obj)
    {
        constantLongCount++;
    }

    @Override
    public void visitConstantMethodref(final ConstantMethodref obj)
    {
        constantMethodrefCount++;
    }

    @Override
    public void visitConstantNameAndType(final ConstantNameAndType obj)
    {
        constantNameAndTypeCount++;
    }

    @Override
    public void visitConstantPool(final ConstantPool obj)
    {
        constantPoolCount++;
    }

    @Override
    public void visitConstantString(final ConstantString obj)
    {
        constantStringCount++;
    }

    @Override
    public void visitConstantUtf8(final ConstantUtf8 obj)
    {
        constantUtf8Count++;
    }

    @Override
    public void visitConstantValue(final ConstantValue obj)
    {
        constantValueCount++;
    }

    @Override
    public void visitDeprecated(final Deprecated obj)
    {
        deprecatedCount++;
    }

    @Override
    public void visitEnclosingMethod(final EnclosingMethod obj)
    {
        enclosingMethodCount++;
    }

    @Override
    public void visitExceptionTable(final ExceptionTable obj)
    {
        exceptionTableCount++;
    }

    @Override
    public void visitField(final Field obj)
    {
        fieldCount++;
    }

    @Override
    public void visitInnerClass(final InnerClass obj)
    {
        innerClassCount++;
    }

    @Override
    public void visitInnerClasses(final InnerClasses obj)
    {
        innerClassesCount++;
    }

    @Override
    public void visitJavaClass(final JavaClass obj)
    {
        javaClassCount++;
    }

    @Override
    public void visitLineNumber(final LineNumber obj)
    {
        lineNumberCount++;
    }

    @Override
    public void visitLineNumberTable(final LineNumberTable obj)
    {
        lineNumberTableCount++;
    }

    @Override
    public void visitLocalVariable(final LocalVariable obj)
    {
        localVariableCount++;
    }

    @Override
    public void visitLocalVariableTable(final LocalVariableTable obj)
    {
        localVariableTableCount++;
    }

    @Override
    public void visitLocalVariableTypeTable(final LocalVariableTypeTable obj)
    {
        localVariableTypeTableCount++;
    }

    @Override
    public void visitMethod(final Method obj)
    {
        methodCount++;
    }

    @Override
    public void visitParameterAnnotation(final ParameterAnnotations obj)
    {
        parameterAnnotationCount++;
    }

    @Override
    public void visitSignature(final Signature obj)
    {
        signatureAnnotationCount++;
    }

    @Override
    public void visitSourceFile(final SourceFile obj)
    {
        sourceFileCount++;
    }

    @Override
    public void visitStackMap(final StackMap obj)
    {
        stackMapCount++;
    }

    @Override
    public void visitStackMapEntry(final StackMapEntry obj)
    {
        stackMapEntryCount++;
    }

    @Override
    public void visitSynthetic(final Synthetic obj)
    {
        syntheticCount++;
    }

    @Override
    public void visitUnknown(final Unknown obj)
    {
        unknownCount++;
    }

    /** @since 6.0 */
    @Override
    public void visitBootstrapMethods(final BootstrapMethods obj)
    {
        bootstrapMethodsCount++;
    }

    /** @since 6.0 */
    @Override
    public void visitMethodParameters(final MethodParameters obj)
    {
        methodParametersCount++;
    }

    /** @since 6.0 */
    @Override
    public void visitConstantInvokeDynamic(final ConstantInvokeDynamic obj)
    {
        constantInvokeDynamic++;
    }

    /** @since 6.0 */
    @Override
    public void visitConstantMethodType(final ConstantMethodType obj) {
        // TODO Auto-generated method stub        
    }

    /** @since 6.0 */
    @Override
    public void visitConstantMethodHandle(final ConstantMethodHandle constantMethodHandle) {
        // TODO Auto-generated method stub
    }

    /** @since 6.0 */
    @Override
    public void visitParameterAnnotationEntry(final ParameterAnnotationEntry parameterAnnotationEntry) {
        // TODO Auto-generated method stub        
    }
}