diff --git a/core/pom.xml b/core/pom.xml index 47858cd2427..f690caa1b9c 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -132,6 +132,11 @@ graal-sdk provided + + org.graalvm.nativeimage + svm + provided + ch.qos.logback logback-classic diff --git a/core/src/main/java/com/datastax/oss/driver/shaded/guava/common/primitives/LexicographicalComparatorHolderSubstitution.java b/core/src/main/java/com/datastax/oss/driver/shaded/guava/common/primitives/LexicographicalComparatorHolderSubstitution.java new file mode 100644 index 00000000000..518f53069d2 --- /dev/null +++ b/core/src/main/java/com/datastax/oss/driver/shaded/guava/common/primitives/LexicographicalComparatorHolderSubstitution.java @@ -0,0 +1,37 @@ +/* + * Copyright DataStax, Inc. + * + * Licensed 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 com.datastax.oss.driver.shaded.guava.common.primitives; + +import com.oracle.svm.core.annotate.Alias; +import com.oracle.svm.core.annotate.RecomputeFieldValue; +import com.oracle.svm.core.annotate.Substitute; +import com.oracle.svm.core.annotate.TargetClass; +import java.util.Comparator; + +@TargetClass(UnsignedBytes.LexicographicalComparatorHolder.class) +final class LexicographicalComparatorHolderSubstitution { + + @Alias + @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias) + static Comparator BEST_COMPARATOR = UnsignedBytes.lexicographicalComparatorJavaImpl(); + + /* All known cases should be covered by the field substitution above... keeping this only + * for sake of completeness */ + @Substitute + static Comparator getBestComparator() { + return UnsignedBytes.lexicographicalComparatorJavaImpl(); + } +} diff --git a/core/src/main/java/com/datastax/oss/driver/shaded/guava/common/primitives/UnsafeComparatorSubstitution.java b/core/src/main/java/com/datastax/oss/driver/shaded/guava/common/primitives/UnsafeComparatorSubstitution.java new file mode 100644 index 00000000000..974c7c8a89e --- /dev/null +++ b/core/src/main/java/com/datastax/oss/driver/shaded/guava/common/primitives/UnsafeComparatorSubstitution.java @@ -0,0 +1,23 @@ +/* + * Copyright DataStax, Inc. + * + * Licensed 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 com.datastax.oss.driver.shaded.guava.common.primitives; + +import com.oracle.svm.core.annotate.Delete; +import com.oracle.svm.core.annotate.TargetClass; + +@TargetClass(UnsignedBytes.LexicographicalComparatorHolder.UnsafeComparator.class) +@Delete +final class UnsafeComparatorSubstitution {} diff --git a/pom.xml b/pom.xml index ffbaa5e93d8..3e07ec120ea 100644 --- a/pom.xml +++ b/pom.xml @@ -382,6 +382,11 @@ graal-sdk 20.0.0 + + org.graalvm.nativeimage + svm + 20.0.0 + @@ -693,7 +698,7 @@ limitations under the License.]]> false true all,-missing - com.datastax.*.driver.internal* + com.datastax.*.driver.internal*,com.datastax.oss.driver.shaded.guava.common.primitives