diff options
author | Sven Gothel <[email protected]> | 2014-07-08 21:09:30 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-08 21:09:30 +0200 |
commit | a41db57df54863566b0e286cd100bbbc5518eb7f (patch) | |
tree | fb82077e79f54ba2fcf4c77b42458572fd9995eb /src/jogl/classes | |
parent | b740161d456c059d1b51029c603ce144eb2b2d44 (diff) |
Findbugs: Use <NumberType>.valueOf(..) instead of 'new <NumberType>(..)'
Diffstat (limited to 'src/jogl/classes')
11 files changed, 41 insertions, 44 deletions
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java index a84da723f..bbfe72b08 100644 --- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java +++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java @@ -322,7 +322,7 @@ public class Mixer { private static Map createdBuffers = new HashMap(); // Map Long, ByteBuffer private static ByteBuffer newDirectByteBuffer(final long address, final long capacity) { - final Long key = new Long(address); + final Long key = Long.valueOf(address); ByteBuffer buf = (ByteBuffer) createdBuffers.get(key); if (buf == null) { buf = newDirectByteBufferImpl(address, capacity); @@ -351,9 +351,9 @@ public class Mixer { try { return (ByteBuffer) directByteBufferConstructor.newInstance(new Object[] { - new Integer((int) capacity), + Integer.valueOf((int) capacity), null, - new Integer((int) address) + Integer.valueOf((int) address) }); } catch (final Exception e) { e.printStackTrace(); diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java index 1c9eacec0..763b13954 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java @@ -1582,7 +1582,7 @@ public class TextRenderer { class GlyphProducer { final int undefined = -2; - FontRenderContext fontRenderContext = null; // FIXME: Never initialized! + final FontRenderContext fontRenderContext = null; // FIXME: Never initialized! List<Glyph> glyphsOutput = new ArrayList<Glyph>(); HashMap<String, GlyphVector> fullGlyphVectorCache = new HashMap<String, GlyphVector>(); HashMap<Character, GlyphMetrics> glyphMetricsCache = new HashMap<Character, GlyphMetrics>(); @@ -1749,7 +1749,7 @@ public class TextRenderer { static { for (int i = 0; i < cache.length; i++) { - cache[i] = new Character((char) i); + cache[i] = Character.valueOf((char) i); } } @@ -1757,7 +1757,7 @@ public class TextRenderer { if (c <= 127) { // must cache return CharacterCache.cache[c]; } - return new Character(c); + return Character.valueOf(c); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java index c841f2f09..d758fc121 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java @@ -347,8 +347,7 @@ public class ShaderState { public void bindAttribLocation(final GL2ES2 gl, final int location, final String name) { if(null==shaderProgram) throw new GLException("No program is attached"); if(shaderProgram.linked()) throw new GLException("Program is already linked"); - final Integer loc = new Integer(location); - activeAttribLocationMap.put(name, loc); + activeAttribLocationMap.put(name, Integer.valueOf(location)); gl.glBindAttribLocation(shaderProgram.program(), location, name); } @@ -371,7 +370,7 @@ public class ShaderState { if(null==shaderProgram) throw new GLException("No program is attached"); if(shaderProgram.linked()) throw new GLException("Program is already linked"); final String name = data.getName(); - activeAttribLocationMap.put(name, new Integer(location)); + activeAttribLocationMap.put(name, Integer.valueOf(location)); data.setLocation(gl, shaderProgram.program(), location); activeAttribDataMap.put(data.getName(), data); } @@ -399,7 +398,7 @@ public class ShaderState { if(!shaderProgram.linked()) throw new GLException("Program is not linked"); location = gl.glGetAttribLocation(shaderProgram.program(), name); if(0<=location) { - activeAttribLocationMap.put(name, new Integer(location)); + activeAttribLocationMap.put(name, Integer.valueOf(location)); if(DEBUG) { System.err.println("ShaderState: glGetAttribLocation: "+name+", loc: "+location); } @@ -442,8 +441,7 @@ public class ShaderState { if(!shaderProgram.linked()) throw new GLException("Program is not linked"); location = data.setLocation(gl, shaderProgram.program()); if(0<=location) { - final Integer idx = new Integer(location); - activeAttribLocationMap.put(name, idx); + activeAttribLocationMap.put(name, Integer.valueOf(location)); if(DEBUG) { System.err.println("ShaderState: glGetAttribLocation: "+name+", loc: "+location); } @@ -721,7 +719,7 @@ public class ShaderState { final String name = attribute.getName(); final int loc = attribute.setLocation(gl, shaderProgram.program()); if(0<=loc) { - activeAttribLocationMap.put(name, new Integer(loc)); + activeAttribLocationMap.put(name, Integer.valueOf(loc)); if(DEBUG) { System.err.println("ShaderState: relocateAttribute: "+name+", loc: "+loc); } @@ -873,8 +871,7 @@ public class ShaderState { if(!shaderProgram.linked()) throw new GLException("Program is not linked"); location = gl.glGetUniformLocation(shaderProgram.program(), name); if(0<=location) { - final Integer idx = new Integer(location); - activeUniformLocationMap.put(name, idx); + activeUniformLocationMap.put(name, Integer.valueOf(location)); } else if(verbose) { System.err.println("ShaderState: glUniform failed, no location for: "+name+", index: "+location); if(DEBUG) { @@ -915,7 +912,7 @@ public class ShaderState { if(!shaderProgram.linked()) throw new GLException("Program is not linked"); location = data.setLocation(gl, shaderProgram.program()); if(0<=location) { - activeUniformLocationMap.put(name, new Integer(location)); + activeUniformLocationMap.put(name, Integer.valueOf(location)); } else if(verbose) { System.err.println("ShaderState: glUniform failed, no location for: "+name+", index: "+location); if(DEBUG) { @@ -1005,7 +1002,7 @@ public class ShaderState { final int loc = data.setLocation(gl, shaderProgram.program()); if( 0 <= loc ) { // only pass the data, if the uniform exists in the current shader - activeUniformLocationMap.put(data.getName(), new Integer(loc)); + activeUniformLocationMap.put(data.getName(), Integer.valueOf(loc)); if(DEBUG) { System.err.println("ShaderState: resetAllUniforms: "+data); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java index b927e8ceb..5ff64d81b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java @@ -169,7 +169,7 @@ public class ShaderUtil { final int[] formats = new int[numFormats]; gl.glGetIntegerv(GL2ES2.GL_SHADER_BINARY_FORMATS, formats, 0); for(int i=0; i<numFormats; i++) { - info.shaderBinaryFormats.add(new Integer(formats[i])); + info.shaderBinaryFormats.add(Integer.valueOf(formats[i])); } } } catch (final GLException gle) { @@ -200,7 +200,7 @@ public class ShaderUtil { v = true; } } - info.shaderCompilerAvailable = new Boolean(v); + info.shaderCompilerAvailable = Boolean.valueOf(v); queryOK = true; } catch (final GLException gle) { System.err.println("Caught exception on thread "+Thread.currentThread().getName()); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java index f121478e7..772df7279 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java @@ -216,7 +216,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final String readLine() throws IOException { - return new String(); + return ""; } /** @@ -226,7 +226,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final String readUTF() throws IOException { - return new String(); + return ""; } /** @@ -235,7 +235,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput **/ public final static String readUTF(final DataInput in) throws IOException { - return new String(); + return ""; } } diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 16399799f..e4e29ee2b 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -1611,7 +1611,7 @@ public abstract class GLContext { // Thread.dumpStack(); } final String objectKey = getDeviceVersionAvailableKey(device, reqMajor, profile); - final Integer val = new Integer(composeBits(resMajor, resMinor, resCtp)); + final Integer val = Integer.valueOf(composeBits(resMajor, resMinor, resCtp)); synchronized(deviceVersionAvailable) { return deviceVersionAvailable.put( objectKey, val ); } diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/javax/media/opengl/GLUniformData.java index 67cc4c999..47f07539b 100644 --- a/src/jogl/classes/javax/media/opengl/GLUniformData.java +++ b/src/jogl/classes/javax/media/opengl/GLUniformData.java @@ -15,7 +15,7 @@ public class GLUniformData { * */ public GLUniformData(final String name, final int val) { - initScalar(name, 1, new Integer(val)); + initScalar(name, 1, Integer.valueOf(val)); } /** @@ -25,7 +25,7 @@ public class GLUniformData { * */ public GLUniformData(final String name, final float val) { - initScalar(name, 1, new Float(val)); + initScalar(name, 1, Float.valueOf(val)); } /** @@ -74,8 +74,8 @@ public class GLUniformData { initBuffer(name, rows, columns, data); } - public GLUniformData setData(final int data) { initScalar(new Integer(data)); return this; } - public GLUniformData setData(final float data) { initScalar(new Float(data)); return this; } + public GLUniformData setData(final int data) { initScalar(Integer.valueOf(data)); return this; } + public GLUniformData setData(final float data) { initScalar(Float.valueOf(data)); return this; } public GLUniformData setData(final IntBuffer data) { initBuffer(data); return this; } public GLUniformData setData(final FloatBuffer data) { initBuffer(data); return this; } 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]); } |