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

pmd / pmd / 197

19 Oct 2025 09:43PM UTC coverage: 78.676% (+0.03%) from 78.642%
197

push

github

oowekyala
Fix reviow comments on #6116

18231 of 24023 branches covered (75.89%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 1 file covered. (100.0%)

38 existing lines in 5 files now uncovered.

39748 of 49670 relevant lines covered (80.02%)

0.81 hits per line

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

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

5

6
package net.sourceforge.pmd.lang.java.ast;
7

8
import java.util.Objects;
9

10
import org.checkerframework.checker.nullness.qual.NonNull;
11

12
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
13
import net.sourceforge.pmd.lang.document.FileLocation;
14
import net.sourceforge.pmd.lang.java.symbols.JConstructorSymbol;
15

16
/**
17
 * This defines a compact constructor for a {@linkplain ASTRecordDeclaration RecordDeclaration} (JDK 16 feature).
18
 * Compact constructors implicitly declares formal parameters corresponding to the record component list. These can be
19
 * fetched from {@link #getSymbol()}.
20
 *
21
 * <p>Compact record constructors must be declared "public".
22
 *
23
 * <pre class="grammar">
24
 *
25
 * CompactConstructorDeclaration ::=  {@link ASTModifierList Modifiers}
26
 *                                   &lt;IDENTIFIER&gt;
27
 *                                   {@link ASTBlock Block}
28
 *
29
 * </pre>
30
 */
31
// TODO make implicit formal parameter node and implement ASTExecutableDeclaration.
32
// This might help UnusedAssignmentRule / DataflowPass.ReachingDefsVisitor, see also #4603
33
public final class ASTCompactConstructorDeclaration extends AbstractJavaNode
34
    implements ASTBodyDeclaration, SymbolDeclaratorNode, ModifierOwner, JavadocCommentOwner, ReturnScopeNode, LeftRecursiveNode {
35

36
    private JavaccToken identToken;
37

38
    ASTCompactConstructorDeclaration(int id) {
39
        super(id);
1✔
40
    }
1✔
41

42

43
    @Override
44
    public FileLocation getReportLocation() {
UNCOV
45
        return identToken.getReportLocation();
×
46
    }
47

48
    void setIdentToken(JavaccToken identToken) {
49
        this.identToken = identToken;
1✔
50
    }
1✔
51

52
    @Override
53
    public String getImage() {
54
        return identToken.getImage();
1✔
55
    }
56

57
    @Override
58
    protected <P, R> R acceptVisitor(JavaVisitor<? super P, ? extends R> visitor, P data) {
59
        return visitor.visit(this, data);
1✔
60
    }
61

62
    @Override
63
    public @NonNull ASTBlock getBody() {
64
        return Objects.requireNonNull(firstChild(ASTBlock.class));
1✔
65
    }
66

67
    /**
68
     * @deprecated Since 7.14.0. This method just returns `this` and isn't useful.
69
     */
70
    @Deprecated
71
    public ASTCompactConstructorDeclaration getDeclarationNode() {
UNCOV
72
        return this;
×
73
    }
74

75
    @Override
76
    public ASTRecordDeclaration getEnclosingType() {
77
        return (ASTRecordDeclaration) super.getEnclosingType();
1✔
78
    }
79

80
    @Override
81
    public JConstructorSymbol getSymbol() {
82
        return getEnclosingType().getRecordComponents().getSymbol();
1✔
83
    }
84
}
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