Skip to content

Commit

Permalink
Apply generic definitions wherever applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyor Goldstein committed Jan 14, 2016
1 parent 3e67635 commit 1ca2d4c
Show file tree
Hide file tree
Showing 72 changed files with 1,996 additions and 1,844 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Features
* [#567](https://github.com/java-native-access/jna/pull/567): Added `PrintWindow`, `IsWindowEnabled`, `IsWindow`, `FindWindowEx`, `GetAncestor`, `GetCursorPos`, `SetCursorPos`, `SetWinEventHook`, `UnhookWinEvent`, `CopyIcon`, and `GetClassLong` to `com.sun.jna.platform.win32.User32` and supporting constants to `com.sun.jna.platform.win32.WinUser` - [@mlfreeman2](https://github.com/mlfreeman2).
* [#573](https://github.com/java-native-access/jna/pull/573): Added `EnumProcessModules`, `GetModuleInformation`, and `GetProcessImageFileName` to `com.sun.jna.platform.win32.Psapi` and added `ExtractIconEx` to `com.sun.jna.platform.win32.Shell32` - [@mlfreeman2](https://github.com/mlfreeman2).
* [#574](https://github.com/java-native-access/jna/pull/574): Using static final un-modifiable List of field names for structure(s) [@lgoldstein](https://github.com/lgoldstein)
* [#577](https://github.com/java-native-access/jna/pull/577): Apply generic definitions wherever applicable [@lgoldstein](https://github.com/lgoldstein)

Bug Fixes
---------
Expand Down
2 changes: 1 addition & 1 deletion contrib/platform/src/com/sun/jna/platform/FileMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void addWatch(File dir, int mask) throws IOException {
}

public void addWatch(File dir, int mask, boolean recursive) throws IOException {
watched.put(dir, new Integer(mask));
watched.put(dir, Integer.valueOf(mask));
watch(dir, mask, recursive);
}

Expand Down
8 changes: 4 additions & 4 deletions contrib/platform/src/com/sun/jna/platform/WindowUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ private boolean usingUpdateLayeredWindow(Window w) {
private void storeAlpha(Window w, byte alpha) {
if (w instanceof RootPaneContainer) {
JRootPane root = ((RootPaneContainer)w).getRootPane();
Byte b = alpha == (byte)0xFF ? null : new Byte(alpha);
Byte b = alpha == (byte)0xFF ? null : Byte.valueOf(alpha);
root.putClientProperty(TRANSPARENT_ALPHA, b);
}
}
Expand Down Expand Up @@ -1010,7 +1010,7 @@ else if (type == PathIterator.SEG_LINETO) {
points.add(new POINT((int)coords[0], (int)coords[1]));
}
else if (type == PathIterator.SEG_CLOSE) {
sizes.add(new Integer(size));
sizes.add(Integer.valueOf(size));
}
else {
throw new RuntimeException("Area is not polygonal: " + area);
Expand Down Expand Up @@ -1338,7 +1338,7 @@ private void fixWindowDragging(Window w, String context) {
public void setWindowAlpha(final Window w, final float alpha) {
if (w instanceof RootPaneContainer) {
JRootPane p = ((RootPaneContainer)w).getRootPane();
p.putClientProperty("Window.alpha", new Float(alpha));
p.putClientProperty("Window.alpha", Float.valueOf(alpha));
fixWindowDragging(w, "setWindowAlpha");
}
whenDisplayable(w, new Runnable() {
Expand All @@ -1348,7 +1348,7 @@ public void run() {
peer.getClass().getMethod("setAlpha", new Class[]{
float.class
}).invoke(peer, new Object[]{
new Float(alpha)
Float.valueOf(alpha)
});
}
catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ public static String getUserName() {

if (!result) {
switch (Kernel32.INSTANCE.GetLastError()) {
case W32Errors.ERROR_INSUFFICIENT_BUFFER:
buffer = new char[len.getValue()];
break;
case W32Errors.ERROR_INSUFFICIENT_BUFFER:
buffer = new char[len.getValue()];
break;

default:
throw new Win32Exception(Native.getLastError());
default:
throw new Win32Exception(Native.getLastError());
}

result = Advapi32.INSTANCE.GetUserNameW(buffer, len);
Expand Down Expand Up @@ -975,9 +975,9 @@ public static Object registryGetValue(HKEY hkKey, String subKey,
byteData.write(0, lpData, 0, lpcbData.getValue());

if (lpType.getValue() == WinNT.REG_DWORD) {
result = new Integer(byteData.getInt(0));
result = Integer.valueOf(byteData.getInt(0));
} else if (lpType.getValue() == WinNT.REG_QWORD) {
result = new Long(byteData.getLong(0));
result = Long.valueOf(byteData.getLong(0));
} else if (lpType.getValue() == WinNT.REG_BINARY) {
result = byteData.getByteArray(0, lpcbData.getValue());
} else if ((lpType.getValue() == WinNT.REG_SZ)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public TlbCmdlineArgs(String[] args) {

public int getIntParam(String key) {
String param = this.getRequiredParam(key);
return new Integer(param).intValue();
return Integer.parseInt(param);
}

public String getParam(String key) {
Expand Down
4 changes: 2 additions & 2 deletions contrib/platform/src/com/sun/jna/platform/win32/Variant.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ public VARIANT(CHAR value) {

public VARIANT(short value) {
this();
this.setValue(VT_I2, new SHORT(value));
this.setValue(VT_I2, Short.valueOf(value));
}

public VARIANT(int value) {
this();
this.setValue(VT_I4, new LONG(value));
this.setValue(VT_I4, Long.valueOf(value));
}

public VARIANT(long value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public class LONGByReference extends ByReference {
* Instantiates a new LONG by reference.
*/
public LONGByReference() {
this(new LONG(0));
this(new LONG(0L));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public ShellWindows(IDispatch iDispatch)
public InternetExplorer Item(int idx)
{
VARIANT arg = new VARIANT();
arg.setValue(Variant.VT_I4, new LONG(idx));
arg.setValue(Variant.VT_I4, Long.valueOf(idx));
IDispatch result = (IDispatch) invoke("Item", arg).getValue();
if (result == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
*/
package com.sun.jna.platform.win32;

import junit.framework.TestCase;

import com.sun.jna.platform.win32.OaIdl.SAFEARRAY;
import com.sun.jna.platform.win32.Variant.VARIANT;
import com.sun.jna.platform.win32.WinDef.SHORT;

import junit.framework.TestCase;

/**
* @author Tobias Wolf, [email protected]
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected void setUp() throws Exception {
events = new HashMap<Integer, FileEvent>();
final FileListener listener = new FileListener() {
public void fileChanged(FileEvent e) {
events.put(new Integer(e.getType()), e);
events.put(Integer.valueOf(e.getType()), e);
}
};
monitor = FileMonitor.getInstance();
Expand Down Expand Up @@ -190,7 +190,7 @@ private void assertFileEventCreated(final File expectedFile)
private FileEvent waitForFileEvent(final int expectedFileEvent)
throws InterruptedException {

final Integer expectedFileEventInteger = new Integer(expectedFileEvent);
final Integer expectedFileEventInteger = Integer.valueOf(expectedFileEvent);

FileEvent actualEvent = (FileEvent)events.get(expectedFileEventInteger);
final long start = System.currentTimeMillis();
Expand Down
2 changes: 1 addition & 1 deletion contrib/x11/src/jnacontrib/x11/api/X.java
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ public void fromXModifierKeymap(X11.XModifierKeymapRef xModifierKeymapRef) {
for (int keyNr = 0; keyNr < count; keyNr++) {
byte key = keys[modNr*count + keyNr];
if (key != 0) {
modifier.add(new Byte(key));
modifier.add(Byte.valueOf(key));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/x11/src/jnacontrib/x11/demos/XDesktopDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private void refreshDesktopsAndWindows() throws X.X11Exception {
X.Window window = windows[i];
X.Window.Geometry geo = window.getGeometry();
int windowId = window.getID();
data[i][0] = String.format("0x%08X", new Object[]{new Integer(windowId)});
data[i][0] = String.format("0x%08X", new Object[]{Integer.valueOf(windowId)});
data[i][1] = "" + window.getDesktop();
data[i][2] = window.getTitle();
data[i][3] = "" + geo.x;
Expand Down
8 changes: 4 additions & 4 deletions src/com/sun/jna/CallbackParameterContext.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* Lesser General Public License for more details.
*/
package com.sun.jna;

Expand All @@ -19,7 +19,7 @@ public class CallbackParameterContext extends FromNativeContext {
private Method method;
private Object[] args;
private int index;
CallbackParameterContext(Class javaType, Method m, Object[] args, int index) {
CallbackParameterContext(Class<?> javaType, Method m, Object[] args, int index) {
super(javaType);
this.method = m;
this.args = args;
Expand Down
8 changes: 4 additions & 4 deletions src/com/sun/jna/CallbackProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* Lesser General Public License for more details.
*/
package com.sun.jna;

Expand All @@ -19,12 +19,12 @@
*/
public interface CallbackProxy extends Callback {

/** This is the callback method invoked from native code.
/** This is the callback method invoked from native code.
* It must <em>not</em> throw any exceptions whatsoever.
*/
Object callback(Object[] args);
/** Returns the types of the parameters to the callback method. */
Class[] getParameterTypes();
Class<?>[] getParameterTypes();
/** Returns the type of the callback method's return value. */
Class getReturnType();
Class<?> getReturnType();
}
Loading

0 comments on commit 1ca2d4c

Please sign in to comment.