Skip to content

Commit b5cd781

Browse files
committed
fix TraversalStrategyProxy() compile error on java 11
compile error on java 11: Cannot infer type arguments for new TraversalStrategyProxy<>(strategy) Change-Id: I6a31cb24d4f37cc6af9ae9769a986593301ea1ff
1 parent 99d4481 commit b5cd781

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,16 +1659,14 @@ public Iterator<TraversalStrategy<?>> iterator() {
16591659
return Collections.emptyIterator();
16601660

16611661
}
1662-
return new MapperIterator<TraversalStrategy<?>,
1663-
TraversalStrategy<?>>(
1662+
return new MapperIterator<TraversalStrategy<?>, TraversalStrategy<?>>(
16641663
this.strategies.iterator(), (strategy) -> {
16651664
return new TraversalStrategyProxy<>(strategy);
16661665
});
16671666
}
16681667

16691668
@Override
1670-
public TraversalStrategies addStrategies(TraversalStrategy<?>...
1671-
strategies) {
1669+
public TraversalStrategies addStrategies(TraversalStrategy<?>... strategies) {
16721670
return this.strategies.addStrategies(strategies);
16731671
}
16741672

@@ -1709,8 +1707,10 @@ private final class TraversalStrategyProxy<T extends TraversalStrategy<?>>
17091707

17101708
private final TraversalStrategy<T> origin;
17111709

1712-
public TraversalStrategyProxy(TraversalStrategy<T> origin) {
1713-
this.origin = origin;
1710+
public TraversalStrategyProxy(TraversalStrategy<?> origin) {
1711+
@SuppressWarnings({ "rawtypes", "unchecked" })
1712+
TraversalStrategy<T> strategy = (TraversalStrategy) origin;
1713+
this.origin = strategy;
17141714
}
17151715

17161716
@Override
@@ -1768,8 +1768,8 @@ public Configuration getConfiguration() {
17681768

17691769
@Override
17701770
public int compareTo(@SuppressWarnings("rawtypes")
1771-
Class<? extends TraversalStrategy> otherCategory) {
1772-
return this.origin.compareTo(otherCategory);
1771+
Class<? extends TraversalStrategy> other) {
1772+
return this.origin.compareTo(other);
17731773
}
17741774

17751775
@Override
@@ -1788,8 +1788,7 @@ public String toString() {
17881788
}
17891789
}
17901790

1791-
private static final ThreadLocal<Context> CONTEXTS =
1792-
new InheritableThreadLocal<>();
1791+
private static final ThreadLocal<Context> CONTEXTS = new InheritableThreadLocal<>();
17931792

17941793
protected static final Context setContext(Context context) {
17951794
Context old = CONTEXTS.get();

0 commit comments

Comments
 (0)