Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ruleKey": "S6813",
"hasTruePositives": true,
"falseNegatives": 64,
"falseNegatives": 65,
"falsePositives": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package checks;

import jakarta.inject.Inject;

class InjectedService {
}

class JakartaInject {
@jakarta.inject.Inject
private InjectedService myService; // Compliant, fields annotated with Jakarta's @Inject should be ignored.
}

class JakartaImportedInject {
@Inject
private InjectedService myService; // Compliant, fields annotated with Jakarta's @Inject should be ignored.
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ public class AtLeastOneConstructorCheck extends IssuableSubscriptionVisitor {
"javax.annotation.Resource",
"javax.ejb.EJB",
"javax.inject.Inject",
"jakarta.inject.Inject",
"org.apache.maven.plugins.annotations.Component",
"org.apache.maven.plugins.annotations.Parameter",
"org.codehaus.plexus.component.annotations.Requirement",
"org.codehaus.plexus.component.annotations.Configuration",
"org.springframework.beans.factory.annotation.Value"
);
);

@Override
public List<Kind> nodesToVisit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ void test() {
.onFile(mainCodeSourcesPath("checks/AtLeastOneConstructorCheckSample.java"))
.withCheck(new AtLeastOneConstructorCheck())
.verifyIssues();
CheckVerifier.newVerifier()
.onFile(mainCodeSourcesPath("checks/AtLeastOneConstructorCheckJakartaSample.java"))
.withCheck(new AtLeastOneConstructorCheck())
.verifyNoIssues();
}

@Test
Expand Down
Loading