fix code to compile under java 11 as well

This commit is contained in:
Anna.Kozlova
2019-02-11 18:39:48 +01:00
parent 396ac72d12
commit bb01072eb6
3 changed files with 22 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
import java.util.function.Predicate;
class B<T> {
public static <E> B<E> from( Iterable<? extends E> iterable) {
return null;
}
void m(Iterable<? extends T> it, Predicate<? super T> p) {
<error descr="Incompatible types. Found: 'B<capture<? extends T>>', required: 'B<T>'">B<T> B = from(it).bar(not(p));</error>
}
B<T> bar(Predicate<? super T> p) {
return this;
}
public static <N> Predicate<N> not(Predicate<? super N> c) {
return null;
}
}

View File

@@ -201,6 +201,7 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
doTest();
}
public void testNotInferredVarShouldNotBeUsedForInferenceJava10() { doTest(); }
public void testJavac8UnCaptureBug() { doTest(); }
public void testTopLevelParentNoParameters() {
doTest();
}

View File

@@ -241,7 +241,8 @@ public abstract class FilteredTraverserBase<T, Self extends FilteredTraverserBas
return JBIterable.empty();
}
else if (myMeta.regard.next == null && myMeta.forceDisregard.next == null) {
return JBIterable.from(myTree.fun(node)).filter(not(myMeta.forceIgnore.OR));
JBIterable<T> from = JBIterable.from(myTree.fun(node));
return from.filter(not(myMeta.forceIgnore.OR));
}
else {
// traverse subtree to select accepted children