我正在尝试为静态内部类 Map.Entry 编写一个 Eclipse 外部注释文件。我该怎么做呢?
我在所有外部注释文件所在的文件夹下的子文件夹中Map$Entry.eea
创建了一个名为的文件。java/util
这是该文件的内容。
class java/util/Map$Entry
comparingByKey
<K::Ljava/lang/Comparable<-TK;>;V:Ljava/lang/Object;>()Ljava/util/Comparator<Ljava/util/Map$Entry<TK;TV;>;>;
<K::Ljava/lang/Comparable<-TK;>;V:Ljava/lang/Object;>()L1java/util/Comparator<L1java/util/Map$Entry<T1K;TV;>;>;
comparingByKey
<K:Ljava/lang/Object;V:Ljava/lang/Object;>(Ljava/util/Comparator<-TK;>;)Ljava/util/Comparator<Ljava/util/Map$Entry<TK;TV;>;>;
<K:Ljava/lang/Object;V:Ljava/lang/Object;>(L1java/util/Comparator<-TK;>;)L1java/util/Comparator<L1java/util/Map$Entry<TK;TV;>;>;
comparingByValue
<K:Ljava/lang/Object;V::Ljava/lang/Comparable<-TV;>;>()Ljava/util/Comparator<Ljava/util/Map$Entry<TK;TV;>;>;
<K:Ljava/lang/Object;V::Ljava/lang/Comparable<-TV;>;>()L1java/util/Comparator<L1java/util/Map$Entry<TK;T1V;>;>;
comparingByValue
<K:Ljava/lang/Object;V:Ljava/lang/Object;>(Ljava/util/Comparator<-TV;>;)Ljava/util/Comparator<Ljava/util/Map$Entry<TK;TV;>;>;
<K:Ljava/lang/Object;V:Ljava/lang/Object;>(L1java/util/Comparator<-TV;>;)L1java/util/Comparator<L1java/util/Map$Entry<TK;TV;>;>;
equals
(Ljava/lang/Object;)Z
(L0java/lang/Object;)Z
getKey
()TK;
()TK;
getValue
()TV;
()TV;
setValue
(TV;)TV;
(TV;)TV;
entry.getValue()
Eclipse 仍然在以下代码中标记警告:
Map.Entry<@Nullable String, @NonNull Object> entry;
@NonNull Object value = entry.getValue();
警告是:
Unsafe interpretation of method return type as '@NonNull' based on the receiver type
'Map.<@NonNull Entry<@Nullable String, @NonNull Object>>'. Type Map.Entry<K, V> doesn't seem
to be designed with null type annotations in mind.