You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mb...@apache.org on 2022/08/13 20:11:33 UTC
[db-jdo] branch tck-compiler-warnings updated: JDO-817 removing compiler warnings: „field can be final" in api submodule
This is an automated email from the ASF dual-hosted git repository.
mbo pushed a commit to branch tck-compiler-warnings
in repository https://gitbox.apache.org/repos/asf/db-jdo.git
The following commit(s) were added to refs/heads/tck-compiler-warnings by this push:
new 036f1a20 JDO-817 removing compiler warnings: „field can be final" in api submodule
036f1a20 is described below
commit 036f1a20ffe6b4cdd14c3f1325e4d9eb47becaad
Author: Michael Bouschen <Mi...@akquinet.de>
AuthorDate: Sat Aug 13 22:09:50 2022 +0200
JDO-817 removing compiler warnings: „field can be final" in api submodule
---
api/src/main/java/javax/jdo/Enhancer.java | 20 +--
api/src/main/java/javax/jdo/JDOException.java | 16 +--
api/src/main/java/javax/jdo/JDOHelper.java | 145 ++++++++++-----------
.../main/java/javax/jdo/identity/CharIdentity.java | 6 +-
.../java/javax/jdo/identity/ObjectIdentity.java | 12 +-
.../javax/jdo/identity/SingleFieldIdentity.java | 6 +-
api/src/main/java/javax/jdo/spi/I18NHelper.java | 10 +-
api/src/main/java/javax/jdo/spi/JDOImplHelper.java | 14 +-
.../java/javax/jdo/spi/RegisterClassEvent.java | 10 +-
.../test/java/javax/jdo/AbstractJDOConfigTest.java | 8 +-
api/src/test/java/javax/jdo/EnhancerTest.java | 18 +--
api/src/test/java/javax/jdo/MockEnhancer.java | 10 +-
api/src/test/java/javax/jdo/ObjectStateTest.java | 2 +-
.../javax/jdo/identity/ObjectIdentityTest.java | 4 +-
.../jdo/listener/InstanceLifecycleEventTest.java | 20 +--
api/src/test/java/javax/jdo/schema/XMLTest.java | 26 ++--
.../java/javax/jdo/spi/StateInterrogationTest.java | 36 ++---
api/src/test/java/javax/jdo/stub/StubPMF.java | 2 +-
api/src/test/java/javax/jdo/util/AbstractTest.java | 6 +-
api/src/test/java/javax/jdo/util/XMLTestUtil.java | 12 +-
20 files changed, 189 insertions(+), 194 deletions(-)
diff --git a/api/src/main/java/javax/jdo/Enhancer.java b/api/src/main/java/javax/jdo/Enhancer.java
index dfcf6d96..32b4d686 100644
--- a/api/src/main/java/javax/jdo/Enhancer.java
+++ b/api/src/main/java/javax/jdo/Enhancer.java
@@ -74,13 +74,13 @@ public class Enhancer {
I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N
/** New Line */
- private char NL = '\n'; //NOI18N
+ private static final char NL = '\n'; //NOI18N
/** Jar file suffix */
- private String JAR_FILE_SUFFIX = ".jar"; //NOI18N
+ private static final String JAR_FILE_SUFFIX = ".jar"; //NOI18N
/** JDO Metadata file suffix */
- private String JDO_FILE_SUFFIX = ".jdo"; //NOI18N
+ private static final String JDO_FILE_SUFFIX = ".jdo"; //NOI18N
/** Class file suffix */
- private String CLASS_FILE_SUFFIX = ".class"; //NOI18N
+ private static final String CLASS_FILE_SUFFIX = ".class"; //NOI18N
/** Error indicator */
private boolean error = false;
@@ -88,7 +88,7 @@ public class Enhancer {
private boolean printAndExit = false;
/** Persistence Units */
- private List<String> persistenceUnitNames = new ArrayList<>();
+ private final List<String> persistenceUnitNames = new ArrayList<>();
/** Target Directory Parameter */
private String directoryName = null;
/** ClassLoader for JDOEnhancer */
@@ -102,17 +102,17 @@ public class Enhancer {
/** Recurse flag */
private boolean recurse = false;
/** Error messages should be empty unless there is an error */
- private StringBuilder errorBuffer = new StringBuilder();
+ private final StringBuilder errorBuffer = new StringBuilder();
/** Verbose messages are always collected but only output if verbose flag is set */
- private StringBuilder verboseBuffer = new StringBuilder();
+ private final StringBuilder verboseBuffer = new StringBuilder();
/** File Names */
private List<String> fileNames = new ArrayList<>();
/** Class File Names */
- private List<String> classFileNames = new ArrayList<>();
+ private final List<String> classFileNames = new ArrayList<>();
/** JDO File Names */
- private List<String> jdoFileNames = new ArrayList<>();
+ private final List<String> jdoFileNames = new ArrayList<>();
/** Jar File Names */
- private List<String> jarFileNames = new ArrayList<>();
+ private final List<String> jarFileNames = new ArrayList<>();
/** The number of classes validated by the JDOEnhancer */
private int numberOfValidatedClasses = 0;
/** The number of classes enhanced by the JDOEnhancer */
diff --git a/api/src/main/java/javax/jdo/JDOException.java b/api/src/main/java/javax/jdo/JDOException.java
index dccd4dc6..18774b89 100644
--- a/api/src/main/java/javax/jdo/JDOException.java
+++ b/api/src/main/java/javax/jdo/JDOException.java
@@ -47,7 +47,7 @@ public class JDOException extends java.lang.RuntimeException {
/**
* The Internationalization message helper.
*/
- private static I18NHelper msg = I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N
+ private static final I18NHelper MSG = I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N
/**
* Flag indicating whether printStackTrace is being executed.
@@ -164,7 +164,7 @@ public class JDOException extends java.lang.RuntimeException {
* @return never.
*/
public Throwable initCause(Throwable cause) {
- throw new JDOFatalInternalException(msg.msg("ERR_CannotInitCause"));
+ throw new JDOFatalInternalException(MSG.msg("ERR_CannotInitCause"));
}
/** The <code>String</code> representation includes the name of the class,
@@ -180,7 +180,7 @@ public class JDOException extends java.lang.RuntimeException {
sb.append (super.toString());
// include failed object information
if (failed != null) {
- sb.append ("\n").append (msg.msg ("MSG_FailedObject"));
+ sb.append ("\n").append (MSG.msg ("MSG_FailedObject"));
String failedToString = null;
try {
failedToString = failed.toString();
@@ -188,7 +188,7 @@ public class JDOException extends java.lang.RuntimeException {
// include the information from the exception thrown by failed.toString
Object objectId = JDOHelper.getObjectId(failed);
if (objectId == null) {
- failedToString = msg.msg("MSG_ExceptionGettingFailedToString", //NOI18N
+ failedToString = MSG.msg("MSG_ExceptionGettingFailedToString", //NOI18N
exceptionToString(ex));
}
else {
@@ -200,7 +200,7 @@ public class JDOException extends java.lang.RuntimeException {
catch (Exception ex2) {
objectIdToString = exceptionToString(ex2);
}
- failedToString = msg.msg("MSG_ExceptionGettingFailedToStringObjectId", //NOI18N
+ failedToString = MSG.msg("MSG_ExceptionGettingFailedToStringObjectId", //NOI18N
exceptionToString(ex), objectIdToString);
}
}
@@ -209,7 +209,7 @@ public class JDOException extends java.lang.RuntimeException {
// include nested Throwable information, but only if not called by
// printStackTrace; the stacktrace will include the cause anyway.
if (len > 0 && !inPrintStackTrace) {
- sb.append ("\n").append (msg.msg ("MSG_NestedThrowables")).append ("\n");
+ sb.append ("\n").append (MSG.msg ("MSG_NestedThrowables")).append ("\n");
Throwable exception = nested[0];
sb.append (exception==null?"null":exception.toString()); //NOI18N
for (int i=1; i<len; ++i) {
@@ -242,7 +242,7 @@ public class JDOException extends java.lang.RuntimeException {
inPrintStackTrace = true;
super.printStackTrace(s);
if (len > 0) {
- s.println (msg.msg ("MSG_NestedThrowablesStackTrace"));
+ s.println (MSG.msg ("MSG_NestedThrowablesStackTrace"));
for (int i=0; i<len; ++i) {
Throwable exception = nested[i];
if (exception != null) {
@@ -266,7 +266,7 @@ public class JDOException extends java.lang.RuntimeException {
inPrintStackTrace = true;
super.printStackTrace(s);
if (len > 0) {
- s.println (msg.msg ("MSG_NestedThrowablesStackTrace"));
+ s.println (MSG.msg ("MSG_NestedThrowablesStackTrace"));
for (int i=0; i<len; ++i) {
Throwable exception = nested[i];
if (exception != null) {
diff --git a/api/src/main/java/javax/jdo/JDOHelper.java b/api/src/main/java/javax/jdo/JDOHelper.java
index fb479b84..b4b629de 100644
--- a/api/src/main/java/javax/jdo/JDOHelper.java
+++ b/api/src/main/java/javax/jdo/JDOHelper.java
@@ -50,7 +50,6 @@ import javax.jdo.spi.JDOImplHelper;
import javax.jdo.spi.JDOImplHelper.StateInterrogationBooleanReturn;
import javax.jdo.spi.JDOImplHelper.StateInterrogationObjectReturn;
import javax.jdo.spi.PersistenceCapable;
-import javax.jdo.spi.StateInterrogation;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -94,7 +93,7 @@ public class JDOHelper implements Constants {
/** The Internationalization message helper.
*/
- private final static I18NHelper msg =
+ private final static I18NHelper MSG =
I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N
/**
@@ -175,13 +174,13 @@ public class JDOHelper implements Constants {
/** The JDOImplHelper instance used for handling non-binary-compatible
* implementations.
*/
- private static JDOImplHelper implHelper =
+ private static final JDOImplHelper IMPL_HELPER =
doPrivileged((PrivilegedAction<JDOImplHelper>) JDOImplHelper::getInstance);
/** The singleton instance of JDOHelper.
* @since 2.1
*/
- private static JDOHelper instance = new JDOHelper();
+ private static final JDOHelper INSTANCE = new JDOHelper();
/**
* Return the singleton instance of JDOHelper. This instance is
@@ -190,7 +189,7 @@ public class JDOHelper implements Constants {
* @return the thread-safe singleton JDOHelper
*/
public static JDOHelper getInstance() {
- return instance;
+ return INSTANCE;
}
/** Some applications might prefer to use instance
@@ -202,61 +201,61 @@ public class JDOHelper implements Constants {
/** The stateless instance used for handling non-binary-compatible
* implementations of getPersistenceManager.
*/
- static StateInterrogationObjectReturn getPersistenceManager =
+ static final StateInterrogationObjectReturn getPersistenceManager =
(pc, si) -> si.getPersistenceManager(pc);
/** The stateless instance used for handling non-binary-compatible
* implementations of getObjectId.
*/
- static StateInterrogationObjectReturn getObjectId =
+ static final StateInterrogationObjectReturn getObjectId =
(pc, si) -> si.getObjectId(pc);
/** The stateless instance used for handling non-binary-compatible
* implementations of getTransactionalObjectId.
*/
- static StateInterrogationObjectReturn getTransactionalObjectId =
+ static final StateInterrogationObjectReturn getTransactionalObjectId =
(pc, si) -> si.getTransactionalObjectId(pc);
/** The stateless instance used for handling non-binary-compatible
* implementations of getVersion.
*/
- static StateInterrogationObjectReturn getVersion =
+ static final StateInterrogationObjectReturn getVersion =
(pc, si) -> si.getVersion(pc);
/** The stateless instance used for handling non-binary-compatible
* implementations of isPersistent.
*/
- static StateInterrogationBooleanReturn isPersistent =
+ static final StateInterrogationBooleanReturn isPersistent =
(pc, si) -> si.isPersistent(pc);
/** The stateless instance used for handling non-binary-compatible
* implementations of isTransactional.
*/
- static StateInterrogationBooleanReturn isTransactional =
+ static final StateInterrogationBooleanReturn isTransactional =
(pc, si) -> si.isTransactional(pc);
/** The stateless instance used for handling non-binary-compatible
* implementations of isDirty.
*/
- static StateInterrogationBooleanReturn isDirty =
+ static final StateInterrogationBooleanReturn isDirty =
(pc, si) -> si.isDirty(pc);
/** The stateless instance used for handling non-binary-compatible
* implementations of isNew.
*/
- static StateInterrogationBooleanReturn isNew =
+ static final StateInterrogationBooleanReturn isNew =
(pc, si) -> si.isNew(pc);
/** The stateless instance used for handling non-binary-compatible
* implementations of isDeleted.
*/
- static StateInterrogationBooleanReturn isDeleted =
+ static final StateInterrogationBooleanReturn isDeleted =
(pc, si) -> si.isDeleted(pc);
/** The stateless instance used for handling non-binary-compatible
* implementations of isDetached.
*/
- static StateInterrogationBooleanReturn isDetached =
+ static final StateInterrogationBooleanReturn isDetached =
(pc, si) -> si.isDetached(pc);
/** Return the associated <code>PersistenceManager</code> if there is one.
@@ -276,7 +275,7 @@ public class JDOHelper implements Constants {
return ((PersistenceCapable)pc).jdoGetPersistenceManager();
} else {
return (PersistenceManager)
- implHelper.nonBinaryCompatibleGet(pc, getPersistenceManager);
+ IMPL_HELPER.nonBinaryCompatibleGet(pc, getPersistenceManager);
}
}
@@ -297,7 +296,7 @@ public class JDOHelper implements Constants {
if (pc instanceof PersistenceCapable) {
((PersistenceCapable)pc).jdoMakeDirty(fieldName);
} else {
- implHelper.nonBinaryCompatibleMakeDirty(pc, fieldName);
+ IMPL_HELPER.nonBinaryCompatibleMakeDirty(pc, fieldName);
}
}
@@ -335,7 +334,7 @@ public class JDOHelper implements Constants {
if (pc instanceof PersistenceCapable) {
return ((PersistenceCapable)pc).jdoGetObjectId();
} else {
- return implHelper.nonBinaryCompatibleGet(pc, getObjectId);
+ return IMPL_HELPER.nonBinaryCompatibleGet(pc, getObjectId);
}
}
@@ -392,7 +391,7 @@ public class JDOHelper implements Constants {
if (pc instanceof PersistenceCapable) {
return ((PersistenceCapable)pc).jdoGetTransactionalObjectId();
} else {
- return implHelper.nonBinaryCompatibleGet(
+ return IMPL_HELPER.nonBinaryCompatibleGet(
pc, getTransactionalObjectId);
}
}
@@ -407,7 +406,7 @@ public class JDOHelper implements Constants {
if (pc instanceof PersistenceCapable) {
return ((PersistenceCapable)pc).jdoGetVersion();
} else {
- return implHelper.nonBinaryCompatibleGet(pc, getVersion);
+ return IMPL_HELPER.nonBinaryCompatibleGet(pc, getVersion);
}
}
/** Tests whether the parameter instance is dirty.
@@ -429,7 +428,7 @@ public class JDOHelper implements Constants {
if (pc instanceof PersistenceCapable) {
return ((PersistenceCapable)pc).jdoIsDirty();
} else {
- return implHelper.nonBinaryCompatibleIs(pc, isDirty);
+ return IMPL_HELPER.nonBinaryCompatibleIs(pc, isDirty);
}
}
@@ -448,7 +447,7 @@ public class JDOHelper implements Constants {
if (pc instanceof PersistenceCapable) {
return ((PersistenceCapable)pc).jdoIsTransactional();
} else {
- return implHelper.nonBinaryCompatibleIs(pc, isTransactional);
+ return IMPL_HELPER.nonBinaryCompatibleIs(pc, isTransactional);
}
}
@@ -469,7 +468,7 @@ public class JDOHelper implements Constants {
if (pc instanceof PersistenceCapable) {
return ((PersistenceCapable)pc).jdoIsPersistent();
} else {
- return implHelper.nonBinaryCompatibleIs(pc, isPersistent);
+ return IMPL_HELPER.nonBinaryCompatibleIs(pc, isPersistent);
}
}
@@ -491,7 +490,7 @@ public class JDOHelper implements Constants {
if (pc instanceof PersistenceCapable) {
return ((PersistenceCapable)pc).jdoIsNew();
} else {
- return implHelper.nonBinaryCompatibleIs(pc, isNew);
+ return IMPL_HELPER.nonBinaryCompatibleIs(pc, isNew);
}
}
@@ -513,7 +512,7 @@ public class JDOHelper implements Constants {
if (pc instanceof PersistenceCapable) {
return ((PersistenceCapable)pc).jdoIsDeleted();
} else {
- return implHelper.nonBinaryCompatibleIs(pc, isDeleted);
+ return IMPL_HELPER.nonBinaryCompatibleIs(pc, isDeleted);
}
}
@@ -533,7 +532,7 @@ public class JDOHelper implements Constants {
if (pc instanceof PersistenceCapable) {
return ((PersistenceCapable)pc).jdoIsDetached();
} else {
- return implHelper.nonBinaryCompatibleIs(pc, isDetached);
+ return IMPL_HELPER.nonBinaryCompatibleIs(pc, isDetached);
}
}
@@ -752,7 +751,7 @@ public class JDOHelper implements Constants {
List<Throwable> exceptions = new ArrayList<>();
if (pmfClassLoader == null)
- throw new JDOFatalUserException (msg.msg (
+ throw new JDOFatalUserException (MSG.msg (
"EXC_GetPMFNullLoader")); //NOI18N
JDOImplHelper.assertOnlyKnownStandardProperties(overrides);
@@ -816,7 +815,7 @@ public class JDOHelper implements Constants {
// no PMF class name in props and no services.
- throw new JDOFatalUserException(msg.msg(
+ throw new JDOFatalUserException(MSG.msg(
"EXC_GetPMFNoPMFClassNamePropertyOrPUNameProperty"),
exceptions.toArray(new Throwable[exceptions.size()]));
}
@@ -1021,10 +1020,10 @@ public class JDOHelper implements Constants {
ClassLoader resourceLoader,
ClassLoader pmfLoader) {
if (pmfLoader == null)
- throw new JDOFatalUserException (msg.msg (
+ throw new JDOFatalUserException (MSG.msg (
"EXC_GetPMFNullPMFLoader")); //NOI18N
if (resourceLoader == null) {
- throw new JDOFatalUserException(msg.msg(
+ throw new JDOFatalUserException(MSG.msg(
"EXC_GetPMFNullPropsLoader")); //NOI18N
}
@@ -1061,7 +1060,7 @@ public class JDOHelper implements Constants {
}
// no PMF found; give up
- throw new JDOFatalUserException (msg.msg (
+ throw new JDOFatalUserException (MSG.msg (
"EXC_NoPMFConfigurableViaPropertiesOrXML", name)); //NOI18N
}
@@ -1090,31 +1089,31 @@ public class JDOHelper implements Constants {
(PersistenceManagerFactory) invoke(m,
null, new Object[]{overrides, properties});
if (pmf == null) {
- throw new JDOFatalInternalException(msg.msg (
+ throw new JDOFatalInternalException(MSG.msg (
"EXC_GetPMFNullPMF", pmfClassName)); //NOI18N
}
return pmf;
} catch (ClassNotFoundException e) {
- throw new JDOFatalUserException(msg.msg(
+ throw new JDOFatalUserException(MSG.msg(
"EXC_GetPMFClassNotFound", pmfClassName), e); //NOI18N
} catch (NoSuchMethodException e) {
- throw new JDOFatalInternalException(msg.msg(
+ throw new JDOFatalInternalException(MSG.msg(
"EXC_GetPMFNoSuchMethod2", pmfClassName), e); //NOI18N
} catch (NullPointerException e) {
- throw new JDOFatalInternalException (msg.msg(
+ throw new JDOFatalInternalException (MSG.msg(
"EXC_GetPMFNullPointerException", pmfClassName), e); //NOI18N
} catch (IllegalAccessException e) {
- throw new JDOFatalUserException(msg.msg(
+ throw new JDOFatalUserException(MSG.msg(
"EXC_GetPMFIllegalAccess", pmfClassName), e); //NOI18N
} catch (ClassCastException e) {
- throw new JDOFatalInternalException (msg.msg(
+ throw new JDOFatalInternalException (MSG.msg(
"EXC_GetPMFClassCastException", pmfClassName), e); //NOI18N
} catch (InvocationTargetException ite) {
Throwable nested = ite.getTargetException();
if (nested instanceof JDOException) {
throw (JDOException)nested;
- } else throw new JDOFatalInternalException (msg.msg(
+ } else throw new JDOFatalInternalException (MSG.msg(
"EXC_GetPMFUnexpectedException"), ite); //NOI18N
}
} else {
@@ -1128,30 +1127,30 @@ public class JDOHelper implements Constants {
(PersistenceManagerFactory) invoke(m,
null, new Object[]{properties});
if (pmf == null) {
- throw new JDOFatalInternalException(msg.msg (
+ throw new JDOFatalInternalException(MSG.msg (
"EXC_GetPMFNullPMF", pmfClassName)); //NOI18N
}
return pmf;
} catch (ClassNotFoundException e) {
- throw new JDOFatalUserException(msg.msg(
+ throw new JDOFatalUserException(MSG.msg(
"EXC_GetPMFClassNotFound", pmfClassName), e); //NOI18N
} catch (NoSuchMethodException e) {
- throw new JDOFatalInternalException(msg.msg(
+ throw new JDOFatalInternalException(MSG.msg(
"EXC_GetPMFNoSuchMethod", pmfClassName), e); //NOI18N
} catch (NullPointerException e) {
- throw new JDOFatalInternalException (msg.msg(
+ throw new JDOFatalInternalException (MSG.msg(
"EXC_GetPMFNullPointerException", pmfClassName), e); //NOI18N
} catch (IllegalAccessException e) {
- throw new JDOFatalUserException(msg.msg(
+ throw new JDOFatalUserException(MSG.msg(
"EXC_GetPMFIllegalAccess", pmfClassName), e); //NOI18N
} catch (ClassCastException e) {
- throw new JDOFatalInternalException (msg.msg(
+ throw new JDOFatalInternalException (MSG.msg(
"EXC_GetPMFClassCastException", pmfClassName), e); //NOI18N
} catch (InvocationTargetException ite) {
Throwable nested = ite.getTargetException();
if (nested instanceof JDOException) {
throw (JDOException)nested;
- } else throw new JDOFatalInternalException (msg.msg(
+ } else throw new JDOFatalInternalException (MSG.msg(
"EXC_GetPMFUnexpectedException"), ite); //NOI18N
}
}
@@ -1177,7 +1176,7 @@ public class JDOHelper implements Constants {
props.load(in);
}
} catch (IOException ioe) {
- throw new JDOFatalUserException(msg.msg(
+ throw new JDOFatalUserException(MSG.msg(
"EXC_GetPMFIOExceptionRsrc", name), ioe); //NOI18N
} finally {
if (in != null) {
@@ -1266,7 +1265,7 @@ public class JDOHelper implements Constants {
}
if (propertiesByNameInAllConfigs.containsKey(name))
- throw new JDOFatalUserException (msg.msg(
+ throw new JDOFatalUserException (MSG.msg(
"EXC_DuplicateRequestedNamedPMFFoundInDifferentConfigs",
"".equals(name)
? "(anonymous)"
@@ -1282,10 +1281,10 @@ public class JDOHelper implements Constants {
}
catch (FactoryConfigurationError e) {
throw new JDOFatalUserException(
- msg.msg("ERR_NoDocumentBuilderFactory"), e);
+ MSG.msg("ERR_NoDocumentBuilderFactory"), e);
}
catch (IOException ioe) {
- throw new JDOFatalUserException (msg.msg (
+ throw new JDOFatalUserException (MSG.msg (
"EXC_GetPMFIOExceptionRsrc", name), ioe); //NOI18N
}
@@ -1298,7 +1297,7 @@ public class JDOHelper implements Constants {
protected static DocumentBuilderFactory getDocumentBuilderFactory() {
@SuppressWarnings("static-access")
DocumentBuilderFactory factory =
- implHelper.getRegisteredDocumentBuilderFactory();
+ IMPL_HELPER.getRegisteredDocumentBuilderFactory();
if (factory == null) {
factory = getDefaultDocumentBuilderFactory();
}
@@ -1318,7 +1317,7 @@ public class JDOHelper implements Constants {
protected static ErrorHandler getErrorHandler() {
@SuppressWarnings("static-access")
- ErrorHandler handler = implHelper.getRegisteredErrorHandler();
+ ErrorHandler handler = IMPL_HELPER.getRegisteredErrorHandler();
if (handler == null) {
handler = getDefaultErrorHandler();
}
@@ -1375,7 +1374,7 @@ public class JDOHelper implements Constants {
Element root = doc.getDocumentElement();
if (root == null) {
throw new JDOFatalUserException(
- msg.msg("EXC_InvalidJDOConfigNoRoot", url.toExternalForm())
+ MSG.msg("EXC_InvalidJDOConfigNoRoot", url.toExternalForm())
);
}
@@ -1414,7 +1413,7 @@ public class JDOHelper implements Constants {
if (!isNullOrBlank(pmfNameFromElem)) {
// exception -- PMF name given as both att & elem
throw new JDOFatalUserException(
- msg.msg(
+ MSG.msg(
"EXC_DuplicatePMFNamePropertyFoundWithinConfig",
pmfNameFromAtts,
pmfNameFromElem,
@@ -1430,7 +1429,7 @@ public class JDOHelper implements Constants {
String property = (String) o;
if (pmfPropertiesFromElements.contains(property)) {
throw new JDOFatalUserException(
- msg.msg(
+ MSG.msg(
"EXC_DuplicatePropertyFound",
property,
pmfName,
@@ -1449,7 +1448,7 @@ public class JDOHelper implements Constants {
if (pmfName.equals(requestedPMFName)
&& propertiesByName.containsKey(pmfName)) {
- throw new JDOFatalUserException(msg.msg(
+ throw new JDOFatalUserException(MSG.msg(
"EXC_DuplicateRequestedNamedPMFFoundInSameConfig",
pmfName,
url.toExternalForm()));
@@ -1460,17 +1459,17 @@ public class JDOHelper implements Constants {
}
catch (IOException ioe) {
throw new JDOFatalUserException(
- msg.msg("EXC_GetPMFIOExceptionRsrc", url.toString()),
+ MSG.msg("EXC_GetPMFIOExceptionRsrc", url.toString()),
ioe); //NOI18N
}
catch (ParserConfigurationException e) {
throw new JDOFatalInternalException(
- msg.msg("EXC_ParserConfigException"),
+ MSG.msg("EXC_ParserConfigException"),
e);
}
catch (SAXParseException e) {
throw new JDOFatalUserException(
- msg.msg(
+ MSG.msg(
"EXC_SAXParseException",
url.toExternalForm(),
e.getLineNumber(),
@@ -1479,7 +1478,7 @@ public class JDOHelper implements Constants {
}
catch (SAXException e) {
throw new JDOFatalUserException(
- msg.msg("EXC_SAXException", url.toExternalForm()),
+ MSG.msg("EXC_SAXException", url.toExternalForm()),
e);
}
catch (JDOException e) {
@@ -1487,7 +1486,7 @@ public class JDOHelper implements Constants {
}
catch (RuntimeException e) {
throw new JDOFatalUserException(
- msg.msg("EXC_SAXException", url.toExternalForm()),
+ MSG.msg("EXC_SAXException", url.toExternalForm()),
e);
}
finally {
@@ -1547,12 +1546,12 @@ public class JDOHelper implements Constants {
Node nameAtt = attributes.getNamedItem(PROPERTY_ATTRIBUTE_NAME);
if (nameAtt == null) {
throw new JDOFatalUserException(
- msg.msg("EXC_PropertyElementHasNoNameAttribute", url));
+ MSG.msg("EXC_PropertyElementHasNoNameAttribute", url));
}
String name = nameAtt.getNodeValue().trim();
if ("".equals(name)) {
throw new JDOFatalUserException(
- msg.msg(
+ MSG.msg(
"EXC_PropertyElementNameAttributeHasNoValue",
name,
url));
@@ -1569,7 +1568,7 @@ public class JDOHelper implements Constants {
if (p.containsKey(propertyName)) {
throw new JDOFatalUserException(
- msg.msg(
+ MSG.msg(
"EXC_DuplicatePropertyNameGivenInPropertyElement",
propertyName,
url));
@@ -1592,14 +1591,14 @@ public class JDOHelper implements Constants {
INSTANCE_LIFECYCLE_LISTENER_ATTRIBUTE_LISTENER);
if (listenerAtt == null) {
throw new JDOFatalUserException(
- msg.msg(
+ MSG.msg(
"EXC_MissingListenerAttribute",
url));
}
String listener = listenerAtt.getNodeValue().trim();
if ("".equals(listener)) {
throw new JDOFatalUserException(
- msg.msg(
+ MSG.msg(
"EXC_MissingListenerAttributeValue",
url));
}
@@ -1661,7 +1660,7 @@ public class JDOHelper implements Constants {
public static PersistenceManagerFactory getPersistenceManagerFactory
(File propsFile, ClassLoader loader) {
if (propsFile == null)
- throw new JDOFatalUserException (msg.msg (
+ throw new JDOFatalUserException (MSG.msg (
"EXC_GetPMFNullFile")); //NOI18N
InputStream in = null;
@@ -1669,7 +1668,7 @@ public class JDOHelper implements Constants {
in = new FileInputStream(propsFile);
return getPersistenceManagerFactory(in, loader);
} catch (FileNotFoundException fnfe) {
- throw new JDOFatalUserException (msg.msg (
+ throw new JDOFatalUserException (MSG.msg (
"EXC_GetPMFNoFile", propsFile), fnfe); //NOI18N
} finally {
if (in != null)
@@ -1722,10 +1721,10 @@ public class JDOHelper implements Constants {
public static PersistenceManagerFactory getPersistenceManagerFactory
(String jndiLocation, Context context, ClassLoader loader) {
if (jndiLocation == null)
- throw new JDOFatalUserException (msg.msg (
+ throw new JDOFatalUserException (MSG.msg (
"EXC_GetPMFNullJndiLoc")); //NOI18N
if (loader == null)
- throw new JDOFatalUserException (msg.msg (
+ throw new JDOFatalUserException (MSG.msg (
"EXC_GetPMFNullLoader")); //NOI18N
try {
if (context == null)
@@ -1735,7 +1734,7 @@ public class JDOHelper implements Constants {
return (PersistenceManagerFactory) PortableRemoteObject.narrow
(o, PersistenceManagerFactory.class);
} catch (NamingException ne) {
- throw new JDOFatalUserException (msg.msg (
+ throw new JDOFatalUserException (MSG.msg (
"EXC_GetPMFNamingException", jndiLocation, loader), ne); //NOI18N
}
}
@@ -1774,7 +1773,7 @@ public class JDOHelper implements Constants {
public static PersistenceManagerFactory getPersistenceManagerFactory
(InputStream stream, ClassLoader loader) {
if (stream == null)
- throw new JDOFatalUserException (msg.msg (
+ throw new JDOFatalUserException (MSG.msg (
"EXC_GetPMFNullStream")); //NOI18N
Properties props = new Properties ();
@@ -1782,7 +1781,7 @@ public class JDOHelper implements Constants {
props.load (stream);
} catch (IOException ioe) {
throw new JDOFatalUserException
- (msg.msg ("EXC_GetPMFIOExceptionStream"), ioe); //NOI18N
+ (MSG.msg ("EXC_GetPMFIOExceptionStream"), ioe); //NOI18N
}
return getPersistenceManagerFactory (props, loader);
}
@@ -1845,7 +1844,7 @@ public class JDOHelper implements Constants {
exceptions.add(ex);
}
- throw new JDOFatalUserException(msg.msg("EXC_GetEnhancerNoValidEnhancerAvailable", numberOfJDOEnhancers),
+ throw new JDOFatalUserException(MSG.msg("EXC_GetEnhancerNoValidEnhancerAvailable", numberOfJDOEnhancers),
exceptions.toArray(new Throwable[exceptions.size()]));
}
diff --git a/api/src/main/java/javax/jdo/identity/CharIdentity.java b/api/src/main/java/javax/jdo/identity/CharIdentity.java
index 80f86922..3b1270af 100644
--- a/api/src/main/java/javax/jdo/identity/CharIdentity.java
+++ b/api/src/main/java/javax/jdo/identity/CharIdentity.java
@@ -35,10 +35,6 @@ public class CharIdentity extends SingleFieldIdentity<CharIdentity> {
private static final long serialVersionUID = 1L;
- /** The Internationalization message helper.
- */
- private static I18NHelper msg = I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N
-
/** The key.
*/
private char key;
@@ -77,7 +73,7 @@ public class CharIdentity extends SingleFieldIdentity<CharIdentity> {
assertKeyNotNull(str);
if (str.length() != 1)
throw new IllegalArgumentException(
- msg.msg("EXC_StringWrongLength")); //NOI18N
+ MSG.msg("EXC_StringWrongLength")); //NOI18N
construct(str.charAt(0));
}
diff --git a/api/src/main/java/javax/jdo/identity/ObjectIdentity.java b/api/src/main/java/javax/jdo/identity/ObjectIdentity.java
index a3285842..df9b5b9b 100644
--- a/api/src/main/java/javax/jdo/identity/ObjectIdentity.java
+++ b/api/src/main/java/javax/jdo/identity/ObjectIdentity.java
@@ -47,7 +47,7 @@ public class ObjectIdentity extends SingleFieldIdentity<ObjectIdentity> {
/** The JDOImplHelper instance used for parsing the String to an Object.
*/
- private static JDOImplHelper helper = doPrivileged(JDOImplHelper::getInstance);
+ private static final JDOImplHelper HELPER = doPrivileged(JDOImplHelper::getInstance);
@SuppressWarnings("unchecked")
private static <T> T doPrivileged(PrivilegedAction<T> privilegedAction) {
@@ -81,20 +81,20 @@ public class ObjectIdentity extends SingleFieldIdentity<ObjectIdentity> {
paramString = (String)param;
if (paramString.length() < 3) {
throw new JDOUserException(
- msg.msg("EXC_ObjectIdentityStringConstructionTooShort") + //NOI18N
- msg.msg("EXC_ObjectIdentityStringConstructionUsage", //NOI18N
+ MSG.msg("EXC_ObjectIdentityStringConstructionTooShort") + //NOI18N
+ MSG.msg("EXC_ObjectIdentityStringConstructionUsage", //NOI18N
paramString));
}
int indexOfDelimiter = paramString.indexOf(STRING_DELIMITER);
if (indexOfDelimiter < 0) {
throw new JDOUserException(
- msg.msg("EXC_ObjectIdentityStringConstructionNoDelimiter") + //NOI18N
- msg.msg("EXC_ObjectIdentityStringConstructionUsage", //NOI18N
+ MSG.msg("EXC_ObjectIdentityStringConstructionNoDelimiter") + //NOI18N
+ MSG.msg("EXC_ObjectIdentityStringConstructionUsage", //NOI18N
paramString));
}
keyString = paramString.substring(indexOfDelimiter+1);
className = paramString.substring(0, indexOfDelimiter);
- keyAsObject = helper.construct(className, keyString);
+ keyAsObject = HELPER.construct(className, keyString);
} else {
keyAsObject = param;
}
diff --git a/api/src/main/java/javax/jdo/identity/SingleFieldIdentity.java b/api/src/main/java/javax/jdo/identity/SingleFieldIdentity.java
index 981bc71d..7fb0b3f5 100644
--- a/api/src/main/java/javax/jdo/identity/SingleFieldIdentity.java
+++ b/api/src/main/java/javax/jdo/identity/SingleFieldIdentity.java
@@ -46,7 +46,7 @@ public abstract class SingleFieldIdentity<SUBCLASS extends SingleFieldIdentity<S
/** The Internationalization message helper.
*/
- protected static I18NHelper msg = I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N
+ protected static final I18NHelper MSG = I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N
/** The class of the target object.
*/
@@ -99,7 +99,7 @@ public abstract class SingleFieldIdentity<SUBCLASS extends SingleFieldIdentity<S
protected void assertKeyNotNull(Object key) {
if (key == null) {
throw new JDONullIdentityException(
- msg.msg("EXC_SingleFieldIdentityNullParameter")); //NOI18N
+ MSG.msg("EXC_SingleFieldIdentityNullParameter")); //NOI18N
}
}
@@ -137,7 +137,7 @@ public abstract class SingleFieldIdentity<SUBCLASS extends SingleFieldIdentity<S
*/
protected Object createKeyAsObject() {
throw new JDOFatalInternalException
- (msg.msg("EXC_CreateKeyAsObjectMustNotBeCalled"));
+ (MSG.msg("EXC_CreateKeyAsObjectMustNotBeCalled"));
}
/** Check the class and class name and object type. If restored
diff --git a/api/src/main/java/javax/jdo/spi/I18NHelper.java b/api/src/main/java/javax/jdo/spi/I18NHelper.java
index 304e082b..65774b8b 100644
--- a/api/src/main/java/javax/jdo/spi/I18NHelper.java
+++ b/api/src/main/java/javax/jdo/spi/I18NHelper.java
@@ -50,15 +50,15 @@ public class I18NHelper {
/** Bundles that have already been loaded
*/
- private static Hashtable<String,ResourceBundle> bundles = new Hashtable<>();
+ private static final Hashtable<String,ResourceBundle> bundles = new Hashtable<>();
/** Helper instances that have already been created
*/
- private static Hashtable<String,I18NHelper> helpers = new Hashtable<>();
+ private static final Hashtable<String,I18NHelper> helpers = new Hashtable<>();
/** The default locale for this VM.
*/
- private static Locale locale = Locale.getDefault();
+ private static final Locale locale = Locale.getDefault();
/** The bundle used by this instance of the helper.
*/
@@ -69,7 +69,7 @@ public class I18NHelper {
private Throwable failure = null;
/** The unqualified standard name of a bundle. */
- private static final String bundleSuffix = ".Bundle"; // NOI18N
+ private static final String BUNDLE_SUFFIX = ".Bundle"; // NOI18N
/** Constructor */
private I18NHelper() {
@@ -107,7 +107,7 @@ public class I18NHelper {
*/
public static I18NHelper getInstance (final Class<?> cls) {
ClassLoader classLoader = doPrivileged (cls::getClassLoader);
- String bundle = getPackageName (cls.getName()) + bundleSuffix;
+ String bundle = getPackageName (cls.getName()) + BUNDLE_SUFFIX;
return getInstance (bundle, classLoader);
}
diff --git a/api/src/main/java/javax/jdo/spi/JDOImplHelper.java b/api/src/main/java/javax/jdo/spi/JDOImplHelper.java
index b1cd91e7..ec271d54 100644
--- a/api/src/main/java/javax/jdo/spi/JDOImplHelper.java
+++ b/api/src/main/java/javax/jdo/spi/JDOImplHelper.java
@@ -77,7 +77,7 @@ public class JDOImplHelper extends java.lang.Object {
* are added by the static method in each <code>PersistenceCapable</code>
* class. Entries are never removed.
*/
- private static Map<Class<?>,Meta> registeredClasses =
+ private static final Map<Class<?>,Meta> registeredClasses =
Collections.synchronizedMap(new HashMap<> ());
/** This Set contains all classes that have registered for setStateManager
@@ -100,7 +100,7 @@ public class JDOImplHelper extends java.lang.Object {
/** The singleton <code>JDOImplHelper</code> instance.
*/
- private static JDOImplHelper jdoImplHelper = new JDOImplHelper();
+ private static final JDOImplHelper jdoImplHelper = new JDOImplHelper();
/** The Internationalization message helper.
*/
@@ -938,7 +938,7 @@ public class JDOImplHelper extends java.lang.Object {
* for the Model at runtime. The field
* is passed by the static class initialization.
*/
- String[] fieldNames;
+ final String[] fieldNames;
/** Get the field names from the metadata.
* @return the array of field names.
@@ -951,7 +951,7 @@ public class JDOImplHelper extends java.lang.Object {
* for the Model at runtime. The field
* is passed by the static class initialization.
*/
- Class<?>[] fieldTypes;
+ final Class<?>[] fieldTypes;
/** Get the field types from the metadata.
* @return the array of field types.
@@ -964,7 +964,7 @@ public class JDOImplHelper extends java.lang.Object {
* for the Model at runtime. The field
* is passed by the static class initialization.
*/
- byte[] fieldFlags;
+ final byte[] fieldFlags;
/** Get the field types from the metadata.
* @return the array of field types.
@@ -976,7 +976,7 @@ public class JDOImplHelper extends java.lang.Object {
/** This is the <code>Class</code> instance of the
* <code>PersistenceCapable</code> superclass.
*/
- Class<?> persistenceCapableSuperclass;
+ final Class<?> persistenceCapableSuperclass;
/** Return the <code>PersistenceCapable</code> superclass.
* @return the <code>PersistenceCapable</code> superclass
@@ -987,7 +987,7 @@ public class JDOImplHelper extends java.lang.Object {
/** This is an instance of <code>PersistenceCapable</code>,
* used at runtime to create new instances.
*/
- PersistenceCapable pc;
+ final PersistenceCapable pc;
/** Get an instance of the <code>PersistenceCapable</code> class.
* @return an instance of the <code>PersistenceCapable Class</code>.
diff --git a/api/src/main/java/javax/jdo/spi/RegisterClassEvent.java b/api/src/main/java/javax/jdo/spi/RegisterClassEvent.java
index 960b4a8b..6d909527 100644
--- a/api/src/main/java/javax/jdo/spi/RegisterClassEvent.java
+++ b/api/src/main/java/javax/jdo/spi/RegisterClassEvent.java
@@ -35,19 +35,19 @@ public class RegisterClassEvent extends EventObject
private static final long serialVersionUID = 945917130591776973L;
/** The class object of the registered persistence-capable class */
- protected Class<?> pcClass;
+ protected final Class<?> pcClass;
/** The names of managed fields of the persistence-capable class */
- protected String[] fieldNames;
+ protected final String[] fieldNames;
/** The types of managed fields of the persistence-capable class */
- protected Class<?>[] fieldTypes;
+ protected final Class<?>[] fieldTypes;
/** The flags of managed fields of the persistence-capable class */
- protected byte[] fieldFlags;
+ protected final byte[] fieldFlags;
/** */
- protected Class<?> persistenceCapableSuperclass;
+ protected final Class<?> persistenceCapableSuperclass;
/**
* Constructs a new <code>RegisterClassEvent</code>.
diff --git a/api/src/test/java/javax/jdo/AbstractJDOConfigTest.java b/api/src/test/java/javax/jdo/AbstractJDOConfigTest.java
index 0a25fe45..96bf1b35 100644
--- a/api/src/test/java/javax/jdo/AbstractJDOConfigTest.java
+++ b/api/src/test/java/javax/jdo/AbstractJDOConfigTest.java
@@ -31,7 +31,7 @@ public abstract class AbstractJDOConfigTest extends AbstractTest {
* A class path prefix used in the various tests where the class path
* needs to be set.
*/
- protected static String JDOCONFIG_CLASSPATH_PREFIX
+ protected static final String JDOCONFIG_CLASSPATH_PREFIX
= initJDOConfigClasspathPrefix();
/**
@@ -50,7 +50,7 @@ public abstract class AbstractJDOConfigTest extends AbstractTest {
* The class path used to specify the location of test class files.
* @return the class path where test class files can be found.
*/
- protected static String TEST_CLASSPATH = initTestClasspath();
+ protected static final String TEST_CLASSPATH = initTestClasspath();
/**
* Returns the default class path for JDO test class files
@@ -64,7 +64,7 @@ public abstract class AbstractJDOConfigTest extends AbstractTest {
/**
* The class path used to locate the JDO API class files.
*/
- protected static String API_CLASSPATH = initAPIClasspath();
+ protected static final String API_CLASSPATH = initAPIClasspath();
/**
* Returns the default class path for JDO API class files
@@ -99,7 +99,7 @@ public abstract class AbstractJDOConfigTest extends AbstractTest {
/**
* A randomizer seeded with the system clock's current time.
*/
- protected static Random RANDOM = new Random(System.currentTimeMillis());
+ protected static final Random RANDOM = new Random(System.currentTimeMillis());
/**
* Fails the test if the number of properties in the two specified
diff --git a/api/src/test/java/javax/jdo/EnhancerTest.java b/api/src/test/java/javax/jdo/EnhancerTest.java
index 4e8046c1..7f9baf0f 100644
--- a/api/src/test/java/javax/jdo/EnhancerTest.java
+++ b/api/src/test/java/javax/jdo/EnhancerTest.java
@@ -38,10 +38,10 @@ import javax.jdo.util.BatchTestRunner;
public class EnhancerTest extends AbstractTest {
/** The path delimiter for constructing classpaths. */
- private static String pathDelimiter = System.getProperty("path.separator");
+ private static final String PATH_DELIMITER = System.getProperty("path.separator");
/** The maven basedir identifying the directory of the execution environment. */
- private static String basedir = System.getProperty("basedir");
+ private static final String BASEDIR = System.getProperty("basedir");
/**
* Main
@@ -192,7 +192,7 @@ public class EnhancerTest extends AbstractTest {
// invoke enhancer with a classpath parameter
// JDOHelper must be loadable from this path
// the File.toURI should append "/" to the path, so only "target/classes" is needed
- InvocationResult result = invokeEnhancer("-v -cp " + basedir + "/target/classes");
+ InvocationResult result = invokeEnhancer("-v -cp " + BASEDIR + "/target/classes");
String outputString = result.getOutputString();
String errorString = result.getErrorString();
assertEquals("Wrong exit code from Enhancer with stderr:\n" + errorString, 0, result.getExitValue());
@@ -214,11 +214,11 @@ public class EnhancerTest extends AbstractTest {
// JDOHelper must be loadable from this path
// create the jar file from the target/classes directory
String uuid = UUID.randomUUID().toString();
- File uuidDir = new File(basedir + "/target/" + uuid);
+ File uuidDir = new File(BASEDIR + "/target/" + uuid);
uuidDir.mkdirs();
String enhancerJar = "target/" + uuid + "/enhancer-test.jar";
- String enhancerJarPathname = basedir + "/" + enhancerJar;
- Process create = Runtime.getRuntime().exec("jar -cf " + enhancerJarPathname + " -C " + basedir + "/target/classes .");
+ String enhancerJarPathname = BASEDIR + "/" + enhancerJar;
+ Process create = Runtime.getRuntime().exec("jar -cf " + enhancerJarPathname + " -C " + BASEDIR + "/target/classes .");
int returnCode = create.waitFor();
assertEquals("jar command returned wrong return code.", 0, returnCode);
// find the jdo.jar in target
@@ -246,7 +246,7 @@ public class EnhancerTest extends AbstractTest {
public void testDir() {
// invoke enhancer with directory and not recurse
- InvocationResult result = invokeEnhancer("-v " + basedir + "/target/test-classes/enhancer-test-dir");
+ InvocationResult result = invokeEnhancer("-v " + BASEDIR + "/target/test-classes/enhancer-test-dir");
String outputString = result.getOutputString();
String errorString = result.getErrorString();
assertEquals("Wrong exit code from Enhancer with stderr:\n" + errorString, 0, result.getExitValue());
@@ -260,7 +260,7 @@ public class EnhancerTest extends AbstractTest {
public void testDirRecurse() {
// invoke enhancer with directory and recurse
- InvocationResult result = invokeEnhancer("-v -r " + basedir + "/target/test-classes/enhancer-test-dir");
+ InvocationResult result = invokeEnhancer("-v -r " + BASEDIR + "/target/test-classes/enhancer-test-dir");
String outputString = result.getOutputString();
String errorString = result.getErrorString();
assertEquals("Wrong exit code from Enhancer with stderr:\n" + errorString, 0, result.getExitValue());
@@ -283,7 +283,7 @@ public class EnhancerTest extends AbstractTest {
// find the java command in the user's path
commands.add("java");
commands.add("-cp");
- commands.add("" + basedir + "/target/classes" + pathDelimiter + "" + basedir + "/target/test-classes");
+ commands.add("" + BASEDIR + "/target/classes" + PATH_DELIMITER + "" + BASEDIR + "/target/test-classes");
commands.add("javax.jdo.Enhancer");
// add the test options (from the method parameter) to the java command
String[] optionArray = string.split(" ");
diff --git a/api/src/test/java/javax/jdo/MockEnhancer.java b/api/src/test/java/javax/jdo/MockEnhancer.java
index 03590740..e54e1add 100644
--- a/api/src/test/java/javax/jdo/MockEnhancer.java
+++ b/api/src/test/java/javax/jdo/MockEnhancer.java
@@ -37,7 +37,7 @@ import javax.jdo.metadata.JDOMetadata;
*/
public class MockEnhancer implements JDOEnhancer {
- static Properties props = new Properties();
+ static final Properties props = new Properties();
static {
props.put(PROPERTY_ENHANCER_VENDOR_NAME, "Mock Enhancer");
props.put(PROPERTY_ENHANCER_VERSION_NUMBER, "2.3.0");
@@ -46,10 +46,10 @@ public class MockEnhancer implements JDOEnhancer {
@SuppressWarnings("unused")
private boolean verbose;
private int numberOfElements;
- private List<String> classNames = new ArrayList<>();
- private List<String> jarNames = new ArrayList<>();
- private List<String> jdoNames = new ArrayList<>();
- private List<String> puNames = new ArrayList<>();
+ private final List<String> classNames = new ArrayList<>();
+ private final List<String> jarNames = new ArrayList<>();
+ private final List<String> jdoNames = new ArrayList<>();
+ private final List<String> puNames = new ArrayList<>();
@SuppressWarnings("unused")
private String outputDirectory = null;
diff --git a/api/src/test/java/javax/jdo/ObjectStateTest.java b/api/src/test/java/javax/jdo/ObjectStateTest.java
index 4a62c0eb..aae95093 100644
--- a/api/src/test/java/javax/jdo/ObjectStateTest.java
+++ b/api/src/test/java/javax/jdo/ObjectStateTest.java
@@ -167,7 +167,7 @@ public class ObjectStateTest extends AbstractTest {
private class MockInvocationHandler implements InvocationHandler {
/** States is the sum of all life cycle interrogatives.
*/
- private int states;
+ private final int states;
/**
* Constructs an invocation handler with the specified bit fields set
diff --git a/api/src/test/java/javax/jdo/identity/ObjectIdentityTest.java b/api/src/test/java/javax/jdo/identity/ObjectIdentityTest.java
index 34af5cf7..7a278881 100644
--- a/api/src/test/java/javax/jdo/identity/ObjectIdentityTest.java
+++ b/api/src/test/java/javax/jdo/identity/ObjectIdentityTest.java
@@ -52,7 +52,7 @@ public class ObjectIdentityTest extends SingleFieldIdentityTest {
/** The JDOImplHelper instance used for Date formatting.
*/
- private static JDOImplHelper helper = doPrivileged(JDOImplHelper::getInstance);
+ private static final JDOImplHelper helper = doPrivileged(JDOImplHelper::getInstance);
@SuppressWarnings("unchecked")
private static <T> T doPrivileged(PrivilegedAction<T> privilegedAction) {
@@ -416,7 +416,7 @@ public class ObjectIdentityTest extends SingleFieldIdentityTest {
public static class IdClass implements Serializable {
private static final long serialVersionUID = 5718122068872969580L;
- public int value;
+ public final int value;
public IdClass() {value = 0;}
public IdClass(int value) {this.value = value;}
public IdClass(String str) {this.value = Integer.parseInt(str);}
diff --git a/api/src/test/java/javax/jdo/listener/InstanceLifecycleEventTest.java b/api/src/test/java/javax/jdo/listener/InstanceLifecycleEventTest.java
index 81f43f57..86137f55 100644
--- a/api/src/test/java/javax/jdo/listener/InstanceLifecycleEventTest.java
+++ b/api/src/test/java/javax/jdo/listener/InstanceLifecycleEventTest.java
@@ -31,16 +31,16 @@ import javax.jdo.util.BatchTestRunner;
*/
public class InstanceLifecycleEventTest extends AbstractTest {
- Object created = new Object();
- Object loaded = new Object();
- Object stored = new Object();
- Object cleared = new Object();
- Object deleted = new Object();
- Object dirtied = new Object();
- Object attached = new Object();
- Object attachTarget = new Object();
- Object detached = new Object();
- Object detachTarget = new Object();
+ final Object created = new Object();
+ final Object loaded = new Object();
+ final Object stored = new Object();
+ final Object cleared = new Object();
+ final Object deleted = new Object();
+ final Object dirtied = new Object();
+ final Object attached = new Object();
+ final Object attachTarget = new Object();
+ final Object detached = new Object();
+ final Object detachTarget = new Object();
/** Creates a new instance of SingleFieldIdentityTest */
public InstanceLifecycleEventTest() {
diff --git a/api/src/test/java/javax/jdo/schema/XMLTest.java b/api/src/test/java/javax/jdo/schema/XMLTest.java
index c1286952..b0ecd090 100644
--- a/api/src/test/java/javax/jdo/schema/XMLTest.java
+++ b/api/src/test/java/javax/jdo/schema/XMLTest.java
@@ -31,7 +31,7 @@ import javax.jdo.util.XMLTestUtil;
public class XMLTest extends AbstractTest {
/** */
- protected static String BASEDIR = System.getProperty("basedir", ".");
+ protected static final String BASEDIR = System.getProperty("basedir", ".");
/** File prefix */
protected static final String FILE_PREFIX = BASEDIR + "/src/test/resources/";
@@ -53,20 +53,20 @@ public class XMLTest extends AbstractTest {
new File[] {JDO_XSD_FILE, ORM_XSD_FILE, JDOQUERY_XSD_FILE};
/** XSD metadata files. */
- protected static File[] positiveXSDJDO = getFiles("Positive", "-xsd.jdo");
- protected static File[] negativeXSDJDO = getFiles("Negative", "-xsd.jdo");
- protected static File[] positiveXSDORM = getFiles("Positive", "-xsd.orm");
- protected static File[] negativeXSDORM = getFiles("Negative", "-xsd.orm");
- protected static File[] positiveXSDJDOQUERY = getFiles("Positive", "-xsd.jdoquery");
- protected static File[] negativeXSDJDOQUERY = getFiles("Negative", "-xsd.jdoquery");
+ protected static final File[] positiveXSDJDO = getFiles("Positive", "-xsd.jdo");
+ protected static final File[] negativeXSDJDO = getFiles("Negative", "-xsd.jdo");
+ protected static final File[] positiveXSDORM = getFiles("Positive", "-xsd.orm");
+ protected static final File[] negativeXSDORM = getFiles("Negative", "-xsd.orm");
+ protected static final File[] positiveXSDJDOQUERY = getFiles("Positive", "-xsd.jdoquery");
+ protected static final File[] negativeXSDJDOQUERY = getFiles("Negative", "-xsd.jdoquery");
/** DTD metadata files. */
- protected static File[] positiveDTDJDO = getFiles("Positive", "-dtd.jdo");
- protected static File[] negativeDTDJDO = getFiles("Negative", "-dtd.jdo");
- protected static File[] positiveDTDORM = getFiles("Positive", "-dtd.orm");
- protected static File[] negativeDTDORM = getFiles("Negative", "-dtd.orm");
- protected static File[] positiveDTDJDOQUERY = getFiles("Positive", "-dtd.jdoquery");
- protected static File[] negativeDTDJDOQUERY = getFiles("Negative", "-dtd.jdoquery");
+ protected static final File[] positiveDTDJDO = getFiles("Positive", "-dtd.jdo");
+ protected static final File[] negativeDTDJDO = getFiles("Negative", "-dtd.jdo");
+ protected static final File[] positiveDTDORM = getFiles("Positive", "-dtd.orm");
+ protected static final File[] negativeDTDORM = getFiles("Negative", "-dtd.orm");
+ protected static final File[] positiveDTDJDOQUERY = getFiles("Positive", "-dtd.jdoquery");
+ protected static final File[] negativeDTDJDOQUERY = getFiles("Negative", "-dtd.jdoquery");
/** Returns array of files of matching file names. */
protected static File[] getFiles(final String prefix, final String suffix) {
diff --git a/api/src/test/java/javax/jdo/spi/StateInterrogationTest.java b/api/src/test/java/javax/jdo/spi/StateInterrogationTest.java
index bfbee55d..a1b1cf5f 100644
--- a/api/src/test/java/javax/jdo/spi/StateInterrogationTest.java
+++ b/api/src/test/java/javax/jdo/spi/StateInterrogationTest.java
@@ -41,7 +41,7 @@ import javax.jdo.util.BatchTestRunner;
*/
public class StateInterrogationTest extends AbstractTest {
- private JDOImplHelper implHelper = JDOImplHelper.getInstance();
+ private final JDOImplHelper implHelper = JDOImplHelper.getInstance();
/** Creates a new instance of StateInterrogationTest */
public StateInterrogationTest() {
@@ -322,7 +322,7 @@ public class StateInterrogationTest extends AbstractTest {
/**
* The non-binary-compatible PersistenceManager class instances.
*/
- static private PersistenceManager pmProxy0 = (PersistenceManager)
+ private static final PersistenceManager pmProxy0 = (PersistenceManager)
Proxy.newProxyInstance(
PersistenceManager.class.getClassLoader(),
new Class[] {PersistenceManager.class},
@@ -331,7 +331,7 @@ public class StateInterrogationTest extends AbstractTest {
/**
* The non-binary-compatible PersistenceManager class instances.
*/
- static private PersistenceManager pmProxy1 = (PersistenceManager)
+ private static final PersistenceManager pmProxy1 = (PersistenceManager)
Proxy.newProxyInstance(
PersistenceManager.class.getClassLoader(),
new Class[] {PersistenceManager.class},
@@ -340,7 +340,7 @@ public class StateInterrogationTest extends AbstractTest {
/**
* The non-binary-compatible PersistenceManager class instances.
*/
- static private PersistenceManager pmProxy2 = (PersistenceManager)
+ private static final PersistenceManager pmProxy2 = (PersistenceManager)
Proxy.newProxyInstance(
PersistenceManager.class.getClassLoader(),
new Class[] {PersistenceManager.class},
@@ -349,27 +349,27 @@ public class StateInterrogationTest extends AbstractTest {
/**
* The array of PersistenceManager proxies
*/
- static PersistenceManager[] pmProxies = {pmProxy0, pmProxy1, pmProxy2};
+ static final PersistenceManager[] pmProxies = {pmProxy0, pmProxy1, pmProxy2};
/**
* The array of NonBinaryCompatiblePersistenceCapable instances.
*/
- NonBinaryCompatiblePersistenceCapable nbcpc0 =
+ final NonBinaryCompatiblePersistenceCapable nbcpc0 =
new NonBinaryCompatiblePersistenceCapable(0);
- NonBinaryCompatiblePersistenceCapable nbcpc1 =
+ final NonBinaryCompatiblePersistenceCapable nbcpc1 =
new NonBinaryCompatiblePersistenceCapable(1);
- NonBinaryCompatiblePersistenceCapable nbcpc2 =
+ final NonBinaryCompatiblePersistenceCapable nbcpc2 =
new NonBinaryCompatiblePersistenceCapable(2);
-
- NonBinaryCompatiblePersistenceCapable[] nbcpcs = {nbcpc0, nbcpc1, nbcpc2};
+
+ final NonBinaryCompatiblePersistenceCapable[] nbcpcs = {nbcpc0, nbcpc1, nbcpc2};
/**
* The array of StateInterrogations
*/
- static StateInterrogation si0 = new StateInterrogationImpl(0);
- static StateInterrogation si1 = new StateInterrogationImpl(1);
- static StateInterrogation si2 = new StateInterrogationImpl(2);
- static StateInterrogation[] sis = {si0, si1, si2};
+ static final StateInterrogation si0 = new StateInterrogationImpl(0);
+ static final StateInterrogation si1 = new StateInterrogationImpl(1);
+ static final StateInterrogation si2 = new StateInterrogationImpl(2);
+ static final StateInterrogation[] sis = {si0, si1, si2};
/**
* The StateInterrogation implementation manages
@@ -387,7 +387,7 @@ public class StateInterrogationTest extends AbstractTest {
*/
private static class StateInterrogationImpl implements StateInterrogation {
- private int id;
+ private final int id;
public int hashCode() {
return id;
@@ -471,7 +471,7 @@ public class StateInterrogationTest extends AbstractTest {
* The non-binary-compatible PersistenceCapable class.
*/
public static class NonBinaryCompatiblePersistenceCapable {
- private int id;
+ private final int id;
private boolean dirty = false;
private NonBinaryCompatiblePersistenceCapable(int id) {
this.id = id;
@@ -491,7 +491,7 @@ public class StateInterrogationTest extends AbstractTest {
* The non-binary-compatible object id class.
*/
public static class ObjectIdImpl {
- private int id;
+ private final int id;
private ObjectIdImpl(int id) {
this.id = id;
}
@@ -509,7 +509,7 @@ public class StateInterrogationTest extends AbstractTest {
* for PersistenceManager proxy.
*/
private static class InvocationHandlerImpl implements InvocationHandler {
- private int id;
+ private final int id;
private InvocationHandlerImpl(int id) {
this.id = id;
}
diff --git a/api/src/test/java/javax/jdo/stub/StubPMF.java b/api/src/test/java/javax/jdo/stub/StubPMF.java
index dadfbc7e..943e67c9 100644
--- a/api/src/test/java/javax/jdo/stub/StubPMF.java
+++ b/api/src/test/java/javax/jdo/stub/StubPMF.java
@@ -97,7 +97,7 @@ public class StubPMF implements PersistenceManagerFactory, Constants {
Integer optionDatastoreReadTimeoutMillis;
Integer optionDatastoreWriteTimeoutMillis;
- Properties properties = new Properties();
+ final Properties properties = new Properties();
public String getConnectionUserName() {
return optionConnectionUserName;
diff --git a/api/src/test/java/javax/jdo/util/AbstractTest.java b/api/src/test/java/javax/jdo/util/AbstractTest.java
index 393d278d..d70a3b71 100644
--- a/api/src/test/java/javax/jdo/util/AbstractTest.java
+++ b/api/src/test/java/javax/jdo/util/AbstractTest.java
@@ -27,10 +27,10 @@ import junit.framework.TestCase;
public abstract class AbstractTest extends TestCase implements Constants {
/** */
- protected static PrintStream out = System.out;
+ protected static final PrintStream OUT = System.out;
/** If true, print extra messages. */
- protected boolean verbose;
+ protected final boolean verbose;
/**
* Construct and initialize from properties.
@@ -56,7 +56,7 @@ public abstract class AbstractTest extends TestCase implements Constants {
*/
protected void println(String s) {
if (verbose)
- out.println(s);
+ OUT.println(s);
}
/** New line.
diff --git a/api/src/test/java/javax/jdo/util/XMLTestUtil.java b/api/src/test/java/javax/jdo/util/XMLTestUtil.java
index 520c8926..e41c223b 100644
--- a/api/src/test/java/javax/jdo/util/XMLTestUtil.java
+++ b/api/src/test/java/javax/jdo/util/XMLTestUtil.java
@@ -56,7 +56,7 @@ import org.xml.sax.SAXParseException;
public class XMLTestUtil {
/** */
- protected static String BASEDIR = System.getProperty("basedir", ".");
+ protected static final String BASEDIR = System.getProperty("basedir", ".");
/** "http://www.w3.org/2001/XMLSchema" */
protected static final String XSD_TYPE =
@@ -102,11 +102,11 @@ public class XMLTestUtil {
/** Name of the metadata property, a comma separated list of JDO metadata
* file or directories containing such files. */
- protected static String METADATA_PROP = "javax.jdo.metadata";
+ protected static final String METADATA_PROP = "javax.jdo.metadata";
/** Name of the recursive property, allowing recursive search of metadata
* files. */
- protected static String RECURSIVE_PROP = "javax.jdo.recursive";
+ protected static final String RECURSIVE_PROP = "javax.jdo.recursive";
/** Separator character for the metadata property. */
protected static final String DELIM = ",;";
@@ -389,8 +389,8 @@ public class XMLTestUtil {
private static final String JDOQUERY_DTD_FILENAME =
"javax/jdo/jdoquery_3_2.dtd";
- static Map<String,String> publicIds = new HashMap<>();
- static Map<String,String> systemIds = new HashMap<>();
+ static final Map<String,String> publicIds = new HashMap<>();
+ static final Map<String,String> systemIds = new HashMap<>();
static {
publicIds.put(RECOGNIZED_JDO_PUBLIC_ID, JDO_DTD_FILENAME);
publicIds.put(RECOGNIZED_ORM_PUBLIC_ID, ORM_DTD_FILENAME);
@@ -442,7 +442,7 @@ public class XMLTestUtil {
/** Helper class to find all test JDO metadata files. */
public static class XMLFinder {
- private List<File> metadataFiles = new ArrayList<>();
+ private final List<File> metadataFiles = new ArrayList<>();
private final boolean recursive;
/** Constructor. */