From: <ls...@us...> - 2008-09-27 07:47:19
|
Revision: 4585 http://jnode.svn.sourceforge.net/jnode/?rev=4585&view=rev Author: lsantha Date: 2008-09-27 07:47:11 +0000 (Sat, 27 Sep 2008) Log Message: ----------- Removed redundant type casts. Modified Paths: -------------- trunk/core/src/core/org/jnode/debugger/Debugger.java trunk/core/src/core/org/jnode/debugger/DebuggerPlugin.java trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java trunk/fs/src/test/org/jnode/test/fs/LowLevelIoTest.java trunk/fs/src/test/org/jnode/test/support/TestUtils.java trunk/gui/src/test/org/jnode/test/gui/DDC1Test.java trunk/gui/src/test/org/jnode/test/gui/FBTest.java trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java trunk/net/src/net/org/jnode/net/command/WLanCtlCommand.java trunk/net/src/net/org/jnode/net/ipv4/IPv4Route.java trunk/net/src/net/org/jnode/net/ipv4/bootp/BOOTPClient.java trunk/net/src/net/org/jnode/net/ipv4/config/impl/Ifconfig.java trunk/net/src/net/org/jnode/net/ipv4/config/impl/NetStaticDeviceConfig.java trunk/net/src/net/org/jnode/net/ipv4/config/impl/Route.java trunk/net/src/net/org/jnode/net/ipv4/layer/IPv4Sender.java trunk/net/src/net/org/jnode/net/service/DefaultNetworkLayerManager.java trunk/net/src/net/org/jnode/net/service/NetAPIImpl.java trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java trunk/shell/src/shell/org/jnode/shell/command/driver/system/acpi/AcpiCommand.java Modified: trunk/core/src/core/org/jnode/debugger/Debugger.java =================================================================== --- trunk/core/src/core/org/jnode/debugger/Debugger.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/core/src/core/org/jnode/debugger/Debugger.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -150,8 +150,7 @@ final Collection<Device> devs = DeviceUtils .getDevicesByAPI(KeyboardAPI.class); for (Device dev : devs) { - final KeyboardAPI api = (KeyboardAPI) dev - .getAPI(KeyboardAPI.class); + final KeyboardAPI api = dev.getAPI(KeyboardAPI.class); api.setPreferredListener(l); } } catch (ApiNotFoundException ex) { Modified: trunk/core/src/core/org/jnode/debugger/DebuggerPlugin.java =================================================================== --- trunk/core/src/core/org/jnode/debugger/DebuggerPlugin.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/core/src/core/org/jnode/debugger/DebuggerPlugin.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -100,8 +100,7 @@ private void addListeners(Device device) { if (device.implementsAPI(SystemTriggerAPI.class)) { try { - final SystemTriggerAPI api = (SystemTriggerAPI) device - .getAPI(SystemTriggerAPI.class); + final SystemTriggerAPI api = device.getAPI(SystemTriggerAPI.class); api.addSystemTriggerListener(debugger); } catch (ApiNotFoundException ex) { // Ignore @@ -109,8 +108,7 @@ } if (device.implementsAPI(KeyboardAPI.class)) { try { - final KeyboardAPI api = (KeyboardAPI) device - .getAPI(KeyboardAPI.class); + final KeyboardAPI api = device.getAPI(KeyboardAPI.class); api.addKeyboardListener(debugger); } catch (ApiNotFoundException ex) { // Ignore @@ -121,8 +119,7 @@ private void removeListeners(Device device) { if (device.implementsAPI(SystemTriggerAPI.class)) { try { - final SystemTriggerAPI api = (SystemTriggerAPI) device - .getAPI(SystemTriggerAPI.class); + final SystemTriggerAPI api = device.getAPI(SystemTriggerAPI.class); api.removeSystemTriggerListener(debugger); } catch (ApiNotFoundException ex) { // Ignore @@ -130,8 +127,7 @@ } if (device.implementsAPI(KeyboardAPI.class)) { try { - final KeyboardAPI api = (KeyboardAPI) device - .getAPI(KeyboardAPI.class); + final KeyboardAPI api = device.getAPI(KeyboardAPI.class); api.removeKeyboardListener(debugger); } catch (ApiNotFoundException ex) { // Ignore Modified: trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java =================================================================== --- trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -131,7 +131,7 @@ */ protected final void addPointerDevice(Device pDev) { try { - final PointerAPI pApi = (PointerAPI) pDev.getAPI(PointerAPI.class); + final PointerAPI pApi = pDev.getAPI(PointerAPI.class); pointerDevs.add(pDev); pApi.addPointerListener(this); } catch (ApiNotFoundException ex) { @@ -159,8 +159,7 @@ final void removePointer(Device pDev) { if (pointerDevs.remove(pDev)) { try { - final PointerAPI pApi = (PointerAPI) pDev - .getAPI(PointerAPI.class); + final PointerAPI pApi = pDev.getAPI(PointerAPI.class); pApi.removePointerListener(this); } catch (ApiNotFoundException ex) { BootLog.error("PointerAPI not found", ex); Modified: trunk/fs/src/test/org/jnode/test/fs/LowLevelIoTest.java =================================================================== --- trunk/fs/src/test/org/jnode/test/fs/LowLevelIoTest.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/fs/src/test/org/jnode/test/fs/LowLevelIoTest.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -40,8 +40,7 @@ dm = InitialNaming.lookup(DeviceManager.NAME); IDEDevice current = (IDEDevice) dm.getDevice(args[0]); - BlockDeviceAPI api = - current.getAPI(BlockDeviceAPI.class); + BlockDeviceAPI api = current.getAPI(BlockDeviceAPI.class); int size = (int) (Math.random() * 5 /*256*/) * 512; int offset = (int) (Math.random() * 10000) * 512; Modified: trunk/fs/src/test/org/jnode/test/support/TestUtils.java =================================================================== --- trunk/fs/src/test/org/jnode/test/support/TestUtils.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/fs/src/test/org/jnode/test/support/TestUtils.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -193,8 +193,7 @@ public static File copyDeviceToFile(Device imageDevice, String destFile) throws SecurityException, IOException, ApiNotFoundException { File dest = new File(destFile); - BlockDeviceAPI imgApi = imageDevice - .getAPI(BlockDeviceAPI.class); + BlockDeviceAPI imgApi = imageDevice.getAPI(BlockDeviceAPI.class); if (dest.exists()) dest.delete(); @@ -245,8 +244,7 @@ public static void copyInputStreamToDevice(InputStream imageStream, Device workDevice) throws ApiNotFoundException, NameNotFoundException, IOException, FileSystemException { - BlockDeviceAPI wrkApi = workDevice - .getAPI(BlockDeviceAPI.class); + BlockDeviceAPI wrkApi = workDevice.getAPI(BlockDeviceAPI.class); int sectorSize = 512; byte[] sector = new byte[sectorSize]; @@ -265,10 +263,8 @@ public static void copyDevice(Device imageDevice, Device workDevice) throws ApiNotFoundException, IOException { - BlockDeviceAPI imgApi = imageDevice - .getAPI(BlockDeviceAPI.class); - BlockDeviceAPI wrkApi = workDevice - .getAPI(BlockDeviceAPI.class); + BlockDeviceAPI imgApi = imageDevice.getAPI(BlockDeviceAPI.class); + BlockDeviceAPI wrkApi = workDevice.getAPI(BlockDeviceAPI.class); if (imgApi.getLength() != wrkApi.getLength()) throw new IllegalArgumentException("devices of different length"); Modified: trunk/gui/src/test/org/jnode/test/gui/DDC1Test.java =================================================================== --- trunk/gui/src/test/org/jnode/test/gui/DDC1Test.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/gui/src/test/org/jnode/test/gui/DDC1Test.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -44,7 +44,7 @@ final Device dev = DeviceUtils.getDevice(devId); System.out.println("Reading DDC1 data, please wait"); - final DisplayDataChannelAPI api = (DisplayDataChannelAPI) dev.getAPI(DisplayDataChannelAPI.class); + final DisplayDataChannelAPI api = dev.getAPI(DisplayDataChannelAPI.class); final DDC1Reader reader = new DDC1Reader(api); final EDID data = reader.read(); Modified: trunk/gui/src/test/org/jnode/test/gui/FBTest.java =================================================================== --- trunk/gui/src/test/org/jnode/test/gui/FBTest.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/gui/src/test/org/jnode/test/gui/FBTest.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -127,7 +127,7 @@ } log.info("Using device " + dev.getId()); - final FrameBufferAPI api = (FrameBufferAPI) dev.getAPI(FrameBufferAPI.class); + final FrameBufferAPI api = dev.getAPI(FrameBufferAPI.class); final FrameBufferConfiguration conf = api.getConfigurations()[0]; g = api.open(conf); Modified: trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java =================================================================== --- trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -333,7 +333,7 @@ */ private NetDeviceAPI getAPI(Device device) { try { - return (NetDeviceAPI) device.getAPI(NetDeviceAPI.class); + return device.getAPI(NetDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new IllegalArgumentException("Not a network device " + device.getId()); } Modified: trunk/net/src/net/org/jnode/net/command/WLanCtlCommand.java =================================================================== --- trunk/net/src/net/org/jnode/net/command/WLanCtlCommand.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/net/src/net/org/jnode/net/command/WLanCtlCommand.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -64,7 +64,7 @@ throws ApiNotFoundException, NetworkException { final Device dev = ARG_DEVICE.getValue(); final WirelessNetDeviceAPI api; - api = (WirelessNetDeviceAPI) dev.getAPI(WirelessNetDeviceAPI.class); + api = dev.getAPI(WirelessNetDeviceAPI.class); // Perform the selected operation if (FLAG_SET_ESSID.isSet()) { Modified: trunk/net/src/net/org/jnode/net/ipv4/IPv4Route.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/IPv4Route.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/net/src/net/org/jnode/net/ipv4/IPv4Route.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -84,7 +84,7 @@ this.flags |= RTF_GATEWAY; } try { - this.deviceAPI = (NetDeviceAPI) device.getAPI(NetDeviceAPI.class); + this.deviceAPI = device.getAPI(NetDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new IllegalArgumentException("Device " + device.getId() + " is not a network device"); Modified: trunk/net/src/net/org/jnode/net/ipv4/bootp/BOOTPClient.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/bootp/BOOTPClient.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/net/src/net/org/jnode/net/ipv4/bootp/BOOTPClient.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -65,7 +65,7 @@ public Object run() throws IOException { // Get the API. try { - api = (NetDeviceAPI) device.getAPI(NetDeviceAPI.class); + api = device.getAPI(NetDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new NetworkException("Device is not a network device", ex); } Modified: trunk/net/src/net/org/jnode/net/ipv4/config/impl/Ifconfig.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/config/impl/Ifconfig.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/net/src/net/org/jnode/net/ipv4/config/impl/Ifconfig.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -51,7 +51,7 @@ throws NetworkException { final NetDeviceAPI api; try { - api = (NetDeviceAPI) device.getAPI(NetDeviceAPI.class); + api = device.getAPI(NetDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new NetworkException("Device is not a network device", ex); } @@ -80,7 +80,7 @@ final Collection<Device> devices = DeviceUtils.getDevicesByAPI(NetDeviceAPI.class); for (Device dev : devices) { try { - final NetDeviceAPI api = (NetDeviceAPI) dev.getAPI(NetDeviceAPI.class); + final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class); final IPv4ProtocolAddressInfo addrInfo = (IPv4ProtocolAddressInfo) api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP); if (addrInfo != null) { Modified: trunk/net/src/net/org/jnode/net/ipv4/config/impl/NetStaticDeviceConfig.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/config/impl/NetStaticDeviceConfig.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/net/src/net/org/jnode/net/ipv4/config/impl/NetStaticDeviceConfig.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -67,7 +67,7 @@ public void doApply(Device device) throws NetworkException { final NetDeviceAPI api; try { - api = (NetDeviceAPI) device.getAPI(NetDeviceAPI.class); + api = device.getAPI(NetDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new NetworkException("Device is not a network device", ex); } Modified: trunk/net/src/net/org/jnode/net/ipv4/config/impl/Route.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/config/impl/Route.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/net/src/net/org/jnode/net/ipv4/config/impl/Route.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -126,7 +126,7 @@ throws NetworkException { for (Device dev : dm.getDevicesByAPI(NetDeviceAPI.class)) { try { - final NetDeviceAPI api = (NetDeviceAPI) dev.getAPI(NetDeviceAPI.class); + final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class); final IPv4ProtocolAddressInfo addrInfo; addrInfo = (IPv4ProtocolAddressInfo) api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP); if (addrInfo != null) { Modified: trunk/net/src/net/org/jnode/net/ipv4/layer/IPv4Sender.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/layer/IPv4Sender.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/net/src/net/org/jnode/net/ipv4/layer/IPv4Sender.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -127,7 +127,7 @@ // The device has been given, use it dev = skbuf.getDevice(); try { - api = (NetDeviceAPI) dev.getAPI(NetDeviceAPI.class); + api = dev.getAPI(NetDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new NetworkException("Device is not a network device", ex); } Modified: trunk/net/src/net/org/jnode/net/service/DefaultNetworkLayerManager.java =================================================================== --- trunk/net/src/net/org/jnode/net/service/DefaultNetworkLayerManager.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/net/src/net/org/jnode/net/service/DefaultNetworkLayerManager.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -143,7 +143,7 @@ } final NetDeviceAPI deviceAPI; try { - deviceAPI = (NetDeviceAPI) dev.getAPI(NetDeviceAPI.class); + deviceAPI = dev.getAPI(NetDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new NetworkException("Device in SocketBuffer is not a network device"); } Modified: trunk/net/src/net/org/jnode/net/service/NetAPIImpl.java =================================================================== --- trunk/net/src/net/org/jnode/net/service/NetAPIImpl.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/net/src/net/org/jnode/net/service/NetAPIImpl.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -59,8 +59,7 @@ final SecurityManager sm = System.getSecurityManager(); try { final NetDeviceImpl netDeviceImpl = (NetDeviceImpl) netDevice; - final NetDeviceAPI api = (NetDeviceAPI) netDeviceImpl.getDevice() - .getAPI(NetDeviceAPI.class); + final NetDeviceAPI api = netDeviceImpl.getDevice().getAPI(NetDeviceAPI.class); final ProtocolAddressInfo info = api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP); for (ProtocolAddress ipaddr : info.addresses()) { Modified: trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java =================================================================== --- trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -174,7 +174,7 @@ out.println(); final PrintWriter pw = new PrintWriter(out); try { - final DeviceInfoAPI infoApi = (DeviceInfoAPI) dev.getAPI(DeviceInfoAPI.class); + final DeviceInfoAPI infoApi = dev.getAPI(DeviceInfoAPI.class); if (infoApi != dev) { infoApi.showInfo(pw); } Modified: trunk/shell/src/shell/org/jnode/shell/command/driver/system/acpi/AcpiCommand.java =================================================================== --- trunk/shell/src/shell/org/jnode/shell/command/driver/system/acpi/AcpiCommand.java 2008-09-27 07:31:35 UTC (rev 4584) +++ trunk/shell/src/shell/org/jnode/shell/command/driver/system/acpi/AcpiCommand.java 2008-09-27 07:47:11 UTC (rev 4585) @@ -68,7 +68,7 @@ exit(1); } else { for (Device dev : acpiDevs) { - final AcpiAPI api = (AcpiAPI) dev.getAPI(AcpiAPI.class); + final AcpiAPI api = dev.getAPI(AcpiAPI.class); if (FLAG_DUMP.isSet()) { api.dump(new PrintWriter(out)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |