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

pmd / pmd / 277

27 Nov 2025 01:37PM UTC coverage: 78.778% (+0.03%) from 78.749%
277

push

github

adangel
[java] UseArraysAsList: skip when if-statements (#6228)

18419 of 24233 branches covered (76.01%)

Branch coverage included in aggregate %.

40090 of 50038 relevant lines covered (80.12%)

0.81 hits per line

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

90.0
/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTTypeParameter.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.ast;
6

7

8
import org.checkerframework.checker.nullness.qual.NonNull;
9
import org.checkerframework.checker.nullness.qual.Nullable;
10

11
import net.sourceforge.pmd.lang.java.symbols.JTypeParameterSymbol;
12
import net.sourceforge.pmd.lang.java.types.JTypeVar;
13

14
/**
15
 * Represents a type parameter declaration of a method, constructor, class or interface declaration.
16
 *
17
 * <p>The bound of a type parameter may only be an upper bound ("extends").
18
 * The bound is represented by the type node directly. The type node may
19
 * be an {@link ASTIntersectionType intersection type}.
20
 *
21
 * <pre class="grammar">
22
 *
23
 * TypeParameter ::= {@link ASTAnnotation Annotation}* &lt;IDENTIFIER&gt; ( "extends" {@link ASTReferenceType Type} )?
24
 *
25
 * </pre>
26
 *
27
 * @see <a href="https://docs.oracle.com/javase/specs/jls/se9/html/jls-4.html#jls-4.4">JLS</a>
28
 */
29
public final class ASTTypeParameter extends AbstractTypedSymbolDeclarator<JTypeParameterSymbol> implements Annotatable {
30

31
    ASTTypeParameter(int id) {
32
        super(id);
1✔
33
    }
1✔
34

35
    /**
36
     * Returns the name of the type variable introduced by this declaration.
37
     */
38
    public String getName() {
39
        return getImage();
1✔
40
    }
41

42

43
    /**
44
     * Returns true if this type parameter is bounded,
45
     * in which case {@link #getTypeBoundNode()} doesn't
46
     * return {@code null}.
47
     */
48
    public boolean hasTypeBound() {
49
        return getTypeBoundNode() != null;
1✔
50
    }
51

52

53
    /**
54
     * Returns the type bound node of this parameter,
55
     * or null if it is not bounded.
56
     */
57
    public @Nullable ASTType getTypeBoundNode() {
58
        return firstChild(ASTType.class);
1✔
59
    }
60

61
    /**
62
     * Returns the node to which this type parameter belongs.
63
     */
64
    public TypeParamOwnerNode getOwner() {
65
        return (TypeParamOwnerNode) getParent().getParent();
×
66
    }
67

68
    @Override
69
    public @NonNull JTypeVar getTypeMirror() {
70
        return (JTypeVar) super.getTypeMirror();
1✔
71
    }
72

73
    @Override
74
    protected <P, R> R acceptVisitor(JavaVisitor<? super P, ? extends R> visitor, P data) {
75
        return visitor.visit(this, data);
1✔
76
    }
77
}
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