/** * Return if this version is older than a given version. * @param version the version to compare * @return {@code true} if this version is older than {@code version} */ public boolean isOlderThan(JavaVersion version) { return compareTo(version) < 0; }
/** * Returns the {@link JavaVersion} of the current runtime. * @return the {@link JavaVersion} */ public static JavaVersion getJavaVersion() { List<JavaVersion> candidates = Arrays.asList(JavaVersion.values()); Collections.reverse(candidates); for (JavaVersion candidate : candidates) { if (candidate.available) { return candidate; } } return EIGHT; }
private void cleanupKnownCaches() throws Exception { // Whilst not strictly necessary it helps to cleanup soft reference caches // early rather than waiting for memory limits to be reached ResolvableType.clearCache(); cleanCachedIntrospectionResultsCache(); ReflectionUtils.clearCache(); clearAnnotationUtilsCache(); if (!JavaVersion.getJavaVersion().isEqualOrNewerThan(JavaVersion.NINE)) { clear("com.sun.naming.internal.ResourceManager", "propertiesCache"); } }
throws ClassNotFoundException { try { if (name.startsWith("javax.") && JavaVersion.getJavaVersion().isEqualOrNewerThan(JavaVersion.NINE)) { return getClass().getClassLoader().loadClass(name);
/** * Return if this version is equal to or newer than a given version. * @param version the version to compare * @return {@code true} if this version is equal to or newer than {@code version} */ public boolean isEqualOrNewerThan(JavaVersion version) { return compareTo(version) >= 0; }