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

raphw / byte-buddy / #811

03 Nov 2025 10:41AM UTC coverage: 83.677% (-0.3%) from 84.023%
#811

push

raphw
Fix null handling.

0 of 1 new or added line in 1 file covered. (0.0%)

791 existing lines in 12 files now uncovered.

29814 of 35630 relevant lines covered (83.68%)

0.84 hits per line

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

84.62
/byte-buddy-dep/src/main/java/net/bytebuddy/build/DispatcherAnnotationPlugin.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.build;
17

18
import net.bytebuddy.asm.MemberAttributeExtension;
19
import net.bytebuddy.description.method.MethodDescription;
20
import net.bytebuddy.description.type.TypeDescription;
21
import net.bytebuddy.dynamic.ClassFileLocator;
22
import net.bytebuddy.dynamic.DynamicType;
23
import net.bytebuddy.implementation.attribute.AnnotationValueFilter;
24
import net.bytebuddy.implementation.attribute.MethodAttributeAppender;
25
import net.bytebuddy.utility.dispatcher.JavaDispatcher;
26
import org.objectweb.asm.AnnotationVisitor;
27
import org.objectweb.asm.MethodVisitor;
28
import org.objectweb.asm.Type;
29

30
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
31
import static net.bytebuddy.matcher.ElementMatchers.isAnnotatedWith;
32
import static net.bytebuddy.matcher.ElementMatchers.not;
33

34
/**
35
 * A plugin that adds a {@link net.bytebuddy.utility.dispatcher.JavaDispatcher.Proxied} annotation to any method of an
36
 * enhanced type where the annotation is not set. This aids in supporting obfuscators that rename methods which
37
 * makes reflection-based lookup by the proxy interface's name impossible.
38
 */
39
@HashCodeAndEqualsPlugin.Enhance
40
public class DispatcherAnnotationPlugin extends Plugin.ForElementMatcher implements Plugin.Factory, MethodAttributeAppender.Factory, MethodAttributeAppender {
41

42
    /**
43
     * Creates a new dispatcher annotation plugin.
44
     */
45
    public DispatcherAnnotationPlugin() {
46
        super(isAnnotatedWith(JavaDispatcher.Proxied.class));
1✔
47
    }
1✔
48

49
    /**
50
     * {@inheritDoc}
51
     */
52
    public Plugin make() {
UNCOV
53
        return this;
×
54
    }
55

56
    /**
57
     * {@inheritDoc}
58
     */
59
    public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator) {
60
        return builder.visit(new MemberAttributeExtension.ForMethod()
1✔
61
                .attribute(this)
1✔
62
                .on(not(isAnnotatedWith(JavaDispatcher.Proxied.class)).<MethodDescription>and(isAbstract())));
1✔
63
    }
64

65
    /**
66
     * {@inheritDoc}
67
     */
68
    public void close() {
69
        /* do nothing */
UNCOV
70
    }
×
71

72
    /**
73
     * {@inheritDoc}
74
     */
75
    public MethodAttributeAppender make(TypeDescription typeDescription) {
76
        return this;
1✔
77
    }
78

79
    /**
80
     * {@inheritDoc}
81
     */
82
    public void apply(MethodVisitor methodVisitor, MethodDescription methodDescription, AnnotationValueFilter annotationValueFilter) {
83
        AnnotationVisitor visitor = methodVisitor.visitAnnotation(Type.getDescriptor(JavaDispatcher.Proxied.class), true);
1✔
84
        if (visitor != null) {
1✔
85
            visitor.visit("value", methodDescription.getName());
1✔
86
            visitor.visitEnd();
1✔
87
        }
88
    }
1✔
89
}
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