--- ./applet/build.xml.orig 2009-03-22 15:27:59.000000000 -0600 +++ ./applet/build.xml 2014-02-22 14:00:00.000000000 -0700 @@ -12,7 +12,7 @@ </target> <target name="compile" depends="init"> - <javac srcdir="src" destdir="classes" debug="true" deprecation="true" source="1.4" target="1.4"> + <javac srcdir="src" destdir="classes" debug="true" deprecation="true" source="1.5" target="1.5"> <classpath> <pathelement location="../dist/jinput.jar"/> <pathelement location="../dist/jinput-test.jar"/> --- ./applet/src/net/java/games/input/applet/JInputAppletResourceLoader.java.orig 2008-11-14 15:09:05.000000000 -0700 +++ ./applet/src/net/java/games/input/applet/JInputAppletResourceLoader.java 2014-02-22 14:00:00.000000000 -0700 @@ -50,16 +50,16 @@ public class JInputAppletResourceLoader private int percentageDone = 0; private String getPrivilegedProperty(final String property) { - return (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + return AccessController.doPrivileged(new PrivilegedAction<String>() { + public String run() { return System.getProperty(property); } }); } private String setPrivilegedProperty(final String property, final String value) { - return (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + return AccessController.doPrivileged(new PrivilegedAction<String>() { + public String run() { return System.setProperty(property, value); } }); @@ -94,13 +94,13 @@ public class JInputAppletResourceLoader JarFile localJarFile = new JarFile(new File(tempDir, nativeJar), true); - Enumeration jarEntries = localJarFile.entries(); + Enumeration<JarEntry> jarEntries = localJarFile.entries(); int totalUncompressedBytes = 0; int totalUncompressedBytesWritten = 0; - List entriesToUse = new ArrayList(); + List<JarEntry> entriesToUse = new ArrayList<JarEntry>(); while(jarEntries.hasMoreElements()) { - JarEntry jarEntry = (JarEntry)jarEntries.nextElement(); + JarEntry jarEntry = jarEntries.nextElement(); String entryName = jarEntry.getName(); if(!entryName.startsWith("META-INF")) { totalUncompressedBytes+=jarEntry.getSize(); @@ -116,7 +116,7 @@ public class JInputAppletResourceLoader } for(int i=0;i<entriesToUse.size();i++) { - JarEntry jarEntry = (JarEntry) entriesToUse.get(i); + JarEntry jarEntry = entriesToUse.get(i); InputStream inStream = localJarFile.getInputStream(localJarFile.getEntry(jarEntry.getName())); File nativeFile = new File(tempNativesDir, jarEntry.getName()); FileOutputStream fos = new FileOutputStream(nativeFile); @@ -190,7 +190,6 @@ public class JInputAppletResourceLoader byte[] dataBuffer = new byte[65535]; int bytesRead = 0; int totalRead = 0; - int totalWritten = 0; // Read the first block bytesRead = inStream.read(dataBuffer, 0, dataBuffer.length); @@ -200,8 +199,6 @@ public class JInputAppletResourceLoader outStream.write(dataBuffer, 0, bytesRead); - totalWritten+=bytesRead; - int thisFilePercent = (int)((((float)totalRead)/contentLength)*100); percentageDone = thisFilePercent/2; //Reading the file is only 1/2 the job diagnosticLog.log(Level.INFO, "Written " + totalRead + " out of " + contentLength + " " + thisFilePercent + "%, (" + percentageDone + "% total)"); --- ./coreAPI/build.xml.orig 2011-03-23 12:11:22.000000000 -0600 +++ ./coreAPI/build.xml 2014-02-22 14:00:00.000000000 -0700 @@ -10,7 +10,7 @@ </target> <target name="compile" depends="init"> - <javac srcdir="src/java" destdir="classes" debug="true" deprecation="true" source="1.4" target="1.4"> + <javac srcdir="src/java" destdir="classes" debug="true" deprecation="true" source="1.5" target="1.5"> <include name="net/**"/> <exclude name="**/Version.java"/> <!-- To add something to the classpath: --> @@ -26,7 +26,7 @@ <filter token="API_VERSION" value="${api.version}"/> </filterset> </copy> - <javac srcdir="build/src/java" destdir="classes" debug="true" deprecation="true" source="1.4" target="1.4"> + <javac srcdir="build/src/java" destdir="classes" debug="true" deprecation="true" source="1.5" target="1.5"> <include name="net/**" /> </javac> <echo message="Build version class for ${api.version} build ${build.number}"/> @@ -44,7 +44,7 @@ <target name="javadoc" depends="init" description="Javadoc for my API."> <javadoc packagenames="net.java.games.input.*" destdir="apidocs" - additionalparam="-source 1.4" + additionalparam="-source 1.5" excludepackagenames="net.java.games.input.example.*,net.java.games.input.test.*"> <sourcepath> <pathelement location="src/java"/> --- ./coreAPI/src/java/net/java/games/input/AbstractController.java.orig 2007-04-19 05:59:23.000000000 -0600 +++ ./coreAPI/src/java/net/java/games/input/AbstractController.java 2014-02-22 14:00:00.000000000 -0700 @@ -39,9 +39,7 @@ package net.java.games.input; import java.util.Map; -import java.util.List; import java.util.HashMap; -import java.util.ArrayList; import java.io.IOException; @@ -77,7 +75,7 @@ public abstract class AbstractController /** * Map from Component.Identifiers to Components */ - private final Map id_to_components = new HashMap(); + private final Map<Component.Identifier, Component> id_to_components = new HashMap<Component.Identifier, Component>(); private EventQueue event_queue = new EventQueue(EVENT_QUEUE_DEPTH); @@ -128,7 +126,7 @@ public abstract class AbstractController * if no component with the specified type could be found. */ public final Component getComponent(Component.Identifier id) { - return (Component)id_to_components.get(id); + return id_to_components.get(id); } /** --- ./coreAPI/src/java/net/java/games/input/ControllerEnvironment.java.orig 2009-10-31 05:06:12.000000000 -0600 +++ ./coreAPI/src/java/net/java/games/input/ControllerEnvironment.java 2014-02-22 14:00:00.000000000 -0700 @@ -38,9 +38,6 @@ *****************************************************************************/ package net.java.games.input; -import java.io.File; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Iterator; import java.util.logging.Logger; @@ -87,7 +84,7 @@ public abstract class ControllerEnvironm /** * List of controller listeners */ - protected final ArrayList controllerListeners = new ArrayList(); + protected final ArrayList<ControllerListener> controllerListeners = new ArrayList<ControllerListener>(); /** * Protected constructor for subclassing. @@ -130,9 +127,9 @@ public abstract class ControllerEnvironm */ protected void fireControllerAdded(Controller c) { ControllerEvent ev = new ControllerEvent(c); - Iterator it = controllerListeners.iterator(); + Iterator<ControllerListener> it = controllerListeners.iterator(); while (it.hasNext()) { - ((ControllerListener)it.next()).controllerAdded(ev); + it.next().controllerAdded(ev); } } @@ -142,9 +139,9 @@ public abstract class ControllerEnvironm */ protected void fireControllerRemoved(Controller c) { ControllerEvent ev = new ControllerEvent(c); - Iterator it = controllerListeners.iterator(); + Iterator<ControllerListener> it = controllerListeners.iterator(); while (it.hasNext()) { - ((ControllerListener)it.next()).controllerRemoved(ev); + it.next().controllerRemoved(ev); } } --- ./coreAPI/src/java/net/java/games/input/DefaultControllerEnvironment.java.orig 2011-03-23 12:54:48.000000000 -0600 +++ ./coreAPI/src/java/net/java/games/input/DefaultControllerEnvironment.java 2014-02-22 14:00:00.000000000 -0700 @@ -39,15 +39,10 @@ package net.java.games.input; import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Collection; -import java.util.Iterator; -import java.util.Properties; import java.util.StringTokenizer; import java.util.logging.Logger; @@ -73,7 +68,7 @@ class DefaultControllerEnvironment exten */ static void loadLibrary(final String lib_name) { AccessController.doPrivileged( - new PrivilegedAction() { + new PrivilegedAction<Object>() { public final Object run() { String lib_path = System.getProperty("net.java.games.input.librarypath"); if (lib_path != null) @@ -86,8 +81,8 @@ class DefaultControllerEnvironment exten } static String getPrivilegedProperty(final String property) { - return (String)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + return AccessController.doPrivileged(new PrivilegedAction<String>() { + public String run() { return System.getProperty(property); } }); @@ -95,8 +90,8 @@ class DefaultControllerEnvironment exten static String getPrivilegedProperty(final String property, final String default_value) { - return (String)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + return AccessController.doPrivileged(new PrivilegedAction<String>() { + public String run() { return System.getProperty(property, default_value); } }); @@ -105,9 +100,9 @@ class DefaultControllerEnvironment exten /** * List of all controllers in this environment */ - private ArrayList controllers; + private ArrayList<Controller> controllers; - private Collection loadedPlugins = new ArrayList(); + private Collection<String> loadedPlugins = new ArrayList<String>(); /** * Public no-arg constructor. @@ -122,8 +117,8 @@ class DefaultControllerEnvironment exten public Controller[] getControllers() { if (controllers == null) { // Controller list has not been scanned. - controllers = new ArrayList(); - AccessController.doPrivileged(new PrivilegedAction() { + controllers = new ArrayList<Controller>(); + AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { scanControllers(); return null; @@ -156,8 +151,8 @@ class DefaultControllerEnvironment exten try { if(!loadedPlugins.contains(className)) { log.fine("Loading: " + className); - Class ceClass = Class.forName(className); - ControllerEnvironment ce = (ControllerEnvironment) ceClass.newInstance(); + Class<?> ceClass = Class.forName(className); + ControllerEnvironment ce = ControllerEnvironment.class.cast(ceClass.newInstance()); if(ce.isSupported()) { addControllers(ce.getControllers()); loadedPlugins.add(ce.getClass().getName()); @@ -171,13 +166,7 @@ class DefaultControllerEnvironment exten } } Controller[] ret = new Controller[controllers.size()]; - Iterator it = controllers.iterator(); - int i = 0; - while (it.hasNext()) { - ret[i] = (Controller)it.next(); - i++; - } - return ret; + return controllers.toArray(ret); } /* This is jeff's new plugin code using Jeff's Plugin manager */ @@ -200,14 +189,14 @@ class DefaultControllerEnvironment exten } try { Plugins plugins = new Plugins(file); - Class[] envClasses = plugins.getExtends(ControllerEnvironment.class); + Class<?>[] envClasses = plugins.getExtends(ControllerEnvironment.class); for(int i=0;i<envClasses.length;i++){ try { ControllerEnvironment.logln("ControllerEnvironment "+ envClasses[i].getName() +" loaded by "+envClasses[i].getClassLoader()); - ControllerEnvironment ce = (ControllerEnvironment) - envClasses[i].newInstance(); + ControllerEnvironment ce = + ControllerEnvironment.class.cast(envClasses[i].newInstance()); if(ce.isSupported()) { addControllers(ce.getControllers()); loadedPlugins.add(ce.getClass().getName()); --- ./coreAPI/src/java/net/java/games/input/example/ReadFirstMouse.java.orig 2007-06-10 04:51:31.000000000 -0600 +++ ./coreAPI/src/java/net/java/games/input/example/ReadFirstMouse.java 2014-02-22 14:00:00.000000000 -0700 @@ -3,7 +3,6 @@ package net.java.games.input.example; import net.java.games.input.Component; import net.java.games.input.Controller; import net.java.games.input.ControllerEnvironment; -import net.java.games.input.test.ControllerTextTest; /** * This class shows how to read the values in a polling loop for the first mouse --- ./coreAPI/src/java/net/java/games/input/Mouse.java.orig 2007-06-28 14:37:24.000000000 -0600 +++ ./coreAPI/src/java/net/java/games/input/Mouse.java 2014-02-22 14:00:00.000000000 -0700 @@ -38,9 +38,6 @@ *****************************************************************************/ package net.java.games.input; -import java.util.List; -import java.util.ArrayList; - /** * A Mouse is a type of controller consisting of two child controllers, * a ball and a button pad. This includes devices such as touch pads, --- ./coreAPI/src/java/net/java/games/input/PluginClassLoader.java.orig 2014-02-24 12:07:29.915047993 -0700 +++ ./coreAPI/src/java/net/java/games/input/PluginClassLoader.java 2014-02-24 12:07:33.990044413 -0700 @@ -77,7 +77,7 @@ class PluginClassLoader extends ClassLoa * Overrides findClass to first look in the parent class loader, * then try loading the class from the plugin file system. */ - protected Class findClass(String name) + protected Class<?> findClass(String name) throws ClassNotFoundException { // Try loading the class from the file system. byte[] b = loadClassData(name); --- ./coreAPI/src/java/net/java/games/input/test/ControllerEventTest.java.orig 2011-03-25 17:09:25.000000000 -0600 +++ ./coreAPI/src/java/net/java/games/input/test/ControllerEventTest.java 2014-02-22 14:00:00.000000000 -0700 @@ -165,7 +165,7 @@ public class ControllerEventTest extends private static class ControllerWindow extends JFrame { Controller ca; - Map axes_to_panels = new HashMap(); + Map<Component, AxisPanel> axes_to_panels = new HashMap<Component, AxisPanel>(); boolean disabled = false; public ControllerWindow(JFrame frame,Controller ca){ @@ -207,7 +207,7 @@ public class ControllerEventTest extends } private void addAxis(JPanel p, Component ax){ - JPanel p2; + AxisPanel p2; if (ax.isAnalog()) { p2 = new AnalogAxisPanel(ax); } else { @@ -234,14 +234,14 @@ public class ControllerEventTest extends EventQueue event_queue = ca.getEventQueue(); Event event = new Event(); while (event_queue.getNextEvent(event)) { - AxisPanel panel = (AxisPanel)axes_to_panels.get(event.getComponent()); + AxisPanel panel = axes_to_panels.get(event.getComponent()); panel.setPollData(event.getValue()); } } } static final long HEARTBEATMS =100; // 10th of a second - List controllers = new ArrayList(); + List<ControllerWindow> controllers = new ArrayList<ControllerWindow>(); public ControllerEventTest() { super("Controller Event Test. Version: " + Version.getVersion()); @@ -255,9 +255,9 @@ public class ControllerEventTest extends public void run(){ try { while(true){ - for(Iterator i=controllers.iterator();i.hasNext();){ + for(Iterator<ControllerWindow> i=controllers.iterator();i.hasNext();){ try { - ControllerWindow cw = (ControllerWindow)i.next(); + ControllerWindow cw = i.next(); cw.poll(); } catch (Exception e) { e.printStackTrace(); --- ./coreAPI/src/java/net/java/games/input/test/ControllerReadTest.java.orig 2011-03-25 17:09:25.000000000 -0600 +++ ./coreAPI/src/java/net/java/games/input/test/ControllerReadTest.java 2014-02-22 14:00:00.000000000 -0700 @@ -166,7 +166,7 @@ public class ControllerReadTest extends private static class ControllerWindow extends JFrame { Controller ca; - List axisList = new ArrayList(); + List<AxisPanel> axisList = new ArrayList<AxisPanel>(); boolean disabled = false; public ControllerWindow(JFrame frame,Controller ca){ @@ -208,7 +208,7 @@ public class ControllerReadTest extends } private void addAxis(JPanel p, Component ax){ - JPanel p2; + AxisPanel p2; if (ax.isAnalog()) { p2 = new AnalogAxisPanel(ax); } else { @@ -234,9 +234,9 @@ public class ControllerReadTest extends setDisabled(false); } //System.out.println("Polled "+ca.getName()); - for(Iterator i =axisList.iterator();i.hasNext();){ + for(Iterator<AxisPanel> i =axisList.iterator();i.hasNext();){ try { - ((AxisPanel)i.next()).poll(); + i.next().poll(); }catch (Exception e) { e.printStackTrace(); } @@ -245,7 +245,7 @@ public class ControllerReadTest extends } static final long HEARTBEATMS =100; // 10th of a second - List controllers = new ArrayList(); + List<ControllerWindow> controllers = new ArrayList<ControllerWindow>(); public ControllerReadTest() { super("Controller Read Test. Version: " + Version.getVersion()); @@ -259,9 +259,9 @@ public class ControllerReadTest extends public void run(){ try { while(true){ - for(Iterator i=controllers.iterator();i.hasNext();){ + for(Iterator<ControllerWindow> i=controllers.iterator();i.hasNext();){ try { - ControllerWindow cw = (ControllerWindow)i.next(); + ControllerWindow cw = i.next(); cw.poll(); } catch (Exception e) { e.printStackTrace(); --- ./coreAPI/src/java/net/java/games/input/test/RumbleTest.java.orig 2011-03-25 17:09:25.000000000 -0600 +++ ./coreAPI/src/java/net/java/games/input/test/RumbleTest.java 2014-02-22 14:00:00.000000000 -0700 @@ -47,7 +47,7 @@ public class RumbleTest { Thread.sleep(1); } catch (InterruptedException e) { } - k-=((float)(System.currentTimeMillis() - startTime))/1000f; + k-=(System.currentTimeMillis() - startTime)/1000f; } try { Thread.sleep(1000); --- ./plugins/awt/build.xml.orig 2006-04-29 16:29:27.000000000 -0600 +++ ./plugins/awt/build.xml 2014-02-22 14:00:00.000000000 -0700 @@ -7,7 +7,7 @@ </target> <target depends="init" name="compile"> - <javac debug="true" deprecation="true" destdir="classes" source="1.4" target="1.4" srcdir="src"> + <javac debug="true" deprecation="true" destdir="classes" source="1.5" target="1.5" srcdir="src"> <classpath> <pathelement location="../../coreAPI/bin/jinput-core.jar"/> <pathelement location="../../lib/jutils.jar"/> @@ -28,7 +28,7 @@ <mkdir dir="apidocs"/> <javadoc packagenames="net.java.games.input.*" destdir="apidocs" - additionalparam="-source 1.4" + additionalparam="-source 1.5" link="../../../coreAPI/apidocs"> <sourcepath> <pathelement location="src"/> --- ./plugins/awt/src/net/java/games/input/AWTKeyboard.java.orig 2006-04-29 16:29:27.000000000 -0600 +++ ./plugins/awt/src/net/java/games/input/AWTKeyboard.java 2014-02-22 14:00:00.000000000 -0700 @@ -43,7 +43,7 @@ import java.lang.reflect.Modifier; * @author elias */ final class AWTKeyboard extends Keyboard implements AWTEventListener { - private final List awt_events = new ArrayList(); + private final List<KeyEvent> awt_events = new ArrayList<KeyEvent>(); private Event[] processed_events; private int processed_events_index; @@ -54,7 +54,7 @@ final class AWTKeyboard extends Keyboard } private final static Component[] createComponents() { - List components = new ArrayList(); + List<Component> components = new ArrayList<Component>(); Field[] vkey_fields = KeyEvent.class.getFields(); for (int i = 0; i < vkey_fields.length; i++) { Field vkey_field = vkey_fields[i]; @@ -80,7 +80,7 @@ final class AWTKeyboard extends Keyboard components.add(new Key(Component.Identifier.Key.RETURN)); components.add(new Key(Component.Identifier.Key.NUMPADCOMMA)); components.add(new Key(Component.Identifier.Key.COMMA)); - return (Component[])components.toArray(new Component[]{}); + return components.toArray(new Component[]{}); } private final void resizeEventQueue(int size) { @@ -96,12 +96,12 @@ final class AWTKeyboard extends Keyboard public final synchronized void eventDispatched(AWTEvent event) { if (event instanceof KeyEvent) - awt_events.add(event); + awt_events.add((KeyEvent)event); } public final synchronized void pollDevice() throws IOException { for (int i = 0; i < awt_events.size(); i++) { - KeyEvent event = (KeyEvent)awt_events.get(i); + KeyEvent event = awt_events.get(i); processEvent(event); } awt_events.clear(); --- ./plugins/awt/src/net/java/games/input/AWTMouse.java.orig 2006-04-29 16:29:27.000000000 -0600 +++ ./plugins/awt/src/net/java/games/input/AWTMouse.java 2014-02-22 14:00:00.000000000 -0700 @@ -27,7 +27,6 @@ package net.java.games.input; import java.awt.AWTEvent; -import java.awt.Point; import java.awt.Toolkit; import java.awt.event.AWTEventListener; import java.awt.event.MouseEvent; @@ -47,8 +46,8 @@ final class AWTMouse extends Mouse imple private final static int EVENT_Y = 2; private final static int EVENT_BUTTON = 4; - private final List awt_events = new ArrayList(); - private final List processed_awt_events = new ArrayList(); + private final List<AWTEvent> awt_events = new ArrayList<AWTEvent>(); + private final List<AWTEvent> processed_awt_events = new ArrayList<AWTEvent>(); private int event_state = EVENT_X; @@ -115,7 +114,7 @@ final class AWTMouse extends Mouse imple Axis wheel = (Axis)getWheel(); wheel.setValue(0); for (int i = 0; i < awt_events.size(); i++) { - AWTEvent event = (AWTEvent)awt_events.get(i); + AWTEvent event = awt_events.get(i); processEvent(event); processed_awt_events.add(event); } @@ -126,7 +125,7 @@ final class AWTMouse extends Mouse imple while (true) { if (processed_awt_events.isEmpty()) return false; - AWTEvent awt_event = (AWTEvent)processed_awt_events.get(0); + AWTEvent awt_event = processed_awt_events.get(0); if (awt_event instanceof MouseWheelEvent) { MouseWheelEvent awt_wheel_event = (MouseWheelEvent)awt_event; long nanos = awt_wheel_event.getWhen()*1000000L; --- ./plugins/linux/build.xml.orig 2012-02-02 08:57:51.545209862 -0700 +++ ./plugins/linux/build.xml 2014-02-22 14:00:00.000000000 -0700 @@ -12,7 +12,7 @@ <target depends="init" name="compile"> <!-- <ant dir="src/native" target="createNativeDefinitions.java"/>--> - <javac debug="true" deprecation="true" destdir="classes" source="1.4" target="1.4" srcdir="src/java"> + <javac debug="true" deprecation="true" destdir="classes" source="1.5" target="1.5" srcdir="src/java"> <classpath> <pathelement location="../../coreAPI/bin/jinput-core.jar"/> <pathelement location="../../lib/jutils.jar"/> @@ -33,7 +33,7 @@ <mkdir dir="apidocs"/> <javadoc packagenames="net.java.games.input.*" destdir="apidocs" - additionalparam="-source 1.4" + additionalparam="-source 1.5" link="../../../coreAPI/apidocs"> <sourcepath> <pathelement location="src/java"/> --- ./plugins/linux/src/java/net/java/games/input/LinuxAbstractController.java.orig 2006-04-29 16:29:27.000000000 -0600 +++ ./plugins/linux/src/java/net/java/games/input/LinuxAbstractController.java 2014-02-22 14:00:00.000000000 -0700 @@ -49,7 +49,7 @@ final class LinuxAbstractController exte private final LinuxEventDevice device; private final Type type; - protected LinuxAbstractController(LinuxEventDevice device, Component[] components, Controller[] children, Rumbler[] rumblers, Type type) throws IOException { + protected LinuxAbstractController(LinuxEventDevice device, Component[] components, Controller[] children, Rumbler[] rumblers, Type type) { super(device.getName(), components, children, rumblers); this.device = device; this.port = device.getPortType(); --- ./plugins/linux/src/java/net/java/games/input/LinuxDevice.java.orig 2006-04-29 16:29:27.000000000 -0600 +++ ./plugins/linux/src/java/net/java/games/input/LinuxDevice.java 2014-02-22 14:00:00.000000000 -0700 @@ -26,10 +26,6 @@ package net.java.games.input; import java.io.IOException; -import java.util.Map; -import java.util.HashMap; -import java.util.List; -import java.util.ArrayList; /** * @author elias --- ./plugins/linux/src/java/net/java/games/input/LinuxDeviceThread.java.orig 2006-04-29 16:29:27.000000000 -0600 +++ ./plugins/linux/src/java/net/java/games/input/LinuxDeviceThread.java 2014-02-22 14:00:00.000000000 -0700 @@ -40,7 +40,7 @@ import java.util.ArrayList; * is run on a single thread. */ final class LinuxDeviceThread extends Thread { - private final List tasks = new ArrayList(); + private final List<LinuxDeviceTask> tasks = new ArrayList<LinuxDeviceTask>(); public LinuxDeviceThread() { setDaemon(true); @@ -50,7 +50,7 @@ final class LinuxDeviceThread extends Th public synchronized final void run() { while (true) { if (!tasks.isEmpty()) { - LinuxDeviceTask task = (LinuxDeviceTask)tasks.remove(0); + LinuxDeviceTask task = tasks.remove(0); task.doExecute(); synchronized (task) { task.notify(); --- ./plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java.orig 2014-03-17 21:00:00.000000000 -0600 +++ ./plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java 2014-03-17 21:22:25.313437081 -0600 @@ -46,7 +46,7 @@ public final class LinuxEnvironmentPlugi private static boolean supported = false; private final Controller[] controllers; - private final List devices = new ArrayList(); + private final List<LinuxDevice> devices = new ArrayList<LinuxDevice>(); private final static LinuxDeviceThread device_thread = new LinuxDeviceThread(); /** @@ -58,7 +58,7 @@ public final class LinuxEnvironmentPlugi */ static void loadLibrary(final String lib_name) { AccessController.doPrivileged( - new PrivilegedAction() { + new PrivilegedAction<Object>() { public final Object run() { try { System.load("/usr/lib64" + LIBNAME); @@ -77,8 +77,8 @@ public final class LinuxEnvironmentPlugi } static String getPrivilegedProperty(final String property) { - return (String)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + return AccessController.doPrivileged(new PrivilegedAction<String>() { + public String run() { return System.getProperty(property); } }); @@ -86,8 +86,8 @@ public final class LinuxEnvironmentPlugi static String getPrivilegedProperty(final String property, final String default_value) { - return (String)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + return AccessController.doPrivileged(new PrivilegedAction<String>() { + public String run() { return System.getProperty(property, default_value); } }); @@ -110,7 +110,7 @@ public final class LinuxEnvironmentPlugi this.controllers = enumerateControllers(); logln("Linux plugin claims to have found " + controllers.length + " controllers"); AccessController.doPrivileged( - new PrivilegedAction() { + new PrivilegedAction<Object>() { public final Object run() { Runtime.getRuntime().addShutdownHook(new ShutdownHook()); return null; @@ -130,11 +130,11 @@ public final class LinuxEnvironmentPlugi return controllers; } - private final static Component[] createComponents(List event_components, LinuxEventDevice device) { + private final static Component[] createComponents(List<LinuxEventComponent> event_components, LinuxEventDevice device) { LinuxEventComponent[][] povs = new LinuxEventComponent[4][2]; - List components = new ArrayList(); + List<LinuxComponent> components = new ArrayList<LinuxComponent>(); for (int i = 0; i < event_components.size(); i++) { - LinuxEventComponent event_component = (LinuxEventComponent)event_components.get(i); + LinuxEventComponent event_component = event_components.get(i); Component.Identifier identifier = event_component.getIdentifier(); if (identifier == Component.Identifier.Axis.POV) { @@ -189,7 +189,7 @@ public final class LinuxEnvironmentPlugi return components_array; } - private final static Mouse createMouseFromDevice(LinuxEventDevice device, Component[] components) throws IOException { + private final static Mouse createMouseFromDevice(LinuxEventDevice device, Component[] components) { Mouse mouse = new LinuxMouse(device, components, new Controller[]{}, device.getRumblers()); if (mouse.getX() != null && mouse.getY() != null && mouse.getPrimaryButton() != null) return mouse; @@ -197,18 +197,18 @@ public final class LinuxEnvironmentPlugi return null; } - private final static Keyboard createKeyboardFromDevice(LinuxEventDevice device, Component[] components) throws IOException { + private final static Keyboard createKeyboardFromDevice(LinuxEventDevice device, Component[] components) { Keyboard keyboard = new LinuxKeyboard(device, components, new Controller[]{}, device.getRumblers()); return keyboard; } - private final static Controller createJoystickFromDevice(LinuxEventDevice device, Component[] components, Controller.Type type) throws IOException { + private final static Controller createJoystickFromDevice(LinuxEventDevice device, Component[] components, Controller.Type type) { Controller joystick = new LinuxAbstractController(device, components, new Controller[]{}, device.getRumblers(), type); return joystick; } - private final static Controller createControllerFromDevice(LinuxEventDevice device) throws IOException { - List event_components = device.getComponents(); + private final static Controller createControllerFromDevice(LinuxEventDevice device) { + List<LinuxEventComponent> event_components = device.getComponents(); Component[] components = createComponents(event_components, device); Controller.Type type = device.getType(); @@ -223,16 +223,16 @@ public final class LinuxEnvironmentPlugi } private final Controller[] enumerateControllers() { - List controllers = new ArrayList(); - List eventControllers = new ArrayList(); - List jsControllers = new ArrayList(); + List<Controller> controllers = new ArrayList<Controller>(); + List<Controller> eventControllers = new ArrayList<Controller>(); + List<Controller> jsControllers = new ArrayList<Controller>(); enumerateEventControllers(eventControllers); enumerateJoystickControllers(jsControllers); for(int i=0;i<eventControllers.size();i++) { for(int j=0;j<jsControllers.size();j++) { - Controller evController = (Controller) eventControllers.get(i); - Controller jsController = (Controller) jsControllers.get(j); + Controller evController = eventControllers.get(i); + Controller jsController = jsControllers.get(j); // compare // Check if the nodes have the same name @@ -268,85 +268,14 @@ public final class LinuxEnvironmentPlugi return controllers_array; } - private final static Component.Identifier.Button getButtonIdentifier(int index) { - switch (index) { - case 0: - return Component.Identifier.Button._0; - case 1: - return Component.Identifier.Button._1; - case 2: - return Component.Identifier.Button._2; - case 3: - return Component.Identifier.Button._3; - case 4: - return Component.Identifier.Button._4; - case 5: - return Component.Identifier.Button._5; - case 6: - return Component.Identifier.Button._6; - case 7: - return Component.Identifier.Button._7; - case 8: - return Component.Identifier.Button._8; - case 9: - return Component.Identifier.Button._9; - case 10: - return Component.Identifier.Button._10; - case 11: - return Component.Identifier.Button._11; - case 12: - return Component.Identifier.Button._12; - case 13: - return Component.Identifier.Button._13; - case 14: - return Component.Identifier.Button._14; - case 15: - return Component.Identifier.Button._15; - case 16: - return Component.Identifier.Button._16; - case 17: - return Component.Identifier.Button._17; - case 18: - return Component.Identifier.Button._18; - case 19: - return Component.Identifier.Button._19; - case 20: - return Component.Identifier.Button._20; - case 21: - return Component.Identifier.Button._21; - case 22: - return Component.Identifier.Button._22; - case 23: - return Component.Identifier.Button._23; - case 24: - return Component.Identifier.Button._24; - case 25: - return Component.Identifier.Button._25; - case 26: - return Component.Identifier.Button._26; - case 27: - return Component.Identifier.Button._27; - case 28: - return Component.Identifier.Button._28; - case 29: - return Component.Identifier.Button._29; - case 30: - return Component.Identifier.Button._30; - case 31: - return Component.Identifier.Button._31; - default: - return null; - } - } - private final static Controller createJoystickFromJoystickDevice(LinuxJoystickDevice device) { - List components = new ArrayList(); + List<Component> components = new ArrayList<Component>(); byte[] axisMap = device.getAxisMap(); char[] buttonMap = device.getButtonMap(); LinuxJoystickAxis[] hatBits = new LinuxJoystickAxis[6]; for (int i = 0; i < device.getNumButtons(); i++) { - Component.Identifier button_id = (Component.Identifier)LinuxNativeTypesMap.getButtonID(buttonMap[i]); + Component.Identifier button_id = LinuxNativeTypesMap.getButtonID(buttonMap[i]); if (button_id != null) { LinuxJoystickButton button = new LinuxJoystickButton(button_id); device.registerButton(i, button); @@ -386,10 +315,10 @@ public final class LinuxEnvironmentPlugi } } - return new LinuxJoystickAbstractController(device, (Component[])components.toArray(new Component[]{}), new Controller[]{}, new Rumbler[]{}); + return new LinuxJoystickAbstractController(device, components.toArray(new Component[]{}), new Controller[]{}, new Rumbler[]{}); } - private final void enumerateJoystickControllers(List controllers) { + private final void enumerateJoystickControllers(List<Controller> controllers) { File[] joystick_device_files = enumerateJoystickDeviceFiles("/dev/input"); if (joystick_device_files == null || joystick_device_files.length == 0) { joystick_device_files = enumerateJoystickDeviceFiles("/dev"); @@ -423,20 +352,20 @@ public final class LinuxEnvironmentPlugi } private static String getAbsolutePathPrivileged(final File file) { - return (String)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + return AccessController.doPrivileged(new PrivilegedAction<String>() { + public String run() { return file.getAbsolutePath(); } }); } private static File[] listFilesPrivileged(final File dir, final FilenameFilter filter) { - return (File[])AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + return AccessController.doPrivileged(new PrivilegedAction<File[]>() { + public File[] run() { File[] files = dir.listFiles(filter); - Arrays.sort(files, new Comparator(){ - public int compare(Object f1, Object f2) { - return ((File)f1).getName().compareTo(((File)f2).getName()); + Arrays.sort(files, new Comparator<File>(){ + public int compare(File f1, File f2) { + return f1.getName().compareTo(f2.getName()); } }); return files; @@ -444,7 +373,7 @@ public final class LinuxEnvironmentPlugi }); } - private final void enumerateEventControllers(List controllers) { + private final void enumerateEventControllers(List<Controller> controllers) { final File dev = new File("/dev/input"); File[] event_device_files = listFilesPrivileged(dev, new FilenameFilter() { public final boolean accept(File dir, String name) { @@ -479,7 +408,7 @@ public final class LinuxEnvironmentPlugi public final void run() { for (int i = 0; i < devices.size(); i++) { try { - LinuxDevice device = (LinuxDevice)devices.get(i); + LinuxDevice device = devices.get(i); device.close(); } catch (IOException e) { logln("Failed to close device: " + e.getMessage()); --- ./plugins/linux/src/java/net/java/games/input/LinuxEventDevice.java.orig 2012-02-02 09:08:54.380920130 -0700 +++ ./plugins/linux/src/java/net/java/games/input/LinuxEventDevice.java 2014-02-22 14:00:00.000000000 -0700 @@ -35,12 +35,12 @@ import java.util.ArrayList; * @author elias */ final class LinuxEventDevice implements LinuxDevice { - private final Map component_map = new HashMap(); + private final Map<LinuxAxisDescriptor, LinuxComponent> component_map = new HashMap<LinuxAxisDescriptor, LinuxComponent>(); private final Rumbler[] rumblers; private final long fd; private final String name; private final LinuxInputID input_id; - private final List components; + private final List<LinuxEventComponent> components; private final Controller.Type type; /* Closed state variable that protects the validity of the file descriptor. @@ -83,23 +83,22 @@ final class LinuxEventDevice implements return type; } - private final static int countComponents(List components, Class id_type, boolean relative) { + private final static int countComponents(List<LinuxEventComponent> components, Class<?> id_type, boolean relative) { int count = 0; for (int i = 0; i < components.size(); i++) { - LinuxEventComponent component = (LinuxEventComponent)components.get(i); + LinuxEventComponent component = components.get(i); if (id_type.isInstance(component.getIdentifier()) && relative == component.isRelative()) count++; } return count; } - private final Controller.Type guessType() throws IOException { - List components = getComponents(); + private final Controller.Type guessType() { + List<LinuxEventComponent> components = getComponents(); if (components.size() == 0) return Controller.Type.UNKNOWN; int num_rel_axes = countComponents(components, Component.Identifier.Axis.class, true); int num_abs_axes = countComponents(components, Component.Identifier.Axis.class, false); - int num_keys = countComponents(components, Component.Identifier.Key.class, false); int mouse_traits = 0; int keyboard_traits = 0; int joystick_traits = 0; @@ -118,7 +117,7 @@ final class LinuxEventDevice implements int num_gamepad_button_traits = 0; // count button traits for (int i = 0; i < components.size(); i++) { - LinuxEventComponent component = (LinuxEventComponent)components.get(i); + LinuxEventComponent component = components.get(i); if (component.getButtonTrait() == Controller.Type.MOUSE) num_mouse_button_traits++; else if (component.getButtonTrait() == Controller.Type.KEYBOARD) @@ -158,19 +157,19 @@ final class LinuxEventDevice implements } private final Rumbler[] enumerateRumblers() { - List rumblers = new ArrayList(); + List<Rumbler> rumblers = new ArrayList<Rumbler>(); try { int num_effects = getNumEffects(); if (num_effects <= 0) - return (Rumbler[])rumblers.toArray(new Rumbler[]{}); + return rumblers.toArray(new Rumbler[]{}); byte[] ff_bits = getForceFeedbackBits(); if (isBitSet(ff_bits, NativeDefinitions.FF_RUMBLE) && num_effects > rumblers.size()) { rumblers.add(new LinuxRumbleFF(this)); } } catch (IOException e) { - LinuxEnvironmentPlugin.logln("Failed to enumerate rumblers: " + e.getMessage()); + ControllerEnvironment.logln("Failed to enumerate rumblers: " + e.getMessage()); } - return (Rumbler[])rumblers.toArray(new Rumbler[]{}); + return rumblers.toArray(new Rumbler[]{}); } public final Rumbler[] getRumblers() { @@ -205,10 +204,10 @@ final class LinuxEventDevice implements } public final LinuxComponent mapDescriptor(LinuxAxisDescriptor desc) { - return (LinuxComponent)component_map.get(desc); + return component_map.get(desc); } - public final Controller.PortType getPortType() throws IOException { + public final Controller.PortType getPortType() { return input_id.getPortType(); } @@ -243,7 +242,7 @@ final class LinuxEventDevice implements } private final static native void nGetAbsInfo(long fd, int abs_axis, LinuxAbsInfo abs_info) throws IOException; - private final void addKeys(List components) throws IOException { + private final void addKeys(List<LinuxEventComponent> components) throws IOException { byte[] bits = getKeysBits(); for (int i = 0; i < bits.length*8; i++) { if (isBitSet(bits, i)) { @@ -253,7 +252,7 @@ final class LinuxEventDevice implements } } - private final void addAbsoluteAxes(List components) throws IOException { + private final void addAbsoluteAxes(List<LinuxEventComponent> components) throws IOException { byte[] bits = getAbsoluteAxesBits(); for (int i = 0; i < bits.length*8; i++) { if (isBitSet(bits, i)) { @@ -263,7 +262,7 @@ final class LinuxEventDevice implements } } - private final void addRelativeAxes(List components) throws IOException { + private final void addRelativeAxes(List<LinuxEventComponent> components) throws IOException { byte[] bits = getRelativeAxesBits(); for (int i = 0; i < bits.length*8; i++) { if (isBitSet(bits, i)) { @@ -273,12 +272,12 @@ final class LinuxEventDevice implements } } - public final List getComponents() { + public final List<LinuxEventComponent> getComponents() { return components; } - private final List getDeviceComponents() throws IOException { - List components = new ArrayList(); + private final List<LinuxEventComponent> getDeviceComponents() throws IOException { + List<LinuxEventComponent> components = new ArrayList<LinuxEventComponent>(); byte[] evtype_bits = getEventTypeBits(); if (isBitSet(evtype_bits, NativeDefinitions.EV_KEY)) addKeys(components); --- ./plugins/linux/src/java/net/java/games/input/LinuxForceFeedbackEffect.java.orig 2007-06-10 09:03:27.000000000 -0600 +++ ./plugins/linux/src/java/net/java/games/input/LinuxForceFeedbackEffect.java 2014-02-22 14:00:00.000000000 -0700 @@ -56,7 +56,7 @@ abstract class LinuxForceFeedbackEffect write_task.write(0); } } catch (IOException e) { - LinuxEnvironmentPlugin.logln("Failed to rumble: " + e); + ControllerEnvironment.logln("Failed to rumble: " + e); } } --- ./plugins/linux/src/java/net/java/games/input/LinuxJoystickDevice.java.orig 2007-08-12 14:09:14.000000000 -0600 +++ ./plugins/linux/src/java/net/java/games/input/LinuxJoystickDevice.java 2014-02-22 14:00:00.000000000 -0700 @@ -28,8 +28,6 @@ package net.java.games.input; import java.io.IOException; import java.util.Map; import java.util.HashMap; -import java.util.List; -import java.util.ArrayList; /** * @author elias @@ -48,8 +46,8 @@ final class LinuxJoystickDevice implemen private final Event event = new Event(); private final LinuxJoystickButton[] buttons; private final LinuxJoystickAxis[] axes; - private final Map povXs = new HashMap(); - private final Map povYs = new HashMap(); + private final Map<Integer, LinuxJoystickPOV> povXs = new HashMap<Integer, LinuxJoystickPOV>(); + private final Map<Integer, LinuxJoystickPOV> povYs = new HashMap<Integer, LinuxJoystickPOV>(); private final byte[] axisMap; private final char[] buttonMap; @@ -103,11 +101,11 @@ final class LinuxJoystickDevice implemen float value = (float)joystick_event.getValue()/AXIS_MAX_VALUE; axis.setValue(value); if(povXs.containsKey(new Integer(index))) { - LinuxJoystickPOV pov = (LinuxJoystickPOV)(povXs.get(new Integer(index))); + LinuxJoystickPOV pov = povXs.get(new Integer(index)); pov.updateValue(); event.set(pov, pov.getPollData(), joystick_event.getNanos()); } else if(povYs.containsKey(new Integer(index))) { - LinuxJoystickPOV pov = (LinuxJoystickPOV)(povYs.get(new Integer(index))); + LinuxJoystickPOV pov = povYs.get(new Integer(index)); pov.updateValue(); event.set(pov, pov.getPollData(), joystick_event.getNanos()); } else { @@ -154,7 +152,7 @@ final class LinuxJoystickDevice implemen povYs.put(new Integer(yIndex),pov); } - public final synchronized boolean getNextEvent(Event event) throws IOException { + public final synchronized boolean getNextEvent(Event event) { return event_queue.getNextEvent(event); } --- ./plugins/linux/src/java/net/java/games/input/LinuxJoystickPOV.java.orig 2007-08-12 15:59:25.000000000 -0600 +++ ./plugins/linux/src/java/net/java/games/input/LinuxJoystickPOV.java 2014-02-22 14:00:00.000000000 -0700 @@ -1,7 +1,5 @@ package net.java.games.input; -import java.io.IOException; - public class LinuxJoystickPOV extends LinuxJoystickAxis { private LinuxJoystickAxis hatX; @@ -47,7 +45,7 @@ public class LinuxJoystickPOV extends Li else if (last_x == 1 && last_y == 1) setValue(Component.POV.DOWN_RIGHT); else { - LinuxEnvironmentPlugin.logln("Unknown values x = " + last_x + " | y = " + last_y); + ControllerEnvironment.logln("Unknown values x = " + last_x + " | y = " + last_y); setValue(Component.POV.OFF); } } --- ./plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java.orig 2006-04-29 16:29:27.000000000 -0600 +++ ./plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java 2014-02-22 14:00:00.000000000 -0700 @@ -48,7 +48,7 @@ final class LinuxKeyboard extends Keyboa private final PortType port; private final LinuxEventDevice device; - protected LinuxKeyboard(LinuxEventDevice device, Component[] components, Controller[] children, Rumbler[] rumblers) throws IOException { + protected LinuxKeyboard(LinuxEventDevice device, Component[] components, Controller[] children, Rumbler[] rumblers) { super(device.getName(), components, children, rumblers); this.device = device; this.port = device.getPortType(); --- ./plugins/linux/src/java/net/java/games/input/LinuxMouse.java.orig 2006-04-29 16:29:27.000000000 -0600 +++ ./plugins/linux/src/java/net/java/games/input/LinuxMouse.java 2014-02-22 14:00:00.000000000 -0700 @@ -48,7 +48,7 @@ final class LinuxMouse extends Mouse { private final PortType port; private final LinuxEventDevice device; - protected LinuxMouse(LinuxEventDevice device, Component[] components, Controller[] children, Rumbler[] rumblers) throws IOException { + protected LinuxMouse(LinuxEventDevice device, Component[] components, Controller[] children, Rumbler[] rumblers) { super(device.getName(), components, children, rumblers); this.device = device; this.port = device.getPortType(); --- ./plugins/linux/src/java/net/java/games/input/LinuxPOV.java.orig 2007-06-10 09:03:27.000000000 -0600 +++ ./plugins/linux/src/java/net/java/games/input/LinuxPOV.java 2014-02-22 14:00:00.000000000 -0700 @@ -88,7 +88,7 @@ final class LinuxPOV extends LinuxCompon else if (last_x == 1 && last_y == 1) return Component.POV.DOWN_RIGHT; else { - LinuxEnvironmentPlugin.logln("Unknown values x = " + last_x + " | y = " + last_y); + ControllerEnvironment.logln("Unknown values x = " + last_x + " | y = " + last_y); return Component.POV.OFF; } }