diff options
author | Sven Gothel <[email protected]> | 2014-07-08 12:36:13 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-08 12:36:13 +0200 |
commit | 109e162a78ef5bab0a7481a8499ad1da48cea094 (patch) | |
tree | 2b78799440dbd34039565af0bd15debcc3ac6b52 /src/jogl | |
parent | 98053b73f1ba937108e03556456e51aa95b09b70 (diff) |
Findbugs.static_final_immutable: Use final qualifier for static immutable instances.
Diffstat (limited to 'src/jogl')
6 files changed, 22 insertions, 21 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java index f9719c232..3b08b5386 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java @@ -107,21 +107,21 @@ public class BuildStaticGLInfo { // Handles function pointer protected static final int funcIdentifierGroup = 9; - protected static Pattern funcPattern = + protected static final Pattern funcPattern = Pattern.compile("^(GLAPI|GL_API|GL_APICALL|EGLAPI|extern)?(\\s*)((unsigned|const)\\s+)?(\\w+)(\\s+\\*\\s*|\\s*\\*\\s+|\\s+)?(GLAPIENTRY|GL_APIENTRY|APIENTRY|EGLAPIENTRY|WINAPI)?(\\s*)([ew]?gl\\w+)\\s?(\\(.*)"); - protected static Pattern associationPattern = + protected static final Pattern associationPattern = Pattern.compile("\\#ifndef ([CEW]?GL[XU]?_[A-Za-z0-9_]+)(.*)"); - protected static Pattern ifPattern = + protected static final Pattern ifPattern = Pattern.compile("\\#if(.*)"); - protected static Pattern elsePattern = + protected static final Pattern elsePattern = Pattern.compile("\\#(elif|else)(.*)"); - protected static Pattern endifPattern = + protected static final Pattern endifPattern = Pattern.compile("\\#endif(.*)"); protected static final int defineIdentifierGroup = 1; - protected static Pattern definePattern = + protected static final Pattern definePattern = Pattern.compile("\\#define ([CEW]?GL[XU]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)(.*)"); // Maps function / #define names to Set of names of the extensions they're declared in diff --git a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java index aa56a8442..a7ba141bb 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java +++ b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java @@ -405,7 +405,7 @@ public class GLEventListenerState { } } - public static GLRunnable setViewport = new GLRunnable() { + public static final GLRunnable setViewport = new GLRunnable() { @Override public boolean run(final GLAutoDrawable drawable) { drawable.getGL().glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); @@ -413,7 +413,7 @@ public class GLEventListenerState { } }; - public static GLRunnable glFinish = new GLRunnable() { + public static final GLRunnable glFinish = new GLRunnable() { @Override public boolean run(final GLAutoDrawable drawable) { drawable.getGL().glFinish(); diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java index ec2991448..a09321d75 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java @@ -32,7 +32,6 @@ import java.nio.ByteBuffer; import javax.media.nativewindow.util.PixelFormat; import javax.media.opengl.GL; -import javax.media.opengl.GL2; import javax.media.opengl.GL2ES2; import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; @@ -166,14 +165,14 @@ public class GLPixelBuffer { * utilizing best match for {@link GLPixelAttributes} * and {@link GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocating} a {@link ByteBuffer}. */ - public static GLPixelBufferProvider defaultProviderNoRowStride = new DefaultGLPixelBufferProvider(false); + public static final GLPixelBufferProvider defaultProviderNoRowStride = new DefaultGLPixelBufferProvider(false); /** * Default {@link GLPixelBufferProvider} with {@link GLPixelBufferProvider#getAllowRowStride()} == <code>true</code>, * utilizing best match for {@link GLPixelAttributes} * and {@link GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocating} a {@link ByteBuffer}. */ - public static GLPixelBufferProvider defaultProviderWithRowStride = new DefaultGLPixelBufferProvider(true); + public static final GLPixelBufferProvider defaultProviderWithRowStride = new DefaultGLPixelBufferProvider(true); /** Pixel attributes. */ public static class GLPixelAttributes { diff --git a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java index 3bdf54590..4976fd1fc 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java @@ -32,9 +32,9 @@ import com.jogamp.graph.geom.Triangle; public class HEdge { - public static int BOUNDARY = 3; - public static int INNER = 1; - public static int HOLE = 2; + public static final int BOUNDARY = 3; + public static final int INNER = 1; + public static final int HOLE = 2; private GraphVertex vert; private HEdge prev = null; diff --git a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java index 977881e6b..a6952ec5a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java @@ -119,6 +119,7 @@ import javax.media.opengl.GL; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.GLUquadric; +import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.util.ImmModeSink; import com.jogamp.opengl.util.glsl.ShaderState; @@ -375,7 +376,7 @@ public class GLUquadricImpl implements GLUquadric { nsign = 1.0f; } - da = 2.0f * PI / slices; + da = PI_2 / slices; dr = (topRadius - baseRadius) / stacks; dz = height / stacks; nz = (baseRadius - topRadius) / height; @@ -519,7 +520,7 @@ public class GLUquadricImpl implements GLUquadric { } } - da = 2.0f * PI / slices; + da = PI_2 / slices; dr = (outerRadius - innerRadius) / loops; switch (drawStyle) { @@ -971,7 +972,7 @@ public class GLUquadricImpl implements GLUquadric { } drho = PI / stacks; - dtheta = 2.0f * PI / slices; + dtheta = PI_2 / slices; if (drawStyle == GLU.GLU_FILL) { if (!textureFlag) { @@ -1118,7 +1119,8 @@ public class GLUquadricImpl implements GLUquadric { // Internals only below this point // - private static final float PI = (float)Math.PI; + private static final float PI = FloatUtil.PI; + private static final float PI_2 = 2f * FloatUtil.PI; private static final int CACHE_SIZE = 240; private final void glBegin(final GL gl, final int mode) { diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java index f1bee1957..48e5e8517 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java @@ -16,13 +16,13 @@ public class PngHelperInternal { /**
* Default charset, used internally by PNG for several things
*/
- public static Charset charsetLatin1 = Charset.forName("ISO-8859-1");
+ public static final Charset charsetLatin1 = Charset.forName("ISO-8859-1");
/**
* UTF-8 is only used for some chunks
*/
- public static Charset charsetUTF8 = Charset.forName("UTF-8");
+ public static final Charset charsetUTF8 = Charset.forName("UTF-8");
- static boolean DEBUG = false;
+ static final boolean DEBUG = false;
/**
* PNG magic bytes
|