You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tighten the generic bounds for Structure#newInstance
The signature was: `Structure newInstance(Class<?> type)` requiring
an explicit cast after the call. The the new signature introduces a
type parameter `T` with an upper bound of `com.sun.jna.Structure`:
<T extends Structure> T newInstance(Class<T> type)`
The companion, that takes an init pointer was also updated:
<T extends Structure> T newInstance(Class<T> type, Pointer init)
Closes: #889
Copy file name to clipboardExpand all lines: CHANGES.md
+2
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@ Release 5.0.0 (Next release)
7
7
8
8
Features
9
9
--------
10
+
*[#822](https://github.com/java-native-access/jna/issues/822): `Native#loadLibrary` requires that the interface class passed in is an instance of Library. The runtime check can be enhanced by using a constraint generic. This breaks binary compatibility (see notes below) - [@d-noll](https://github.com/d-noll).
11
+
*[#889](https://github.com/java-native-access/jna/issues/889): The `Structure#newInstance` receive the target type as a parameter. This adds a limited generic type, so that the return type ist the target type and not a generic structure, removing the necessity to do an explizit cast - [@matthiasblaesing](https://github.com/matthiasblaesing).
0 commit comments