Skip to content

Commit 086763e

Browse files
SONARJAVA-5961 Upgrade sonar-java-jdt to 1.8.0.1483 (#5388)
1 parent 610dd3f commit 086763e

6 files changed

Lines changed: 12 additions & 12 deletions

File tree

its/ruling/src/test/resources/eclipse-jetty-similar-to-main/java-S1905.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
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": [
63
279
74
],

its/ruling/src/test/resources/eclipse-jetty/java-S1905.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
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": [
63
279
74
],

java-checks-test-sources/default/src/main/java/checks/RedundantTypeCastCheckSample.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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

java-checks/src/main/java/org/sonar/java/checks/tests/AssertionsInTestsCheck.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,18 @@ private boolean isSpringBootAssertableContext(MethodTree methodTree) {
104104
// In this case we cannot know if the provided ContextConsumer has the type param <AssertableApplicationContext>, but we want to avoid FPs
105105
return true;
106106
}
107-
Type contextConsumerType;
107+
Type contextConsumerType = null;
108108
if (contextConsumerImplSymbol.isInterface()) {
109109
contextConsumerType = contextConsumerImplSymbol.type();
110110
} else {
111-
contextConsumerType = contextConsumerImplSymbol.interfaces().get(0);
111+
List<Type> interfaces = contextConsumerImplSymbol.interfaces();
112+
if (!interfaces.isEmpty()) {
113+
contextConsumerType = interfaces.get(0);
114+
}
112115
}
113-
return isAssertableApplicationContext(contextConsumerType) && hasDeclaredAssertions(contextConsumerImplSymbol);
116+
return contextConsumerType != null
117+
&& isAssertableApplicationContext(contextConsumerType)
118+
&& hasDeclaredAssertions(contextConsumerImplSymbol);
114119
}
115120
return false;
116121
}

java-frontend/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<dependency>
1818
<groupId>${project.groupId}</groupId>
1919
<artifactId>jdt-package</artifactId>
20-
<version>1.6.0.160</version>
20+
<version>1.8.0.1483</version>
2121
</dependency>
2222

2323
<dependency>

java-frontend/src/test/java/org/sonar/java/model/JParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)