Revert "[java-inspections] IDEA-328239 Casting with conjunction"

This reverts commit 97e21dbacccd9382e48387295a911b127882e625.

GitOrigin-RevId: 572b3b40ac196132e233d044631ee27b565f0edc
This commit is contained in:
Mikhail Pyltsin
2023-08-29 22:10:40 +00:00
committed by intellij-monorepo-bot
parent 06509345d6
commit 320f621750
3 changed files with 10 additions and 103 deletions
@@ -5,41 +5,4 @@ class Test {
public static <K extends Comparable<? super K>, V> Comparator<Map.Entry<K, V>> foo() {
return (Comparator<Map.Entry<K, V>> & Serializable)(c1, c2) -> c1.getKey().compareTo(c2.getKey());
}
public static void main(String... args) {
var shouldCompile = (Consumer<Integer> & IntConsumerAdapter1)
i -> System.out.println("Cons3uming dd" + i);
System.out.println(shouldCompile.getClass());
shouldCompile.accept(42);
shouldCompile.accept(Integer.valueOf(52));
var shouldNotCompile = (Consumer<Integer> & IntConsumerAdapter2)
<error descr="No target method found">i -> System.out.println("Consumins2gs " + i)</error>;
shouldNotCompile.accept(42);
shouldNotCompile.accept(Integer.valueOf(52));
}
public interface Consumer<T> {
void accept(T t);
}
public interface IntConsumer {
void accept(int value);
}
@FunctionalInterface
interface IntConsumerAdapter1 extends IntConsumer, Consumer<Integer> {
default void accept(int value) {
accept(Integer.valueOf(value));
}
}
interface IntConsumerAdapter2 extends IntConsumer, Consumer<Integer> {
default void accept(int value) {
accept(Integer.valueOf(value));
}
default void accept(Integer integer) {
}
}
}