aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-core
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2023-02-15 23:08:25 +0100
committerJulien Gouesse <[email protected]>2023-02-15 23:08:25 +0100
commitaa6df077361bf1470d3799514f5774951025bed4 (patch)
treeef4161d363c026cfcdf9ac884f91a16bf09869ef /ardor3d-core
parentd0444773304dd536898183e361d2737315aee6b5 (diff)
Removes some deprecated calls in order to ease compilation with future versions of Java
Diffstat (limited to 'ardor3d-core')
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java7
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/Constants.java49
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java2
6 files changed, 13 insertions, 52 deletions
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java
index 3a3083c..1bbf316 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java
@@ -105,9 +105,6 @@ public class FragmentProgramState extends RenderState {
// Set data with byte content from stream
final byte data[] = outputStream.toByteArray();
- // Release resources
- inputStream.close();
-
program = BufferUtils.createByteBuffer(data.length);
program.put(data);
program.rewind();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java
index 77a2936..8a98868 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java
@@ -1324,15 +1324,12 @@ public class GLSLShaderObjectsState extends RenderState {
}
try {
- final T shaderUniform = classz.newInstance();
+ final T shaderUniform = classz.getDeclaredConstructor().newInstance();
shaderUniform.name = name;
shaderVariableList.add(shaderUniform);
return shaderUniform;
- } catch (final InstantiationException e) {
- logger.logp(Level.SEVERE, this.getClass().toString(), "getShaderVariable(name, classz, shaderVariableList)",
- "Exception", e);
- } catch (final IllegalAccessException e) {
+ } catch (final Exception e) {
logger.logp(Level.SEVERE, this.getClass().toString(), "getShaderVariable(name, classz, shaderVariableList)",
"Exception", e);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java
index 0b3f5ce..9c00d53 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java
@@ -1288,7 +1288,7 @@ public abstract class Spatial implements Savable, Hintable {
try {
final SavableFactory ann = clazz.getAnnotation(SavableFactory.class);
if (ann == null) {
- spat = clazz.newInstance();
+ spat = clazz.getDeclaredConstructor().newInstance();
} else {
spat = (Spatial) clazz.getMethod(ann.factoryMethod(), (Class<?>[]) null).invoke(null, (Object[]) null);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/Constants.java b/ardor3d-core/src/main/java/com/ardor3d/util/Constants.java
index 71210ac..1c2e0ca 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/Constants.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/Constants.java
@@ -17,52 +17,19 @@ public class Constants {
public static boolean updateGraphs = false;
- public static final boolean useStatePools;
+ public static final boolean useStatePools = System.getProperty("ardor3d.noStatePools") == null;
- public static final boolean stats;
+ public static final boolean stats = System.getProperty("ardor3d.stats") != null;
- public static final boolean trackDirectMemory;
+ public static final boolean trackDirectMemory = System.getProperty("ardor3d.trackDirect") != null;
- public static final boolean useMultipleContexts;
+ public static final boolean useMultipleContexts = System.getProperty("ardor3d.useMultipleContexts") != null;
- public static final boolean storeSavableImages;
+ public static final boolean storeSavableImages = System.getProperty("ardor3d.storeSavableImages") != null;
- public static final int maxStatePoolSize;
+ public static final int maxStatePoolSize = Integer.parseInt(System.getProperty("ardor3d.maxStatePoolSize", "11"));
- public static final boolean useValidatingTransform;
+ public static final boolean useValidatingTransform = System.getProperty("ardor3d.disableValidatingTransform") == null;
- public static final boolean enableInstancedGeometrySupport;
-
- static {
- boolean hasPropertyAccess = true;
- try {
- if (System.getSecurityManager() != null) {
- System.getSecurityManager().checkPropertiesAccess();
- }
- } catch (final SecurityException e) {
- hasPropertyAccess = false;
- }
-
- if (hasPropertyAccess) {
- stats = (System.getProperty("ardor3d.stats") != null);
- trackDirectMemory = (System.getProperty("ardor3d.trackDirect") != null);
- useMultipleContexts = (System.getProperty("ardor3d.useMultipleContexts") != null);
- useStatePools = (System.getProperty("ardor3d.noStatePools") == null);
- storeSavableImages = (System.getProperty("ardor3d.storeSavableImages") != null);
- maxStatePoolSize = (System.getProperty("ardor3d.maxStatePoolSize") != null ? Integer.parseInt(System
- .getProperty("ardor3d.maxStatePoolSize")) : 11);
-
- useValidatingTransform = (System.getProperty("ardor3d.disableValidatingTransform") == null);
- enableInstancedGeometrySupport = (System.getProperty("ardor3d.enableInstancedGeometrySupport") != null);
- } else {
- stats = false;
- trackDirectMemory = false;
- useMultipleContexts = false;
- useStatePools = true;
- storeSavableImages = false;
- maxStatePoolSize = 11;
- useValidatingTransform = true;
- enableInstancedGeometrySupport = false;
- }
- }
+ public static final boolean enableInstancedGeometrySupport = System.getProperty("ardor3d.enableInstancedGeometrySupport") != null;
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java
index f77c220..3e90b96 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java
@@ -236,7 +236,7 @@ public class BinaryImporter implements Ardor3dImporter {
final Class<? extends Savable> clazz = (Class<? extends Savable>) Class.forName(bco._className);
final SavableFactory ann = clazz.getAnnotation(SavableFactory.class);
if (ann == null) {
- out = clazz.newInstance();
+ out = clazz.getDeclaredConstructor().newInstance();
} else {
out = (Savable) clazz.getMethod(ann.factoryMethod(), (Class<?>[]) null).invoke(null,
(Object[]) null);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java
index 0cbeea8..9905b06 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java
@@ -820,7 +820,7 @@ public class DOMInputCapsule implements InputCapsule {
final Class<? extends Savable> clazz = (Class<? extends Savable>) Class.forName(className);
final SavableFactory ann = clazz.getAnnotation(SavableFactory.class);
if (ann == null) {
- tmp = clazz.newInstance();
+ tmp = clazz.getDeclaredConstructor().newInstance();
} else {
tmp = (Savable) clazz.getMethod(ann.factoryMethod(), (Class<?>[]) null).invoke(null,
(Object[]) null);