Skip to content

Commit

Permalink
Add JavaVersion.TWENTY
Browse files Browse the repository at this point in the history
Closes gh-35758
  • Loading branch information
mhalbritter committed Jun 7, 2023
1 parent be72e48 commit 2927d50
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,6 +33,7 @@
*
* @author Oliver Gierke
* @author Phillip Webb
* @author Moritz Halbritter
* @since 2.0.0
*/
public enum JavaVersion {
Expand Down Expand Up @@ -95,7 +96,12 @@ public enum JavaVersion {
/**
* Java 19.
*/
NINETEEN("19", Future.class, "state");
NINETEEN("19", Future.class, "state"),

/**
* Java 20.
*/
TWENTY("20", Class.class, "accessFlags");

private final String name;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -152,8 +152,18 @@ void currentJavaVersionNineteen() {
assertThat(JavaVersion.getJavaVersion()).isEqualTo(JavaVersion.NINETEEN);
}

@Test
@EnabledIf("java20")
void currentJavaVersionTwenty() {
assertThat(JavaVersion.getJavaVersion()).isEqualTo(JavaVersion.TWENTY);
}

static boolean java19() {
return "19".equals(System.getProperty("java.version"));
}

static boolean java20() {
return System.getProperty("java.version").startsWith("20");
}

}

0 comments on commit 2927d50

Please sign in to comment.