Fix missing virtual call detector

This commit is contained in:
Alexey Andreev 2021-02-26 11:52:10 +03:00
parent d1fa57210e
commit 0eca9d95e1
2 changed files with 36 additions and 6 deletions

View File

@ -71,10 +71,17 @@ public interface TSpliterator<T> {
} }
interface OfInt extends OfPrimitive<Integer, IntConsumer, OfInt> { interface OfInt extends OfPrimitive<Integer, IntConsumer, OfInt> {
@Override
boolean tryAdvance(IntConsumer consumer);
@Override @Override
default boolean tryAdvance(Consumer<? super Integer> action) { default boolean tryAdvance(Consumer<? super Integer> action) {
if (action instanceof IntConsumer) {
return tryAdvance((IntConsumer) action);
} else {
return tryAdvance((IntConsumer) action::accept); return tryAdvance((IntConsumer) action::accept);
} }
}
@Override @Override
default void forEachRemaining(Consumer<? super Integer> action) { default void forEachRemaining(Consumer<? super Integer> action) {
@ -82,9 +89,19 @@ public interface TSpliterator<T> {
// continue // continue
} }
} }
@Override
default void forEachRemaining(IntConsumer action) {
while (tryAdvance(action)) {
// continue
}
}
} }
interface OfLong extends OfPrimitive<Long, LongConsumer, OfLong> { interface OfLong extends OfPrimitive<Long, LongConsumer, OfLong> {
@Override
boolean tryAdvance(LongConsumer consumer);
@Override @Override
default boolean tryAdvance(Consumer<? super Long> action) { default boolean tryAdvance(Consumer<? super Long> action) {
return tryAdvance((LongConsumer) action::accept); return tryAdvance((LongConsumer) action::accept);
@ -96,9 +113,19 @@ public interface TSpliterator<T> {
// continue // continue
} }
} }
@Override
default void forEachRemaining(LongConsumer action) {
while (tryAdvance(action)) {
// continue
}
}
} }
interface OfDouble extends OfPrimitive<Double, DoubleConsumer, OfDouble> { interface OfDouble extends OfPrimitive<Double, DoubleConsumer, OfDouble> {
@Override
boolean tryAdvance(DoubleConsumer consumer);
@Override @Override
default boolean tryAdvance(Consumer<? super Double> action) { default boolean tryAdvance(Consumer<? super Double> action) {
return tryAdvance((DoubleConsumer) action::accept); return tryAdvance((DoubleConsumer) action::accept);
@ -110,5 +137,12 @@ public interface TSpliterator<T> {
// continue // continue
} }
} }
@Override
default void forEachRemaining(DoubleConsumer action) {
while (tryAdvance(action)) {
// continue
}
}
} }
} }

View File

@ -207,16 +207,12 @@ public class MissingItemsProcessor {
if (!checkClass(location, method.getClassName())) { if (!checkClass(location, method.getClassName())) {
return false; return false;
} }
if (!reachableMethods.contains(method)) {
return true;
}
if (hierarchy.resolve(method) != null) { if (hierarchy.resolve(method) != null) {
return true; return true;
} }
diagnostics.error(new CallLocation(methodRef, location), "Method {{m0}} was not found", diagnostics.error(new CallLocation(methodRef, location), "Method {{m0}} was not found", method);
method);
emitExceptionThrow(location, NoSuchMethodError.class.getName(), "Method not found: " + method); emitExceptionThrow(location, NoSuchMethodError.class.getName(), "Method not found: " + method);
return true; return true;
} }