Skip to content

Commit

Permalink
Guard against missing Java 19 version.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Nov 22, 2023
1 parent f8a2c36 commit 4bed078
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions byte-buddy-gradle-plugin/common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ if (!raw.startsWith("1.") && raw.contains(".")) {
current = JavaVersion.toVersion(raw)
}

def java19Version
try {
java19Version = JavaVersion.valueOf("JAVA_19");
} catch (Exception ignored) {
java19Version = null
}

def sourceVersion = System.getProperty("net.bytebuddy.gradle.version.source")
def source
if (sourceVersion != null) {
source = JavaVersion.toVersion(sourceVersion)
} else if (current > JavaVersion.VERSION_19) {
} else if (java19Version != null && current > java19Version) {
source = JavaVersion.VERSION_1_8
} else if (current > JavaVersion.VERSION_1_9) {
source = JavaVersion.VERSION_1_7
Expand All @@ -38,7 +45,7 @@ def targetVersion = System.getProperty("net.bytebuddy.gradle.version.target")
def target
if (targetVersion != null) {
target = JavaVersion.toVersion(targetVersion)
} else if (current > JavaVersion.VERSION_19) {
} else if (java19Version != null && current > java19Version) {
target = JavaVersion.VERSION_1_8
} else if (current > JavaVersion.VERSION_1_9) {
target = JavaVersion.VERSION_1_7
Expand Down

0 comments on commit 4bed078

Please sign in to comment.