Merge pull request #19511 from nosan

* pr/19511:
  Polish "Add Java 14 to JavaVersion enumeration"
  Add Java 14 to JavaVersion enumeration

Closes gh-19511
This commit is contained in:
Stephane Nicoll 2020-01-04 11:47:18 +01:00
commit e250cce274
2 changed files with 15 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,6 +16,7 @@
package org.springframework.boot.system; package org.springframework.boot.system;
import java.lang.invoke.MethodHandles;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -60,7 +61,12 @@ public enum JavaVersion {
/** /**
* Java 13. * Java 13.
*/ */
THIRTEEN("13", String.class, "stripIndent"); THIRTEEN("13", String.class, "stripIndent"),
/**
* Java 14.
*/
FOURTEEN("14", MethodHandles.Lookup.class, "hasFullPrivilegeAccess");
private final String name; private final String name;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -115,4 +115,10 @@ class JavaVersionTests {
assertThat(JavaVersion.getJavaVersion()).isEqualTo(JavaVersion.THIRTEEN); assertThat(JavaVersion.getJavaVersion()).isEqualTo(JavaVersion.THIRTEEN);
} }
@Test
@EnabledOnJre(JRE.JAVA_14)
void currentJavaVersionFourteen() {
assertThat(JavaVersion.getJavaVersion()).isEqualTo(JavaVersion.FOURTEEN);
}
} }