Skip to content

Commit 8c27b1c

Browse files
committed
Update Java and Gradle
Use Java 11 as minimum version. Update Gradle Wrapper to 7.6 and plugins to support newer Java versions. Address Error Prone check and disable some that don't apply to the generated code. Update Ant to latest version. Signed-off-by: thc202 <[email protected]>
1 parent cf88738 commit 8c27b1c

File tree

9 files changed

+44
-26
lines changed

9 files changed

+44
-26
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
java: [8, 11]
14+
java: [11]
1515

1616
steps:
1717
- uses: actions/checkout@v2

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Changed
9+
- Minimum Java version is now 11.
810

911
## [1.11.0] - 2022-11-01
1012
### Added

build.gradle

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
2-
id "com.diffplug.spotless" version "5.12.1"
3-
id "net.ltgt.errorprone" version "2.0.1"
2+
id "com.diffplug.spotless" version "6.14.1"
3+
id "net.ltgt.errorprone" version "3.0.1"
44
}
55

66
apply from: "gradle/compile.gradle"
@@ -19,8 +19,8 @@ subprojects {
1919
mavenCentral()
2020
}
2121

22-
sourceCompatibility = JavaVersion.VERSION_1_7
23-
targetCompatibility = JavaVersion.VERSION_1_7
22+
sourceCompatibility = JavaVersion.VERSION_11
23+
targetCompatibility = JavaVersion.VERSION_11
2424

2525
spotless {
2626
java {
@@ -31,9 +31,14 @@ subprojects {
3131
}
3232

3333
dependencies {
34-
errorprone 'com.google.errorprone:error_prone_core:2.3.1'
35-
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
36-
errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
34+
errorprone 'com.google.errorprone:error_prone_core:2.18.0'
35+
}
36+
37+
tasks.withType(JavaCompile).configureEach {
38+
options.encoding = "utf-8"
39+
options.compilerArgs = ["-Xlint:all", "-Xlint:-path", "-Xlint:-options", "-Werror"]
40+
options.errorprone {
41+
disable("EmptyBlockTag", "InlineMeSuggester")
3742
}
3843
}
3944
}

gradle/wrapper/gradle-wrapper.jar

1.71 KB
Binary file not shown.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=a9a7b7baba105f6557c9dcf9c3c6e8f7e57e6b49889c5f1d133f015d0727e4be
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-all.zip
3+
distributionSha256Sum=312eb12875e1747e05c2f81a4789902d7e4ec5defbd1eefeaccc08acf096505d
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
5+
networkTimeout=10000
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
86+
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
8787

8888
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
8989
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
143143
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144144
case $MAX_FD in #(
145145
max*)
146+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147+
# shellcheck disable=SC3045
146148
MAX_FD=$( ulimit -H -n ) ||
147149
warn "Could not query maximum file descriptor limit"
148150
esac
149151
case $MAX_FD in #(
150152
'' | soft) :;; #(
151153
*)
154+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155+
# shellcheck disable=SC3045
152156
ulimit -n "$MAX_FD" ||
153157
warn "Could not set maximum file descriptor limit to $MAX_FD"
154158
esac
@@ -205,6 +209,12 @@ set -- \
205209
org.gradle.wrapper.GradleWrapperMain \
206210
"$@"
207211

212+
# Stop when "xargs" is not available.
213+
if ! command -v xargs >/dev/null 2>&1
214+
then
215+
die "xargs is not available"
216+
fi
217+
208218
# Use "xargs" to parse quoted args.
209219
#
210220
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

gradlew.bat

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@rem limitations under the License.
1515
@rem
1616

17-
@if "%DEBUG%" == "" @echo off
17+
@if "%DEBUG%"=="" @echo off
1818
@rem ##########################################################################
1919
@rem
2020
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
2525
if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
28-
if "%DIRNAME%" == "" set DIRNAME=.
28+
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4041

4142
set JAVA_EXE=java.exe
4243
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto execute
44+
if %ERRORLEVEL% equ 0 goto execute
4445

4546
echo.
4647
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7576

7677
:end
7778
@rem End local scope for the variables with windows NT shell
78-
if "%ERRORLEVEL%"=="0" goto mainEnd
79+
if %ERRORLEVEL% equ 0 goto mainEnd
7980

8081
:fail
8182
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8283
rem the _cmd.exe /c_ return code!
83-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84-
exit /b 1
84+
set EXIT_CODE=%ERRORLEVEL%
85+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
86+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87+
exit /b %EXIT_CODE%
8588

8689
:mainEnd
8790
if "%OS%"=="Windows_NT" endlocal

subprojects/zap-clientapi-ant/zap-clientapi-ant.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
dependencies {
33
implementation project(':zap-clientapi')
4-
compileOnly 'org.apache.ant:ant:1.9.7'
4+
compileOnly 'org.apache.ant:ant:1.10.13'
55

6-
testImplementation 'org.apache.ant:ant-testutil:1.9.7'
6+
testImplementation 'org.apache.ant:ant-testutil:1.10.13'
77
testImplementation 'org.nanohttpd:nanohttpd:2.3.1'
88
}
99

subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/core/Alert.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,7 @@ public boolean equals(Object object) {
437437
if (this == object) {
438438
return true;
439439
}
440-
if (object == null) {
441-
return false;
442-
}
443-
if (getClass() != object.getClass()) {
440+
if (!(object instanceof Alert)) {
444441
return false;
445442
}
446443
Alert otherAlert = (Alert) object;

0 commit comments

Comments
 (0)