Skip to content

Commit 02cdf9e

Browse files
authored
SOLR-17321 JDK 21: delete obsolete checks mostly in build (#2868)
* Build checks * SSL checks not needed * Lookup.ensureInitialized
1 parent c058ea5 commit 02cdf9e

File tree

7 files changed

+3
-235
lines changed

7 files changed

+3
-235
lines changed

build-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,6 @@ private void error(Element element, String message) {
438438
fullMessage.append("): ");
439439
fullMessage.append(message);
440440

441-
if (Runtime.version().feature() == 11 && element.getKind() == ElementKind.PACKAGE) {
442-
// Avoid JDK 11 bug:
443-
// https://issues.apache.org/jira/browse/LUCENE-9747
444-
// https://bugs.openjdk.java.net/browse/JDK-8224082
445-
reporter.print(Diagnostic.Kind.ERROR, fullMessage.toString());
446-
} else {
447-
reporter.print(Diagnostic.Kind.ERROR, element, fullMessage.toString());
448-
}
441+
reporter.print(Diagnostic.Kind.ERROR, element, fullMessage.toString());
449442
}
450443
}

build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ apply from: file('gradle/java/javac.gradle')
133133
apply from: file('gradle/testing/defaults-tests.gradle')
134134
apply from: file('gradle/testing/randomization.gradle')
135135
apply from: file('gradle/testing/fail-on-no-tests.gradle')
136-
apply from: file('gradle/testing/fail-on-unsupported-jdk.gradle')
137136
apply from: file('gradle/testing/alternative-jdk-support.gradle')
138137
apply from: file('gradle/java/jar-manifest.gradle')
139138
apply from: file('gradle/testing/retry-test.gradle')
@@ -206,7 +205,6 @@ apply from: file('gradle/hacks/global-exclude-dependencies.gradle')
206205
apply from: file('gradle/hacks/gradle-archives.gradle')
207206

208207
apply from: file('gradle/hacks/wipe-temp.gradle')
209-
apply from: file('gradle/hacks/hashmapAssertions.gradle')
210208
apply from: file('gradle/hacks/turbocharge-jvm-opts.gradle')
211209
apply from: file('gradle/hacks/dummy-outputs.gradle')
212210

gradle/hacks/hashmapAssertions.gradle

Lines changed: 0 additions & 33 deletions
This file was deleted.

gradle/testing/fail-on-unsupported-jdk.gradle

Lines changed: 0 additions & 32 deletions
This file was deleted.

solr/core/src/java/org/apache/solr/servlet/CoreContainerProvider.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,12 @@ private void init(ServletContext servletContext) {
215215
}
216216

217217
// Do initial logs for experimental Lucene classes.
218-
// TODO: Use "MethodHandles.lookup().ensureClassInitialized()" instead of "Class.forName()"
219-
// once JDK 15+ is mandatory
218+
final var lookup = MethodHandles.lookup();
220219
Stream.of(MMapDirectory.class, VectorUtil.class)
221220
.forEach(
222221
cls -> {
223222
try {
224-
Class.forName(cls.getName());
223+
lookup.ensureInitialized(cls);
225224
} catch (ReflectiveOperationException re) {
226225
throw new SolrException(
227226
ErrorCode.SERVER_ERROR, "Could not load Lucene class: " + cls.getName());

solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
package org.apache.solr.util;
1818

19-
import com.carrotsearch.randomizedtesting.RandomizedTest;
2019
import java.security.KeyManagementException;
2120
import java.security.KeyStore;
2221
import java.security.KeyStoreException;
@@ -27,7 +26,6 @@
2726
import java.security.UnrecoverableKeyException;
2827
import java.util.Random;
2928
import java.util.concurrent.ThreadLocalRandom;
30-
import java.util.regex.Pattern;
3129
import javax.net.ssl.SSLContext;
3230
import org.apache.http.config.Registry;
3331
import org.apache.http.config.RegistryBuilder;
@@ -38,7 +36,6 @@
3836
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
3937
import org.apache.http.ssl.SSLContextBuilder;
4038
import org.apache.http.ssl.SSLContexts;
41-
import org.apache.lucene.util.Constants;
4239
import org.apache.solr.client.solrj.embedded.SSLConfig;
4340
import org.apache.solr.client.solrj.impl.HttpClientUtil;
4441
import org.apache.solr.client.solrj.impl.HttpClientUtil.SocketFactoryRegistryProvider;
@@ -108,10 +105,6 @@ public SSLTestConfig(boolean useSsl, boolean clientAuth, boolean checkPeerName)
108105
this.clientAuth = clientAuth;
109106
this.checkPeerName = checkPeerName;
110107

111-
if (this.useSsl) {
112-
assumeSslIsSafeToTest();
113-
}
114-
115108
final String resourceName =
116109
checkPeerName ? TEST_KEYSTORE_LOCALHOST_RESOURCE : TEST_KEYSTORE_BOGUSHOST_RESOURCE;
117110
trustStore = keyStore = Resource.newClassPathResource(resourceName);
@@ -414,50 +407,4 @@ public void reseed(SecureRandomParameters params) {
414407
/* NOOP */
415408
}
416409
}
417-
418-
/**
419-
* Helper method for sanity checking if it's safe to use SSL on this JVM
420-
*
421-
* @see <a href="https://issues.apache.org/jira/browse/SOLR-12988">SOLR-12988</a>
422-
* @throws org.junit.internal.AssumptionViolatedException if this JVM is known to have SSL
423-
* problems
424-
*/
425-
public static void assumeSslIsSafeToTest() {
426-
if (Constants.JVM_NAME.startsWith("OpenJDK")
427-
|| Constants.JVM_NAME.startsWith("Java HotSpot(TM)")) {
428-
RandomizedTest.assumeFalse(
429-
"Test (or randomization for this seed) wants to use SSL, "
430-
+ "but SSL is known to fail on your JVM: "
431-
+ Constants.JVM_NAME
432-
+ " / "
433-
+ Constants.JVM_VERSION,
434-
isOpenJdkJvmVersionKnownToHaveProblems(Constants.JVM_VERSION));
435-
}
436-
}
437-
438-
/**
439-
* package visibility for tests
440-
*
441-
* @see Constants#JVM_VERSION
442-
* @lucene.internal
443-
*/
444-
static boolean isOpenJdkJvmVersionKnownToHaveProblems(final String jvmVersion) {
445-
// TODO: would be nice to replace with Runtime.Version once we don't have to
446-
// worry about java8 support when backporting to branch_8x
447-
return KNOWN_BAD_OPENJDK_JVMS.matcher(jvmVersion).matches();
448-
}
449-
450-
private static final Pattern KNOWN_BAD_OPENJDK_JVMS =
451-
Pattern.compile( // 11 to 11.0.2 were all definitely problematic
452-
// - https://bugs.openjdk.java.net/browse/JDK-8212885
453-
// - https://bugs.openjdk.java.net/browse/JDK-8213202
454-
"(^11(\\.0(\\.0|\\.1|\\.2)?)?($|(\\_|\\+|\\-).*$))|"
455-
+
456-
// early (pre-ea) "testing" builds of 11, 12, and 13 were also buggy
457-
// - https://bugs.openjdk.java.net/browse/JDK-8224829
458-
"(^(11|12|13).*-testing.*$)|"
459-
+
460-
// So far, all 13-ea builds (up to 13-ea-26) have been buggy
461-
// - https://bugs.openjdk.java.net/browse/JDK-8226338
462-
"(^13-ea.*$)");
463410
}

solr/test-framework/src/test/org/apache/solr/util/TestSSLTestConfig.java

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)