| package test; |
| |
| import java.util.List; |
| import java.util.Map; |
| |
| import org.eclipse.jdt.annotation.NonNull; |
| |
| public class Client { |
| |
| List<@NonNull String> list; |
| Map<Integer, @NonNull String> map; |
| |
| @NonNull String test (int i) { |
| if (i >= 0) |
| return list.get(i); |
| // Unsafe interpretation of method return type as '@NonNull' |
| // base on the receiver type 'List<@NonNull String>'. |
| // Type 'List<E>' doesn't seem to be designed with |
| // null type annotations in mind |
| else |
| return map.get(i); |
| // Unsafe interpretation of method return type as '@NonNull' |
| // base on the receiver type 'Map<Integer,@NonNull String>'. |
| // Type 'Map<K,V>' doesn't seem to be designed with |
| // null type annotations in mind |
| } |
| } |