diff options
author | Sven Gothel <[email protected]> | 2014-07-08 21:13:15 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-08 21:13:15 +0200 |
commit | 815776c5760e42c8b3c858a9bab982b203c59c24 (patch) | |
tree | 3f8ecd7e905b0f431f5472565fce837b24f922ab /src/jogl/classes/com | |
parent | a41db57df54863566b0e286cd100bbbc5518eb7f (diff) |
Findbugs: Remove branches where reference cannot be null
Diffstat (limited to 'src/jogl/classes/com')
-rw-r--r-- | src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java | 6 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java index f082f358f..af7694ce1 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java @@ -186,8 +186,10 @@ public class BuildComposablePipeline { } try { + // Keep assignment w/ null comparison for clarification. + // If no exception is thrown, return value is always non-null; hasImmediateMode = - (classToComposeAround.getMethod("glBegin", new Class<?>[]{Integer.TYPE}) != null); + null != classToComposeAround.getMethod("glBegin", new Class<?>[]{Integer.TYPE}); } catch (final Exception e) { } @@ -388,7 +390,7 @@ public class BuildComposablePipeline { } } - if (null != baseInterfaceClass && !clazzList.contains(baseInterfaceClass)) { + if ( !clazzList.contains(baseInterfaceClass) ) { ifNames[i++] = baseInterfaceClass.getName(); clazzList.add(baseInterfaceClass); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java index 4a3e5b2e1..29dce40f5 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java @@ -551,7 +551,7 @@ public class ShaderCode { out.println("<no shader source>"); return; } - final int sourceCount = (null!=shaderSource)?shaderSource.length:0; + final int sourceCount = shaderSource.length; final int shaderCount = (null!=shader)?shader.capacity():0; for(int i=0; i<shaderCount; i++) { out.println(""); @@ -601,7 +601,7 @@ public class ShaderCode { if(0>shaderIdx || shaderIdx>=shaderCount) { throw new IndexOutOfBoundsException("shaderIdx not within shader bounds [0.."+(shaderCount-1)+"]: "+shaderIdx); } - final int sourceCount = (null!=shaderSource)?shaderSource.length:0; + final int sourceCount = shaderSource.length; if(shaderIdx>=sourceCount) { throw new IndexOutOfBoundsException("shaderIdx not within source bounds [0.."+(sourceCount-1)+"]: "+shaderIdx); } @@ -660,7 +660,7 @@ public class ShaderCode { final int oldNameLen = oldName.length(); final int newNameLen = newName.length(); int num = 0; - final int sourceCount = (null!=shaderSource)?shaderSource.length:0; + final int sourceCount = shaderSource.length; for(int shaderIdx = 0; shaderIdx<sourceCount; shaderIdx++) { final CharSequence[] src = shaderSource[shaderIdx]; for(int j=0; j<src.length; j++) { @@ -706,7 +706,7 @@ public class ShaderCode { if(0>shaderIdx || shaderIdx>=shaderCount) { throw new IndexOutOfBoundsException("shaderIdx not within shader bounds [0.."+(shaderCount-1)+"]: "+shaderIdx); } - final int sourceCount = (null!=shaderSource)?shaderSource.length:0; + final int sourceCount = shaderSource.length; if(shaderIdx>=sourceCount) { throw new IndexOutOfBoundsException("shaderIdx not within source bounds [0.."+(sourceCount-1)+"]: "+shaderIdx); } |