From a41db57df54863566b0e286cd100bbbc5518eb7f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 8 Jul 2014 21:09:30 +0200 Subject: Findbugs: Use .valueOf(..) instead of 'new (..)' --- .../jogamp/graph/font/typecast/ot/table/CffTable.java | 12 ++++++------ .../jogamp/graph/font/typecast/ot/table/CharstringType2.java | 10 +++++----- src/jogl/classes/jogamp/opengl/awt/Java2D.java | 10 +++++----- .../wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src/jogl/classes/jogamp') diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java index b0acff575..541c280bc 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java @@ -100,26 +100,26 @@ public class CffTable implements Table { // 1 byte integer ++_index; - return new Integer(b0 - 139); + return Integer.valueOf(b0 - 139); } else if (247 <= b0 && b0 <= 250) { // 2 byte integer final int b1 = _data[_index + 1]; _index += 2; - return new Integer((b0 - 247) * 256 + b1 + 108); + return Integer.valueOf((b0 - 247) * 256 + b1 + 108); } else if (251 <= b0 && b0 <= 254) { // 2 byte integer final int b1 = _data[_index + 1]; _index += 2; - return new Integer(-(b0 - 251) * 256 - b1 - 108); + return Integer.valueOf(-(b0 - 251) * 256 - b1 - 108); } else if (b0 == 28) { // 3 byte integer final int b1 = _data[_index + 1]; final int b2 = _data[_index + 2]; _index += 3; - return new Integer(b1 << 8 | b2); + return Integer.valueOf(b1 << 8 | b2); } else if (b0 == 29) { // 5 byte integer @@ -128,7 +128,7 @@ public class CffTable implements Table { final int b3 = _data[_index + 3]; final int b4 = _data[_index + 4]; _index += 5; - return new Integer(b1 << 24 | b2 << 16 | b3 << 8 | b4); + return Integer.valueOf(b1 << 24 | b2 << 16 | b3 << 8 | b4); } else if (b0 == 30) { // Real number @@ -143,7 +143,7 @@ public class CffTable implements Table { fString.append(decodeRealNibble(nibble1)); fString.append(decodeRealNibble(nibble2)); } - return new Float(fString.toString()); + return Float.valueOf(fString.toString()); } else { return null; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java index 211499357..d96a5848b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java @@ -183,26 +183,26 @@ public class CharstringType2 extends Charstring { // 1 byte integer ++_ip; - return new Integer(b0 - 139); + return Integer.valueOf(b0 - 139); } else if (247 <= b0 && b0 <= 250) { // 2 byte integer final int b1 = _data[_ip + 1]; _ip += 2; - return new Integer((b0 - 247) * 256 + b1 + 108); + return Integer.valueOf((b0 - 247) * 256 + b1 + 108); } else if (251 <= b0 && b0 <= 254) { // 2 byte integer final int b1 = _data[_ip + 1]; _ip += 2; - return new Integer(-(b0 - 251) * 256 - b1 - 108); + return Integer.valueOf(-(b0 - 251) * 256 - b1 - 108); } else if (b0 == 28) { // 3 byte integer final int b1 = _data[_ip + 1]; final int b2 = _data[_ip + 2]; _ip += 3; - return new Integer(b1 << 8 | b2); + return Integer.valueOf(b1 << 8 | b2); } else if (b0 == 255) { // 16-bit signed integer with 16 bits of fraction @@ -211,7 +211,7 @@ public class CharstringType2 extends Charstring { final int b3 = _data[_ip + 3]; final int b4 = _data[_ip + 4]; _ip += 5; - return new Float((b1 << 8 | b2) + ((b3 << 8 | b4) / 65536.0)); + return Float.valueOf((b1 << 8 | b2) + ((b3 << 8 | b4) / 65536f)); } else { return null; } diff --git a/src/jogl/classes/jogamp/opengl/awt/Java2D.java b/src/jogl/classes/jogamp/opengl/awt/Java2D.java index 86ca7650f..55212025d 100644 --- a/src/jogl/classes/jogamp/opengl/awt/Java2D.java +++ b/src/jogl/classes/jogamp/opengl/awt/Java2D.java @@ -387,8 +387,8 @@ public class Java2D { try { return (Rectangle) getOGLViewportMethod.invoke(null, new Object[] {g, - new Integer(componentWidth), - new Integer(componentHeight)}); + Integer.valueOf(componentWidth), + Integer.valueOf(componentHeight)}); } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); } catch (final Exception e) { @@ -514,7 +514,7 @@ public class Java2D { checkCompatible(); try { - return ((Long) createOGLContextOnSurfaceMethod.invoke(null, new Object[] { g, new Long(shareCtx) })).longValue(); + return ((Long) createOGLContextOnSurfaceMethod.invoke(null, new Object[] { g, Long.valueOf(shareCtx) })).longValue(); } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); } catch (final Exception e) { @@ -528,7 +528,7 @@ public class Java2D { checkCompatible(); try { - return ((Boolean) makeOGLContextCurrentOnSurfaceMethod.invoke(null, new Object[] { g, new Long(ctx) })).booleanValue(); + return ((Boolean) makeOGLContextCurrentOnSurfaceMethod.invoke(null, new Object[] { g, Long.valueOf(ctx) })).booleanValue(); } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); } catch (final Exception e) { @@ -541,7 +541,7 @@ public class Java2D { checkCompatible(); try { - destroyOGLContextMethod.invoke(null, new Object[] { new Long(ctx) }); + destroyOGLContextMethod.invoke(null, new Object[] { Long.valueOf(ctx) }); } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); } catch (final Exception e) { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java index 66d3018fc..517ca72cc 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java @@ -156,7 +156,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu for (int i = 0; i < configs.length; i++) { final GraphicsConfiguration gc = configs[i]; pfdIDs[i] = Win32SunJDKReflection.graphicsConfigurationGetPixelFormatID(gc); - pfdIDOSet.add(new Integer(pfdIDs[i])); + pfdIDOSet.add( Integer.valueOf(pfdIDs[i]) ); if(DEBUG) { System.err.println("AWT pfd["+i+"] "+pfdIDs[i]); } -- cgit v1.2.3