Files
Tagir Valeevandintellij-monorepo-bot 745a58a701 Contract checker: allow convertible (but not assignable) conversions for paramX contracts
Class.cast(Object) is already externally annotated as "_ -> param1". Were this in the source we would issue a warning, because T is not assignable from Object.
Fixes IDEA-229184 @Contract falsely report warning  for methods that contain unchecked casts

GitOrigin-RevId: 404b103733fcc1d0803222fe2898fde87085383a
2019-12-17 04:42:17 +00:00

14 lines
339 B
Java

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
class Foo {
// IDEA-229184
@Contract(value = "_ -> param1", pure = true)
@SuppressWarnings("unchecked")
public static <T> Option<T> narrow(@NotNull Option<? extends T> option) {
return ((Option<T>) option);
}
interface Option<T> {}
}