Skip to content

Commit 07970bc

Browse files
BerndFarkaDynaDaniel Mühlbachler
authored andcommitted
#282 set taget to JDK 1.8 but still test and compile with 1.8 and 11
1 parent 2bde095 commit 07970bc

File tree

6 files changed

+15
-6
lines changed

6 files changed

+15
-6
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ matrix:
2424
include:
2525
- jdk: openjdk11
2626
env: CMD="./.ci/travis.sh install"
27-
27+
28+
- jdk: openjdk8
29+
env: CMD="./.ci/travis.sh install"
30+
2831
- jdk: openjdk11
2932
env: CMD="./.ci/travis.sh integration-tests"
3033

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
8.28
104104
</maven.sevntu.checkstyle.plugin.checkstyle.version>
105105
<maven.jacoco.plugin.version>0.8.5</maven.jacoco.plugin.version>
106-
<java.version>11</java.version>
106+
<java.version>1.8</java.version>
107107
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
108108
<!-- we disable ITs by default as it need download of 200MB sonar application jar -->
109109
<skipITs>true</skipITs>

src/it/java/org/checkstyle/plugins/sonar/RunPluginTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.checkstyle.plugins.sonar;
2121

22+
import static java.nio.charset.StandardCharsets.UTF_8;
2223
import static org.junit.Assert.fail;
2324

2425
import java.io.File;
@@ -157,7 +158,9 @@ private static void executeBuildWithCommonProperties(Build<?> build, boolean bui
157158

158159
private static void assertNoDifferences() {
159160
try {
160-
final String differences = Files.readString(Paths.get(litsDifferencesPath()));
161+
final String differences = new String(Files
162+
.readAllBytes(new File(litsDifferencesPath()).toPath()), UTF_8);
163+
161164
Assertions.assertThat(differences)
162165
.isEmpty();
163166
}

src/test/java/org/sonar/plugins/checkstyle/CheckstyleConstantsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class CheckstyleConstantsTest {
3131
public void privateConstructor() throws ReflectiveOperationException {
3232
final Constructor<CheckstyleConstants> constructor = CheckstyleConstants.class
3333
.getDeclaredConstructor();
34-
assertThat(constructor.canAccess(null)).isFalse();
34+
assertThat(constructor.isAccessible()).isFalse();
3535
constructor.setAccessible(true);
3636
constructor.newInstance();
3737
}

src/test/java/org/sonar/plugins/checkstyle/CheckstyleSeverityUtilsTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ public void testFromSeverity() {
7171
public void privateConstructor() throws ReflectiveOperationException {
7272
final Constructor<CheckstyleSeverityUtils> constructor = CheckstyleSeverityUtils.class
7373
.getDeclaredConstructor();
74-
assertThat(constructor.canAccess(null)).isFalse();
74+
75+
assertThat(constructor.isAccessible()).isFalse();
7576
constructor.setAccessible(true);
7677
constructor.newInstance();
7778
}

src/test/java/org/sonar/plugins/checkstyle/internal/ChecksTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
package org.sonar.plugins.checkstyle.internal;
2121

22+
import static java.nio.charset.StandardCharsets.UTF_8;
23+
2224
import java.beans.PropertyDescriptor;
2325
import java.io.File;
2426
import java.io.FileInputStream;
@@ -98,7 +100,7 @@ private static void validateSonarRules(Set<Class<?>> modules)
98100
Assert.assertTrue(RULES_PATH + " must exist", rulesFile.exists());
99101

100102
try {
101-
final String input = Files.readString(rulesFile.toPath());
103+
final String input = new String(Files.readAllBytes(rulesFile.toPath()), UTF_8);
102104
final Document document = XmlUtil.getRawXml(rulesFile.getAbsolutePath(), input, input);
103105
validateSonarRules(document, modules);
104106
}

0 commit comments

Comments
 (0)