diff --git a/CHANGES.md b/CHANGES.md
index eeb5234265..4388f98001 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -16,12 +16,44 @@ Bug Fixes
Breaking Changes
----------------
-* `Pointer#SIZE` is removed. Its use is replaced by `Native#POINTER_SIZE`
+
+* `com.sun.jna.Pointer#SIZE` is removed. Its use is replaced by `com.sun.jna.Native#POINTER_SIZE`
to prevent a class loading deadlock, when JNA is initialized from multiple threads
-* `SecBufferDesc` was incompatibly changed to match the correct native semantics.
- SecBufferDesc describing more than one buffer were broken. For most usecases
+* `com.sun.jna.Pointer#getString(long offset, boolean wide)` is removed. It was replaced by
+ `com.sun.jna.Pointer#getString(long offset)` or
+ `com.sun.jna.Pointer#getWideString(long offset)`
+* `com.sun.jna.Pointer#getStringArray(long offset, boolean wide)` is removed. It was replaced by
+ `com.sun.jna.Pointer#getStringArray(long offset)` or
+ `com.sun.jna.Pointer#getWideStringArray(long offset)`
+* `com.sun.jna.Pointer#setString(long offset, String value, boolean wide)` is removed. It was replaced by
+ `com.sun.jna.Pointer#setString(long offset, String value)` or
+ `com.sun.jna.Pointer#setWideString(long offset, String value)`
+* `com.sun.jna.Structure#setFieldOrder` is removed. It was replaced by
+ `com.sun.jna.Structure#getFieldOrder` and threw an `java.lang.Error` on call.
+* `com.sun.jna.Native#parseVersion` was removed without replacement
+* `com.sun.jna.Native#setPreserveLastError` and `com.sun.jna.Native#getPreserveLastError`
+ were removed without replacement. They were turned into NOOPs in the past.
+* `com.sun.jna.Native#getDirectByteBuffer` was replaced by `com.sun.jna.Pointer#getByteBuffer`
+* `com.sun.jna.platform.win32.Sspi.SecBufferDesc` was incompatibly changed to
+ match the correct native semantics. SecBufferDesc describing more than one
+ buffer were broken. For most usecases
`com.sun.jna.platform.win32.SspiUtil.ManagedSecBufferDesc` is the best
alternative.
+* `com.sun.jna.platform.win32.WinBase.FILETIME#toLong()` was replaced by
+ `com.sun.jna.platform.win32.WinBase.FILETIME#toTime()`
+* `com.sun.jna.platform.win32.Variant#COM_DAYS_ADJUSTMENT` was removed
+* `com.sun.jna.platform.win32.Variant#MICRO_SECONDS_PER_DAY` was removed
+* `com.sun.jna.platform.win32.Variant.VARIANT#toJavaDate` was removed
+* `com.sun.jna.platform.win32.Variant.VARIANT#fromJavaDate` was removed
+* `com.sun.jna.platform.win32.User32#MonitorFromPoint(Point pt, int dwFlags)`
+ was replaced by
+ `com.sun.jna.platform.win32.User32#MonitorFromPoint(Point.ByValue pt, int dwFlags)`
+* `com.sun.jna.platform.win32.OleAuto.LoadTypeLib(WString, PointerByReference)`
+ was replaced by
+ `com.sun.jna.platform.win32.OleAuto.LoadTypeLib(String, PointerByReference)`
+* `com.sun.jna.platform.win32.Kernel32Util.formatMessageFromHR(HRESULT)`
+ was replaced by
+ `com.sun.jna.platform.win32.Kernel32Util.formatMessage(HRESULT)`
Release 4.5.0
=============
diff --git a/contrib/platform/src/com/sun/jna/platform/win32/COM/TypeLibUtil.java b/contrib/platform/src/com/sun/jna/platform/win32/COM/TypeLibUtil.java
index 4146c0e544..35fc2746e1 100644
--- a/contrib/platform/src/com/sun/jna/platform/win32/COM/TypeLibUtil.java
+++ b/contrib/platform/src/com/sun/jna/platform/win32/COM/TypeLibUtil.java
@@ -106,7 +106,7 @@ public TypeLibUtil(String clsidStr, int wVerMajor, int wVerMinor) {
public TypeLibUtil(String file) {
// load typelib
PointerByReference pTypeLib = new PointerByReference();
- HRESULT hr = OleAuto.INSTANCE.LoadTypeLib(new WString(file), pTypeLib);
+ HRESULT hr = OleAuto.INSTANCE.LoadTypeLib(file, pTypeLib);
COMUtils.checkRC(hr);
// init type lib class
diff --git a/contrib/platform/src/com/sun/jna/platform/win32/Kernel32Util.java b/contrib/platform/src/com/sun/jna/platform/win32/Kernel32Util.java
index 3e7a11f4c3..9a7892b884 100644
--- a/contrib/platform/src/com/sun/jna/platform/win32/Kernel32Util.java
+++ b/contrib/platform/src/com/sun/jna/platform/win32/Kernel32Util.java
@@ -216,16 +216,6 @@ public static String formatMessage(HRESULT code) {
return formatMessage(code.intValue());
}
- /**
- * @deprecated use {@link #formatMessage(WinNT.HRESULT)} instead.
- * @param code error code
- * @return formatted message
- */
- @Deprecated
- public static String formatMessageFromHR(HRESULT code) {
- return formatMessage(code.intValue());
- }
-
/**
* Format a system message from an error code.
*
@@ -234,7 +224,7 @@ public static String formatMessageFromHR(HRESULT code) {
* @return Formatted message.
*/
public static String formatMessageFromLastErrorCode(int code) {
- return formatMessageFromHR(W32Errors.HRESULT_FROM_WIN32(code));
+ return formatMessage(W32Errors.HRESULT_FROM_WIN32(code));
}
/**
diff --git a/contrib/platform/src/com/sun/jna/platform/win32/OleAuto.java b/contrib/platform/src/com/sun/jna/platform/win32/OleAuto.java
index 80a31b89d3..87054d1b9b 100644
--- a/contrib/platform/src/com/sun/jna/platform/win32/OleAuto.java
+++ b/contrib/platform/src/com/sun/jna/platform/win32/OleAuto.java
@@ -29,7 +29,6 @@
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
-import com.sun.jna.WString;
import com.sun.jna.platform.win32.Guid.GUID;
import com.sun.jna.platform.win32.OaIdl.DISPID;
import com.sun.jna.platform.win32.OaIdl.SAFEARRAY;
@@ -883,9 +882,6 @@ protected List
Converts this filetime into a number of milliseconds which have - * passed since January 1, 1970 (UTC).
- * @return This filetime as a number of milliseconds which have passed - * since January 1, 1970 (UTC) - * @deprecated Replaced by {@link #toTime()} - */ - @Deprecated - public long toLong() { - return toDate().getTime(); - } - /** *Converts the two 32-bit unsigned integer parts of this filetime
* into a 64-bit unsigned integer representing the number of
diff --git a/src/com/sun/jna/Native.java b/src/com/sun/jna/Native.java
index 86e342e86d..fbed55b717 100644
--- a/src/com/sun/jna/Native.java
+++ b/src/com/sun/jna/Native.java
@@ -147,11 +147,6 @@ public void uncaughtException(Callback c, Throwable e) {
static final int MAX_ALIGNMENT;
static final int MAX_PADDING;
-
- @Deprecated
- public static float parseVersion(String v) {
- return Float.parseFloat(v.substring(0, v.lastIndexOf(".")));
- }
/**
* Version string must have the structure
- * @see #getLastError()
- * @deprecated Last error is always preserved and available via {@link #getLastError()}
- */
- @Deprecated
- public static boolean getPreserveLastError() { return true; }
-
/** Utility method to get the native window ID for a Java {@link Window}
* as a true
long
value.
* This method is primarily for X11-based systems, which use an opaque
@@ -2189,16 +2169,10 @@ static String getString(Pointer pointer, long offset, String encoding) {
public static native void free(long ptr);
/**
- * Get a direct ByteBuffer mapped to the memory pointed to by the pointer.
- * This method calls through to the JNA NewDirectByteBuffer method.
- *
- * @param addr base address of the JNA-originated memory
- * @param length Length of ByteBuffer
- * @return a direct ByteBuffer that accesses the memory being pointed to
- * @deprecated Use {@link Pointer#getByteBuffer(long, long)} (since 4.3.0)
+ * @deprecated retained to keep native signature
*/
@Deprecated
- public static native ByteBuffer getDirectByteBuffer(long addr, long length);
+ private static native ByteBuffer getDirectByteBuffer(long addr, long length);
private static final ThreadLocalwide
is true,
- * access the memory as an array of wchar_t
, otherwise
- * as an array of char
, using the default platform encoding.
- *
- * @param offset byte offset from pointer to obtain the native string
-v * @param wide whether to convert from a wide or standard C string
- * @return the String
value being pointed to
- *
- * @deprecated use {@link #getString(long,String)} or {@link
- * #getWideString(long)} instead.
- */
- @Deprecated
- public String getString(long offset, boolean wide) {
- return wide ? getWideString(offset) : getString(offset);
- }
-
/** Read a wide (const wchar_t *
) string from memory. */
public String getWideString(long offset) {
return Native.getWideString(this, this.peer, offset);
@@ -811,19 +794,6 @@ public String[] getStringArray(long offset, int length) {
return getStringArray(offset, length, Native.getDefaultStringEncoding());
}
- /** Returns an array of String
based on a native array
- * of char*
or wchar_t*
based on the
- * wide
parameter. The array length is determined by a
- * NULL-valued terminating element.
- *
- * @deprecated use {@link #getStringArray(long,String)} or {@link
- * #getWideStringArray(long)} instead.
- */
- @Deprecated
- public String[] getStringArray(long offset, boolean wide) {
- return getStringArray(offset, -1, wide);
- }
-
public String[] getWideStringArray(long offset) {
return getWideStringArray(offset, -1);
}
@@ -832,18 +802,6 @@ public String[] getWideStringArray(long offset, int length) {
return getStringArray(offset, length, NativeString.WIDE_STRING);
}
- /** Returns an array of String
based on a native array
- * of char*
or wchar_t*
based on the
- * wide
parameter, using the given array length.
- *
- * @deprecated use {@link #getStringArray(long,int,String)} or {@link
- * #getWideStringArray(long,int)} instead.
- */
- @Deprecated
- public String[] getStringArray(long offset, int length, boolean wide) {
- return getStringArray(offset, length, wide ? NativeString.WIDE_STRING : Native.getDefaultStringEncoding());
- }
-
/** Returns an array of String
based on a native array
* of char*
or wchar_t*
based on the
* wide
parameter, using the given array length.
@@ -1145,29 +1103,6 @@ public void setPointer(long offset, Pointer value) {
Native.setPointer(this, this.peer, offset, value != null ? value.peer : 0);
}
- /**
- * Copy string value
to the location being pointed to.
- *
- * @param offset byte offset from pointer at which characters in
- * value
must be set
- * @param value java.lang.String
value to set
- * @param wide whether to write the native string as an array of
- * wchar_t
. If false, writes as a NUL-terminated array of
- * char
using the encoding indicated by {@link
- * Native#getDefaultStringEncoding()}.
- *
- * @deprecated use {@link #setWideString(long,String)} instead.
- */
- @Deprecated
- public void setString(long offset, String value, boolean wide) {
- if (wide) {
- setWideString(offset, value);
- }
- else {
- setString(offset, value);
- }
- }
-
/**
* Copy string value
to the location being pointed to as a
* wide string (wchar_t*
).
diff --git a/src/com/sun/jna/Structure.java b/src/com/sun/jna/Structure.java
index be71f4e0c9..5e4b7f7dfb 100644
--- a/src/com/sun/jna/Structure.java
+++ b/src/com/sun/jna/Structure.java
@@ -890,17 +890,6 @@ protected void writeField(StructField structField) {
*/
protected abstract ListUnions
Obtaining "last" error
If a function sets the system error property
-(errno
or GetLastError()
), the error code will be thrown as a {@link com.sun.jna.LastErrorException} if you declare the exception in your JNA mapping. Alternatively, you can use {@link com.sun.jna.Native#getLastError()} to retrieve it, providing that {@link com.sun.jna.Native#setPreserveLastError(boolean)} has been called with a true
value. Throwing an exception is preferred since it has better performance.
+(errno
or
+GetLastError()
),
+the error code will be thrown as a {@link com.sun.jna.LastErrorException} if you
+declare the exception in your JNA mapping. Alternatively, you can use
+{@link com.sun.jna.Native#getLastError()} to retrieve it. Throwing an exception
+is preferred since it has better performance.
Arbitrary Java Object arguments/return values
@@ -743,10 +748,6 @@ Large Structures
com.sun.jna.Structure#writeField(String,Object)} to synch with just the fields
of interest.
Throw exceptions on last error
-To avoid the overhead of preserving the system last error information on every
-native call, invoke
-{@link com.sun.jna.Native#setPreserveLastError setPreserveLastError(false)} or
-set the System property jna.preserve_last_error=false
.
In those methods where you are interested in the value of errno/GetLastError(),
declare your method to throw {@link com.sun.jna.LastErrorException}.