Skip to content

Commit

Permalink
Remove redundant legacy Java workarounds (#1361)
Browse files Browse the repository at this point in the history
Some classes use workarounds for issues present in older JDKs that
Hazelcast no longer supports, and can be removed.

Issues:
- [JDK bug](https://bugs.openjdk.java.net/browse/JDK-8156584), fixed in
9
   - `TestJavaKeyStoreSecureStoreUtils`
- [JDK bug](https://bugs.java.com/bugdatabase/view_bug?bug_id=8234729),
fixed in [15 (see blocking
issues)](https://bugs.openjdk.org/browse/JDK-8171335) + only skips on 15
& 16 (nothing else) anyway
   - `DebeziumCdcIntegrationTest.java`
   - `AbstractMySqlCdcIntegrationTest.java`
   - `MySqlCdcNetworkIntegrationTest.java`
- JDK8 compiler issue (unknown root cause) - compiles properly now
   - `GrAggBuilder`
   - `GeneralHashJoinBuilder`
GitOrigin-RevId: 75141818062b1e790a201a597c760f634e1d2d4b
  • Loading branch information
JackPGreen authored and actions-user committed Apr 17, 2024
1 parent 69bcb55 commit 2da9239
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 35 deletions.
Expand Up @@ -34,7 +34,6 @@
import io.debezium.connector.mysql.MySqlConnector;
import io.debezium.connector.postgresql.PostgresConnector;
import org.bson.Document;
import org.junit.Assume;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -73,10 +72,6 @@ public class DebeziumCdcIntegrationTest extends AbstractCdcIntegrationTest {

@Test
public void mysql() throws Exception {
Assume.assumeFalse("https://github.com/hazelcast/hazelcast-jet/issues/2623, " +
"https://github.com/hazelcast/hazelcast/issues/18800",
System.getProperty("java.version").matches("^1[56].*"));

try (MySQLContainer<?> container = mySqlContainer()) {
container.start();

Expand Down Expand Up @@ -154,10 +149,6 @@ private StreamSource<ChangeRecord> mySqlSource(MySQLContainer<?> container) {

@Test
public void mysql_simpleJson() {
Assume.assumeFalse("https://github.com/hazelcast/hazelcast-jet/issues/2623, " +
"https://github.com/hazelcast/hazelcast/issues/18800",
System.getProperty("java.version").matches("^1[56].*"));

try (MySQLContainer<?> container = mySqlContainer()) {
container.start();

Expand Down
Expand Up @@ -21,8 +21,6 @@
import com.hazelcast.jet.test.IgnoreInJenkinsOnWindows;
import com.hazelcast.test.HazelcastSerialClassRunner;
import com.hazelcast.test.annotation.ParallelJVMTest;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -51,13 +49,6 @@ public abstract class AbstractMySqlCdcIntegrationTest extends AbstractCdcIntegra
.withPassword("mysqlpw")
);

@BeforeClass
public static void ignoreOnJdk15OrHigher() {
Assume.assumeFalse("https://github.com/hazelcast/hazelcast-jet/issues/2623, " +
"https://github.com/hazelcast/hazelcast/issues/18800",
System.getProperty("java.version").matches("^1[56].*"));
}

protected MySqlCdcSources.Builder sourceBuilder(String name) {
return MySqlCdcSources.mysql(name)
.setDatabaseAddress(mysql.getHost())
Expand Down
Expand Up @@ -37,8 +37,6 @@
import eu.rekawek.toxiproxy.ToxiproxyClient;
import eu.rekawek.toxiproxy.model.ToxicDirection;
import org.junit.After;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -101,13 +99,6 @@ public static Collection<Object[]> data() {
});
}

@Before
public void ignoreOnJdk15OrHigher() {
Assume.assumeFalse("https://github.com/hazelcast/hazelcast-jet/issues/2623, " +
"https://github.com/hazelcast/hazelcast/issues/18800",
System.getProperty("java.version").matches("^1[567].*"));
}

@After
public void after() {
if (mysql != null) {
Expand Down
Expand Up @@ -106,9 +106,7 @@ public <A, R, OUT> BatchStage<OUT> buildBatch(
public <A, R> StreamStage<KeyedWindowResult<K, R>> buildStream(@Nonnull AggregateOperation<A, ? extends R> aggrOp) {
List<Transform> upstreamTransforms = toList(upstreamStages, s -> s.transform);
FunctionAdapter fnAdapter = ADAPT_TO_JET_EVENT;
// Casts in this expression are a workaround for JDK 8 compiler bug:
@SuppressWarnings("unchecked")
List<FunctionEx<?, ? extends K>> adaptedKeyFns = toList(keyFns, fn -> fnAdapter.adaptKeyFn((FunctionEx) fn));
List<FunctionEx<?, ? extends K>> adaptedKeyFns = toList(keyFns, fnAdapter::adaptKeyFn);
AbstractTransform transform = new WindowGroupTransform<K, R>(
upstreamTransforms, wDef, adaptedKeyFns, fnAdapter.adaptAggregateOperation(aggrOp));
pipelineImpl.connect(upstreamStages, transform);
Expand Down
Expand Up @@ -112,20 +112,19 @@ <R> GeneralStage<R> build0(BiFunctionEx<T0, ItemsByTag, R> mapToOutputFn) {
List<Entry<Tag<?>, StageAndClause<?, T0, ?, ?>>> orderedClauses =
clauses.entrySet().stream()
.sorted(Entry.comparingByKey())
.collect(toList());
.toList();
List<GeneralStage> upstream = concat(
Stream.of(stage0),
orderedClauses.stream().map(e -> e.getValue().stage())
).collect(toList());
Stream<? extends JoinClause<?, T0, ?, ?>> joinClauses = orderedClauses
Stream<JoinClause<?, T0, ?, ?>> joinClauses = orderedClauses
.stream()
.map(e -> e.getValue().clause());
// JoinClause's second param, T0, is the same for all clauses but only
// before FunctionAdapter treatment. After that it may be T0 or JetEvent<T0>
// so we are forced to generalize to just ?.
// The (JoinClause) and (List<JoinClause>) casts are a workaround for JDK 8 compiler bugs.
List<JoinClause> adaptedClauses = (List<JoinClause>) joinClauses
.map(joinClause -> fnAdapter.adaptJoinClause((JoinClause) joinClause))
List<JoinClause> adaptedClauses = joinClauses
.map((JoinClause joinClause) -> fnAdapter.adaptJoinClause(joinClause))
.collect(toList());
BiFunctionEx<?, ? super ItemsByTag, ?> adaptedOutputFn = fnAdapter.adaptHashJoinOutputFn(mapToOutputFn);
// Here we break type safety and assume T0 as the type parameter even though
Expand Down

0 comments on commit 2da9239

Please sign in to comment.