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,9 +71,16 @@ public interface TSpliterator<T> {
}
interface OfInt extends OfPrimitive<Integer, IntConsumer, OfInt> {
@Override
boolean tryAdvance(IntConsumer consumer);
@Override
default boolean tryAdvance(Consumer<? super Integer> action) {
return tryAdvance((IntConsumer) action::accept);
if (action instanceof IntConsumer) {
return tryAdvance((IntConsumer) action);
} else {
return tryAdvance((IntConsumer) action::accept);
}
}
@Override
@ -82,9 +89,19 @@ public interface TSpliterator<T> {
// continue
}
}
@Override
default void forEachRemaining(IntConsumer action) {
while (tryAdvance(action)) {
// continue
}
}
}
interface OfLong extends OfPrimitive<Long, LongConsumer, OfLong> {
@Override
boolean tryAdvance(LongConsumer consumer);
@Override
default boolean tryAdvance(Consumer<? super Long> action) {
return tryAdvance((LongConsumer) action::accept);
@ -96,9 +113,19 @@ public interface TSpliterator<T> {
// continue
}
}
@Override
default void forEachRemaining(LongConsumer action) {
while (tryAdvance(action)) {
// continue
}
}
}
interface OfDouble extends OfPrimitive<Double, DoubleConsumer, OfDouble> {
@Override
boolean tryAdvance(DoubleConsumer consumer);
@Override
default boolean tryAdvance(Consumer<? super Double> action) {
return tryAdvance((DoubleConsumer) action::accept);
@ -110,5 +137,12 @@ public interface TSpliterator<T> {
// 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())) {
return false;
}
if (!reachableMethods.contains(method)) {
return true;
}
if (hierarchy.resolve(method) != null) {
return true;
}
diagnostics.error(new CallLocation(methodRef, location), "Method {{m0}} was not found",
method);
diagnostics.error(new CallLocation(methodRef, location), "Method {{m0}} was not found", method);
emitExceptionThrow(location, NoSuchMethodError.class.getName(), "Method not found: " + method);
return true;
}