• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

raphw / byte-buddy / #801

27 Oct 2025 09:37AM UTC coverage: 84.715% (-0.4%) from 85.118%
#801

push

raphw
Fix imports.

29586 of 34924 relevant lines covered (84.72%)

0.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

48.1
/byte-buddy-dep/src/main/java/net/bytebuddy/asm/TypeReferenceAdjustment.java
1
/*
2
 * Copyright 2014 - Present Rafael Winterhalter
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package net.bytebuddy.asm;
17

18
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
19
import net.bytebuddy.build.HashCodeAndEqualsPlugin;
20
import net.bytebuddy.description.field.FieldDescription;
21
import net.bytebuddy.description.field.FieldList;
22
import net.bytebuddy.description.method.MethodList;
23
import net.bytebuddy.description.type.TypeDescription;
24
import net.bytebuddy.implementation.Implementation;
25
import net.bytebuddy.matcher.ElementMatcher;
26
import net.bytebuddy.pool.TypePool;
27
import net.bytebuddy.utility.OpenedClassReader;
28
import net.bytebuddy.utility.nullability.AlwaysNull;
29
import net.bytebuddy.utility.nullability.MaybeNull;
30
import org.objectweb.asm.AnnotationVisitor;
31
import org.objectweb.asm.ClassVisitor;
32
import org.objectweb.asm.ConstantDynamic;
33
import org.objectweb.asm.FieldVisitor;
34
import org.objectweb.asm.Handle;
35
import org.objectweb.asm.Label;
36
import org.objectweb.asm.MethodVisitor;
37
import org.objectweb.asm.RecordComponentVisitor;
38
import org.objectweb.asm.Type;
39
import org.objectweb.asm.TypePath;
40

41
import java.util.Arrays;
42
import java.util.HashSet;
43
import java.util.Set;
44

45
import static net.bytebuddy.matcher.ElementMatchers.none;
46

47
/**
48
 * Adds an attribute value for all inner classes that are referenced by the instrumented type. Adding such attributes
49
 * is formally required by the Java virtual machine specification but it is not enforced by the verifier. As a result,
50
 * many alternative JVM languages do not correctly implement the attribute. By adding this visitor, a type's inner
51
 * class attribute can be repaired or created by registering this visitor wrapper.
52
 */
53
@HashCodeAndEqualsPlugin.Enhance
54
public class TypeReferenceAdjustment extends AsmVisitorWrapper.AbstractBase {
55

56
    /**
57
     * {@code true} if the visitor should throw an exception if a type reference cannot be located.
58
     */
59
    private final boolean strict;
60

61
    /**
62
     * A filter for excluding types from type reference analysis.
63
     */
64
    private final ElementMatcher.Junction<? super TypeDescription> filter;
65

66
    /**
67
     * Creates a type reference adjustment.
68
     *
69
     * @param strict {@code true} if the visitor should throw an exception if a type reference cannot be located.
70
     * @param filter A filter for excluding types from type reference analysis.
71
     */
72
    protected TypeReferenceAdjustment(boolean strict, ElementMatcher.Junction<? super TypeDescription> filter) {
1✔
73
        this.strict = strict;
1✔
74
        this.filter = filter;
1✔
75
    }
1✔
76

77
    /**
78
     * Creates a strict type reference adjustment that throws an exception if a type reference cannot be resolved
79
     * in the supplied type pool.
80
     *
81
     * @return A strict type reference adjustment.
82
     */
83
    public static TypeReferenceAdjustment strict() {
84
        return new TypeReferenceAdjustment(true, none());
1✔
85
    }
86

87
    /**
88
     * Creates a strict type reference adjustment that ignores type references that cannot be resolved
89
     * in the supplied type pool.
90
     *
91
     * @return A relaxed type reference adjustment.
92
     */
93
    public static TypeReferenceAdjustment relaxed() {
94
        return new TypeReferenceAdjustment(false, none());
1✔
95
    }
96

97
    /**
98
     * Excludes all matched types from being added as an attribute.
99
     *
100
     * @param filter A filter for excluding types from the attribute generation.
101
     * @return A new type reference adjustment that uses the supplied filter for excluding types.
102
     */
103
    public TypeReferenceAdjustment filter(ElementMatcher<? super TypeDescription> filter) {
104
        return new TypeReferenceAdjustment(strict, this.filter.<TypeDescription>or(filter));
1✔
105
    }
106

107
    /**
108
     * {@inheritDoc}
109
     */
110
    public ClassVisitor wrap(TypeDescription instrumentedType,
111
                             ClassVisitor classVisitor,
112
                             Implementation.Context implementationContext,
113
                             TypePool typePool,
114
                             FieldList<FieldDescription.InDefinedShape> fields,
115
                             MethodList<?> methods,
116
                             int writerFlags,
117
                             int readerFlags) {
118
        return new TypeReferenceClassVisitor(classVisitor, strict, filter, typePool);
1✔
119
    }
120

121
    /**
122
     * A class visitor that collects all type references and all inner class references.
123
     */
124
    protected static class TypeReferenceClassVisitor extends ClassVisitor {
125

126
        /**
127
         * Indicates that an annotation is not of interest.
128
         */
129
        @AlwaysNull
130
        private static final AnnotationVisitor IGNORE_ANNOTATION = null;
1✔
131

132
        /**
133
         * Indicates that a field is not of interest.
134
         */
135
        @AlwaysNull
136
        private static final FieldVisitor IGNORE_FIELD = null;
1✔
137

138
        /**
139
         * Indicates that a method is not of interest.
140
         */
141
        @AlwaysNull
142
        private static final MethodVisitor IGNORE_METHOD = null;
1✔
143

144
        /**
145
         * {@code true} if the visitor should throw an exception if a type reference cannot be located.
146
         */
147
        private final boolean strict;
148

149
        /**
150
         * A filter for excluding types from type reference analysis.
151
         */
152
        private final ElementMatcher<? super TypeDescription> filter;
153

154
        /**
155
         * The type pool to use for locating types.
156
         */
157
        private final TypePool typePool;
158

159
        /**
160
         * A set of inner class names that have been observed within the processed class file.
161
         */
162
        private final Set<String> observedTypes;
163

164
        /**
165
         * A set of inner class names that were added as inner class attribute values.
166
         */
167
        private final Set<String> visitedInnerTypes;
168

169
        /**
170
         * Creates a type reference class visitor.
171
         *
172
         * @param classVisitor {@code true} if the visitor should throw an exception if a type reference cannot be located.
173
         * @param strict       {@code true} if the visitor should throw an exception if a type reference cannot be located.
174
         * @param filter       A filter for excluding types from type reference analysis.
175
         * @param typePool     The type pool to use for locating types.
176
         */
177
        protected TypeReferenceClassVisitor(ClassVisitor classVisitor, boolean strict, ElementMatcher<? super TypeDescription> filter, TypePool typePool) {
178
            super(OpenedClassReader.ASM_API, classVisitor);
1✔
179
            this.typePool = typePool;
1✔
180
            this.strict = strict;
1✔
181
            this.filter = filter;
1✔
182
            observedTypes = new HashSet<String>();
1✔
183
            visitedInnerTypes = new HashSet<String>();
1✔
184
        }
1✔
185

186
        @Override
187
        public void visit(int version,
188
                          int modifiers,
189
                          String internalName,
190
                          @MaybeNull String genericSignature,
191
                          @MaybeNull String superClassInternalName,
192
                          @MaybeNull String[] interfaceInternalName) {
193
            if (superClassInternalName != null) {
1✔
194
                observedTypes.add(superClassInternalName);
1✔
195
            }
196
            if (interfaceInternalName != null) {
1✔
197
                observedTypes.addAll(Arrays.asList(interfaceInternalName));
1✔
198
            }
199
            super.visit(version, modifiers, internalName, genericSignature, superClassInternalName, interfaceInternalName);
1✔
200
        }
1✔
201

202
        @Override
203
        public void visitNestHost(String nestHost) {
204
            observedTypes.add(nestHost);
×
205
            super.visitNestHost(nestHost);
×
206
        }
×
207

208
        @Override
209
        public void visitOuterClass(String ownerTypeInternalName, String methodName, String methodDescriptor) {
210
            observedTypes.add(ownerTypeInternalName);
×
211
            super.visitOuterClass(ownerTypeInternalName, methodName, methodDescriptor);
×
212
        }
×
213

214
        @Override
215
        public void visitNestMember(String nestMember) {
216
            observedTypes.add(nestMember);
×
217
            super.visitNestMember(nestMember);
×
218
        }
×
219

220
        @Override
221
        public void visitInnerClass(String internalName, String outerName, String innerName, int modifiers) {
222
            visitedInnerTypes.add(internalName);
×
223
            super.visitInnerClass(internalName, outerName, innerName, modifiers);
×
224
        }
×
225

226
        @Override
227
        @MaybeNull
228
        public RecordComponentVisitor visitRecordComponent(String name, String descriptor, @MaybeNull String signature) {
229
            observedTypes.add(Type.getType(descriptor).getInternalName());
×
230
            return super.visitRecordComponent(name, descriptor, signature);
×
231
        }
232

233
        @Override
234
        @MaybeNull
235
        public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
236
            observedTypes.add(Type.getType(descriptor).getInternalName());
1✔
237
            AnnotationVisitor annotationVisitor = super.visitAnnotation(descriptor, visible);
1✔
238
            if (annotationVisitor != null) {
1✔
239
                return new TypeReferenceAnnotationVisitor(annotationVisitor);
1✔
240
            } else {
241
                return IGNORE_ANNOTATION;
×
242
            }
243
        }
244

245
        @Override
246
        @MaybeNull
247
        public AnnotationVisitor visitTypeAnnotation(int typeReference, @MaybeNull TypePath typePath, String descriptor, boolean visible) {
248
            observedTypes.add(Type.getType(descriptor).getInternalName());
×
249
            AnnotationVisitor annotationVisitor = super.visitTypeAnnotation(typeReference, typePath, descriptor, visible);
×
250
            if (annotationVisitor != null) {
×
251
                return new TypeReferenceAnnotationVisitor(annotationVisitor);
×
252
            } else {
253
                return IGNORE_ANNOTATION;
×
254
            }
255
        }
256

257
        @Override
258
        @MaybeNull
259
        public FieldVisitor visitField(int modifiers, String name, String descriptor, @MaybeNull String signature, @MaybeNull Object value) {
260
            FieldVisitor fieldVisitor = super.visitField(modifiers, name, descriptor, signature, value);
1✔
261
            if (fieldVisitor != null) {
1✔
262
                resolve(Type.getType(descriptor));
1✔
263
                return new TypeReferenceFieldVisitor(fieldVisitor);
1✔
264
            } else {
265
                return IGNORE_FIELD;
×
266
            }
267
        }
268

269
        @Override
270
        @MaybeNull
271
        public MethodVisitor visitMethod(int modifiers, String internalName, String descriptor, @MaybeNull String signature, @MaybeNull String[] exceptionInternalName) {
272
            MethodVisitor methodVisitor = super.visitMethod(modifiers, internalName, descriptor, signature, exceptionInternalName);
1✔
273
            if (methodVisitor != null) {
1✔
274
                resolve(Type.getType(descriptor));
1✔
275
                if (exceptionInternalName != null) {
1✔
276
                    observedTypes.addAll(Arrays.asList(exceptionInternalName));
×
277
                }
278
                return new TypeReferenceMethodVisitor(methodVisitor);
1✔
279
            } else {
280
                return IGNORE_METHOD;
×
281
            }
282
        }
283

284
        @Override
285
        @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "Assuming declaring type for type member.")
286
        public void visitEnd() {
287
            for (String observedType : observedTypes) {
1✔
288
                if (visitedInnerTypes.add(observedType)) {
1✔
289
                    TypePool.Resolution resolution = typePool.describe(observedType.replace('/', '.'));
1✔
290
                    if (resolution.isResolved()) {
1✔
291
                        TypeDescription typeDescription = resolution.resolve();
1✔
292
                        if (!filter.matches(typeDescription)) {
1✔
293
                            while (typeDescription != null && typeDescription.isNestedClass()) {
1✔
294
                                super.visitInnerClass(typeDescription.getInternalName(),
1✔
295
                                        typeDescription.isMemberType()
1✔
296
                                                ? typeDescription.getDeclaringType().getInternalName()
1✔
297
                                                : null,
298
                                        typeDescription.isAnonymousType()
1✔
299
                                                ? null
300
                                                : typeDescription.getSimpleName(),
1✔
301
                                        typeDescription.getModifiers());
1✔
302
                                try {
303
                                    do {
304
                                        typeDescription = typeDescription.getEnclosingType();
1✔
305
                                    } while (typeDescription != null && !visitedInnerTypes.add(typeDescription.getInternalName()));
1✔
306
                                } catch (RuntimeException exception) {
×
307
                                    if (strict) {
×
308
                                        throw exception;
×
309
                                    } else {
310
                                        break;
×
311
                                    }
312
                                }
1✔
313
                            }
314
                        }
315
                    } else if (strict) {
1✔
316
                        throw new IllegalStateException("Could not locate type for: " + observedType.replace('/', '.'));
1✔
317
                    }
318
                }
319
            }
1✔
320
            super.visitEnd();
1✔
321
        }
1✔
322

323
        /**
324
         * Resolves all type references that are referenced by a {@link Type} value.
325
         *
326
         * @param type The type to resolve.
327
         */
328
        protected void resolve(Type type) {
329
            if (type.getSort() == Type.METHOD) {
1✔
330
                resolve(type.getReturnType());
1✔
331
                for (Type argumentType : type.getArgumentTypes()) {
1✔
332
                    resolve(argumentType);
1✔
333
                }
334
            } else {
335
                while (type.getSort() == Type.ARRAY) {
1✔
336
                    type = type.getElementType();
×
337
                }
338
                if (type.getSort() == Type.OBJECT) {
1✔
339
                    observedTypes.add(type.getInternalName());
1✔
340
                }
341
            }
342
        }
1✔
343

344
        /**
345
         * Resolves all type references that are referenced by a {@link Handle} value.
346
         *
347
         * @param handle The handle to resolve.
348
         */
349
        protected void resolve(Handle handle) {
350
            observedTypes.add(handle.getOwner());
×
351
            Type methodType = Type.getType(handle.getDesc());
×
352
            resolve(methodType.getReturnType());
×
353
            for (Type type : methodType.getArgumentTypes()) {
×
354
                resolve(type);
×
355
            }
356
        }
×
357

358
        /**
359
         * Resolves all type references that are referenced by a {@link ConstantDynamic} value.
360
         *
361
         * @param constant The dynamic constant to resolve.
362
         */
363
        protected void resolve(ConstantDynamic constant) {
364
            Type methodType = Type.getType(constant.getDescriptor());
×
365
            resolve(methodType.getReturnType());
×
366
            for (Type type : methodType.getArgumentTypes()) {
×
367
                resolve(type);
×
368
            }
369
            resolve(constant.getBootstrapMethod());
×
370
            for (int index = 0; index < constant.getBootstrapMethodArgumentCount(); index++) {
×
371
                resolve(constant.getBootstrapMethodArgument(index));
×
372
            }
373
        }
×
374

375
        /**
376
         * Observes an internal name of an object type that might be an array type.
377
         *
378
         * @param internalName The internal name to resolve.
379
         */
380
        private void observeInternalName(String internalName) {
381
            int index = internalName.lastIndexOf('[');
1✔
382
            if (index != -1) {
1✔
383
                internalName = internalName.substring(index + 2, internalName.length() - 1);
×
384
            }
385
            observedTypes.add(internalName);
1✔
386
        }
1✔
387

388
        /**
389
         * Resolves all type references that are referenced by any ASM constant value.
390
         *
391
         * @param value The unknown constant value to resolve.
392
         */
393
        protected void resolve(Object value) {
394
            if (value instanceof Type) {
1✔
395
                resolve((Type) value);
1✔
396
            } else if (value instanceof Handle) {
×
397
                resolve((Handle) value);
×
398
            } else if (value instanceof ConstantDynamic) {
×
399
                resolve((ConstantDynamic) value);
×
400
            }
401
        }
1✔
402

403
        /**
404
         * An annotation visitor that collects all type references.
405
         */
406
        protected class TypeReferenceAnnotationVisitor extends AnnotationVisitor {
407

408
            /**
409
             * Creates a new type reference-collecting annotation visitor.
410
             *
411
             * @param annotationVisitor The annotation visitor to delegate to.
412
             */
413
            protected TypeReferenceAnnotationVisitor(AnnotationVisitor annotationVisitor) {
1✔
414
                super(OpenedClassReader.ASM_API, annotationVisitor);
1✔
415
            }
1✔
416

417
            @Override
418
            public void visit(String name, Object value) {
419
                resolve(value);
×
420
                super.visit(name, value);
×
421
            }
×
422

423
            @Override
424
            public void visitEnum(String name, String descriptor, String value) {
425
                observedTypes.add(Type.getType(descriptor).getInternalName());
×
426
                super.visitEnum(name, descriptor, value);
×
427
            }
×
428

429
            @Override
430
            @MaybeNull
431
            public AnnotationVisitor visitAnnotation(String name, String descriptor) {
432
                observedTypes.add(Type.getType(descriptor).getInternalName());
×
433
                AnnotationVisitor annotationVisitor = super.visitAnnotation(name, descriptor);
×
434
                if (annotationVisitor != null) {
×
435
                    return new TypeReferenceAnnotationVisitor(annotationVisitor);
×
436
                } else {
437
                    return IGNORE_ANNOTATION;
×
438
                }
439
            }
440

441
            @Override
442
            @MaybeNull
443
            public AnnotationVisitor visitArray(String name) {
444
                AnnotationVisitor annotationVisitor = super.visitArray(name);
×
445
                if (annotationVisitor != null) {
×
446
                    return new TypeReferenceAnnotationVisitor(annotationVisitor);
×
447
                } else {
448
                    return IGNORE_ANNOTATION;
×
449
                }
450
            }
451
        }
452

453
        /**
454
         * A field visitor that collects all type references.
455
         */
456
        protected class TypeReferenceFieldVisitor extends FieldVisitor {
457

458
            /**
459
             * Creates a new type reference-collecting field visitor.
460
             *
461
             * @param fieldVisitor The field visitor to delegate to.
462
             */
463
            protected TypeReferenceFieldVisitor(FieldVisitor fieldVisitor) {
1✔
464
                super(OpenedClassReader.ASM_API, fieldVisitor);
1✔
465
            }
1✔
466

467
            @Override
468
            @MaybeNull
469
            public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
470
                observedTypes.add(Type.getType(descriptor).getInternalName());
1✔
471
                AnnotationVisitor annotationVisitor = super.visitAnnotation(descriptor, visible);
1✔
472
                if (annotationVisitor != null) {
1✔
473
                    return new TypeReferenceAnnotationVisitor(annotationVisitor);
1✔
474
                } else {
475
                    return IGNORE_ANNOTATION;
×
476
                }
477
            }
478
        }
479

480
        /**
481
         * A method visitor that collects all type references.
482
         */
483
        protected class TypeReferenceMethodVisitor extends MethodVisitor {
484

485
            /**
486
             * Creates a new type reference-collecting method visitor.
487
             *
488
             * @param methodVisitor The method visitor to delegate to.
489
             */
490
            protected TypeReferenceMethodVisitor(MethodVisitor methodVisitor) {
1✔
491
                super(OpenedClassReader.ASM_API, methodVisitor);
1✔
492
            }
1✔
493

494
            @Override
495
            @MaybeNull
496
            public AnnotationVisitor visitAnnotationDefault() {
497
                AnnotationVisitor annotationVisitor = super.visitAnnotationDefault();
×
498
                if (annotationVisitor != null) {
×
499
                    return new TypeReferenceAnnotationVisitor(annotationVisitor);
×
500
                } else {
501
                    return IGNORE_ANNOTATION;
×
502
                }
503
            }
504

505
            @Override
506
            @MaybeNull
507
            public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
508
                observedTypes.add(Type.getType(descriptor).getInternalName());
1✔
509
                AnnotationVisitor annotationVisitor = super.visitAnnotation(descriptor, visible);
1✔
510
                if (annotationVisitor != null) {
1✔
511
                    return new TypeReferenceAnnotationVisitor(annotationVisitor);
1✔
512
                } else {
513
                    return IGNORE_ANNOTATION;
×
514
                }
515
            }
516

517
            @Override
518
            @MaybeNull
519
            public AnnotationVisitor visitTypeAnnotation(int typeReference, @MaybeNull TypePath typePath, String descriptor, boolean visible) {
520
                observedTypes.add(Type.getType(descriptor).getInternalName());
×
521
                AnnotationVisitor annotationVisitor = super.visitTypeAnnotation(typeReference, typePath, descriptor, visible);
×
522
                if (annotationVisitor != null) {
×
523
                    return new TypeReferenceAnnotationVisitor(annotationVisitor);
×
524
                } else {
525
                    return IGNORE_ANNOTATION;
×
526
                }
527
            }
528

529
            @Override
530
            @MaybeNull
531
            public AnnotationVisitor visitParameterAnnotation(int index, String descriptor, boolean visible) {
532
                observedTypes.add(Type.getType(descriptor).getInternalName());
1✔
533
                AnnotationVisitor annotationVisitor = super.visitParameterAnnotation(index, descriptor, visible);
1✔
534
                if (annotationVisitor != null) {
1✔
535
                    return new TypeReferenceAnnotationVisitor(annotationVisitor);
1✔
536
                } else {
537
                    return IGNORE_ANNOTATION;
×
538
                }
539
            }
540

541
            @Override
542
            @MaybeNull
543
            public AnnotationVisitor visitInsnAnnotation(int typeReference, @MaybeNull TypePath typePath, String descriptor, boolean visible) {
544
                observedTypes.add(Type.getType(descriptor).getInternalName());
×
545
                AnnotationVisitor annotationVisitor = super.visitInsnAnnotation(typeReference, typePath, descriptor, visible);
×
546
                if (annotationVisitor != null) {
×
547
                    return new TypeReferenceAnnotationVisitor(annotationVisitor);
×
548
                } else {
549
                    return IGNORE_ANNOTATION;
×
550
                }
551
            }
552

553
            @Override
554
            @MaybeNull
555
            public AnnotationVisitor visitTryCatchAnnotation(int typeReference, @MaybeNull TypePath typePath, String descriptor, boolean visible) {
556
                observedTypes.add(Type.getType(descriptor).getInternalName());
×
557
                AnnotationVisitor annotationVisitor = super.visitTryCatchAnnotation(typeReference, typePath, descriptor, visible);
×
558
                if (annotationVisitor != null) {
×
559
                    return new TypeReferenceAnnotationVisitor(annotationVisitor);
×
560
                } else {
561
                    return IGNORE_ANNOTATION;
×
562
                }
563
            }
564

565
            @Override
566
            @MaybeNull
567
            public AnnotationVisitor visitLocalVariableAnnotation(int typeReference,
568
                                                                  @MaybeNull TypePath typePath,
569
                                                                  Label[] start,
570
                                                                  Label[] end,
571
                                                                  int[] offset,
572
                                                                  String descriptor,
573
                                                                  boolean visible) {
574
                observedTypes.add(Type.getType(descriptor).getInternalName());
×
575
                AnnotationVisitor annotationVisitor = super.visitLocalVariableAnnotation(typeReference, typePath, start, end, offset, descriptor, visible);
×
576
                if (annotationVisitor != null) {
×
577
                    return new TypeReferenceAnnotationVisitor(annotationVisitor);
×
578
                } else {
579
                    return IGNORE_ANNOTATION;
×
580
                }
581
            }
582

583
            @Override
584
            public void visitTypeInsn(int opcode, String internalName) {
585
                observeInternalName(internalName);
×
586
                super.visitTypeInsn(opcode, internalName);
×
587
            }
×
588

589
            @Override
590
            public void visitFieldInsn(int opcode, String ownerInternalName, String name, String descriptor) {
591
                observeInternalName(ownerInternalName);
×
592
                resolve(Type.getType(descriptor));
×
593
                super.visitFieldInsn(opcode, ownerInternalName, name, descriptor);
×
594
            }
×
595

596
            @Override
597
            public void visitMethodInsn(int opcode, String ownerInternalName, String name, String descriptor, boolean isInterface) {
598
                observeInternalName(ownerInternalName);
1✔
599
                resolve(Type.getType(descriptor));
1✔
600
                super.visitMethodInsn(opcode, ownerInternalName, name, descriptor, isInterface);
1✔
601
            }
1✔
602

603
            @Override
604
            public void visitInvokeDynamicInsn(String name, String descriptor, Handle handle, Object... argument) {
605
                resolve(Type.getType(descriptor));
×
606
                resolve(handle);
×
607
                for (Object anArgument : argument) {
×
608
                    resolve(anArgument);
×
609
                }
610
                super.visitInvokeDynamicInsn(name, descriptor, handle, argument);
×
611
            }
×
612

613
            @Override
614
            public void visitLdcInsn(Object value) {
615
                resolve(value);
1✔
616
                super.visitLdcInsn(value);
1✔
617
            }
1✔
618

619
            @Override
620
            public void visitMultiANewArrayInsn(String descriptor, int dimension) {
621
                resolve(Type.getType(descriptor));
×
622
                super.visitMultiANewArrayInsn(descriptor, dimension);
×
623
            }
×
624

625
            @Override
626
            public void visitTryCatchBlock(Label start, Label end, Label handler, @MaybeNull String typeInternalName) {
627
                if (typeInternalName != null) {
×
628
                    observedTypes.add(typeInternalName);
×
629
                }
630
                super.visitTryCatchBlock(start, end, handler, typeInternalName);
×
631
            }
×
632
        }
633
    }
634
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc