summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-08 12:36:13 +0200
committerSven Gothel <[email protected]>2014-07-08 12:36:13 +0200
commit109e162a78ef5bab0a7481a8499ad1da48cea094 (patch)
tree2b78799440dbd34039565af0bd15debcc3ac6b52
parent98053b73f1ba937108e03556456e51aa95b09b70 (diff)
Findbugs.static_final_immutable: Use final qualifier for static immutable instances.
-rw-r--r--src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java5
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/HEdge.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java6
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java16
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java16
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java16
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java12
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java2
16 files changed, 67 insertions, 66 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
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
index 7b8313b7f..c463ede2a 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
@@ -47,14 +47,14 @@ import com.jogamp.opengl.util.glsl.ShaderState;
*/
@SuppressWarnings("serial")
public class Bug735Inv0AppletAWT extends Applet implements Runnable {
- static public int AWT = 0;
- static public int NEWT = 1;
-
- static public int APPLET_WIDTH = 500;
- static public int APPLET_HEIGHT = 290;
- static public int TARGET_FPS = 120;
- static public int TOOLKIT = NEWT;
- static public boolean MANUAL_FRAME_HANDLING = true;
+ static public final int AWT = 0;
+ static public final int NEWT = 1;
+
+ static public final int APPLET_WIDTH = 500;
+ static public final int APPLET_HEIGHT = 290;
+ static public final int TARGET_FPS = 120;
+ static public final int TOOLKIT = NEWT;
+ static public final boolean MANUAL_FRAME_HANDLING = true;
//////////////////////////////////////////////////////////////////////////////
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
index 377f5e7ef..580f3caea 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
@@ -49,14 +49,14 @@ import com.jogamp.opengl.util.glsl.ShaderState;
*/
@SuppressWarnings("serial")
public class Bug735Inv1AppletAWT extends Applet implements Runnable {
- static public int AWT = 0;
- static public int NEWT = 1;
-
- static public int APPLET_WIDTH = 500;
- static public int APPLET_HEIGHT = 290;
- static public int TARGET_FPS = 120;
- static public int TOOLKIT = NEWT;
- static public boolean MANUAL_FRAME_HANDLING = true;
+ static public final int AWT = 0;
+ static public final int NEWT = 1;
+
+ static public final int APPLET_WIDTH = 500;
+ static public final int APPLET_HEIGHT = 290;
+ static public final int TARGET_FPS = 120;
+ static public final int TOOLKIT = NEWT;
+ static public final boolean MANUAL_FRAME_HANDLING = true;
//////////////////////////////////////////////////////////////////////////////
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java
index 109bb1a42..1128c7680 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java
@@ -43,14 +43,14 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
*/
@SuppressWarnings("serial")
public class Bug735Inv2AppletAWT extends Applet implements Runnable {
- static public int AWT = 0;
- static public int NEWT = 1;
-
- static public int APPLET_WIDTH = 500;
- static public int APPLET_HEIGHT = 290;
- static public int TARGET_FPS = 120;
- static public int TOOLKIT = NEWT;
- static public boolean IGNORE_AWT_REPAINT = false;
+ static public final int AWT = 0;
+ static public final int NEWT = 1;
+
+ static public final int APPLET_WIDTH = 500;
+ static public final int APPLET_HEIGHT = 290;
+ static public final int TARGET_FPS = 120;
+ static public final int TOOLKIT = NEWT;
+ static public final boolean IGNORE_AWT_REPAINT = false;
static public boolean USE_ECT = false;
static public int SWAP_INTERVAL = 1;
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java
index 883a40345..83db15cf3 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java
@@ -46,13 +46,13 @@ import com.jogamp.opengl.util.AnimatorBase;
*/
@SuppressWarnings("serial")
public class Bug735Inv3AppletAWT extends Applet {
- static public int AWT = 0;
- static public int NEWT = 1;
+ static public final int AWT = 0;
+ static public final int NEWT = 1;
- static public int APPLET_WIDTH = 500;
- static public int APPLET_HEIGHT = 290;
- static public int TOOLKIT = NEWT;
- static public boolean IGNORE_AWT_REPAINT = false;
+ static public final int APPLET_WIDTH = 500;
+ static public final int APPLET_HEIGHT = 290;
+ static public final int TOOLKIT = NEWT;
+ static public final boolean IGNORE_AWT_REPAINT = false;
static public boolean USE_ECT = false;
static public int SWAP_INTERVAL = 1;
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java
index c9df683b1..a3fd3fa21 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java
@@ -44,13 +44,13 @@ import com.jogamp.opengl.util.AnimatorBase;
* </pre>
*/
public class Bug735Inv4AWT {
- static public int AWT = 0;
- static public int NEWT = 1;
+ static public final int AWT = 0;
+ static public final int NEWT = 1;
- static public int APPLET_WIDTH = 500;
- static public int APPLET_HEIGHT = 290;
- static public int TOOLKIT = NEWT;
- static public boolean IGNORE_AWT_REPAINT = false;
+ static public final int APPLET_WIDTH = 500;
+ static public final int APPLET_HEIGHT = 290;
+ static public final int TOOLKIT = NEWT;
+ static public final boolean IGNORE_AWT_REPAINT = false;
static public boolean USE_ECT = false;
static public int SWAP_INTERVAL = 1;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java
index a1a33531a..d1155bd30 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java
@@ -155,12 +155,12 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
boolean useShared;
int canvasWidth;
int canvasHeight;
- private final float boundsRadius = 2f;
+ private static final float boundsRadius = 2f;
private float viewDistance;
- private float viewDistanceFactor = 1.0f;
+ private static float viewDistanceFactor = 1.0f;
private float xAxisRotation;
private float yAxisRotation;
- private final float viewFovDegrees = 15f;
+ private static final float viewFovDegrees = 15f;
// Buffer objects can be shared across canvas instances, if those canvases are initialized with the same GLContext.
// If we run with sharedBufferObjects true, then the tests will use these shared buffer objects.
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java
index eae4d41e3..9f5940b53 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java
@@ -30,8 +30,8 @@ public class OlympicES1 implements GLEventListener
private boolean debug = false ;
private boolean trace = false ;
- // private static final double M_PI= 3.141592654;
- private static final double M_2PI= 2*3.141592654;
+ // private static final double M_PI= Math.PI;
+ private static final double M_2PI = 2.0*Math.PI;
private static final int
// XSIZE= 100,
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java
index c341c6de6..72524aa67 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java
@@ -46,7 +46,7 @@ public class LandscapeES2 implements GLEventListener {
private int swapInterval = 0;
private boolean verbose = true;
- static public int TARGET_FPS = 120;
+ static public final int TARGET_FPS = 120;
private long millisOffset;
private int frameCount;
private float frameRate;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java
index 178887059..9284ec48e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java
@@ -29,7 +29,7 @@
package com.jogamp.opengl.test.junit.jogl.demos.es2.shader;
public class RedSquareShader {
- public static String VERTEX_SHADER_TEXT =
+ public static final String VERTEX_SHADER_TEXT =
" #ifdef GL_ES\n" +
" precision mediump float;\n" +
" precision mediump int;\n" +
@@ -51,7 +51,7 @@ public class RedSquareShader {
" gl_Position = mgl_PMVMatrix[0] * mgl_PMVMatrix[1] * mgl_Vertex;\n" +
"}\n" ;
- public static String FRAGMENT_SHADER_TEXT =
+ public static final String FRAGMENT_SHADER_TEXT =
" #ifdef GL_ES\n" +
" precision mediump float;\n" +
" precision mediump int;\n" +
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
index 27d095a11..a2fd7b08c 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
@@ -72,7 +72,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
protected static final int MS_ROBOT_POST_TEST_DELAY = 100;
protected static final boolean _debug = true ;
- protected static PrintStream _debugPrintStream = System.err ;
+ protected static final PrintStream _debugPrintStream = System.err ;
////////////////////////////////////////////////////////////////////////////