Skip to content

Commit 796d1ea

Browse files
author
sonartech
committed
refs/remotes/origin/dogfood/tt-jdt-1.8
refs/remotes/origin/master
2 parents fbc6581 + 2f17773 commit 796d1ea

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

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: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
import org.sonar.plugins.java.api.tree.Modifier;
4343
import org.sonar.plugins.java.api.tree.Tree;
4444

45+
import javax.annotation.Nullable;
46+
4547
import static org.apache.commons.lang3.StringUtils.isEmpty;
4648
import 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
}

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.1471</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)