Skip to content

Commit 75beb2b

Browse files
committed
Upgrading to java17 as minimum
Signed-off-by: Haroon Sheikh <haroon.sheikh@sky.uk>
1 parent b3b85e2 commit 75beb2b

24 files changed

+188
-166
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: [ubuntu-latest, windows-latest]
17-
java_version: ['11', '17', '21']
17+
java_version: ['17', '21']
1818
fail-fast: false
1919

2020
steps:
@@ -105,7 +105,7 @@ jobs:
105105
strategy:
106106
matrix:
107107
os: [ubuntu-latest, windows-latest]
108-
java_version: ['11', '17', '21']
108+
java_version: ['17', '21']
109109
fail-fast: false
110110

111111
steps:

java.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "java",
3-
"version": "0.13.0",
3+
"version": "1.0.0",
44
"description": "Java support for gauge",
55
"install": {
66
"windows": [],

pom.xml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<name>gauge-java</name>
55
<groupId>com.thoughtworks.gauge</groupId>
66
<artifactId>gauge-java</artifactId>
7-
<version>0.13.0</version>
7+
<version>1.0.0</version>
88
<description>Java plugin for Gauge</description>
99
<url>https://github.com/getgauge/gauge-java</url>
1010
<dependencyManagement>
@@ -19,7 +19,7 @@
1919
<dependency>
2020
<groupId>org.junit</groupId>
2121
<artifactId>junit-bom</artifactId>
22-
<version>5.14.0</version>
22+
<version>6.0.1</version>
2323
<type>pom</type>
2424
<scope>import</scope>
2525
</dependency>
@@ -46,7 +46,7 @@
4646
<dependency>
4747
<groupId>com.github.javaparser</groupId>
4848
<artifactId>javaparser-core</artifactId>
49-
<version>3.27.0</version>
49+
<version>3.27.1</version>
5050
</dependency>
5151
<dependency>
5252
<groupId>org.json</groupId>
@@ -235,7 +235,7 @@
235235
<dependency>
236236
<groupId>com.puppycrawl.tools</groupId>
237237
<artifactId>checkstyle</artifactId>
238-
<version>10.26.1</version>
238+
<version>12.1.1</version>
239239
</dependency>
240240
</dependencies>
241241
<executions>
@@ -262,7 +262,7 @@
262262
<plugin>
263263
<groupId>org.apache.maven.plugins</groupId>
264264
<artifactId>maven-dependency-plugin</artifactId>
265-
<version>3.8.1</version>
265+
<version>3.9.0</version>
266266
<executions>
267267
<execution>
268268
<id>copy-dependencies</id>
@@ -312,12 +312,13 @@
312312
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
313313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
314314
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
315-
<java.version>11</java.version>
315+
<java.version>17</java.version>
316316
<maven.compiler.source>${java.version}</maven.compiler.source>
317317
<maven.compiler.target>${java.version}</maven.compiler.target>
318+
<maven.compiler.release>${java.version}</maven.compiler.release>
318319

319-
<protobuf.version>4.32.1</protobuf.version>
320-
<grpc.version>1.75.0</grpc.version>
320+
<protobuf.version>4.33.0</protobuf.version>
321+
<grpc.version>1.76.0</grpc.version>
321322
</properties>
322323

323324
</project>

src/main/java/com/thoughtworks/gauge/DefaultClassInitializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ public class DefaultClassInitializer implements ClassInitializer {
99

1010
@Override
1111
public Object initialize(Class<?> classToInitialize) throws Exception {
12-
return Class.forName(classToInitialize.getName()).newInstance();
12+
return Class.forName(classToInitialize.getName()).getDeclaredConstructor().newInstance();
1313
}
1414
}

src/main/java/com/thoughtworks/gauge/FileHelper.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import java.io.IOException;
1010
import java.nio.file.Files;
1111
import java.nio.file.Path;
12-
import java.nio.file.Paths;
1312
import java.util.ArrayList;
1413
import java.util.Arrays;
1514
import java.util.List;
@@ -28,7 +27,7 @@ public class FileHelper {
2827
public static List<String> getAllImplementationFiles() {
2928
ArrayList<String> outputFiles = new ArrayList<>();
3029
getStepImplDirs().forEach(dir -> {
31-
try (Stream<Path> filePathStream = Files.walk(Paths.get(dir))) {
30+
try (Stream<Path> filePathStream = Files.walk(Path.of(dir))) {
3231
filePathStream.forEach(filePath -> {
3332
if (Files.isRegularFile(filePath) && filePath.toString().endsWith(JAVA_FILE_EXT)) {
3433
outputFiles.add(filePath.toString());
@@ -42,8 +41,8 @@ public static List<String> getAllImplementationFiles() {
4241
}
4342

4443
private static Path getAbsolutePath(String dir) {
45-
Path path = Paths.get(dir);
46-
return !path.isAbsolute() ? Paths.get(System.getenv(GAUGE_PROJECT_ROOT), dir) : path;
44+
Path path = Path.of(dir);
45+
return !path.isAbsolute() ? Path.of(System.getenv(GAUGE_PROJECT_ROOT), dir) : path;
4746
}
4847

4948
static List<String> getStepImplDirs() {
@@ -65,7 +64,7 @@ public static String getClassName(File filepath) {
6564

6665
public static File getDefaultImplFileName(String suffix, int count) {
6766
String filename = "StepImplementation" + suffix + JAVA_FILE_EXT;
68-
Path filepath = Paths.get(getDefaultStepImplDir(), filename);
67+
Path filepath = Path.of(getDefaultStepImplDir(), filename);
6968
File file = new File(filepath.toString());
7069
return file.exists() ? getDefaultImplFileName(String.valueOf(++count), count) : file;
7170
}

src/main/java/com/thoughtworks/gauge/Table.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ private Comparator<String> maxStringLength() {
181181
public int hashCode() {
182182
final int prime = 31;
183183
int result = 1;
184-
result = prime * result + ((headers == null) ? 0 : headers.hashCode());
185-
result = prime * result + ((rows == null) ? 0 : rows.hashCode());
186-
result = prime * result + ((tableRows == null) ? 0 : tableRows.hashCode());
184+
result = prime * result + (headers == null ? 0 : headers.hashCode());
185+
result = prime * result + (rows == null ? 0 : rows.hashCode());
186+
result = prime * result + (tableRows == null ? 0 : tableRows.hashCode());
187187
return result;
188188
}
189189

src/main/java/com/thoughtworks/gauge/Util.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static String trimQuotes(String text) {
4444

4545
public static boolean shouldTakeFailureScreenshot() {
4646
String screenshotOnFailureEnabled = System.getenv(GaugeConstant.SCREENSHOT_ON_FAILURE_ENABLED);
47-
return !(screenshotOnFailureEnabled == null || screenshotOnFailureEnabled.equalsIgnoreCase("false"));
47+
return !(screenshotOnFailureEnabled == null || "false".equalsIgnoreCase(screenshotOnFailureEnabled));
4848
}
4949

5050
}

src/main/java/com/thoughtworks/gauge/command/SetupCommand.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import java.io.IOException;
1111
import java.nio.file.Files;
1212
import java.nio.file.Path;
13-
import java.nio.file.Paths;
1413
import java.nio.file.StandardOpenOption;
1514

1615
public class SetupCommand implements GaugeJavaCommand {
@@ -90,16 +89,16 @@ public void execute() throws IOException {
9089

9190
String projectRoot = System.getenv("GAUGE_PROJECT_ROOT");
9291

93-
Path implFilePath = Paths.get(projectRoot, "src", "test", "java", "StepImplementation.java");
92+
Path implFilePath = Path.of(projectRoot, "src", "test", "java", "StepImplementation.java");
9493
this.writeContent(implFilePath, implementation);
9594

96-
Path propFilePath = Paths.get(projectRoot, "env", "default", "java.properties");
95+
Path propFilePath = Path.of(projectRoot, "env", "default", "java.properties");
9796
this.writeContent(propFilePath, properties);
9897

99-
Path gitIgnoreFilePath = Paths.get(projectRoot, ".gitignore");
98+
Path gitIgnoreFilePath = Path.of(projectRoot, ".gitignore");
10099
this.writeContent(gitIgnoreFilePath, gitIgnore);
101100

102-
Path libsDirPath = Paths.get(projectRoot, "libs", ".gitkeep");
101+
Path libsDirPath = Path.of(projectRoot, "libs", ".gitkeep");
103102
this.writeContent(libsDirPath, "");
104103
}
105104

src/main/java/com/thoughtworks/gauge/connection/StubImplementationCodeProcessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import com.google.protobuf.ProtocolStringList;
1616
import com.thoughtworks.gauge.FileHelper;
1717
import com.thoughtworks.gauge.Logger;
18+
import com.thoughtworks.gauge.processor.IMessageProcessor;
1819
import gauge.messages.Messages;
1920
import gauge.messages.Spec;
2021

@@ -25,7 +26,7 @@
2526
import java.util.ArrayList;
2627
import java.util.List;
2728

28-
public class StubImplementationCodeProcessor implements com.thoughtworks.gauge.processor.IMessageProcessor {
29+
public class StubImplementationCodeProcessor implements IMessageProcessor {
2930
private static final String NEW_LINE = "\n";
3031
private static final List<MethodDeclaration> METHOD_DECLARATIONS = new ArrayList<>();
3132
private static Range classRange;

src/main/java/com/thoughtworks/gauge/execution/parameters/ParsingException.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
*----------------------------------------------------------------*/
66
package com.thoughtworks.gauge.execution.parameters;
77

8-
import gauge.messages.Spec.ProtoExecutionResult;
9-
10-
public class ParsingException extends Exception {
11-
private static final long serialVersionUID = -4205182693938362914L;
8+
import gauge.messages.Spec.ProtoExecutionResult;
9+
10+
import java.io.Serial;
11+
12+
public class ParsingException extends Exception {
13+
@Serial
14+
private static final long serialVersionUID = -4205182693938362914L;
1215

1316
private final ProtoExecutionResult executionResult;
1417

0 commit comments

Comments
 (0)