• 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

96.15
/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/WildcardTypeImpl.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.types;
6

7
import java.util.Objects;
8
import java.util.function.Function;
9

10
import org.checkerframework.checker.nullness.qual.NonNull;
11
import org.checkerframework.checker.nullness.qual.Nullable;
12
import org.pcollections.PSet;
13

14
import net.sourceforge.pmd.lang.java.symbols.SymbolicValue.SymAnnot;
15

16

17
final class WildcardTypeImpl implements JWildcardType {
18

19
    private final JTypeMirror bound;
20
    private final boolean isUpperBound;
21
    private final TypeSystem ts;
22
    private final PSet<SymAnnot> typeAnnots;
23

24

25
    WildcardTypeImpl(TypeSystem ts, boolean isUpperBound, @Nullable JTypeMirror bound, PSet<SymAnnot> typeAnnots) {
1✔
26
        this.ts = ts;
1✔
27
        this.typeAnnots = typeAnnots;
1✔
28
        this.bound = bound != null ? bound
1✔
29
                                   : isUpperBound ? ts.OBJECT : ts.NULL_TYPE;
1✔
30
        this.isUpperBound = isUpperBound;
1✔
31
    }
1✔
32

33
    @Override
34
    public JWildcardType subst(Function<? super SubstVar, ? extends @NonNull JTypeMirror> subst) {
35
        JTypeMirror newBound = getBound().subst(subst);
1✔
36
        return newBound == getBound() ? this : ts.wildcard(isUpperBound(), newBound).withAnnotations(typeAnnots); // NOPMD CompareObjectsWithEquals
1✔
37
    }
38

39
    @Override
40
    public PSet<SymAnnot> getTypeAnnotations() {
41
        return typeAnnots;
1✔
42
    }
43

44
    @Override
45
    public JWildcardType withAnnotations(PSet<SymAnnot> newTypeAnnots) {
46
        if (newTypeAnnots.isEmpty() && !typeAnnots.isEmpty()) {
1✔
47
            return ts.wildcard(isUpperBound, bound);
×
48
        } else if (!newTypeAnnots.isEmpty()) {
1✔
49
            return new WildcardTypeImpl(ts, isUpperBound(), bound, newTypeAnnots);
1✔
50
        }
51
        return this;
1✔
52
    }
53

54
    @Override
55
    public TypeSystem getTypeSystem() {
56
        return ts;
1✔
57
    }
58

59
    @Override
60
    public @NonNull JTypeMirror getBound() {
61
        return bound;
1✔
62
    }
63

64

65
    @Override
66
    public boolean isUpperBound() {
67
        return isUpperBound;
1✔
68
    }
69

70
    @Override
71
    public String toString() {
72
        return TypePrettyPrint.prettyPrint(this);
1✔
73
    }
74

75
    @Override
76
    public boolean equals(Object o) {
77
        if (this == o) {
1✔
78
            return true;
1✔
79
        }
80
        if (!(o instanceof JWildcardType)) {
1✔
81
            return false;
1✔
82
        }
83
        JWildcardType that = (JWildcardType) o;
1✔
84
        return isUpperBound == that.isUpperBound() && Objects.equals(bound, that.getBound());
1✔
85
    }
86

87
    @Override
88
    public int hashCode() {
89
        return Objects.hash(bound, isUpperBound);
1✔
90
    }
91
}
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