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

pmd / pmd / #3722

pending completion
#3722

push

github actions

adangel
Suppress MissingOverride for Chars::isEmpty (#4291)

67270 of 127658 relevant lines covered (52.7%)

0.53 hits per line

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

85.71
/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/AnnotableSymbol.java
1
/*
2
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3
 */
4

5
package net.sourceforge.pmd.lang.java.symbols;
6

7
import java.lang.annotation.Annotation;
8

9
import org.pcollections.HashTreePSet;
10
import org.pcollections.PSet;
11

12
import net.sourceforge.pmd.lang.java.symbols.SymbolicValue.SymAnnot;
13

14
/**
15
 * A symbol that can have annotations.
16
 */
17
public interface AnnotableSymbol extends JElementSymbol {
18

19
    /**
20
     * Return the valid symbolic annotations defined on this symbol.
21
     * Annotations that could not be converted, eg because
22
     * they are written with invalid code, are discarded, so
23
     * this might not match the annotations on a node one to one.
24
     */
25
    default PSet<SymAnnot> getDeclaredAnnotations() {
26
        return HashTreePSet.empty();
×
27
    }
28

29

30
    /**
31
     * Return an annotation of the given type, if it is present on this declaration.
32
     * This does not consider inherited annotations.
33
     */
34
    default SymbolicValue.SymAnnot getDeclaredAnnotation(Class<? extends Annotation> type) {
35
        for (SymAnnot a : getDeclaredAnnotations()) {
1✔
36
            if (a.isOfType(type)) {
1✔
37
                return a;
1✔
38
            }
39
        }
1✔
40
        return null;
1✔
41
    }
42

43

44
    /**
45
     * Return true if an annotation of the given type is present on this declaration.
46
     */
47
    default boolean isAnnotationPresent(Class<? extends Annotation> type) {
48
        return getDeclaredAnnotation(type) != null;
1✔
49
    }
50
}
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