File tree Expand file tree Collapse file tree 6 files changed +14
-12
lines changed
its/ruling/src/test/resources
eclipse-jetty-similar-to-main
java-checks-test-sources/default/src/main/java/checks
java-checks/src/main/java/org/sonar/java/checks/tests
src/test/java/org/sonar/java/model Expand file tree Collapse file tree 6 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 11{
2- "org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/Cookies.java" : [
3- 102
4- ],
52"org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java" : [
63279
74],
Original file line number Diff line number Diff line change 11{
2- "org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/Cookies.java" : [
3- 102
4- ],
52"org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java" : [
63279
74],
Original file line number Diff line number Diff line change @@ -228,7 +228,8 @@ <K> K getValue(K s) {
228228 return s ;
229229 }
230230 String foo () {
231- return (String ) getValue ("" ); // Noncompliant
231+ // FN introduced due to ECJ 3.44
232+ return (String ) getValue ("" ); // Compliant
232233 }
233234 }
234235
Original file line number Diff line number Diff line change 4242import org .sonar .plugins .java .api .tree .Modifier ;
4343import org .sonar .plugins .java .api .tree .Tree ;
4444
45+ import javax .annotation .Nullable ;
46+
4547import static org .apache .commons .lang3 .StringUtils .isEmpty ;
4648import static org .sonar .java .checks .helpers .UnitTestUtils .isUnitTest ;
4749
@@ -104,13 +106,18 @@ private boolean isSpringBootAssertableContext(MethodTree methodTree) {
104106 // In this case we cannot know if the provided ContextConsumer has the type param <AssertableApplicationContext>, but we want to avoid FPs
105107 return true ;
106108 }
107- Type contextConsumerType ;
109+ @ Nullable Type contextConsumerType = null ;
108110 if (contextConsumerImplSymbol .isInterface ()) {
109111 contextConsumerType = contextConsumerImplSymbol .type ();
110112 } else {
111- contextConsumerType = contextConsumerImplSymbol .interfaces ().get (0 );
113+ List <Type > interfaces = contextConsumerImplSymbol .interfaces ();
114+ if (!interfaces .isEmpty ()) {
115+ contextConsumerType = interfaces .get (0 );
116+ }
112117 }
113- return isAssertableApplicationContext (contextConsumerType ) && hasDeclaredAssertions (contextConsumerImplSymbol );
118+ return contextConsumerType != null
119+ && isAssertableApplicationContext (contextConsumerType )
120+ && hasDeclaredAssertions (contextConsumerImplSymbol );
114121 }
115122 return false ;
116123 }
Original file line number Diff line number Diff line change 1717 <dependency >
1818 <groupId >${project.groupId} </groupId >
1919 <artifactId >jdt-package</artifactId >
20- <version >1.6 .0.160 </version >
20+ <version >1.8 .0.1471 </version >
2121 </dependency >
2222
2323 <dependency >
Original file line number Diff line number Diff line change @@ -569,7 +569,7 @@ void foo() {}
569569
570570 Token token5 = tokens .get (5 );
571571 assertThat (token5 .toString (source )).isEqualTo ("/// markdown comment 1\n /// markdown comment 2" );
572- assertThat (token5 .isComment ()).isFalse (); // JDT issue https://github.com/eclipse-jdt/eclipse.jdt.core/issues/3914
572+ assertThat (token5 .isComment ()).isTrue ();
573573 assertThat (isComment (token5 )).isTrue ();
574574 assertThat (convertTokenTypeToCommentKind (token5 )).isEqualTo (CommentKind .MARKDOWN );
575575
You can’t perform that action at this time.
0 commit comments