Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.datastax.oss.driver.api.core.context.DriverContext;
import com.datastax.oss.driver.internal.core.util.GraalDependencyChecker;
import com.datastax.oss.protocol.internal.Compressor;
import com.oracle.svm.core.annotate.Delete;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import io.netty.buffer.ByteBuf;
Expand Down Expand Up @@ -82,14 +81,6 @@ public static Compressor<ByteBuf> newInstance(String name, DriverContext context
}
}

@TargetClass(value = Lz4Compressor.class, onlyWith = Lz4Missing.class)
@Delete
public static final class DeleteLz4Compressor {}

@TargetClass(value = SnappyCompressor.class)
@Delete
public static final class DeleteSnappyCompressor {}

public static class Lz4Present implements BooleanSupplier {
@Override
public boolean getAsBoolean() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/
package com.datastax.oss.driver.internal.core.util;

import com.datastax.oss.driver.shaded.guava.common.collect.ImmutableList;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we add a comment somewhere to warn future maintainers that this class should be extra careful when importing anything outside of the standard library?

Copy link
Contributor Author

@absurdfarce absurdfarce Oct 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So... I'm a little torn on this, frankly.

I'd feel better about saying something like this if I understood more cleanly why the change in question resulted in the behaviour we saw. But it seems to be the case that introducing a dependency upon a shaded class somehow:

  • caused Graal to eval this class as a runtime class
  • only did so for Graal 22.2; the original code has always worked fine on 22.1

I... just don't know if I have enough there to extract some kind of meaningful guidance. We've already seen that changes between Graal versions can have odd impacts on what was perfectly valid code. This seems like another one of those, but I just don't see a way to draw a lesson from that which can be clearly stated and apply to future use.

I'm open to suggestions if anybody has any.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah pretty hard to anticipate this kind of behavior change, I would vote for no specific comment but up to you.

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
* A set of driver optional dependencies and a common mechanism to test the presence of such
Expand Down Expand Up @@ -48,10 +50,10 @@ public enum Dependency {
;

@SuppressWarnings("ImmutableEnumChecker")
private final ImmutableList<String> clzs;
private final List<String> clzs;

Dependency(String... classNames) {
clzs = ImmutableList.copyOf(classNames);
clzs = Collections.unmodifiableList(Arrays.asList(classNames));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A proxy for immutable lists without the type information. Probably not strictly necessary (there's no obvious way for these lists to change) but it provides information that these values shouldn't change.

}

public Iterable<String> classes() {
Expand Down