Deprecate JdkVersion (for optimistic compatibility with newer JDK generations)

Issue: SPR-13312
This commit is contained in:
Juergen Hoeller
2015-08-12 16:14:43 +02:00
parent e20b47c3bc
commit bec3b0fa1a
4 changed files with 24 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 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.
@@ -16,6 +16,8 @@
package org.springframework.core;
import org.springframework.util.ClassUtils;
/**
* Default implementation of the {@link ParameterNameDiscoverer} strategy interface,
* using the Java 8 standard reflection mechanism (if available), and falling back
@@ -31,8 +33,8 @@ package org.springframework.core;
*/
public class DefaultParameterNameDiscoverer extends PrioritizedParameterNameDiscoverer {
private static final boolean standardReflectionAvailable =
(JdkVersion.getMajorJavaVersion() >= JdkVersion.JAVA_18);
private static final boolean standardReflectionAvailable = ClassUtils.isPresent(
"java.lang.reflect.Executable", DefaultParameterNameDiscoverer.class.getClassLoader());
public DefaultParameterNameDiscoverer() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 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.
@@ -27,7 +27,10 @@ package org.springframework.core;
* @author Juergen Hoeller
* @author Rick Evans
* @author Sam Brannen
* @deprecated as of Spring 4.2.1, in favor of direct checks for the desired
* JDK API variants via reflection
*/
@Deprecated
public abstract class JdkVersion {
/**