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

pmd / pmd / 489

24 Apr 2026 09:16AM UTC coverage: 79.012% (-0.02%) from 79.035%
489

push

github

adangel
[java] Fix #4272: False positive in UnitTestShouldIncludeAssert when using assertion in lambda (#6556)

18715 of 24609 branches covered (76.05%)

Branch coverage included in aggregate %.

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

17 existing lines in 4 files now uncovered.

40799 of 50714 relevant lines covered (80.45%)

0.81 hits per line

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

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

5
package net.sourceforge.pmd.lang.apex.ast;
6

7
import java.util.Collection;
8
import java.util.List;
9

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

12
import net.sourceforge.pmd.lang.apex.ApexLanguageProcessor;
13
import net.sourceforge.pmd.lang.apex.multifile.ApexMultifileAnalysis;
14
import net.sourceforge.pmd.lang.ast.AstInfo;
15
import net.sourceforge.pmd.lang.ast.Parser.ParserTask;
16
import net.sourceforge.pmd.lang.ast.RootNode;
17
import net.sourceforge.pmd.lang.document.FileId;
18
import net.sourceforge.pmd.lang.document.TextRegion;
19
import net.sourceforge.pmd.reporting.ViolationSuppressor.SuppressionCommentWrapper;
20

21
import com.google.summit.ast.CompilationUnit;
22
import com.nawforce.apexlink.api.TypeSummary;
23
import io.github.apexdevtools.api.Issue;
24

25
public final class ASTApexFile extends AbstractApexNode.Single<CompilationUnit> implements RootNode {
26

27
    private final AstInfo<ASTApexFile> astInfo;
28
    private final @NonNull ApexMultifileAnalysis multifileAnalysis;
29

30
    ASTApexFile(ParserTask task,
31
                CompilationUnit compilationUnit,
32
                Collection<? extends SuppressionCommentWrapper> suppressMap,
33
                @NonNull ApexLanguageProcessor apexLang) {
34
        super(compilationUnit);
1✔
35
        this.astInfo = new AstInfo<>(task, this).withSuppressionComments(suppressMap);
1✔
36
        this.multifileAnalysis = apexLang.getMultiFileState();
1✔
37
        this.setRegion(TextRegion.fromOffsetLength(0, task.getTextDocument().getLength()));
1✔
38
    }
1✔
39

40
    @Override
41
    public AstInfo<ASTApexFile> getAstInfo() {
42
        return astInfo;
1✔
43
    }
44

45
    public ASTUserClassOrInterface<?> getMainNode() {
46
        return (ASTUserClassOrInterface<?>) getChild(0);
1✔
47
    }
48

49
    @Override
50
    public @NonNull ASTApexFile getRoot() {
51
        return this;
1✔
52
    }
53

54

55
    @Override
56
    protected <P, R> R acceptApexVisitor(ApexVisitor<? super P, ? extends R> visitor, P data) {
57
        return visitor.visit(this, data);
1✔
58
    }
59

60
    public List<Issue> getGlobalIssues() {
61
        FileId fileId = getAstInfo().getTextDocument().getFileId();
1✔
62
        return multifileAnalysis.getFileIssues(fileId.getAbsolutePath());
1✔
63
    }
64

65
    /**
66
     * Returns an unmodifiable list of all type summaries in the org.
67
     * Returns an empty list when multifile analysis is unavailable.
68
     * This enables rules to perform complex cross-type analysis.
69
     * @since 7.24.0
70
     */
71
    public @NonNull List<TypeSummary> getTypeSummaries() {
72
        return multifileAnalysis.getTypeSummaries();
1✔
73
    }
74

75
    @Override
76
    public String getDefiningType() {
77
        // an apex file can contain only one top level type
78
        BaseApexClass baseApexClass = firstChild(BaseApexClass.class);
1✔
79
        if (baseApexClass != null) {
1!
80
            return baseApexClass.getQualifiedName().toString();
1✔
81
        }
UNCOV
82
        return null;
×
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