Java SE 规格 |S|象征
Java SE specifications |S| symbol
我正在阅读 Java 子类型化和类型转换规范 我知道 S <: T 表示 S 是 T 的子类型。但是,我不明白 |S| 是什么意思<:|T|方法?例如在这种情况下:
One type argument is a type variable or wildcard, with an upper bound
(from capture conversion, if necessary) of S; and the other type
argument T is not a type variable or wildcard; and neither |S| <: |T|
nor |T| <: |S|.
|T|是 T 引用的类型?是指T的class吗?
符号“|T|”表示类型"T"的类型擦除,根据JLS, Section 4.6.
中类型擦除的定义
Type erasure is a mapping from types (possibly including parameterized types and type variables) to types (that are never parameterized types or type variables). We write |T| for the erasure of type T. The erasure mapping is defined as follows:
The erasure of a parameterized type (§4.5) G is |G|.
The erasure of a nested type T.C is |T|.C.
The erasure of an array type T[] is |T|[].
The erasure of a type variable (§4.4) is the erasure of its leftmost bound.
The erasure of every other type is the type itself.
所以,“|S| <: |T|”表示S的擦除是T的擦除的子类型。
我正在阅读 Java 子类型化和类型转换规范 我知道 S <: T 表示 S 是 T 的子类型。但是,我不明白 |S| 是什么意思<:|T|方法?例如在这种情况下:
One type argument is a type variable or wildcard, with an upper bound (from capture conversion, if necessary) of S; and the other type argument T is not a type variable or wildcard; and neither |S| <: |T| nor |T| <: |S|.
|T|是 T 引用的类型?是指T的class吗?
符号“|T|”表示类型"T"的类型擦除,根据JLS, Section 4.6.
中类型擦除的定义Type erasure is a mapping from types (possibly including parameterized types and type variables) to types (that are never parameterized types or type variables). We write |T| for the erasure of type T. The erasure mapping is defined as follows:
The erasure of a parameterized type (§4.5) G is |G|.
The erasure of a nested type T.C is |T|.C.
The erasure of an array type T[] is |T|[].
The erasure of a type variable (§4.4) is the erasure of its leftmost bound.
The erasure of every other type is the type itself.
所以,“|S| <: |T|”表示S的擦除是T的擦除的子类型。