diff --git a/build-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java b/build-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java index 44c9c411a9e..d4f389f7052 100644 --- a/build-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java +++ b/build-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java @@ -439,13 +439,6 @@ private void error(Element element, String message) { fullMessage.append("): "); fullMessage.append(message); - if (Runtime.version().feature() == 11 && element.getKind() == ElementKind.PACKAGE) { - // Avoid JDK 11 bug: - // https://issues.apache.org/jira/browse/LUCENE-9747 - // https://bugs.openjdk.java.net/browse/JDK-8224082 - reporter.print(Diagnostic.Kind.ERROR, fullMessage.toString()); - } else { - reporter.print(Diagnostic.Kind.ERROR, element, fullMessage.toString()); - } + reporter.print(Diagnostic.Kind.ERROR, element, fullMessage.toString()); } } diff --git a/build.gradle b/build.gradle index 13065fcfc8f..8653e36406b 100644 --- a/build.gradle +++ b/build.gradle @@ -131,7 +131,6 @@ apply from: file('gradle/java/javac.gradle') apply from: file('gradle/testing/defaults-tests.gradle') apply from: file('gradle/testing/randomization.gradle') apply from: file('gradle/testing/fail-on-no-tests.gradle') -apply from: file('gradle/testing/fail-on-unsupported-jdk.gradle') apply from: file('gradle/testing/alternative-jdk-support.gradle') apply from: file('gradle/java/jar-manifest.gradle') apply from: file('gradle/testing/retry-test.gradle') @@ -205,7 +204,6 @@ apply from: file('gradle/hacks/global-exclude-dependencies.gradle') apply from: file('gradle/hacks/gradle-archives.gradle') apply from: file('gradle/hacks/wipe-temp.gradle') -apply from: file('gradle/hacks/hashmapAssertions.gradle') apply from: file('gradle/hacks/turbocharge-jvm-opts.gradle') apply from: file('gradle/hacks/dummy-outputs.gradle') diff --git a/gradle/hacks/hashmapAssertions.gradle b/gradle/hacks/hashmapAssertions.gradle deleted file mode 100644 index 095726c9701..00000000000 --- a/gradle/hacks/hashmapAssertions.gradle +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Disable assertions for HashMap due to: LUCENE-8991 / JDK-8205399 -def vmName = System.getProperty("java.vm.name") -def spec = System.getProperty("java.specification.version") -if (vmName =~ /(?i)(hotspot|openjdk|jrockit)/ && - spec =~ /^(1\.8|9|10|11)$/ && - !Boolean.parseBoolean(propertyOrDefault('tests.asserts.hashmap', 'false'))) { - logger.info("Enabling HashMap assertions.") - allprojects { - plugins.withType(JavaPlugin) { - tasks.withType(Test) { task -> - jvmArgs("-da:java.util.HashMap") - } - } - } -} - diff --git a/gradle/testing/fail-on-unsupported-jdk.gradle b/gradle/testing/fail-on-unsupported-jdk.gradle deleted file mode 100644 index 7d94b709764..00000000000 --- a/gradle/testing/fail-on-unsupported-jdk.gradle +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -configure(rootProject) { - task ensureJdkSupported() { - doFirst { - if (System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("mac") && rootProject.runtimeJavaVersion == JavaVersion.VERSION_20) { - throw new GradleException("Tests cannot be run with JDK20 on Mac; see SOLR-16733 for more details.") - } - } - } - - allprojects { - tasks.withType(Test) { - dependsOn ":ensureJdkSupported" - } - } -} diff --git a/solr/core/src/java/org/apache/solr/servlet/CoreContainerProvider.java b/solr/core/src/java/org/apache/solr/servlet/CoreContainerProvider.java index 8b8bc3c927d..5a2a053c090 100644 --- a/solr/core/src/java/org/apache/solr/servlet/CoreContainerProvider.java +++ b/solr/core/src/java/org/apache/solr/servlet/CoreContainerProvider.java @@ -215,13 +215,12 @@ private void init(ServletContext servletContext) { } // Do initial logs for experimental Lucene classes. - // TODO: Use "MethodHandles.lookup().ensureClassInitialized()" instead of "Class.forName()" - // once JDK 15+ is mandatory + final var lookup = MethodHandles.lookup(); Stream.of(MMapDirectory.class, VectorUtil.class) .forEach( cls -> { try { - Class.forName(cls.getName()); + lookup.ensureInitialized(cls); } catch (ReflectiveOperationException re) { throw new SolrException( ErrorCode.SERVER_ERROR, "Could not load Lucene class: " + cls.getName()); diff --git a/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java b/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java index 4b0c7c47529..5a830e35aa8 100644 --- a/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java +++ b/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java @@ -16,7 +16,6 @@ */ package org.apache.solr.util; -import com.carrotsearch.randomizedtesting.RandomizedTest; import java.security.KeyManagementException; import java.security.KeyStore; import java.security.KeyStoreException; @@ -27,7 +26,6 @@ import java.security.UnrecoverableKeyException; import java.util.Random; import java.util.concurrent.ThreadLocalRandom; -import java.util.regex.Pattern; import javax.net.ssl.SSLContext; import org.apache.http.config.Registry; import org.apache.http.config.RegistryBuilder; @@ -38,7 +36,6 @@ import org.apache.http.conn.ssl.TrustSelfSignedStrategy; import org.apache.http.ssl.SSLContextBuilder; import org.apache.http.ssl.SSLContexts; -import org.apache.lucene.util.Constants; import org.apache.solr.client.solrj.embedded.SSLConfig; import org.apache.solr.client.solrj.impl.HttpClientUtil; import org.apache.solr.client.solrj.impl.HttpClientUtil.SocketFactoryRegistryProvider; @@ -108,10 +105,6 @@ public SSLTestConfig(boolean useSsl, boolean clientAuth, boolean checkPeerName) this.clientAuth = clientAuth; this.checkPeerName = checkPeerName; - if (this.useSsl) { - assumeSslIsSafeToTest(); - } - final String resourceName = checkPeerName ? TEST_KEYSTORE_LOCALHOST_RESOURCE : TEST_KEYSTORE_BOGUSHOST_RESOURCE; trustStore = keyStore = Resource.newClassPathResource(resourceName); @@ -414,50 +407,4 @@ public void reseed(SecureRandomParameters params) { /* NOOP */ } } - - /** - * Helper method for sanity checking if it's safe to use SSL on this JVM - * - * @see SOLR-12988 - * @throws org.junit.internal.AssumptionViolatedException if this JVM is known to have SSL - * problems - */ - public static void assumeSslIsSafeToTest() { - if (Constants.JVM_NAME.startsWith("OpenJDK") - || Constants.JVM_NAME.startsWith("Java HotSpot(TM)")) { - RandomizedTest.assumeFalse( - "Test (or randomization for this seed) wants to use SSL, " - + "but SSL is known to fail on your JVM: " - + Constants.JVM_NAME - + " / " - + Constants.JVM_VERSION, - isOpenJdkJvmVersionKnownToHaveProblems(Constants.JVM_VERSION)); - } - } - - /** - * package visibility for tests - * - * @see Constants#JVM_VERSION - * @lucene.internal - */ - static boolean isOpenJdkJvmVersionKnownToHaveProblems(final String jvmVersion) { - // TODO: would be nice to replace with Runtime.Version once we don't have to - // worry about java8 support when backporting to branch_8x - return KNOWN_BAD_OPENJDK_JVMS.matcher(jvmVersion).matches(); - } - - private static final Pattern KNOWN_BAD_OPENJDK_JVMS = - Pattern.compile( // 11 to 11.0.2 were all definitely problematic - // - https://bugs.openjdk.java.net/browse/JDK-8212885 - // - https://bugs.openjdk.java.net/browse/JDK-8213202 - "(^11(\\.0(\\.0|\\.1|\\.2)?)?($|(\\_|\\+|\\-).*$))|" - + - // early (pre-ea) "testing" builds of 11, 12, and 13 were also buggy - // - https://bugs.openjdk.java.net/browse/JDK-8224829 - "(^(11|12|13).*-testing.*$)|" - + - // So far, all 13-ea builds (up to 13-ea-26) have been buggy - // - https://bugs.openjdk.java.net/browse/JDK-8226338 - "(^13-ea.*$)"); } diff --git a/solr/test-framework/src/test/org/apache/solr/util/TestSSLTestConfig.java b/solr/test-framework/src/test/org/apache/solr/util/TestSSLTestConfig.java deleted file mode 100644 index 319f78923d8..00000000000 --- a/solr/test-framework/src/test/org/apache/solr/util/TestSSLTestConfig.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.util; - -import java.util.Arrays; -import java.util.List; -import org.apache.lucene.util.Constants; -import org.apache.solr.SolrTestCase; - -public class TestSSLTestConfig extends SolrTestCase { - - /** Sanity check that our JVM version parsing logic seems correct */ - public void testIsOpenJdkJvmVersionKnownToHaveProblems() { - final List rel_suffixes = Arrays.asList("", "+42"); - final List ea_suffixes = Arrays.asList("-ea", "-ea+42"); - final List suffixes = Arrays.asList("", "+42", "-ea", "-ea+42"); - - // as far as we know, any Java 8, 9 or 10 impl should be fine... - for (String base : - Arrays.asList( - "1.8", "1.8.0", "1.8.1", "9", "9.0", "9.1", "9.0.0", "9.1.0", "9.1.1", "10", "10.0", - "10.1", "10.0.0", "10.1.0", "10.1.1")) { - for (String suffix : suffixes) { - final String v = base + suffix; - assertFalse(v, SSLTestConfig.isOpenJdkJvmVersionKnownToHaveProblems(v)); - } - } - - // Known Problems start with Java 11... - - // java 11 releases below 11.0.3 were all bad... - for (String bad : Arrays.asList("11", "11.0", "11.0.1", "11.0.2")) { - for (String suffix : suffixes) { - final String v = bad + suffix; - assertTrue(v, SSLTestConfig.isOpenJdkJvmVersionKnownToHaveProblems(v)); - } - } - - // ...but 11.0.3 or higher should be ok. - for (String ok : Arrays.asList("11.0.3", "11.0.42", "11.1", "11.1.42")) { - for (String suffix : suffixes) { - final String v = ok + suffix; - assertFalse(v, SSLTestConfig.isOpenJdkJvmVersionKnownToHaveProblems(v)); - } - } - - // As far as we know/hope, all "official" java 12 and higher impls should be fine... - for (String major : Arrays.asList("12", "13", "99")) { - for (String minor : Arrays.asList("", ".0", ".42", ".0.42")) { - for (String suffix : rel_suffixes) { - final String v = major + minor + suffix; - assertFalse(v, SSLTestConfig.isOpenJdkJvmVersionKnownToHaveProblems(v)); - } - } - } - - // ...but pre EA "testing" builds of 11, 12, and 13 are all definitely problematic... - for (String major : Arrays.asList("11", "12", "13")) { - for (String suffix : suffixes) { - final String v = major + "-testing" + suffix; - assertTrue(v, SSLTestConfig.isOpenJdkJvmVersionKnownToHaveProblems(v)); - } - } - - // ...and all 13-ea builds (so far) have definitely been problematic. - for (String suffix : ea_suffixes) { - final String v = "13" + suffix; - assertTrue(v, SSLTestConfig.isOpenJdkJvmVersionKnownToHaveProblems(v)); - } - } - - public void testFailIfUserRunsTestsWithJVMThatHasKnownSSLBugs() { - // NOTE: If there is some future JVM version, where all available "ea" builds are known to be - // buggy, but we still want to be able to use for running tests (ie: via jenkins) to look for - // *other* bugs, then those -ea versions can be "white listed" here... - - try { - SSLTestConfig.assumeSslIsSafeToTest(); - } catch (org.junit.AssumptionViolatedException ave) { - fail( - "Current JVM (" - + Constants.JVM_NAME - + " / " - + Constants.JVM_VERSION - + ") is known to have SSL Bugs. Other tests that (explicitly or via randomization) " - + " use SSL will be SKIPed"); - } - } -}