Skip to content

Commit 3add31b

Browse files
[jnigen] Add type erasure warning for isA doc (#2217)
1 parent a796a45 commit 3add31b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkgs/jni/lib/src/jobject.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,13 @@ class JObject {
137137
reference.release();
138138
}
139139

140-
/// Whether this object is of the given [type].
140+
/// Whether this object is of the given [type] ignoring the type parameters.
141+
///
142+
/// > [!WARNING]
143+
/// > Because of Java generic type erasure, this method cannot distinguish
144+
/// > between two classes `Foo<A>` and `Foo<B>` as they are both of type
145+
/// > `Foo`. Therefore, `object.isA(Foo.type(A.type))` will return a
146+
/// > false-positive `true` for objects of type `Foo<B>` as well.
141147
///
142148
/// For example:
143149
///

0 commit comments

Comments
 (0)