diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountDataBean.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountDataBean.java index 3bcf6f7c9..35480b368 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountDataBean.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/AccountDataBean.java @@ -147,7 +147,7 @@ public class AccountDataBean implements Serializable { } public static AccountDataBean getRandomInstance() { - return new AccountDataBean(new Integer(TradeConfig.rndInt(100000)), //accountID + return new AccountDataBean(TradeConfig.rndInt(100000), //accountID TradeConfig.rndInt(10000), //loginCount TradeConfig.rndInt(10000), //logoutCount new java.util.Date(), //lastLogin diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/HoldingDataBean.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/HoldingDataBean.java index a1a39f6a7..f10d1ef0f 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/HoldingDataBean.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/HoldingDataBean.java @@ -119,7 +119,7 @@ public class HoldingDataBean implements Serializable { public static HoldingDataBean getRandomInstance() { return new HoldingDataBean( - new Integer(TradeConfig.rndInt(100000)), //holdingID + TradeConfig.rndInt(100000), //holdingID TradeConfig.rndQuantity(), //quantity TradeConfig.rndBigDecimal(1000.0f), //purchasePrice new java.util.Date(TradeConfig.rndInt(Integer.MAX_VALUE)), //purchaseDate diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/OrderDataBean.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/OrderDataBean.java index cb3b8b9d6..4e98d34b7 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/OrderDataBean.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/OrderDataBean.java @@ -169,7 +169,7 @@ public class OrderDataBean implements Serializable public static OrderDataBean getRandomInstance() { return new OrderDataBean( - new Integer(TradeConfig.rndInt(100000)), + TradeConfig.rndInt(100000), TradeConfig.rndBoolean() ? "buy" : "sell", "open", new java.util.Date(TradeConfig.rndInt(Integer.MAX_VALUE)), diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeAction.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeAction.java index 62533332f..d0593660e 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeAction.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeAction.java @@ -133,7 +133,7 @@ public class TradeAction extends TradeJPADirect { setAttribute(sb, "Page", "Buy"); try { OrderDataBean orderData = buy(userID, symbol, new Double( - quantity).doubleValue(), TradeConfig.orderProcessingMode); + quantity), TradeConfig.orderProcessingMode); setAttribute(sb, "orderData", orderData); setAttribute(sb, "results", results); } catch (java.lang.IllegalArgumentException e) { diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeConfig.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeConfig.java index 8e2d65c46..e678b7233 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeConfig.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeConfig.java @@ -388,7 +388,7 @@ public class TradeConfig { return (new Float(random() * i)).intValue(); } public static float rndFloat(int i) { - return (new Float(random() * i)).floatValue(); + return new Float(random() * i); } public static BigDecimal rndBigDecimal(float f) { return (new BigDecimal(random() * f)).setScale( @@ -465,7 +465,7 @@ public class TradeConfig { if (deck == null) { deck = new ArrayList(numUsers); for (int i = 0; i < numUsers; i++) - deck.add(i, new Integer(i)); + deck.add(i, i); java.util.Collections.shuffle(deck, r0); } if (card >= numUsers) diff --git a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeJPADirect.java b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeJPADirect.java index 24a7df8df..233e8ea54 100644 --- a/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeJPADirect.java +++ b/openjpa-integration/daytrader/src/test/java/org/apache/openjpa/integration/daytrader/TradeJPADirect.java @@ -522,7 +522,7 @@ public class TradeJPADirect { Query updateStatus = entityManager.createNativeQuery( "UPDATE orderejb o SET o.orderStatus = 'completed' WHERE " + "o.orderStatus = 'closed' AND o.ACCOUNT_ACCOUNTID = ?"); - updateStatus.setParameter(1, accountid.intValue()); + updateStatus.setParameter(1, accountid); updateStatus.executeUpdate(); } if (entityManager != null) { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java index 8b6ca55fd..fb73f3fc0 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java @@ -272,8 +272,8 @@ public class ReverseMappingToolTask // load customizer properties Properties customProps = new Properties(); File propsFile = Files.getFile(customizerProperties, loader); - if (propsFile != null && (AccessController.doPrivileged( - J2DoPrivHelper.existsAction(propsFile))).booleanValue()) { + if (propsFile != null && AccessController.doPrivileged( + J2DoPrivHelper.existsAction(propsFile))) { FileInputStream fis = null; try { fis = AccessController.doPrivileged( diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java index 6b6a43755..53ad0ffd4 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java @@ -164,7 +164,7 @@ public class JDBCFetchConfigurationImpl && mode != EagerFetchModes.EAGER_NONE && mode != EagerFetchModes.EAGER_JOIN && mode != EagerFetchModes.EAGER_PARALLEL) - throw new IllegalArgumentException(_loc.get("bad-fetch-mode", Integer.valueOf(mode)).getMessage()); + throw new IllegalArgumentException(_loc.get("bad-fetch-mode", mode).getMessage()); if (mode == DEFAULT) { JDBCConfiguration conf = getJDBCConfiguration(); @@ -197,7 +197,7 @@ public class JDBCFetchConfigurationImpl && mode != EagerFetchModes.EAGER_NONE && mode != EagerFetchModes.EAGER_JOIN && mode != EagerFetchModes.EAGER_PARALLEL) - throw new IllegalArgumentException(_loc.get("bad-fetch-mode", Integer.valueOf(mode)).getMessage()); + throw new IllegalArgumentException(_loc.get("bad-fetch-mode", mode).getMessage()); if (mode == DEFAULT) { JDBCConfiguration conf = getJDBCConfiguration(); @@ -220,7 +220,7 @@ public class JDBCFetchConfigurationImpl && type != ResultSet.TYPE_FORWARD_ONLY && type != ResultSet.TYPE_SCROLL_INSENSITIVE && type != ResultSet.TYPE_SCROLL_SENSITIVE) - throw new IllegalArgumentException(_loc.get("bad-resultset-type", Integer.valueOf(type)).getMessage()); + throw new IllegalArgumentException(_loc.get("bad-resultset-type", type).getMessage()); if (type == DEFAULT) { JDBCConfiguration conf = getJDBCConfiguration(); @@ -242,7 +242,7 @@ public class JDBCFetchConfigurationImpl && direction != ResultSet.FETCH_FORWARD && direction != ResultSet.FETCH_REVERSE && direction != ResultSet.FETCH_UNKNOWN) - throw new IllegalArgumentException(_loc.get("bad-fetch-direction", Integer.valueOf(direction)) + throw new IllegalArgumentException(_loc.get("bad-fetch-direction", direction) .getMessage()); if (direction == DEFAULT) { @@ -265,7 +265,7 @@ public class JDBCFetchConfigurationImpl && size != LRSSizes.SIZE_QUERY && size != LRSSizes.SIZE_LAST && size != LRSSizes.SIZE_UNKNOWN) - throw new IllegalArgumentException(_loc.get("bad-lrs-size", Integer.valueOf(size)).getMessage()); + throw new IllegalArgumentException(_loc.get("bad-lrs-size", size).getMessage()); if (size == DEFAULT) { JDBCConfiguration conf = getJDBCConfiguration(); @@ -287,7 +287,7 @@ public class JDBCFetchConfigurationImpl && syntax != JoinSyntaxes.SYNTAX_SQL92 && syntax != JoinSyntaxes.SYNTAX_TRADITIONAL && syntax != JoinSyntaxes.SYNTAX_DATABASE) - throw new IllegalArgumentException(_loc.get("bad-join-syntax", Integer.valueOf(syntax)).getMessage()); + throw new IllegalArgumentException(_loc.get("bad-join-syntax", syntax).getMessage()); if (syntax == DEFAULT) { JDBCConfiguration conf = getJDBCConfiguration(); @@ -417,7 +417,7 @@ public class JDBCFetchConfigurationImpl && level != Connection.TRANSACTION_READ_COMMITTED && level != Connection.TRANSACTION_REPEATABLE_READ && level != Connection.TRANSACTION_SERIALIZABLE) - throw new IllegalArgumentException(_loc.get("bad-level", Integer.valueOf(level)).getMessage()); + throw new IllegalArgumentException(_loc.get("bad-level", level).getMessage()); if (level == DEFAULT) _state.isolationLevel = -1; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java index 2ebd6b62a..e51f5b171 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java @@ -353,7 +353,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { && !((OpenJPAId) oid).hasSubclasses()) { Boolean custom = customLoad(sm, mapping, state, fetch); if (custom != null) - return custom.booleanValue(); + return custom; res = getInitializeStateResult(sm, mapping, fetch, Select.SUBS_EXACT); if (res == null && !selectPrimaryKey(sm, mapping, fetch)) @@ -367,7 +367,7 @@ public class JDBCStoreManager implements StoreManager, JDBCStore { mapping = mappings[0]; Boolean custom = customLoad(sm, mapping, state, fetch); if (custom != null) - return custom.booleanValue(); + return custom; res = getInitializeStateResult(sm, mapping, fetch, Select.SUBS_ANY_JOINABLE); if (res == null && !selectPrimaryKey(sm, mapping, fetch)) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java index 35d9e28e8..8adec8a70 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreQuery.java @@ -915,7 +915,7 @@ public class JDBCStoreQuery Boolean where = trimVal.getWhere(); if (where == null) { //trim both return trimLeading(trimTrailing(valStr, trimCharObj), trimCharObj); - } else if (where.booleanValue()) { // trim leading + } else if (where) { // trim leading return trimLeading(valStr, trimCharObj); } else { // trim trailing return trimTrailing(valStr, trimCharObj); @@ -964,13 +964,13 @@ public class JDBCStoreQuery Object val = getValue(absVal.getValue(), ob, params, sm); Class c = val.getClass(); if (c == Integer.class) - return Integer.valueOf(java.lang.Math.abs(((Integer) val).intValue())); + return Math.abs(((Integer) val).intValue()); else if (c == Float.class) - return Float.valueOf(java.lang.Math.abs(((Float) val).floatValue())); + return Math.abs(((Float) val).floatValue()); else if (c == Double.class) - return Double.valueOf(java.lang.Math.abs(((Double) val).doubleValue())); + return Math.abs(((Double) val).doubleValue()); else if (c == Long.class) - return Long.valueOf(java.lang.Math.abs(((Long) val).longValue())); + return Math.abs(((Long) val).longValue()); throw new UnsupportedException(); } @@ -981,13 +981,13 @@ public class JDBCStoreQuery Object val = getValue(sqrtVal.getValue(), ob, params, sm); Class c = val.getClass(); if (c == Integer.class) - return Double.valueOf(java.lang.Math.sqrt(((Integer) val).doubleValue())); + return Math.sqrt(((Integer) val).doubleValue()); else if (c == Float.class) - return Double.valueOf(java.lang.Math.sqrt(((Float) val).floatValue())); + return Math.sqrt(((Float) val).floatValue()); else if (c == Double.class) - return Double.valueOf(java.lang.Math.sqrt(((Double) val).doubleValue())); + return Math.sqrt(((Double) val).doubleValue()); else if (c == Long.class) - return Double.valueOf(java.lang.Math.sqrt(((Long) val).doubleValue())); + return Math.sqrt(((Long) val).doubleValue()); throw new UnsupportedException(); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java index 9c7105960..bb3573898 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java @@ -163,7 +163,7 @@ public class PreparedSQLStoreQuery extends SQLStoreQuery { Set> userSet = userParams.entrySet(); for (Map.Entry userEntry : userSet) { - int idx = ((Integer)userEntry.getKey()).intValue(); + int idx = (Integer) userEntry.getKey(); array[idx] = userEntry.getValue(); } return array; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java index 402004948..7f2646b44 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java @@ -86,7 +86,7 @@ public abstract class SelectResultObjectProvider ra = _sel.supportsRandomAccess(_fetch.getReadLockLevel() > 0); _ra = (ra) ? Boolean.TRUE : Boolean.FALSE; } - return _ra.booleanValue(); + return _ra; } @Override diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ContainsExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ContainsExpression.java index e91d48b66..b1901fb23 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ContainsExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ContainsExpression.java @@ -52,7 +52,7 @@ class ContainsExpression if (count == null) count = 0; else - count = count.intValue() + 1; + count = count + 1; contains.put(path, count); sql.setContainsId(count.toString()); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/OrExpression.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/OrExpression.java index e24c2443f..1d56b9991 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/OrExpression.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/OrExpression.java @@ -68,7 +68,7 @@ class OrExpression entry = (Map.Entry) itr.next(); val2 = (Integer) entry.getValue(); val1 = (Integer) contains.get(entry.getKey()); - if (val1 == null || val2.intValue() > val1.intValue()) + if (val1 == null || val2 > val1) contains.put(entry.getKey(), val2); } return ret; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Trim.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Trim.java index 468ec69e3..b2f3b0a57 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Trim.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Trim.java @@ -170,7 +170,7 @@ public class Trim if (_where == null) { func = dict.trimBothFunction; dict.assertSupport(func != null, "TrimBothFunction"); - } else if (_where.booleanValue()) { + } else if (_where) { func = dict.trimLeadingFunction; dict.assertSupport(func != null, "TrimLeadingFunction"); } else { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java index 1e35054ef..8fb5d1af4 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java @@ -418,7 +418,7 @@ public class ClassMapping try { strategy.setClassMapping(this); if (adapt != null) - strategy.map(adapt.booleanValue()); + strategy.map(adapt); } catch (RuntimeException re) { // reset strategy _strategy = orig; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Discriminator.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Discriminator.java index d118dd7bf..6a04f2436 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Discriminator.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Discriminator.java @@ -113,7 +113,7 @@ public class Discriminator try { strategy.setDiscriminator(this); if (adapt != null) - strategy.map(adapt.booleanValue()); + strategy.map(adapt); } catch (RuntimeException re) { // reset strategy _strategy = orig; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DiscriminatorMappingInfo.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DiscriminatorMappingInfo.java index d9a125b9c..c19b54fde 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DiscriminatorMappingInfo.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/DiscriminatorMappingInfo.java @@ -71,7 +71,7 @@ public class DiscriminatorMappingInfo extends MappingInfo { case JavaTypes.INT: return Integer.valueOf(_value); case JavaTypes.CHAR: - return Character.valueOf(_value.charAt(_value.indexOf('\'')+1)); + return _value.charAt(_value.indexOf('\'') + 1); case JavaTypes.STRING: default: return _value; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/FieldMapping.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/FieldMapping.java index 3d76b5ebb..da5510103 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/FieldMapping.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/FieldMapping.java @@ -144,7 +144,7 @@ public class FieldMapping try { strategy.setFieldMapping(this); if (adapt != null) - strategy.map(adapt.booleanValue()); + strategy.map(adapt); } catch (RuntimeException re) { // reset strategy _strategy = orig; @@ -1280,7 +1280,7 @@ public class FieldMapping */ public boolean isBidirectionalJoinTableMappingOwner() { if (_bidirectionalJoinTableOwner != null) - return _bidirectionalJoinTableOwner.booleanValue(); + return _bidirectionalJoinTableOwner; _bidirectionalJoinTableOwner = false; ForeignKey fk = getForeignKey(); @@ -1313,7 +1313,7 @@ public class FieldMapping } } } - return _bidirectionalJoinTableOwner.booleanValue(); + return _bidirectionalJoinTableOwner; } /** @@ -1323,7 +1323,7 @@ public class FieldMapping */ public boolean isBidirectionalJoinTableMappingNonOwner() { if (_bidirectionalJoinTableNonOwner != null) - return _bidirectionalJoinTableNonOwner.booleanValue(); + return _bidirectionalJoinTableNonOwner; _bidirectionalJoinTableNonOwner = false; ForeignKey fk = getForeignKey(); @@ -1358,7 +1358,7 @@ public class FieldMapping } } } - return _bidirectionalJoinTableNonOwner.booleanValue(); + return _bidirectionalJoinTableNonOwner; } public boolean isBiMTo1JT() { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JavaSQLTypes.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JavaSQLTypes.java index 8108f10e0..895cb2088 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JavaSQLTypes.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/JavaSQLTypes.java @@ -54,18 +54,18 @@ public class JavaSQLTypes public static final int TIMESTAMP = 1011; public static final int JDBC_DEFAULT = 1012; - private static final Byte ZERO_BYTE = Byte.valueOf((byte) 0); - private static final Character ZERO_CHAR = Character.valueOf((char) 0); - private static final Double ZERO_DOUBLE = Double.valueOf(0d); - private static final Float ZERO_FLOAT = Float.valueOf(0f); - private static final Short ZERO_SHORT = Short.valueOf((short) 0); + private static final Byte ZERO_BYTE = (byte) 0; + private static final Character ZERO_CHAR = (char) 0; + private static final Double ZERO_DOUBLE = 0d; + private static final Float ZERO_FLOAT = 0f; + private static final Short ZERO_SHORT = (short) 0; private static final BigDecimal ZERO_BIGDECIMAL = new BigDecimal(0d); - private static final Byte NONZERO_BYTE = new Byte((byte) 1); - private static final Character NONZERO_CHAR = Character.valueOf((char) 'a'); - private static final Double NONZERO_DOUBLE = Double.valueOf(1d); - private static final Float NONZERO_FLOAT = Float.valueOf(1f); - private static final Short NONZERO_SHORT = Short.valueOf((short) 1); + private static final Byte NONZERO_BYTE = (byte) 1; + private static final Character NONZERO_CHAR = (char) 'a'; + private static final Double NONZERO_DOUBLE = 1d; + private static final Float NONZERO_FLOAT = 1f; + private static final Short NONZERO_SHORT = (short) 1; private static final BigInteger NONZERO_BIGINTEGER = new BigInteger("1"); private static final BigDecimal NONZERO_BIGDECIMAL = new BigDecimal(1d); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaultsImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaultsImpl.java index 9843ab38a..cf288f7a9 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaultsImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaultsImpl.java @@ -590,9 +590,9 @@ public class MappingDefaultsImpl switch (disc.getJavaType()) { case JavaTypes.INT: - return Integer.valueOf(alias.hashCode()); + return alias.hashCode(); case JavaTypes.CHAR: - return Character.valueOf(alias.charAt(0)); + return alias.charAt(0); case JavaTypes.STRING: default: return alias; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java index 26d2876fc..cccc36522 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java @@ -810,7 +810,7 @@ public abstract class MappingInfo implements Serializable { if (defStr != null) col.setDefaultString(defStr); if (notNull != null) - col.setNotNull(notNull.booleanValue()); + col.setNotNull(notNull); // add other details if adapting if (adapt) { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ReverseMappingTool.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ReverseMappingTool.java index ece945723..b383f627d 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ReverseMappingTool.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ReverseMappingTool.java @@ -1951,8 +1951,8 @@ public class ReverseMappingTool File customFile = Files.getFile (opts.removeProperty("customizerProperties", "cp", null), null); Properties customProps = new Properties(); - if (customFile != null && (AccessController.doPrivileged( - J2DoPrivHelper.existsAction(customFile))).booleanValue()) { + if (customFile != null && AccessController.doPrivileged( + J2DoPrivHelper.existsAction(customFile))) { FileInputStream fis = null; try { fis = AccessController.doPrivileged( diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Version.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Version.java index f045470dd..db17416cb 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Version.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/Version.java @@ -104,7 +104,7 @@ public class Version try { strategy.setVersion(this); if (adapt != null) - strategy.map(adapt.booleanValue()); + strategy.map(adapt); } catch (RuntimeException re) { // reset strategy _strategy = orig; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EnumValueHandler.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EnumValueHandler.java index 0d0b15f35..1a6c518be 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EnumValueHandler.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EnumValueHandler.java @@ -107,7 +107,7 @@ public class EnumValueHandler extends AbstractValueHandler { if (val == null) return null; if (_ordinal) - return Integer.valueOf(((Enum) val).ordinal()); + return ((Enum) val).ordinal(); return ((Enum) val).name(); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/LRSProxyCollection.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/LRSProxyCollection.java index 296520087..995a8107b 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/LRSProxyCollection.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/LRSProxyCollection.java @@ -212,7 +212,7 @@ public class LRSProxyCollection throw SQLExceptions.getStore(se, _store.getDBDictionary()); } } - return _next.booleanValue(); + return _next; } @Override diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/LRSProxyMap.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/LRSProxyMap.java index 6528a6009..fa18c90d4 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/LRSProxyMap.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/LRSProxyMap.java @@ -361,13 +361,13 @@ class LRSProxyMap if (_next == null) { try { _next = (_res[0].next()) ? Boolean.TRUE : Boolean.FALSE; - if (_next.booleanValue() && _res[1] != _res[0]) + if (_next && _res[1] != _res[0]) _res[1].next(); } catch (SQLException se) { throw SQLExceptions.getStore(se, _store.getDBDictionary()); } } - return _next.booleanValue(); + return _next; } @Override diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/NumberVersionStrategy.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/NumberVersionStrategy.java index 860c74f70..cc8c21ee9 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/NumberVersionStrategy.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/NumberVersionStrategy.java @@ -62,7 +62,7 @@ public class NumberVersionStrategy @Override protected int getJavaType() { if (_javaType == null && vers.getClassMapping().getVersionFieldMapping() != null) { - _javaType = Integer.valueOf(vers.getClassMapping().getVersionFieldMapping().getTypeCode()); + _javaType = vers.getClassMapping().getVersionFieldMapping().getTypeCode(); } else { return JavaTypes.INT; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/PrimitiveFieldStrategy.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/PrimitiveFieldStrategy.java index 1d05a3305..5177acf14 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/PrimitiveFieldStrategy.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/PrimitiveFieldStrategy.java @@ -350,7 +350,7 @@ public class PrimitiveFieldStrategy if (autoInc == null) sm.storeBoolean(idx, false); else if (autoInc instanceof Boolean) - sm.storeBoolean(idx, ((Boolean) autoInc).booleanValue()); + sm.storeBoolean(idx, (Boolean) autoInc); else sm.storeBoolean(idx, ((Number) autoInc).intValue() != 0); break; @@ -364,7 +364,7 @@ public class PrimitiveFieldStrategy if (autoInc == null) sm.storeChar(idx, (char) 0); else if (autoInc instanceof Character) - sm.storeChar(idx, ((Character) autoInc).charValue()); + sm.storeChar(idx, (Character) autoInc); else if (autoInc instanceof String) sm.storeChar(idx, ((String) autoInc).charAt(0)); else diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/PrimitiveWrapperArrays.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/PrimitiveWrapperArrays.java index 09cac1edf..e75d5514f 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/PrimitiveWrapperArrays.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/PrimitiveWrapperArrays.java @@ -36,7 +36,7 @@ class PrimitiveWrapperArrays { if (vm.getType().getComponentType() == Character.class) { Character[] objectArray = new Character[array.length]; for (int i = 0; i < array.length; i++) - objectArray[i] = Character.valueOf(array[i]); + objectArray[i] = array[i]; return objectArray; } return array; @@ -50,7 +50,7 @@ class PrimitiveWrapperArrays { Character[] charOb = (Character[]) ob; char[] chars = new char[charOb.length]; for (int i = 0; i < charOb.length; i++) - chars[i] = charOb[i] == null ? 0 : charOb[i].charValue(); + chars[i] = charOb[i] == null ? 0 : charOb[i]; return chars; } return (char[]) ob; @@ -65,7 +65,7 @@ class PrimitiveWrapperArrays { if (vm.getType().getComponentType() == Byte.class) { Byte[] objectArray = new Byte[array.length]; for (int i = 0; i < array.length; i++) - objectArray[i] = Byte.valueOf(array[i]); + objectArray[i] = array[i]; return objectArray; } return array; @@ -79,7 +79,7 @@ class PrimitiveWrapperArrays { Byte[] byteOb = (Byte[]) ob; byte[] bytes = new byte[byteOb.length]; for (int i = 0; i < byteOb.length; i++) - bytes[i] = byteOb[i] == null ? 0 : byteOb[i].byteValue(); + bytes[i] = byteOb[i] == null ? 0 : byteOb[i]; return bytes; } return (byte[]) ob; diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java index 35b02a697..8bca53f9f 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java @@ -451,7 +451,7 @@ public class Column extends ReferenceCounter { break; case JavaTypes.CHAR: case JavaTypes.CHAR_OBJ: - _default = Character.valueOf(_defaultStr.charAt(0)); + _default = _defaultStr.charAt(0); break; case JavaTypes.DOUBLE: case JavaTypes.DOUBLE_OBJ: diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java index 2ad6f401c..1ead22af8 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java @@ -137,7 +137,7 @@ extends SimpleDriverDataSource implements Configurable, Closeable { // save exception details for later instead of throwing here _dbcpEx = new RuntimeException(_eloc.get("driver-null", DBCPBASICDATASOURCENAME).getMessage(), e); } - return _dbcpAvail.booleanValue(); + return _dbcpAvail; } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ForeignKey.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ForeignKey.java index 4cd8851fe..ff856e913 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ForeignKey.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ForeignKey.java @@ -183,7 +183,7 @@ public class ForeignKey extends Constraint { */ public boolean isPrimaryKeyAutoAssigned() { if (_autoAssign != null) - return _autoAssign.booleanValue(); + return _autoAssign; return isPrimaryKeyAutoAssigned(new ArrayList(3)); } @@ -199,7 +199,7 @@ public class ForeignKey extends Constraint { */ private boolean isPrimaryKeyAutoAssigned(List seen) { if (_autoAssign != null) - return _autoAssign.booleanValue(); + return _autoAssign; Column[] cols = getPrimaryKeyColumns(); if (cols.length == 0) { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java index 8b2a01a12..e8ef28f33 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java @@ -453,7 +453,7 @@ public abstract class AbstractResult null, joins)); if (val == null) return false; - return Boolean.valueOf(val.toString()).booleanValue(); + return Boolean.valueOf(val.toString()); } @Override @@ -612,7 +612,7 @@ public abstract class AbstractResult if (val == null) return 0; if (val instanceof Character) - return ((Character) val).charValue(); + return (Character) val; String str = val.toString(); return (str.length() == 0) ? 0 : str.charAt(0); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java index 87b6fc29c..3689396ef 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java @@ -670,10 +670,10 @@ public class DBDictionary return getBigDecimal(rs, column); } catch (Exception e1) { try { - return Double.valueOf(getDouble(rs, column)); + return getDouble(rs, column); } catch (Exception e2) { try { - return Float.valueOf(getFloat(rs, column)); + return getFloat(rs, column); } catch (Exception e3) { try { return getLong(rs, column); @@ -1381,9 +1381,9 @@ public class DBDictionary // check for known floating point types to give driver a chance to // handle special numbers like NaN and infinity; bug #1053 if (num instanceof Double) - setDouble(stmnt, idx, ((Double) num).doubleValue(), col); + setDouble(stmnt, idx, (Double) num, col); else if (num instanceof Float) - setFloat(stmnt, idx, ((Float) num).floatValue(), col); + setFloat(stmnt, idx, (Float) num, col); else setBigDecimal(stmnt, idx, new BigDecimal(num.toString()), col); } @@ -1472,7 +1472,7 @@ public class DBDictionary switch (type) { case JavaTypes.BOOLEAN: case JavaTypes.BOOLEAN_OBJ: - setBoolean(stmnt, idx, ((Boolean) val).booleanValue(), col); + setBoolean(stmnt, idx, (Boolean) val, col); break; case JavaTypes.BYTE: case JavaTypes.BYTE_OBJ: @@ -1480,7 +1480,7 @@ public class DBDictionary break; case JavaTypes.CHAR: case JavaTypes.CHAR_OBJ: - setChar(stmnt, idx, ((Character) val).charValue(), col); + setChar(stmnt, idx, (Character) val, col); break; case JavaTypes.DOUBLE: case JavaTypes.DOUBLE_OBJ: @@ -1642,21 +1642,21 @@ public class DBDictionary else if (val instanceof String) setString(stmnt, idx, val.toString(), col); else if (val instanceof Integer) - setInt(stmnt, idx, ((Integer) val).intValue(), col); + setInt(stmnt, idx, (Integer) val, col); else if (val instanceof Boolean) - setBoolean(stmnt, idx, ((Boolean) val).booleanValue(), col); + setBoolean(stmnt, idx, (Boolean) val, col); else if (val instanceof Long) - setLong(stmnt, idx, ((Long) val).longValue(), col); + setLong(stmnt, idx, (Long) val, col); else if (val instanceof Float) - setFloat(stmnt, idx, ((Float) val).floatValue(), col); + setFloat(stmnt, idx, (Float) val, col); else if (val instanceof Double) - setDouble(stmnt, idx, ((Double) val).doubleValue(), col); + setDouble(stmnt, idx, (Double) val, col); else if (val instanceof Byte) - setByte(stmnt, idx, ((Byte) val).byteValue(), col); + setByte(stmnt, idx, (Byte) val, col); else if (val instanceof Character) - setChar(stmnt, idx, ((Character) val).charValue(), col); + setChar(stmnt, idx, (Character) val, col); else if (val instanceof Short) - setShort(stmnt, idx, ((Short) val).shortValue(), col); + setShort(stmnt, idx, (Short) val, col); else if (val instanceof Locale) setLocale(stmnt, idx, (Locale) val, col); else if (val instanceof BigDecimal) @@ -5163,7 +5163,7 @@ public class DBDictionary timeout = 0; } else if (timeout < 0) { if (log.isWarnEnabled()) - log.warn(_loc.get("invalid-timeout", Integer.valueOf(timeout))); + log.warn(_loc.get("invalid-timeout", timeout)); return; } else if (timeout > 0 && timeout < 1000) { // round up to 1 sec @@ -5755,7 +5755,7 @@ public class DBDictionary * @param supportsDelimitedIds the supportsDelimitedIds to set */ public void setSupportsDelimitedIdentifiers(boolean supportsDelimitedIds) { - supportsDelimitedIdentifiers = Boolean.valueOf(supportsDelimitedIds); + supportsDelimitedIdentifiers = supportsDelimitedIds; } /** @@ -5763,12 +5763,11 @@ public class DBDictionary */ private void setSupportsDelimitedIdentifiers(DatabaseMetaData metaData) { try { - supportsDelimitedIdentifiers = Boolean.valueOf( - metaData.supportsMixedCaseQuotedIdentifiers() || - metaData.storesLowerCaseQuotedIdentifiers() || - metaData.storesUpperCaseQuotedIdentifiers()); + supportsDelimitedIdentifiers = metaData.supportsMixedCaseQuotedIdentifiers() || + metaData.storesLowerCaseQuotedIdentifiers() || + metaData.storesUpperCaseQuotedIdentifiers(); } catch (SQLException e) { - supportsDelimitedIdentifiers = Boolean.valueOf(false); + supportsDelimitedIdentifiers = Boolean.FALSE; getLog().warn(_loc.get("unknown-delim-support", e)); } } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/EmpressDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/EmpressDictionary.java index a371e9a9b..e3fd7937a 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/EmpressDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/EmpressDictionary.java @@ -151,12 +151,12 @@ public class EmpressDictionary // which can prove to be difficult to handle if (val == Float.POSITIVE_INFINITY) { val = Float.MAX_VALUE; - storageWarning(new Float(Float.POSITIVE_INFINITY), - new Float(val)); + storageWarning(Float.POSITIVE_INFINITY, + val); } else if (val == Float.NEGATIVE_INFINITY) { val = Float.MIN_VALUE + 1; - storageWarning(new Float(Float.NEGATIVE_INFINITY), - new Float(val)); + storageWarning(Float.NEGATIVE_INFINITY, + val); } super.setFloat(stmnt, idx, val, col); } @@ -169,12 +169,12 @@ public class EmpressDictionary // which can prove to be difficult to handle if (val == Double.POSITIVE_INFINITY) { val = Double.MAX_VALUE; - storageWarning(new Double(Double.POSITIVE_INFINITY), - new Double(val)); + storageWarning(Double.POSITIVE_INFINITY, + val); } else if (val == Double.NEGATIVE_INFINITY) { val = Double.MIN_VALUE + 1; - storageWarning(new Double(Double.NEGATIVE_INFINITY), - new Double(val)); + storageWarning(Double.NEGATIVE_INFINITY, + val); } super.setDouble(stmnt, idx, val, col); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java index 56bb2ecac..1b4349f96 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java @@ -1123,7 +1123,7 @@ public class LogicalUnion */ private Object getOrderingValue(ResultSet rs, Object i) { try { - return _dict.getObject(rs, ((Integer) i).intValue() + 1, null); + return _dict.getObject(rs, (Integer) i + 1, null); } catch (SQLException se) { throw SQLExceptions.getStore(se, _dict); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java index 9555640c2..8dd0687b9 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java @@ -585,7 +585,7 @@ public class OracleDictionary new Class[]{ int.class, short.class }). invoke(inner, new Object[]{ - Integer.valueOf(idx), + idx, oraclePreparedStatementFormNvarcharField.get(null) }); } catch (Exception e) { @@ -613,7 +613,7 @@ public class OracleDictionary setFixedCharMethod.setAccessible(true); } - setFixedCharMethod.invoke(inner, new Object[]{ new Integer(idx), val }); + setFixedCharMethod.invoke(inner, new Object[]{idx, val }); return; } catch (Exception e) { log.warn(e); @@ -711,7 +711,7 @@ public class OracleDictionary return null; if (oracleClob_isEmptyLob_Method != null && clob.getClass().getName().equals("oracle.sql.CLOB")) { try { - if (((Boolean) oracleClob_isEmptyLob_Method.invoke(clob, new Object[0])).booleanValue()) { + if ((Boolean) oracleClob_isEmptyLob_Method.invoke(clob, new Object[0])) { return null; } } catch (Exception e) { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java index ee7ddd380..979ad2cf6 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java @@ -438,19 +438,19 @@ public class ResultSetResult break; case JavaTypes.BYTE: case JavaTypes.BYTE_OBJ: - val = new Byte(getByteInternal(obj, joins)); + val = getByteInternal(obj, joins); break; case JavaTypes.CHAR: case JavaTypes.CHAR_OBJ: - val = new Character(getCharInternal(obj, joins)); + val = getCharInternal(obj, joins); break; case JavaTypes.DOUBLE: case JavaTypes.DOUBLE_OBJ: - val = new Double(getDoubleInternal(obj, joins)); + val = getDoubleInternal(obj, joins); break; case JavaTypes.FLOAT: case JavaTypes.FLOAT_OBJ: - val = new Float(getFloatInternal(obj, joins)); + val = getFloatInternal(obj, joins); break; case JavaTypes.INT: case JavaTypes.INT_OBJ: @@ -462,7 +462,7 @@ public class ResultSetResult break; case JavaTypes.SHORT: case JavaTypes.SHORT_OBJ: - val = new Short(getShortInternal(obj, joins)); + val = getShortInternal(obj, joins); break; case JavaTypes.STRING: return getStringInternal(obj, joins, isClob); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/RowImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/RowImpl.java index 8fa87de52..402e585f0 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/RowImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/RowImpl.java @@ -439,7 +439,7 @@ public class RowImpl @Override public void setByte(Column col, byte val) throws SQLException { - setObject(col, new Byte(val), JavaTypes.BYTE, false); + setObject(col, val, JavaTypes.BYTE, false); } @Override @@ -457,7 +457,7 @@ public class RowImpl @Override public void setChar(Column col, char val) throws SQLException { - setObject(col, new Character(val), JavaTypes.CHAR, false); + setObject(col, val, JavaTypes.CHAR, false); } @Override @@ -493,13 +493,13 @@ public class RowImpl @Override public void setDouble(Column col, double val) throws SQLException { - setObject(col, new Double(val), JavaTypes.DOUBLE, false); + setObject(col, val, JavaTypes.DOUBLE, false); } @Override public void setFloat(Column col, float val) throws SQLException { - setObject(col, new Float(val), JavaTypes.FLOAT, false); + setObject(col, val, JavaTypes.FLOAT, false); } @Override @@ -547,7 +547,7 @@ public class RowImpl @Override public void setShort(Column col, short val) throws SQLException { - setObject(col, new Short(val), JavaTypes.SHORT, false); + setObject(col, val, JavaTypes.SHORT, false); } @Override @@ -635,7 +635,7 @@ public class RowImpl @Override public void whereByte(Column col, byte val) throws SQLException { - whereObject(col, new Byte(val), JavaTypes.BYTE); + whereObject(col, val, JavaTypes.BYTE); } @Override @@ -653,7 +653,7 @@ public class RowImpl @Override public void whereChar(Column col, char val) throws SQLException { - whereObject(col, new Character(val), JavaTypes.CHAR); + whereObject(col, val, JavaTypes.CHAR); } @Override @@ -689,13 +689,13 @@ public class RowImpl @Override public void whereDouble(Column col, double val) throws SQLException { - whereObject(col, new Double(val), JavaTypes.DOUBLE); + whereObject(col, val, JavaTypes.DOUBLE); } @Override public void whereFloat(Column col, float val) throws SQLException { - whereObject(col, new Float(val), JavaTypes.FLOAT); + whereObject(col, val, JavaTypes.FLOAT); } @Override @@ -737,7 +737,7 @@ public class RowImpl @Override public void whereShort(Column col, short val) throws SQLException { - whereObject(col, new Short(val), JavaTypes.SHORT); + whereObject(col, val, JavaTypes.SHORT); } @Override diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java index 645145f27..d26e2f97f 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java @@ -366,14 +366,14 @@ public final class SQLBuffer } else if ( type == Character.class ) { if (_dict.storeCharsAsNumbers) { - _sql.append(Integer.toString(((Character)o).charValue())); + _sql.append(Integer.toString((Character) o)); } else { _sql.append("'" + o.toString().replace("'", "''") + "'"); } } else if (type == Boolean.class) { Boolean b = (Boolean) o; // We store B(b)ooleans as ints. Convert - _sql.append(_dict.getBooleanRepresentation().getRepresentation(b.booleanValue())); + _sql.append(_dict.getBooleanRepresentation().getRepresentation(b)); } else { _sql.append(o.toString()); } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java index 82ec97021..0970bbcb7 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java @@ -1206,7 +1206,7 @@ public class SelectImpl boolean seld = sel && select(col, pj, false); if (asc != null) { String alias = (as != null) ? as : getColumnAlias(col, pj); - appendOrdering(alias, asc.booleanValue()); + appendOrdering(alias, asc); } return seld; } @@ -2170,13 +2170,13 @@ public class SelectImpl } if (i != null) - return i.intValue(); + return i; // check out existing aliases i = findAlias(table, key); if (i != null) - return i.intValue(); + return i; if (!create) return -1; @@ -2187,7 +2187,7 @@ public class SelectImpl // " created alias: "+ // i.intValue()+ " "+ key); recordTableAlias(table, key, i); - return i.intValue(); + return i; } private Integer findAliasForQuery(Table table, PathJoins pj, Object key, @@ -2249,7 +2249,7 @@ public class SelectImpl // "Query created alias: "+ // i.intValue()+ " "+ key); recordTableAlias(table, key, i); - return i.intValue(); + return i; } private Integer findAlias(Table table, Object key) { @@ -2278,7 +2278,7 @@ public class SelectImpl _aliases.put(key, alias); String tableString = _dict.getFullName(table, false) + " " - + toAlias(alias.intValue()); + + toAlias(alias); if (_tables == null) _tables = new TreeMap(); _tables.put(alias, tableString); @@ -2644,7 +2644,7 @@ public class SelectImpl if (pk == null) pk = (obj instanceof Column && ((Column) obj).isPrimaryKey()) ? Boolean.TRUE : Boolean.FALSE; - if (pk.booleanValue()) { + if (pk) { for (int i = _pos - 1; i >= 0 && i >= _pos - 3; i--) if (_sel._selects.get(i).equals(obj)) return i + 1; @@ -3262,7 +3262,7 @@ public class SelectImpl boolean found2 = false; for (int i = 0; i < aliases.length; i++) { - int alias = ((Integer)aliases[i]).intValue(); + int alias = (Integer) aliases[i]; if (alias == j.getIndex1()) found1 = true; if (alias == j.getIndex2()) @@ -3306,7 +3306,7 @@ public class SelectImpl boolean found2 = false; for (int i = 0; i < aliases.length; i++) { - int alias = ((Integer)aliases[i]).intValue(); + int alias = (Integer) aliases[i]; if (alias == join.getIndex1()) found1 = true; if (alias == join.getIndex2()) diff --git a/openjpa-jest/src/test/java/demo/DataLoader.java b/openjpa-jest/src/test/java/demo/DataLoader.java index de30d81f4..1f19418f9 100644 --- a/openjpa-jest/src/test/java/demo/DataLoader.java +++ b/openjpa-jest/src/test/java/demo/DataLoader.java @@ -70,7 +70,7 @@ public class DataLoader { public void populate(EntityManager em) throws Exception { Long count = em.createQuery("select count(m) from Movie m", Long.class).getSingleResult(); - if (count != null && count.longValue() > 0) { + if (count != null && count > 0) { System.err.println("Found " + count + " Movie records in the database"); return; } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java index 4660b8d4b..a85d2dc52 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java @@ -868,7 +868,7 @@ public class OpenJPAConfigurationImpl @Override public void setRefreshFromDataCache(Boolean flag) { if (flag != null) { - refreshFromDataCache.set(flag.booleanValue()); + refreshFromDataCache.set(flag); } } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/conf/RemoteCommitProviderValue.java b/openjpa-kernel/src/main/java/org/apache/openjpa/conf/RemoteCommitProviderValue.java index 338f40edb..ac012acb2 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/conf/RemoteCommitProviderValue.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/conf/RemoteCommitProviderValue.java @@ -114,7 +114,7 @@ public class RemoteCommitProviderValue public void configureEventManager(RemoteCommitEventManager mgr) { parseOptions(); if (_transmitPersIds != null) - mgr.setTransmitPersistedObjectIds(_transmitPersIds.booleanValue()); + mgr.setTransmitPersistedObjectIds(_transmitPersIds); } /** diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java index 9c7ea75d6..a2b709819 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java @@ -120,7 +120,7 @@ public abstract class AbstractQueryCache // Pre-load all the entity types into the HashMap to handle // synchronization on the map efficiently for (Object o : perTypes) - entityTimestampMap.put((String)o, Long.valueOf(0)); + entityTimestampMap.put((String)o, 0L); } } @@ -153,7 +153,7 @@ public abstract class AbstractQueryCache Collection changedTypes = ev.getTypes(); HashMap changedClasses = new HashMap<>(); - Long tstamp = Long.valueOf(System.currentTimeMillis()); + Long tstamp = System.currentTimeMillis(); for (Object o: changedTypes) { String name = ((Class) o).getName(); if(!changedClasses.containsKey(name)) { diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ClassRedefiner.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ClassRedefiner.java index 0b2e11e79..72c13973f 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ClassRedefiner.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ClassRedefiner.java @@ -108,6 +108,6 @@ public class ClassRedefiner { _canRedefine = Boolean.FALSE; } } - return _canRedefine.booleanValue(); + return _canRedefine; } } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCClassFileTransformer.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCClassFileTransformer.java index 8376c6e55..ce4be6bd7 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCClassFileTransformer.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCClassFileTransformer.java @@ -185,7 +185,7 @@ public class PCClassFileTransformer if (_names != null) { if (_names.contains(clsName.replace('/', '.'))) - return Boolean.valueOf(!isEnhanced(bytes)); + return !isEnhanced(bytes); return null; } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ReflectingPersistenceCapable.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ReflectingPersistenceCapable.java index 82f460258..5efe72ea0 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ReflectingPersistenceCapable.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ReflectingPersistenceCapable.java @@ -100,35 +100,35 @@ public class ReflectingPersistenceCapable switch (meta.getField(i).getDeclaredTypeCode()) { case JavaTypes.BOOLEAN: sm.providedBooleanField(this, i, value == null ? false : - ((Boolean) value).booleanValue()); + (Boolean) value); break; case JavaTypes.BYTE: sm.providedByteField(this, i, value == null ? 0 : - ((Byte) value).byteValue()); + (Byte) value); break; case JavaTypes.CHAR: sm.providedCharField(this, i, value == null ? 0 : - ((Character) value).charValue()); + (Character) value); break; case JavaTypes.DOUBLE: sm.providedDoubleField(this, i, value == null ? 0 : - ((Double) value).doubleValue()); + (Double) value); break; case JavaTypes.FLOAT: sm.providedFloatField(this, i, value == null ? 0 : - ((Float) value).floatValue()); + (Float) value); break; case JavaTypes.INT: sm.providedIntField(this, i, value == null ? 0 : - ((Integer) value).intValue()); + (Integer) value); break; case JavaTypes.LONG: sm.providedLongField(this, i, value == null ? 0 : - ((Long) value).longValue()); + (Long) value); break; case JavaTypes.SHORT: sm.providedShortField(this, i, value == null ? 0 : - ((Short) value).shortValue()); + (Short) value); break; case JavaTypes.STRING: sm.providedStringField(this, i, (String) value); @@ -149,29 +149,28 @@ public class ReflectingPersistenceCapable public void pcReplaceField(int i) { switch(meta.getField(i).getDeclaredTypeCode()) { case JavaTypes.BOOLEAN: - setValue(i, o, Boolean.valueOf( - sm.replaceBooleanField(this, i))); + setValue(i, o, sm.replaceBooleanField(this, i)); break; case JavaTypes.BYTE: - setValue(i, o, Byte.valueOf(sm.replaceByteField(this, i))); + setValue(i, o, sm.replaceByteField(this, i)); break; case JavaTypes.CHAR: - setValue(i, o, Character.valueOf(sm.replaceCharField(this, i))); + setValue(i, o, sm.replaceCharField(this, i)); break; case JavaTypes.DOUBLE: - setValue(i, o, new Double(sm.replaceDoubleField(this, i))); + setValue(i, o, sm.replaceDoubleField(this, i)); break; case JavaTypes.FLOAT: - setValue(i, o, new Float(sm.replaceFloatField(this, i))); + setValue(i, o, sm.replaceFloatField(this, i)); break; case JavaTypes.INT: - setValue(i, o, Integer.valueOf(sm.replaceIntField(this, i))); + setValue(i, o, sm.replaceIntField(this, i)); break; case JavaTypes.LONG: - setValue(i, o, Long.valueOf(sm.replaceLongField(this, i))); + setValue(i, o, sm.replaceLongField(this, i)); break; case JavaTypes.SHORT: - setValue(i, o, Short.valueOf(sm.replaceShortField(this, i))); + setValue(i, o, sm.replaceShortField(this, i)); break; case JavaTypes.STRING: setValue(i, o, sm.replaceStringField(this, i)); @@ -273,7 +272,7 @@ public class ReflectingPersistenceCapable @Override public Boolean pcIsDetached() { if (sm != null) - return Boolean.valueOf(sm.isDetached()); + return sm.isDetached(); // ##### we could do a lot more here if a detached state field // ##### was specified. diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java index 3cf6e88a9..81ab673b7 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java @@ -481,7 +481,7 @@ public class Reflection { */ public static boolean getBoolean(Object target, Method getter) { Object o = get(target, getter); - return (o == null) ? false : ((Boolean) o).booleanValue(); + return (o == null) ? false : (Boolean) o; } /** @@ -497,7 +497,7 @@ public class Reflection { */ public static char getChar(Object target, Method getter) { Object o = get(target, getter); - return (o == null) ? (char) 0 : ((Character) o).charValue(); + return (o == null) ? (char) 0 : (Character) o; } /** diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java index e8d893dde..2312e6542 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java @@ -1757,8 +1757,7 @@ public class BrokerImpl implements Broker, FindCallbacks, Cloneable, Serializabl && (tranStatus != Status.STATUS_COMMITTED)) _runtime.setRollbackOnly(cause); else if (_log.isTraceEnabled()) - _log.trace(_loc.get("invalid-tran-status", Integer.valueOf( - tranStatus), "setRollbackOnly")); + _log.trace(_loc.get("invalid-tran-status", tranStatus, "setRollbackOnly")); } catch (OpenJPAException ke) { throw ke; } catch (Exception e) { @@ -4784,7 +4783,7 @@ public class BrokerImpl implements Broker, FindCallbacks, Cloneable, Serializabl return true; Boolean detached = pc.pcIsDetached(); if (detached != null) - return detached.booleanValue(); + return detached; if(!find){ return false; diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedValueStateManager.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedValueStateManager.java index 53e9e9cb2..90ce2f9cf 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedValueStateManager.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedValueStateManager.java @@ -362,19 +362,19 @@ public class DetachedValueStateManager return (fm.fetchBooleanField(field)) ? Boolean.TRUE : Boolean.FALSE; case JavaTypes.BYTE: - return Byte.valueOf(fm.fetchByteField(field)); + return fm.fetchByteField(field); case JavaTypes.CHAR: - return Character.valueOf(fm.fetchCharField(field)); + return fm.fetchCharField(field); case JavaTypes.DOUBLE: - return Double.valueOf(fm.fetchDoubleField(field)); + return fm.fetchDoubleField(field); case JavaTypes.FLOAT: - return Float.valueOf(fm.fetchFloatField(field)); + return fm.fetchFloatField(field); case JavaTypes.INT: return fm.fetchIntField(field); case JavaTypes.LONG: return fm.fetchLongField(field); case JavaTypes.SHORT: - return Short.valueOf(fm.fetchShortField(field)); + return fm.fetchShortField(field); default: return fm.fetchObjectField(field); } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java index a53e41fde..cdb611501 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java @@ -448,7 +448,7 @@ public class ExpressionStoreQuery for(Entry> entry : paramTypes.entrySet()){ Object key = entry.getKey(); int idx = (key instanceof Integer) - ? ((Integer)key).intValue() - base + ? (Integer) key - base : paramTypes.indexOf(key); if (idx >= arr.length || idx < 0) throw new UserException(_loc.get("gap-query-param", diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java index 6a36bd671..b1b4dea80 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java @@ -331,7 +331,7 @@ public class FetchConfigurationImpl && flush != QueryFlushModes.FLUSH_FALSE && flush != QueryFlushModes.FLUSH_WITH_CONNECTION) throw new IllegalArgumentException(_loc.get( - "bad-flush-before-queries", Integer.valueOf(flush)).getMessage()); + "bad-flush-before-queries", flush).getMessage()); if (flush == DEFAULT && _state.ctx != null) _state.flushQuery = _state.ctx.getConfiguration(). @@ -681,7 +681,7 @@ public class FetchConfigurationImpl && scope != LockScopes.LOCKSCOPE_NORMAL && scope != LockScopes.LOCKSCOPE_EXTENDED) throw new IllegalArgumentException(_loc.get( - "bad-lock-scope", Integer.valueOf(scope)).getMessage()); + "bad-lock-scope", scope).getMessage()); if (scope == DEFAULT ) _state.lockScope = LOCKSCOPE_NORMAL; else @@ -709,7 +709,7 @@ public class FetchConfigurationImpl && level != MixedLockLevels.LOCK_PESSIMISTIC_WRITE && level != MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT) throw new IllegalArgumentException(_loc.get( - "bad-lock-level", Integer.valueOf(level)).getMessage()); + "bad-lock-level", level).getMessage()); lock(); try { @@ -746,7 +746,7 @@ public class FetchConfigurationImpl && level != MixedLockLevels.LOCK_PESSIMISTIC_WRITE && level != MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT) throw new IllegalArgumentException(_loc.get( - "bad-lock-level", Integer.valueOf(level)).getMessage()); + "bad-lock-level", level).getMessage()); lock(); try { diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Filters.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Filters.java index d9e8c22e3..879226ad2 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Filters.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Filters.java @@ -309,7 +309,7 @@ public class Filters { else if (type == Character.class) { String str = o.toString(); if (str != null && str.length() == 1) { - return Character.valueOf(str.charAt(0)); + return str.charAt(0); } } else if (Calendar.class.isAssignableFrom(type) && o instanceof Date) { @@ -398,9 +398,9 @@ public class Filters { if (type == Integer.class && allowNumericConversion(o.getClass(), type, strictNumericConversion)) { return ((Number) o).intValue(); } else if (type == Float.class && allowNumericConversion(o.getClass(), type, strictNumericConversion)) { - return Float.valueOf(((Number) o).floatValue()); + return ((Number) o).floatValue(); } else if (type == Double.class) { - return Double.valueOf(((Number) o).doubleValue()); + return ((Number) o).doubleValue(); } else if (type == Long.class && allowNumericConversion(o.getClass(), type, strictNumericConversion)) { return ((Number) o).longValue(); } else if (type == BigDecimal.class) { @@ -410,20 +410,20 @@ public class Filters { // and Float versions, despite wanting to cast it to BigDecimal double dval = ((Number) o).doubleValue(); if (Double.isNaN(dval) || Double.isInfinite(dval)) { - return Double.valueOf(dval); + return dval; } float fval = ((Number) o).floatValue(); if (Float.isNaN(fval) || Float.isInfinite(fval)) { - return Float.valueOf(fval); + return fval; } return new BigDecimal(o.toString()); } else if (type == BigInteger.class) { return new BigInteger(o.toString()); } else if (type == Short.class && allowNumericConversion(o.getClass(), type, strictNumericConversion)) { - return Short.valueOf(((Number) o).shortValue()); + return ((Number) o).shortValue(); } else if (type == Byte.class && allowNumericConversion(o.getClass(), type, strictNumericConversion)) { - return Byte.valueOf(((Number) o).byteValue()); + return ((Number) o).byteValue(); } else if (type == Character.class) { return (char) ((Number) o).intValue(); } else if (!strictNumericConversion) { @@ -576,7 +576,7 @@ public class Filters { default: throw new InternalException(); } - return Float.valueOf(tot); + return tot; } /** @@ -603,7 +603,7 @@ public class Filters { default: throw new InternalException(); } - return Double.valueOf(tot); + return tot; } /** @@ -1084,15 +1084,15 @@ public class Filters { public static Object getDefaultForNull(Class nType) { if (nType == Long.class) - return Long.valueOf(0); + return 0L; if (nType == Integer.class) - return Integer.valueOf(0); + return 0; if (nType == Double.class) - return Double.valueOf(0.0); + return 0.0; if (nType == Float.class) - return new Float(0.0); + return 0.0F; if (nType == Short.class) - return Short.valueOf((short)0); + return (short) 0; return null; } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java index ebb00d07d..dceaedcb3 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java @@ -193,7 +193,7 @@ public class MethodStoreQuery continue; args[OBJ_INDEX] = obj; - if (((Boolean) invoke(q, args)).booleanValue()) + if ((Boolean) invoke(q, args)) results.add(obj); } } @@ -284,7 +284,7 @@ public class MethodStoreQuery int base = positionalParameterBase(userParams.keySet()); for (Object key : paramTypes.keySet()) { int idx = (key instanceof Integer) - ? ((Integer)key).intValue() - base + ? (Integer) key - base : paramTypes.indexOf(key); if (idx >= arr.length || idx < 0) throw new UserException(_loc.get("gap-query-param", diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ObjectIdStateManager.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ObjectIdStateManager.java index 65cd03438..587341599 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ObjectIdStateManager.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ObjectIdStateManager.java @@ -46,11 +46,11 @@ import org.apache.openjpa.util.ImplHelper; public class ObjectIdStateManager implements OpenJPAStateManager { - private static final Byte ZERO_BYTE = Byte.valueOf((byte)0); - private static final Character ZERO_CHAR = Character.valueOf((char)0); - private static final Double ZERO_DOUBLE = Double.valueOf(0); - private static final Float ZERO_FLOAT = Float.valueOf(0); - private static final Short ZERO_SHORT = Short.valueOf((short)0); + private static final Byte ZERO_BYTE = (byte) 0; + private static final Character ZERO_CHAR = (char) 0; + private static final Double ZERO_DOUBLE = (double) 0; + private static final Float ZERO_FLOAT = (float) 0; + private static final Short ZERO_SHORT = (short) 0; private Object _oid; private final OpenJPAStateManager _owner; @@ -429,7 +429,7 @@ public class ObjectIdStateManager case JavaTypes.BOOLEAN: return Boolean.FALSE.equals(val); case JavaTypes.CHAR: - return ((Character) val).charValue() == 0; + return (Character) val == 0; case JavaTypes.BYTE: case JavaTypes.DOUBLE: case JavaTypes.FLOAT: @@ -551,12 +551,12 @@ public class ObjectIdStateManager @Override public void storeByte(int field, byte extVal) { - setValue(field, Byte.valueOf(extVal), true); + setValue(field, extVal, true); } @Override public void storeChar(int field, char extVal) { - setValue(field, Character.valueOf(extVal), true); + setValue(field, extVal, true); } @Override @@ -566,7 +566,7 @@ public class ObjectIdStateManager @Override public void storeShort(int field, short extVal) { - setValue(field, Short.valueOf(extVal), true); + setValue(field, extVal, true); } @Override @@ -576,12 +576,12 @@ public class ObjectIdStateManager @Override public void storeFloat(int field, float extVal) { - setValue(field, Float.valueOf(extVal), true); + setValue(field, extVal, true); } @Override public void storeDouble(int field, double extVal) { - setValue(field, Double.valueOf(extVal), true); + setValue(field, extVal, true); } @Override @@ -661,7 +661,7 @@ public class ObjectIdStateManager @Override public boolean fetchBoolean(int field) { - return ((Boolean) getValue(field)).booleanValue(); + return (Boolean) getValue(field); } @Override @@ -671,7 +671,7 @@ public class ObjectIdStateManager @Override public char fetchChar(int field) { - return ((Character) getValue(field)).charValue(); + return (Character) getValue(field); } @Override diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java index e0a9b0832..331c8f585 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java @@ -480,7 +480,7 @@ public class QueryImpl implements Query { try { assertOpen(); if (_unique != null) - return _unique.booleanValue(); + return _unique; if ((_query == null && _language.endsWith("JPQL")) || _compiling || _broker == null) return false; @@ -488,7 +488,7 @@ public class QueryImpl implements Query { if (_compiled == null) { compileForCompilation(); if (_unique != null) - return _unique.booleanValue(); + return _unique; } // no explicit setting; default @@ -1171,7 +1171,7 @@ public class QueryImpl implements Query { switch (fmd.getDeclaredTypeCode()) { case JavaTypes.BOOLEAN: sm.settingBooleanField(into, i, sm.fetchBooleanField(i), - val == null ? false : ((Boolean) val).booleanValue(), + val == null ? false : (Boolean) val, set); break; case JavaTypes.BYTE: diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java index 361c99c4c..e9dfca813 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java @@ -908,19 +908,19 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { return (fetchBooleanField(field)) ? Boolean.TRUE : Boolean.FALSE; case JavaTypes.BYTE: - return Byte.valueOf(fetchByteField(field)); + return fetchByteField(field); case JavaTypes.CHAR: - return Character.valueOf(fetchCharField(field)); + return fetchCharField(field); case JavaTypes.DOUBLE: - return Double.valueOf(fetchDoubleField(field)); + return fetchDoubleField(field); case JavaTypes.FLOAT: - return Float.valueOf(fetchFloatField(field)); + return fetchFloatField(field); case JavaTypes.INT: return fetchIntField(field); case JavaTypes.LONG: return fetchLongField(field); case JavaTypes.SHORT: - return Short.valueOf(fetchShortField(field)); + return fetchShortField(field); default: return fetchObjectField(field); } @@ -1042,19 +1042,19 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { return (fm.fetchBooleanField(field)) ? Boolean.TRUE : Boolean.FALSE; case JavaTypes.BYTE: - return Byte.valueOf(fm.fetchByteField(field)); + return fm.fetchByteField(field); case JavaTypes.CHAR: - return Character.valueOf(fm.fetchCharField(field)); + return fm.fetchCharField(field); case JavaTypes.DOUBLE: - return Double.valueOf(fm.fetchDoubleField(field)); + return fm.fetchDoubleField(field); case JavaTypes.FLOAT: - return Float.valueOf(fm.fetchFloatField(field)); + return fm.fetchFloatField(field); case JavaTypes.INT: return fm.fetchIntField(field); case JavaTypes.LONG: return fm.fetchLongField(field); case JavaTypes.SHORT: - return Short.valueOf(fm.fetchShortField(field)); + return fm.fetchShortField(field); case JavaTypes.STRING: return fm.fetchStringField(field); default: @@ -1840,10 +1840,10 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { if (active) { if (_broker.getOptimistic()) setPCState(_state.beforeOptimisticWrite(this, field, - mutate.booleanValue())); + mutate)); else setPCState(_state.beforeWrite(this, field, - mutate.booleanValue())); + mutate)); } else if (fmd.getManagement() == FieldMetaData.MANAGE_PERSISTENT) { if (isPersistent() && !_broker.getNontransactionalWrite()) throw new InvalidStateException(_loc.get @@ -1851,7 +1851,7 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { (getManagedInstance()); setPCState(_state.beforeNontransactionalWrite(this, field, - mutate.booleanValue())); + mutate)); } if ((_flags & FLAG_FLUSHED) != 0) { @@ -2398,7 +2398,7 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { return fetchBooleanField(field); Object val = fetchField(field, false); - return ((Boolean) fmd.getExternalValue(val, _broker)).booleanValue(); + return (Boolean) fmd.getExternalValue(val, _broker); } @Override @@ -2446,7 +2446,7 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { return fetchCharField(field); Object val = fetchField(field, false); - return ((Character) fmd.getExternalValue(val, _broker)).charValue(); + return (Character) fmd.getExternalValue(val, _broker); } @Override @@ -2661,7 +2661,7 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { if (!fmd.isExternalized()) storeByteField(field, externalVal); else - storeField(field, fmd.getFieldValue(Byte.valueOf(externalVal), + storeField(field, fmd.getFieldValue(externalVal, _broker)); } @@ -2684,7 +2684,7 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { if (!fmd.isExternalized()) storeCharField(field, externalVal); else - storeField(field, fmd.getFieldValue(Character.valueOf(externalVal), + storeField(field, fmd.getFieldValue(externalVal, _broker)); } @@ -2707,7 +2707,7 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { if (!fmd.isExternalized()) storeDoubleField(field, externalVal); else - storeField(field, fmd.getFieldValue(Double.valueOf(externalVal), _broker)); + storeField(field, fmd.getFieldValue(externalVal, _broker)); } @Override @@ -2729,7 +2729,7 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { if (!fmd.isExternalized()) storeFloatField(field, externalVal); else - storeField(field, fmd.getFieldValue(Float.valueOf(externalVal), _broker)); + storeField(field, fmd.getFieldValue(externalVal, _broker)); } @Override @@ -2821,7 +2821,7 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { if (!fmd.isExternalized()) storeShortField(field, externalVal); else - storeField(field, fmd.getFieldValue(Short.valueOf(externalVal), + storeField(field, fmd.getFieldValue(externalVal, _broker)); } @@ -2872,7 +2872,7 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { switch (fmd.getDeclaredTypeCode()) { case JavaTypes.BOOLEAN: - boolean bool = val != null && ((Boolean) val).booleanValue(); + boolean bool = val != null && (Boolean) val; fm.storeBooleanField(field, bool); break; case JavaTypes.BYTE: @@ -2880,7 +2880,7 @@ public class StateManagerImpl implements OpenJPAStateManager, Serializable { fm.storeByteField(field, b); break; case JavaTypes.CHAR: - char c = (val == null) ? 0 : ((Character) val).charValue(); + char c = (val == null) ? 0 : (Character) val; fm.storeCharField(field, c); break; case JavaTypes.DOUBLE: diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Abs.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Abs.java index 16575bef7..bb6a634c9 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Abs.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Abs.java @@ -58,9 +58,9 @@ class Abs if (c == Integer.class) return Math.abs(((Number) o).intValue()); if (c == Float.class) - return Float.valueOf(Math.abs(((Number) o).floatValue())); + return Math.abs(((Number) o).floatValue()); if (c == Double.class) - return Double.valueOf(Math.abs(((Number) o).doubleValue())); + return Math.abs(((Number) o).doubleValue()); if (c == Long.class) return Math.abs(((Number) o).longValue()); if (c == BigDecimal.class) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/InMemoryExpressionFactory.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/InMemoryExpressionFactory.java index 1b8ca3cbd..cb771c734 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/InMemoryExpressionFactory.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/InMemoryExpressionFactory.java @@ -817,8 +817,8 @@ public class InMemoryExpressionFactory return (_asc) ? -1 : 1; if (o1 instanceof Boolean && o2 instanceof Boolean) { - int i1 = ((Boolean) o1).booleanValue() ? 1 : 0; - int i2 = ((Boolean) o2).booleanValue() ? 1 : 0; + int i1 = (Boolean) o1 ? 1 : 0; + int i2 = (Boolean) o2 ? 1 : 0; return i1 - i2; } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java index 741f48592..3ddce5381 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java @@ -99,7 +99,7 @@ public class QueryExpressions implements Serializable { if (_aggregate == null) _aggregate = (AggregateExpressionVisitor.isAggregate(projections)) ? Boolean.TRUE : Boolean.FALSE; - return _aggregate.booleanValue(); + return _aggregate; } public boolean isDistinct() { diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Sqrt.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Sqrt.java index 542fac2a0..e9d207f4b 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Sqrt.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Sqrt.java @@ -43,6 +43,6 @@ class Sqrt @Override protected Object operate(Object o, Class c) { - return Double.valueOf(Math.sqrt(((Number) o).doubleValue())); + return Math.sqrt(((Number) o).doubleValue()); } } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ValExpression.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ValExpression.java index 5e26e8e8d..8b294b0d8 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ValExpression.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ValExpression.java @@ -45,7 +45,7 @@ class ValExpression protected boolean eval(Object candidate, Object orig, StoreContext ctx, Object[] params) { Object o = _val.eval(candidate, orig, ctx, params); - return o != null && ((Boolean) o).booleanValue(); + return o != null && (Boolean) o; } @Override @@ -53,7 +53,7 @@ class ValExpression Object[] params) { Collection c = _val.eval(candidates, null, ctx, params); Object o = (c == null || c.isEmpty()) ? null : c.iterator().next(); - return o != null && ((Boolean) o).booleanValue(); + return o != null && (Boolean) o; } @Override diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java index 7e277928c..97db506f1 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java @@ -1035,7 +1035,7 @@ public class JPQLExpressionBuilder ? node.text.substring(0, node.text.length() - 1) : node.text). multiply(new BigDecimal(negative(node))); - return factory.newLiteral(Long.valueOf(intlit.longValue()), + return factory.newLiteral(intlit.longValue(), Literal.TYPE_NUMBER); case JJTDECIMALLITERAL: @@ -1322,7 +1322,7 @@ public class JPQLExpressionBuilder case JJTCONCAT: if (node.children.length < 2) throw parseException(EX_USER, "less-child-count", - new Object[]{ Integer.valueOf(2), node, + new Object[]{2, node, Arrays.asList(node.children) }, null); val1 = getValue(firstChild(node)); @@ -1485,7 +1485,7 @@ public class JPQLExpressionBuilder ? node.text.substring(0, node.text.length() - 1) : node.text). multiply(new BigDecimal(negative(node))); - return factory.newLiteral(Integer.valueOf(bigdec.intValue()), + return factory.newLiteral(bigdec.intValue(), Literal.TYPE_NUMBER); } @@ -2209,7 +2209,7 @@ public class JPQLExpressionBuilder private JPQLNode child(JPQLNode node, int childNum, int assertCount) { if (node.children.length != assertCount) throw parseException(EX_USER, "wrong-child-count", - new Object[]{ Integer.valueOf(assertCount), node, + new Object[]{assertCount, node, Arrays.asList(node.children) }, null); return node.children[childNum]; diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java index fd7f1cdc5..1200e24e3 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java @@ -108,8 +108,8 @@ public abstract class AbstractCFMetaDataFactory File file; for (int i = 0; i < strs.length; i++) { file = new File(strs[i]); - if ((AccessController.doPrivileged( - J2DoPrivHelper.existsAction(file))).booleanValue()) + if (AccessController.doPrivileged( + J2DoPrivHelper.existsAction(file))) this.files.add(file); } } @@ -377,8 +377,8 @@ public abstract class AbstractCFMetaDataFactory for (int i = 0; i < metas.length; i++) { if (getSourceFile(metas[i]) == null) setSourceFile(metas[i], defaultSourceFile(metas[i])); - if ((AccessController.doPrivileged(J2DoPrivHelper - .existsAction(getSourceFile(metas[i])))).booleanValue()) { + if (AccessController.doPrivileged(J2DoPrivHelper + .existsAction(getSourceFile(metas[i])))) { if (files == null) files = new HashSet(); files.add(getSourceFile(metas[i])); @@ -393,9 +393,8 @@ public abstract class AbstractCFMetaDataFactory queries[i].setSource(defaultFile, queries[i].getSourceScope(), queries[i].getSourceType(), defaultFile == null ? "" : defaultFile.getPath()); } - if ((AccessController.doPrivileged( - J2DoPrivHelper.existsAction(queries[i].getSourceFile()))) - .booleanValue()) { + if (AccessController.doPrivileged( + J2DoPrivHelper.existsAction(queries[i].getSourceFile()))) { if (files == null) files = new HashSet(); files.add(queries[i].getSourceFile()); @@ -406,9 +405,8 @@ public abstract class AbstractCFMetaDataFactory if (getSourceFile(seqs[i]) == null) setSourceFile(seqs[i], defaultSourceFile(seqs[i], clsNames)); - if ((AccessController.doPrivileged( - J2DoPrivHelper.existsAction(getSourceFile(seqs[i])))) - .booleanValue()) { + if (AccessController.doPrivileged( + J2DoPrivHelper.existsAction(getSourceFile(seqs[i])))) { if (files == null) files = new HashSet(); files.add(getSourceFile(seqs[i])); @@ -436,9 +434,8 @@ public abstract class AbstractCFMetaDataFactory queries[i].setSource(defaultFile, queries[i].getSourceScope(), queries[i].getSourceType(), defaultFile == null ? "" : defaultFile.getPath()); } - if ((AccessController.doPrivileged( - J2DoPrivHelper.existsAction(queries[i].getSourceFile()))) - .booleanValue()) { + if (AccessController.doPrivileged( + J2DoPrivHelper.existsAction(queries[i].getSourceFile()))) { if (files == null) files = new HashSet(); files.add(queries[i].getSourceFile()); @@ -650,8 +647,8 @@ public abstract class AbstractCFMetaDataFactory File file; for (Iterator itr = files.iterator(); itr.hasNext();) { file = (File) itr.next(); - if ((AccessController.doPrivileged(J2DoPrivHelper - .isDirectoryAction(file))).booleanValue()) { + if (AccessController.doPrivileged(J2DoPrivHelper + .isDirectoryAction(file))) { if (log.isTraceEnabled()) log.trace(_loc.get("scanning-directory", file)); scan(new FileMetaDataIterator(file, newMetaDataFilter()), @@ -699,9 +696,8 @@ public abstract class AbstractCFMetaDataFactory .getAbsoluteFileAction(new File(url.getFile()))); if (files != null && files.contains(file)) { continue; - } else if ((AccessController - .doPrivileged(J2DoPrivHelper.isDirectoryAction(file))) - .booleanValue()) { + } else if (AccessController + .doPrivileged(J2DoPrivHelper.isDirectoryAction(file))) { if (log.isTraceEnabled()) log.trace(_loc.get("scanning-directory", file)); scan( diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java index c40840e8d..a0c0c8b36 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java @@ -595,7 +595,7 @@ public class ClassMetaData */ public boolean isObjectIdTypeShared() { if (_objectIdShared != null) - return _objectIdShared.booleanValue(); + return _objectIdShared; if (_super != null) return getPCSuperclassMetaData().isObjectIdTypeShared(); return isOpenJPAIdentity(); @@ -612,7 +612,7 @@ public class ClassMetaData _openjpaId = (OpenJPAId.class.isAssignableFrom(cls)) ? Boolean.TRUE : Boolean.FALSE; } - return _openjpaId.booleanValue(); + return _openjpaId; } /** @@ -769,7 +769,7 @@ public class ClassMetaData else _extent = Boolean.TRUE; } - return _extent.booleanValue(); + return _extent; } /** @@ -791,7 +791,7 @@ public class ClassMetaData else _embedded = Boolean.FALSE; } - return _embedded.booleanValue(); + return _embedded; } /** @@ -831,7 +831,7 @@ public class ClassMetaData public boolean isManagedInterface() { if (!_type.isInterface()) return false; - return _interface == null ? false : _interface.booleanValue(); + return _interface == null ? false : _interface; } /** @@ -1584,7 +1584,7 @@ public class ClassMetaData else _detachable = Boolean.FALSE; } - return _detachable.booleanValue(); + return _detachable; } /** @@ -2143,7 +2143,7 @@ public class ClassMetaData } } } - return _useIdClassFromParent.booleanValue(); + return _useIdClassFromParent; } /** @@ -2705,7 +2705,7 @@ public class ClassMetaData */ public boolean hasAbstractPKField() { if (_hasAbstractPKField != null) { - return _hasAbstractPKField.booleanValue(); + return _hasAbstractPKField; } // Default to false, set to true only if this type is abstract and @@ -2725,7 +2725,7 @@ public class ClassMetaData } _hasAbstractPKField = temp; - return _hasAbstractPKField.booleanValue(); + return _hasAbstractPKField; } /** @@ -2740,7 +2740,7 @@ public class ClassMetaData */ public boolean hasPKFieldsFromAbstractClass() { if (_hasPKFieldsFromAbstractClass != null) { - return _hasPKFieldsFromAbstractClass.booleanValue(); + return _hasPKFieldsFromAbstractClass; } // Default to FALSE, until proven true. @@ -2766,7 +2766,7 @@ public class ClassMetaData } _hasPKFieldsFromAbstractClass = temp; - return _hasPKFieldsFromAbstractClass.booleanValue(); + return _hasPKFieldsFromAbstractClass; } /** @@ -2804,7 +2804,7 @@ public class ClassMetaData int idsSize = ids.size(); int[] temp = new int[idsSize]; for (int i = 0; i < idsSize; i++) { - temp[i] = ids.get(i).intValue(); + temp[i] = ids.get(i); } _pkAndNonPersistentManagedFmdIndexes = temp; } @@ -2822,7 +2822,7 @@ public class ClassMetaData } inverseManagedFields = res; } - return inverseManagedFields.booleanValue(); + return inverseManagedFields; } public List getMappyedByIdFields() { diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/Extensions.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/Extensions.java index 202131bfa..c785c24de 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/Extensions.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/Extensions.java @@ -220,7 +220,7 @@ public abstract class Extensions */ public boolean getBooleanExtension(String vendor, String key) { String str = getStringExtension(vendor, key); - return (str == null) ? false : Boolean.valueOf(str).booleanValue(); + return (str == null) ? false : Boolean.valueOf(str); } /** diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java index 85218622d..1dead9b0b 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java @@ -317,7 +317,7 @@ public class FetchGroup */ public boolean isPostLoad () { if (_postLoad != null) - return _postLoad.booleanValue(); + return _postLoad; if (_meta != null) { ClassMetaData sup = _meta.getPCSuperclassMetaData(); diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java index 3ea4388f9..c35ef4629 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java @@ -659,7 +659,7 @@ public class FieldMetaData _enumField = Enum.class.isAssignableFrom(decl) ? Boolean.TRUE : Boolean.FALSE; } - return _enumField.booleanValue(); + return _enumField; } private boolean isSerializable() { @@ -670,7 +670,7 @@ public class FieldMetaData else _serializableField = Boolean.FALSE; } - return _serializableField.booleanValue(); + return _serializableField; } private boolean isLobArray() { @@ -683,7 +683,7 @@ public class FieldMetaData else _lobField = Boolean.FALSE; } - return _lobField.booleanValue(); + return _lobField; } /** @@ -1537,7 +1537,7 @@ public class FieldMetaData return Float.valueOf(val); case JavaTypes.CHAR: case JavaTypes.CHAR_OBJ: - return Character.valueOf(val.charAt(0)); + return val.charAt(0); case JavaTypes.STRING: return val; case JavaTypes.ENUM: @@ -2467,7 +2467,7 @@ public class FieldMetaData public boolean isDelayCapable() { if (_delayCapable != null) { - return _delayCapable.booleanValue(); + return _delayCapable; } if (getTypeCode() != JavaTypes.COLLECTION || isLRS()) { _delayCapable = Boolean.FALSE; diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java index c1c9f8fd5..c0b9b8a3f 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java @@ -162,7 +162,7 @@ public class JavaTypes { Integer code = _typeCodes.get(type); if (code != null) { - return code.intValue(); + return code; } // have to do this first to catch custom collection and map types; @@ -342,7 +342,7 @@ public class JavaTypes { if (val instanceof Byte) return val; if (val instanceof Number) - return Byte.valueOf(((Number) val).byteValue()); + return ((Number) val).byteValue(); // no break case BYTE: if (val instanceof String) @@ -353,9 +353,9 @@ public class JavaTypes { if (val instanceof Character) return val; if (val instanceof String) - return Character.valueOf(val.toString().charAt(0)); + return val.toString().charAt(0); if (val instanceof Number) - return Character.valueOf((char) ((Number) val).intValue()); + return (char) ((Number) val).intValue(); return val; case DATE: if (val instanceof String) @@ -365,7 +365,7 @@ public class JavaTypes { if (val instanceof Double) return val; if (val instanceof Number) - return Double.valueOf(((Number) val).doubleValue()); + return ((Number) val).doubleValue(); // no break case DOUBLE: if (val instanceof String) @@ -375,7 +375,7 @@ public class JavaTypes { if (val instanceof Float) return val; if (val instanceof Number) - return Float.valueOf(((Number) val).floatValue()); + return ((Number) val).floatValue(); // no break case FLOAT: if (val instanceof String) @@ -411,7 +411,7 @@ public class JavaTypes { if (val instanceof Short) return val; if (val instanceof Number) - return Short.valueOf(((Number) val).shortValue()); + return ((Number) val).shortValue(); // no break case SHORT: if (val instanceof String) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java index dfea7c276..34f0c1aee 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java @@ -99,7 +99,7 @@ public class QueryMetaData * Whether the query has been marked read-only. */ public boolean isReadOnly() { - return _readOnly != null && _readOnly.booleanValue(); + return _readOnly != null && _readOnly; } /** @@ -217,7 +217,7 @@ public class QueryMetaData if (_res != null) query.setResultType(_res); if (_readOnly != null) - query.setReadOnly(_readOnly.booleanValue()); + query.setReadOnly(_readOnly); if (_resultSetMappingName != null) query.setResultMapping(null, _resultSetMappingName); } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ValueMetaDataImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ValueMetaDataImpl.java index f85e00c81..9086422f0 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ValueMetaDataImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ValueMetaDataImpl.java @@ -182,7 +182,7 @@ public class ValueMetaDataImpl _embedded = Boolean.TRUE; } } - return _embedded.booleanValue(); + return _embedded; } @Override diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/AbstractChangeTracker.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/AbstractChangeTracker.java index a891503b1..bbd14288e 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/AbstractChangeTracker.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/AbstractChangeTracker.java @@ -213,9 +213,9 @@ public abstract class AbstractChangeTracker else _identity = Boolean.FALSE; - add = switchStructure(add, _identity.booleanValue()); - rem = switchStructure(rem, _identity.booleanValue()); - change = switchStructure(change, _identity.booleanValue()); + add = switchStructure(add, _identity); + rem = switchStructure(rem, _identity); + change = switchStructure(change, _identity); } /** diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java index 7c8c06e3a..5ca1993ab 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java @@ -152,7 +152,7 @@ public class ApplicationIds { case JavaTypes.CHAR: case JavaTypes.CHAR_OBJ: return new CharId(meta.getDescribedType(), - val == null ? 0 : ((Character) val).charValue()); + val == null ? 0 : (Character) val); case JavaTypes.DOUBLE: case JavaTypes.DOUBLE_OBJ: if (!convert && !(val instanceof Double)) @@ -611,17 +611,17 @@ public class ApplicationIds { @Override public void storeByteField(int field, byte val) { - store(Byte.valueOf(val)); + store(val); } @Override public void storeCharField(int field, char val) { - store(Character.valueOf(val)); + store(val); } @Override public void storeShortField(int field, short val) { - store(Short.valueOf(val)); + store(val); } @Override @@ -636,12 +636,12 @@ public class ApplicationIds { @Override public void storeFloatField(int field, float val) { - store(Float.valueOf(val)); + store(val); } @Override public void storeDoubleField(int field, double val) { - store(Double.valueOf(val)); + store(val); } @Override @@ -661,7 +661,7 @@ public class ApplicationIds { @Override public char fetchCharField(int field) { - return ((Character) retrieve(field)).charValue(); + return (Character) retrieve(field); } @Override diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/BooleanId.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/BooleanId.java index 1094eb3b7..2cae87e67 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/BooleanId.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/BooleanId.java @@ -54,7 +54,7 @@ public class BooleanId extends OpenJPAId { @Override public Object getIdObject() { - return Boolean.valueOf(key); + return key; } @Override diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/ByteId.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/ByteId.java index 958cec774..28688781b 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/ByteId.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/ByteId.java @@ -30,7 +30,7 @@ public final class ByteId extends OpenJPAId { private final byte key; public ByteId(Class cls, Byte key) { - this(cls, (key == null) ? (byte) 0 : key.byteValue()); + this(cls, (key == null) ? (byte) 0 : key); } public ByteId(Class cls, String key) { @@ -53,7 +53,7 @@ public final class ByteId extends OpenJPAId { @Override public Object getIdObject() { - return Byte.valueOf(key); + return key; } @Override diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/CharId.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/CharId.java index a955593c9..3eac17be9 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/CharId.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/CharId.java @@ -30,7 +30,7 @@ public final class CharId extends OpenJPAId { private final char key; public CharId(Class cls, Character key) { - this(cls, (key == null) ? (char) 0 : key.charValue()); + this(cls, (key == null) ? (char) 0 : key); } public CharId(Class cls, String key) { @@ -53,7 +53,7 @@ public final class CharId extends OpenJPAId { @Override public Object getIdObject() { - return Character.valueOf(key); + return key; } @Override diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/DoubleId.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/DoubleId.java index 3d42582e1..bc5cbe7b0 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/DoubleId.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/DoubleId.java @@ -31,7 +31,7 @@ public final class DoubleId private final double key; public DoubleId(Class cls, Double key) { - this(cls, (key == null) ? 0D : key.doubleValue()); + this(cls, (key == null) ? 0D : key); } public DoubleId(Class cls, String key) { @@ -54,7 +54,7 @@ public final class DoubleId @Override public Object getIdObject() { - return Double.valueOf(key); + return key; } @Override diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/FloatId.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/FloatId.java index 22381ed05..6d77cfe4f 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/FloatId.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/FloatId.java @@ -31,7 +31,7 @@ public final class FloatId private final float key; public FloatId(Class cls, Float key) { - this(cls, (key == null) ? 0F : key.floatValue()); + this(cls, (key == null) ? 0F : key); } public FloatId(Class cls, String key) { @@ -54,7 +54,7 @@ public final class FloatId @Override public Object getIdObject() { - return Float.valueOf(key); + return key; } @Override diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/Id.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/Id.java index ca5378859..346e1b294 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/Id.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/Id.java @@ -117,7 +117,7 @@ public final class Id * Construct from key value. */ public Id(Class cls, Long key) { - this(cls, (key == null) ? 0L : key.longValue()); + this(cls, (key == null) ? 0L : key); } /** diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java index 023abf82f..decf29fb1 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java @@ -262,11 +262,11 @@ public class ImplHelper { } if (isAssignable == null) {// we don't have a record of this pair... - isAssignable = Boolean.valueOf(from.isAssignableFrom(to)); + isAssignable = from.isAssignableFrom(to); assignableTo.put(to, isAssignable); } - return isAssignable.booleanValue(); + return isAssignable; } /** diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/IntId.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/IntId.java index 3dc2bd62b..a5110d09a 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/IntId.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/IntId.java @@ -31,7 +31,7 @@ public final class IntId extends OpenJPAId { private final int key; public IntId(Class cls, Integer key) { - this(cls, (key == null) ? 0 : key.intValue()); + this(cls, (key == null) ? 0 : key); } public IntId(Class cls, String key) { diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/LongId.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/LongId.java index 0b776a6aa..606c504dc 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/LongId.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/LongId.java @@ -31,7 +31,7 @@ public final class LongId extends OpenJPAId { private final long key; public LongId(Class cls, Long key) { - this(cls, (key == null) ? 0L : key.longValue()); + this(cls, (key == null) ? 0L : key); } public LongId(Class cls, String key) { diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java index 48298d45e..5e0af10c3 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java @@ -119,9 +119,9 @@ public abstract class OpenJPAId superclass = base.getSuperclass(); } _typeHash = base.getName().hashCode(); - _typeCache.put(type, Integer.valueOf(_typeHash)); + _typeCache.put(type, _typeHash); } else { - _typeHash = typeHashInt.intValue(); + _typeHash = typeHashInt; } } return _typeHash ^ idHash(); diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/ShortId.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/ShortId.java index ba49c8c26..009b84170 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/ShortId.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/ShortId.java @@ -30,7 +30,7 @@ public final class ShortId extends OpenJPAId { private final short key; public ShortId(Class cls, Short key) { - this(cls, (key == null) ? (short) 0 : key.shortValue()); + this(cls, (key == null) ? (short) 0 : key); } public ShortId(Class cls, String key) { @@ -53,7 +53,7 @@ public final class ShortId extends OpenJPAId { @Override public Object getIdObject() { - return Short.valueOf(key); + return key; } @Override diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java b/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java index ef3f082aa..b2a4950c9 100644 --- a/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java +++ b/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java @@ -85,11 +85,11 @@ public class TestProxyManager { * Populate the given list with arbitrary data. */ private static void populate(Collection coll) { - coll.add(new Integer(1)); + coll.add(1); coll.add("foo"); - coll.add(new Long(99)); + coll.add(99L); coll.add("bar"); - coll.add(new Short((short) 50)); + coll.add((short) 50); } /** @@ -145,11 +145,11 @@ public class TestProxyManager { * Populate the given sorted set with arbitrary data. */ private static void populate(SortedSet coll) { - coll.add(new Integer(1)); - coll.add(new Integer(99)); - coll.add(new Integer(50)); - coll.add(new Integer(-5)); - coll.add(new Integer(10)); + coll.add(1); + coll.add(99); + coll.add(50); + coll.add(-5); + coll.add(10); } /** @@ -422,10 +422,10 @@ public class TestProxyManager { * Populate the given map with arbitrary data. */ private static void populate(Map map) { - map.put(new Integer(1), "1"); - map.put(new Integer(99), "99"); - map.put(new Integer(-2), "-2"); - map.put(new Integer(50), "50"); + map.put(1, "1"); + map.put(99, "99"); + map.put(-2, "-2"); + map.put(50, "50"); } /** diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/ant/AbstractTask.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/ant/AbstractTask.java index 9ffc22e61..421848d06 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/ant/AbstractTask.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/ant/AbstractTask.java @@ -209,8 +209,8 @@ public abstract class AbstractTask extends MatchingTask { String[] dsFiles = ds.getIncludedFiles(); for (int j = 0; j < dsFiles.length; j++) { File f = new File(dsFiles[j]); - if (!( AccessController.doPrivileged(J2DoPrivHelper - .isFileAction(f))).booleanValue()) + if (!AccessController.doPrivileged(J2DoPrivHelper + .isFileAction(f))) f = new File(ds.getBasedir(), dsFiles[j]); files.add(AccessController.doPrivileged( J2DoPrivHelper.getAbsolutePathAction(f))); diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BooleanValue.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BooleanValue.java index 5209d1847..8f572df3a 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BooleanValue.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BooleanValue.java @@ -63,7 +63,7 @@ public class BooleanValue extends Value { @Override protected void setInternalString(String val) { - set(Boolean.valueOf(val).booleanValue()); + set(Boolean.valueOf(val)); } @Override @@ -71,6 +71,6 @@ public class BooleanValue extends Value { if (obj == null) set(false); else - set(((Boolean) obj).booleanValue()); + set((Boolean) obj); } } diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java index 624f3cc19..94fcbb48f 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java @@ -341,13 +341,13 @@ public class Configurations { String anchor = result.get(CONFIG_RESOURCE_ANCHOR); File file = new File(path); - if ((AccessController.doPrivileged(J2DoPrivHelper - .isFileAction(file))).booleanValue()) + if (AccessController.doPrivileged(J2DoPrivHelper + .isFileAction(file))) provider = ProductDerivations.load(file, anchor, null); else { file = new File("META-INF" + File.separatorChar + path); - if ((AccessController.doPrivileged(J2DoPrivHelper - .isFileAction(file))).booleanValue()) + if (AccessController.doPrivileged(J2DoPrivHelper + .isFileAction(file))) provider = ProductDerivations.load(file, anchor, null); else provider = ProductDerivations.load(path, anchor, null); diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java index 3c606d683..ec928838e 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java @@ -407,15 +407,13 @@ public class ProductDerivations { } File f = new File(propertiesLocation); - if (((Boolean) J2DoPrivHelper.isFileAction(f).run()) - .booleanValue()) { + if ((Boolean) J2DoPrivHelper.isFileAction(f).run()) { addAll(fqAnchors, propertiesLocation, _derivations[i].getAnchorsInFile(f)); } else { f = new File("META-INF" + File.separatorChar + propertiesLocation); - if (((Boolean) J2DoPrivHelper.isFileAction(f).run()) - .booleanValue()) { + if ((Boolean) J2DoPrivHelper.isFileAction(f).run()) { addAll(fqAnchors, propertiesLocation, _derivations[i].getAnchorsInFile(f)); } else { diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/ConfiguringConnectionDecorator.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/ConfiguringConnectionDecorator.java index daf42ed1a..1dcf82cf0 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/ConfiguringConnectionDecorator.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/ConfiguringConnectionDecorator.java @@ -107,8 +107,8 @@ public class ConfiguringConnectionDecorator implements ConnectionDecorator { super(conn); if (_autoCommit != null) { _curAutoCommit = ConfiguringConnection.this.getAutoCommit(); - if (_curAutoCommit != _autoCommit.booleanValue()) - setAutoCommit(_autoCommit.booleanValue()); + if (_curAutoCommit != _autoCommit) + setAutoCommit(_autoCommit); } } @@ -125,8 +125,8 @@ public class ConfiguringConnectionDecorator implements ConnectionDecorator { if (_isolation != TRANSACTION_NONE) super.commit(); if (_autoCommit != null - && _autoCommit.booleanValue() != _curAutoCommit) - setAutoCommit(_autoCommit.booleanValue()); + && _autoCommit != _curAutoCommit) + setAutoCommit(_autoCommit); } @Override @@ -134,8 +134,8 @@ public class ConfiguringConnectionDecorator implements ConnectionDecorator { if (_isolation != TRANSACTION_NONE) super.rollback(); if (_autoCommit != null - && _autoCommit.booleanValue() != _curAutoCommit) - setAutoCommit(_autoCommit.booleanValue()); + && _autoCommit != _curAutoCommit) + setAutoCommit(_autoCommit); } @Override diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java index ace5aa350..6b8a9fcd5 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java @@ -114,7 +114,7 @@ public class LogFactoryImpl l = newLogImpl(); l.setChannel(channel); // TODO add to interface? Short lvl = _configuredLevels.get(shorten(channel)); - l.setLevel(lvl == null ? _defaultLogLevel : lvl.shortValue()); + l.setLevel(lvl == null ? _defaultLogLevel : lvl); _logs.put(channel, l); } return l; @@ -282,7 +282,7 @@ public class LogFactoryImpl for (Iterator> iter = opts.entrySet().iterator(); iter.hasNext();) { e = iter.next(); - _configuredLevels.put(shorten((String) e.getKey()), Short.valueOf(getLevel((String) e.getValue()))); + _configuredLevels.put(shorten((String) e.getKey()), getLevel((String) e.getValue())); } opts.clear(); } diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java index c13c95769..e4a22f760 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java @@ -216,8 +216,8 @@ public class ClassArgParser { return new String[]{ getFromClassFile(file) }; if (arg.endsWith(".java")) return new String[]{ getFromJavaFile(file) }; - if ((AccessController.doPrivileged( - J2DoPrivHelper.existsAction(file))).booleanValue()) { + if (AccessController.doPrivileged( + J2DoPrivHelper.existsAction(file))) { Collection col = getFromMetaDataFile(file); return col.toArray(new String[col.size()]); } diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassMetaDataIterator.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassMetaDataIterator.java index 76839ea42..246ea3b49 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassMetaDataIterator.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassMetaDataIterator.java @@ -192,8 +192,8 @@ public class ClassMetaDataIterator implements MetaDataIterator { if (_url == -1 || _url >= _urls.size()) throw new IllegalStateException(); File file = new File(URLDecoder.decode((_urls.get(_url)).getFile())); - return ((AccessController.doPrivileged( - J2DoPrivHelper.existsAction(file))).booleanValue()) ? file:null; + return (AccessController.doPrivileged( + J2DoPrivHelper.existsAction(file))) ? file:null; } @Override diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClasspathMetaDataIterator.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClasspathMetaDataIterator.java index dc94e0417..5da5b660c 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClasspathMetaDataIterator.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClasspathMetaDataIterator.java @@ -60,11 +60,11 @@ public class ClasspathMetaDataIterator extends MetaDataIteratorChain { continue; File file = new File(tokens[i]); - if (!(AccessController.doPrivileged( - J2DoPrivHelper.existsAction(file))).booleanValue()) + if (!AccessController.doPrivileged( + J2DoPrivHelper.existsAction(file))) continue; if (AccessController.doPrivileged(J2DoPrivHelper - .isDirectoryAction(file)).booleanValue()) + .isDirectoryAction(file))) addIterator(new FileMetaDataIterator(file, filter)); else if (tokens[i].endsWith(".jar")) { try { diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java index 28624a602..3ce915860 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java @@ -164,8 +164,8 @@ public class FileMetaDataIterator implements MetaDataIterator { @Override public byte[] getContent() throws IOException { - long len = (AccessController.doPrivileged( - J2DoPrivHelper.lengthAction(_file))).longValue(); + long len = AccessController.doPrivileged( + J2DoPrivHelper.lengthAction(_file)); FileInputStream fin = null; try { fin = AccessController.doPrivileged( diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ResourceMetaDataIterator.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ResourceMetaDataIterator.java index 4cefb8e3d..06413de44 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ResourceMetaDataIterator.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ResourceMetaDataIterator.java @@ -106,8 +106,8 @@ public class ResourceMetaDataIterator implements MetaDataIterator { if (_url == -1 || _url >= _urls.size()) throw new IllegalStateException(); File file = new File(URLDecoder.decode((_urls.get(_url)).getFile())); - return ((AccessController.doPrivileged( - J2DoPrivHelper.existsAction(file))).booleanValue()) ? file :null; + return (AccessController.doPrivileged( + J2DoPrivHelper.existsAction(file))) ? file :null; } @Override diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/URLMetaDataIterator.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/URLMetaDataIterator.java index cc1cdee7f..4964fdc5e 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/URLMetaDataIterator.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/URLMetaDataIterator.java @@ -80,8 +80,8 @@ public class URLMetaDataIterator implements MetaDataIterator { if (_url == null) return null; File file = new File(URLDecoder.decode(_url.getPath())); - return ((AccessController.doPrivileged( - J2DoPrivHelper.existsAction(file))).booleanValue()) ? file:null; + return (AccessController.doPrivileged( + J2DoPrivHelper.existsAction(file))) ? file:null; } @Override diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java index 7f3a1d1ef..4cf064eda 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java @@ -305,8 +305,8 @@ public abstract class XMLMetaDataParser extends DefaultHandler public void parse(File file) throws IOException { if (file == null) return; - if (!(AccessController.doPrivileged(J2DoPrivHelper - .isDirectoryAction(file))).booleanValue()) + if (!AccessController.doPrivileged(J2DoPrivHelper + .isDirectoryAction(file))) parse(new FileMetaDataIterator(file)); else { String suff = (_suffix == null) ? "" : _suffix; diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataSerializer.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataSerializer.java index c916d179e..60582a3f5 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataSerializer.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataSerializer.java @@ -138,8 +138,8 @@ public abstract class XMLMetaDataSerializer implements MetaDataSerializer { File backup = Files.backup(file, false); if (backup == null) { File parent = file.getParentFile(); - if (parent != null && !(AccessController.doPrivileged( - J2DoPrivHelper.existsAction(parent))).booleanValue()) + if (parent != null && !AccessController.doPrivileged( + J2DoPrivHelper.existsAction(parent))) AccessController.doPrivileged( J2DoPrivHelper.mkdirsAction(parent)); } diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/RandomAccessResultList.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/RandomAccessResultList.java index 8f4ce5b80..99415daa4 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/RandomAccessResultList.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/RandomAccessResultList.java @@ -118,7 +118,7 @@ public class RandomAccessResultList extends AbstractNonSequentialResultList { private Object instantiateRow(Integer i) { _requests++; try { - if (!_rop.absolute(i.intValue())) + if (!_rop.absolute(i)) return PAST_END; Object ob = _rop.getResultObject(); @@ -157,7 +157,7 @@ public class RandomAccessResultList extends AbstractNonSequentialResultList { Integer key; for (Iterator itr = _rows.keySet().iterator(); itr.hasNext(); count++) { key = (Integer) itr.next(); - full[key.intValue()] = _rows.get(key); + full[key] = _rows.get(key); } // double-check, in case any of the soft references were diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/ResultObjectProviderIterator.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/ResultObjectProviderIterator.java index 7a754532d..dfb52fcbe 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/ResultObjectProviderIterator.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/rop/ResultObjectProviderIterator.java @@ -83,7 +83,7 @@ public class ResultObjectProviderIterator implements Iterator, Closeable { } // close if we reach the end of the list - if (!_hasNext.booleanValue()) { + if (!_hasNext) { close(); return false; } diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java index 0f7cc996a..674e28a85 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java @@ -48,8 +48,8 @@ public class Files { * the file does not exist or a backup could not be created, returns null. */ public static File backup(File file, boolean copy) { - if (file == null || !(AccessController.doPrivileged( - J2DoPrivHelper.existsAction(file))).booleanValue()) + if (file == null || !AccessController.doPrivileged( + J2DoPrivHelper.existsAction(file))) return null; // create new file object copy so we don't modify the original @@ -57,8 +57,8 @@ public class Files { J2DoPrivHelper.getAbsolutePathAction(file)); File clone = new File(aPath); File bk = new File(aPath + "~"); - if (!(AccessController.doPrivileged( - J2DoPrivHelper.renameToAction(clone, bk))).booleanValue()) + if (!AccessController.doPrivileged( + J2DoPrivHelper.renameToAction(clone, bk))) return null; if (copy) { try { @@ -80,8 +80,8 @@ public class Files { return null; if (!backup.getName().endsWith("~")) backup = new File(backup.getPath() + "~"); - if (!(AccessController.doPrivileged( - J2DoPrivHelper.existsAction(backup))).booleanValue()) + if (!AccessController.doPrivileged( + J2DoPrivHelper.existsAction(backup))) return null; // create new file object copy so we don't modify the original @@ -89,8 +89,8 @@ public class Files { J2DoPrivHelper.getAbsolutePathAction(backup)); File clone = new File(path); File orig = new File(path.substring(0, path.length() - 1)); - if (!(AccessController.doPrivileged( - J2DoPrivHelper.renameToAction(clone, orig))).booleanValue()) + if (!AccessController.doPrivileged( + J2DoPrivHelper.renameToAction(clone, orig))) return null; if (copy) { try { @@ -148,8 +148,8 @@ public class Files { base = new File(AccessController.doPrivileged( J2DoPrivHelper.getPropertyAction("user.dir"))); if (StringUtil.isEmpty(pkg)) { - if (mkdirs && !(AccessController.doPrivileged( - J2DoPrivHelper.existsAction(base))).booleanValue()) + if (mkdirs && !AccessController.doPrivileged( + J2DoPrivHelper.existsAction(base))) AccessController.doPrivileged( J2DoPrivHelper.mkdirsAction(base)); return base; @@ -170,8 +170,8 @@ public class Files { throw new RuntimeException(ioe); } - if (mkdirs && !(AccessController.doPrivileged( - J2DoPrivHelper.existsAction(file))).booleanValue()) + if (mkdirs && !AccessController.doPrivileged( + J2DoPrivHelper.existsAction(file))) AccessController.doPrivileged(J2DoPrivHelper.mkdirsAction(file)); return file; } @@ -192,8 +192,8 @@ public class Files { return null; File file = new File(name); - if ((AccessController.doPrivileged( - J2DoPrivHelper.existsAction(file))).booleanValue()) + if (AccessController.doPrivileged( + J2DoPrivHelper.existsAction(file))) return file; if (loader == null) @@ -205,8 +205,8 @@ public class Files { String urlFile = url.getFile(); if (urlFile != null) { File rsrc = new File(URLDecoder.decode(urlFile)); - if ((AccessController.doPrivileged( - J2DoPrivHelper.existsAction(rsrc))).booleanValue()) + if (AccessController.doPrivileged( + J2DoPrivHelper.existsAction(rsrc))) return rsrc; } } @@ -293,8 +293,8 @@ public class Files { */ public static boolean copy(File from, File to) throws IOException { if (from == null || to == null || - !(AccessController.doPrivileged( - J2DoPrivHelper.existsAction(from))).booleanValue()) + !AccessController.doPrivileged( + J2DoPrivHelper.existsAction(from))) return false; FileInputStream in = null; diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java index 0866d9caa..f02e011a1 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java @@ -644,7 +644,7 @@ public abstract class J2DoPrivHelper { return new PrivilegedAction() { @Override public Long run() { - return Long.valueOf(f.length()); + return f.length(); } }; } diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java index dc23a52ad..072409f8e 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java @@ -58,13 +58,13 @@ public class Options extends TypedProperties { // maps primitive types to the appropriate wrapper class and default value private static Object[][] _primWrappers = new Object[][]{ { boolean.class, Boolean.class, Boolean.FALSE }, - { byte.class, Byte.class, Byte.valueOf((byte) 0) }, - { char.class, Character.class, Character.valueOf((char) 0) }, - { double.class, Double.class, Double.valueOf(0D) }, - { float.class, Float.class, Float.valueOf(0F) }, - { int.class, Integer.class, Integer.valueOf(0) }, - { long.class, Long.class, Long.valueOf(0L) }, - { short.class, Short.class, Short.valueOf((short) 0) }, }; + { byte.class, Byte.class, (byte) 0}, + { char.class, Character.class, (char) 0}, + { double.class, Double.class, 0D}, + { float.class, Float.class, 0F}, + { int.class, Integer.class, 0}, + { long.class, Long.class, 0L}, + { short.class, Short.class, (short) 0}, }; private static Localizer _loc = Localizer.forPackage(Options.class); diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/StringUtil.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/StringUtil.java index 2a46898cd..461264f38 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/StringUtil.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/StringUtil.java @@ -26,13 +26,13 @@ public final class StringUtil { private static final String[] EMPTY_STRING_ARRAY = new String[0]; - private static final Byte BYTE_ZERO = Byte.valueOf((byte) 0); - private static final Character CHAR_ZERO = Character.valueOf((char) 0); - private static final Double DOUBLE_ZERO = Double.valueOf(0.0d); - private static final Float FLOAT_ZERO = Float.valueOf(0.0f); - private static final Integer INTEGER_ZERO = Integer.valueOf(0); - private static final Long LONG_ZERO = Long.valueOf(0); - private static final Short SHORT_ZERO = Short.valueOf((short) 0); + private static final Byte BYTE_ZERO = (byte) 0; + private static final Character CHAR_ZERO = (char) 0; + private static final Double DOUBLE_ZERO = 0.0d; + private static final Float FLOAT_ZERO = 0.0f; + private static final Integer INTEGER_ZERO = 0; + private static final Long LONG_ZERO = 0L; + private static final Short SHORT_ZERO = (short) 0; private StringUtil() { } @@ -446,7 +446,7 @@ public final class StringUtil { private static Character parseCharString(String val) { if (val.length() == 0) { - return Character.valueOf((char) 0); + return (char) 0; } if (val.length() == 1) { return val.charAt(0); diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/ListIteratorWrapper.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/ListIteratorWrapper.java index b9de65ec4..a4ae7714a 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/ListIteratorWrapper.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/collections/ListIteratorWrapper.java @@ -218,7 +218,7 @@ public class ListIteratorWrapper implements ResettableListIterator { --removeIndex; } if (!removeState || wrappedIteratorIndex - currentIndex > 1) { - throw new IllegalStateException(MessageFormat.format(CANNOT_REMOVE_MESSAGE, Integer.valueOf(removeIndex))); + throw new IllegalStateException(MessageFormat.format(CANNOT_REMOVE_MESSAGE, removeIndex)); } iterator.remove(); list.remove(removeIndex); diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/TestConfigurationImpl.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/TestConfigurationImpl.java index ae55bfae7..c8788180b 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/TestConfigurationImpl.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/TestConfigurationImpl.java @@ -136,7 +136,7 @@ public class TestConfigurationImpl extends AbstractTestCase { Map props3 = _conf.toProperties(false); _conf.setTestKey("changed"); Map props4 = _conf.toProperties(false); - _conf.setPluginKey(new Integer(1)); + _conf.setPluginKey(1); Map props5 = _conf.toProperties(false); assertEquals(props1, props2); assertEquals(props1, props3); @@ -195,8 +195,8 @@ public class TestConfigurationImpl extends AbstractTestCase { else if (param == String.class) setVal = randomString(); else if (param == boolean.class) - setVal = new Boolean(!(((Boolean) getter.invoke(_conf, - (Object[]) null)).booleanValue())); + setVal = !(((Boolean) getter.invoke(_conf, + (Object[]) null)).booleanValue()); else continue; diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/TestPluginValue.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/TestPluginValue.java index 5417d2575..e7e04ceae 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/TestPluginValue.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/TestPluginValue.java @@ -66,9 +66,9 @@ public class TestPluginValue extends AbstractTestCase { val.setDefault("foo"); val.setString("x=y"); assertEquals("foo(x=y)", val.getString()); - val.set(new Integer(1)); + val.set(1); assertEquals("java.lang.Integer", val.getString()); - assertEquals(new Integer(1), val.get()); + assertEquals(1, val.get()); val.set(null); assertEquals("foo", val.getString()); assertEquals(null, val.get()); diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestDepthFirstAnalysis.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestDepthFirstAnalysis.java index eb4e9e851..f9dc00fc4 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestDepthFirstAnalysis.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestDepthFirstAnalysis.java @@ -64,11 +64,11 @@ public class TestDepthFirstAnalysis public void setUpGraph2() { Graph graph = new Graph(); - Integer node1 = new Integer(1); - Integer node2 = new Integer(2); - Integer node3 = new Integer(3); - Integer node4 = new Integer(4); - Integer node5 = new Integer(5); + Integer node1 = 1; + Integer node2 = 2; + Integer node3 = 3; + Integer node4 = 4; + Integer node5 = 5; graph.addNode(node2); // has to be first node for testcase graph.addNode(node5); graph.addNode(node4); diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/test/AbstractTestCase.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/test/AbstractTestCase.java index 7c5a44599..96ddf20fe 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/test/AbstractTestCase.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/test/AbstractTestCase.java @@ -95,7 +95,7 @@ public abstract class AbstractTestCase { * Support method to get a random Integer for testing. */ public static Integer randomInt() { - return new Integer((int) (Math.random() * Integer.MAX_VALUE)); + return (int) (Math.random() * Integer.MAX_VALUE); } /** @@ -108,15 +108,15 @@ public abstract class AbstractTestCase { 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; - return new Character(TEST_CHAR_ARRAY[ - (int) (Math.random() * TEST_CHAR_ARRAY.length)]); + return TEST_CHAR_ARRAY[ + (int) (Math.random() * TEST_CHAR_ARRAY.length)]; } /** * Support method to get a random Long for testing. */ public static Long randomLong() { - return new Long((long) (Math.random() * Long.MAX_VALUE)); + return (long) (Math.random() * Long.MAX_VALUE); } diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestPropertiesParser.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestPropertiesParser.java index 8dc734d8e..71fd35b3e 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestPropertiesParser.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestPropertiesParser.java @@ -247,8 +247,8 @@ public class TestPropertiesParser { 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; - return new Character(TEST_CHAR_ARRAY[ - (int) (Math.random() * TEST_CHAR_ARRAY.length)]); + return TEST_CHAR_ARRAY[ + (int) (Math.random() * TEST_CHAR_ARRAY.length)]; } static String randomString(int len) { diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestReferenceSet.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestReferenceSet.java index 0b210789e..a334b6e14 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestReferenceSet.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/TestReferenceSet.java @@ -37,12 +37,12 @@ public class TestReferenceSet { private ReferenceHashSet _coll = new ReferenceHashSet(ReferenceStrength.WEAK); - private Object _heldValue = new Integer(2); + private Object _heldValue = 2; @Before public void setUp() { _coll.add(_heldValue); - _coll.add(new Integer(1)); + _coll.add(1); } /** @@ -89,7 +89,7 @@ public class TestReferenceSet { System.gc(); System.gc(); - assertTrue(!_coll.contains(new Integer(1))); + assertTrue(!_coll.contains(1)); assertEquals(1, _coll.size()); int size = 0; @@ -102,7 +102,7 @@ public class TestReferenceSet { assertEquals(2, _coll.size()); assertTrue(_coll.contains("foo")); assertTrue(_coll.contains(_heldValue)); - assertTrue(!_coll.contains(new Integer(1))); + assertTrue(!_coll.contains(1)); } /** @@ -113,7 +113,7 @@ public class TestReferenceSet { if (JavaVersions.VERSION >= 5) return; - Object held = new Integer(1); + Object held = 1; assertTrue(_coll.remove(held)); assertTrue(_coll.add(held)); System.gc(); diff --git a/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java b/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java index 26e6274c8..f1944f562 100644 --- a/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java +++ b/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/AnnotationPersistenceMappingParser.java @@ -1699,9 +1699,9 @@ public class AnnotationPersistenceMappingParser } if (xmlRootElementClass != null && StringUtil.isEmpty(pcols[i].columnDefinition()) - && (AccessController.doPrivileged(J2DoPrivHelper + && AccessController.doPrivileged(J2DoPrivHelper .isAnnotationPresentAction(fm.getDeclaredType(), - (Class) xmlRootElementClass))).booleanValue()) { + (Class) xmlRootElementClass))) { DBDictionary dict = ((MappingRepository) getRepository()) .getDBDictionary(); if (dict.supportsXMLColumn) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/conf/TestQueryProperties.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/conf/TestQueryProperties.java index ba91e4ed3..38c2328a4 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/conf/TestQueryProperties.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/conf/TestQueryProperties.java @@ -66,8 +66,8 @@ public class TestQueryProperties extends SingleEMFTestCase { OpenJPAQuery q; Map hints; Integer timeout; - Integer lTime = new Integer(0); - Integer qTime = new Integer(0); + Integer lTime = 0; + Integer qTime = 0; // create our PU without properties emf1 = OpenJPAPersistence.createEntityManagerFactory( @@ -190,8 +190,8 @@ public class TestQueryProperties extends SingleEMFTestCase { OpenJPAQuery q; Map hints; Integer timeout; - Integer lTime = new Integer(10000); - Integer qTime = new Integer(5000); + Integer lTime = 10000; + Integer qTime = 5000; // create our PU with properties emf1 = OpenJPAPersistence.createEntityManagerFactory( diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingToolAutoDelete.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingToolAutoDelete.java index 1fbf1f28b..a50448270 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingToolAutoDelete.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/TestMappingToolAutoDelete.java @@ -73,7 +73,7 @@ public class TestMappingToolAutoDelete MappingTool.run(_conf, new String[0], flags, null); EntityManager em = emf.createEntityManager(); - assertEquals(Long.valueOf(0), + assertEquals(0L, em.createQuery("select count(o) from AllFieldTypes o") .getSingleResult()); em.close(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira1794/AggEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira1794/AggEntity.java index 099f6e67c..28ca63f86 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira1794/AggEntity.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira1794/AggEntity.java @@ -146,7 +146,7 @@ public class AggEntity { public void init() { setPshortVal((short) 1); - setShortVal(Short.valueOf((short) 1)); + setShortVal((short) 1); setIntVal(1); setPintVal(1); setLongVal(1L); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEmbeddedId.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEmbeddedId.java index 2f9a8b854..53d7d271e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEmbeddedId.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEmbeddedId.java @@ -193,7 +193,7 @@ public class TestEmbeddedId extends AnnotationTestCase q = em.createQuery("select e.id.pk2 from EmbeddedIdEntity e " + "where e.id.pk1 = 1"); - assertEquals(new Long(_oid.getPk2()), q.getSingleResult()); + assertEquals(_oid.getPk2(), q.getSingleResult()); q = em.createQuery("select e.id from EmbeddedIdEntity e " + "where e.id.pk1 = 1"); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestJoinedInheritance.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestJoinedInheritance.java index ff9e3f73e..8314746b4 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestJoinedInheritance.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestJoinedInheritance.java @@ -52,7 +52,7 @@ public class TestJoinedInheritance extends AnnotationTestCase OpenJPAEntityManager em =(OpenJPAEntityManager) currentEntityManager(); startTx(em); AnnoTest3 pc = new AnnoTest3(); - pc.setPk(new Long(1)); + pc.setPk(1L); pc.setBasic(10); pc.setBasic2(20); em.persist(pc); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestManyToMany.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestManyToMany.java index 987a99e1a..ce420d40d 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestManyToMany.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestManyToMany.java @@ -58,7 +58,7 @@ public class TestManyToMany extends AnnotationTestCase endEm(em); em =(OpenJPAEntityManager) currentEntityManager(); - pc = em.find(AnnoTest1.class, new Long(lid)); + pc = em.find(AnnoTest1.class, lid); Set many = pc.getManyMany(); assertEquals(3, many.size()); for (AnnoTest2 manyPc2 : many) { @@ -95,7 +95,7 @@ public class TestManyToMany extends AnnotationTestCase endEm(em); em =(OpenJPAEntityManager) currentEntityManager(); - pc = em.find(AnnoTest1.class, new Long(lid)); + pc = em.find(AnnoTest1.class, lid); Set many = pc.getInverseOwnerManyMany(); assertEquals(3, many.size()); for (AnnoTest2 manyPc2 : many) { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestMappedSuperClass.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestMappedSuperClass.java index 2a0ae14fb..8a6f8b8ee 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestMappedSuperClass.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestMappedSuperClass.java @@ -36,7 +36,7 @@ import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype. public class TestMappedSuperClass extends AnnotationTestCase { - public static Long pkey = new Long(1500); + public static Long pkey = 1500L; public static String pstr = "TestParty"; public static int ikey = 1501; public static PartyId pid = new PartyId(pstr, ikey); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestVersion.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestVersion.java index ff1b9cc3a..e87e555f7 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestVersion.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestVersion.java @@ -64,7 +64,7 @@ public class TestVersion extends AnnotationTestCase OpenJPAEntityManager em = currentEntityManager(); startTx(em); AnnoTest1 test1 = new AnnoTest1(); - test1.setPk(new Long(5)); + test1.setPk(5L); test1.setBasic(50); test1.setTransient(500); em.persist(test1); @@ -76,7 +76,7 @@ public class TestVersion extends AnnotationTestCase em.persist(test2); AnnoTest3 test3 = new AnnoTest3(); - test3.setPk(new Long(3)); + test3.setPk(3L); test3.setBasic2(50); em.persist(test3); oid = em.getObjectId(test1); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/AnnoTest1.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/AnnoTest1.java index a80bd632f..84512c58b 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/AnnoTest1.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/AnnoTest1.java @@ -164,7 +164,7 @@ public class AnnoTest1 { } public AnnoTest1(long pk) { - this.pk = new Long(pk); + this.pk = pk; } public void setPk(Long val) { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Generator.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Generator.java index f25d82dda..c7415d360 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Generator.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Generator.java @@ -88,7 +88,7 @@ public class Generator { StringTokenizer tok = new StringTokenizer(str, ","); pk = Integer.parseInt(tok.nextToken()); pk2 = Integer.valueOf(tok.nextToken()); - pk3 = Long.valueOf(tok.nextToken()); + pk3 = Long.parseLong(tok.nextToken()); } @Override diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/PostPersistEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/PostPersistEntity.java index 603a6b0f6..11df1e69e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/PostPersistEntity.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/PostPersistEntity.java @@ -45,7 +45,7 @@ public class PostPersistEntity { @PostPersist public void postPersist() { postPersistCallbackCount++; - idOnCallback = ((Long)getByReflection("id")).longValue(); + idOnCallback = (Long) getByReflection("id"); } public String getName() { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java index d56ab2f45..36769ab8c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java @@ -358,7 +358,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase { * Support method to get a random Integer for testing. */ public static Integer randomInt() { - return new Integer((int) (Math.random() * Integer.MAX_VALUE)); + return (int) (Math.random() * Integer.MAX_VALUE); } /** @@ -371,50 +371,50 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase { 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; - return new Character(TEST_CHAR_ARRAY[ - (int) (Math.random() * TEST_CHAR_ARRAY.length)]); + return TEST_CHAR_ARRAY[ + (int) (Math.random() * TEST_CHAR_ARRAY.length)]; } /** * Support method to get a random Long for testing. */ public static Long randomLong() { - return new Long((long) (Math.random() * Long.MAX_VALUE)); + return (long) (Math.random() * Long.MAX_VALUE); } /** * Support method to get a random Short for testing. */ public static Short randomShort() { - return new Short((short) (Math.random() * Short.MAX_VALUE)); + return (short) (Math.random() * Short.MAX_VALUE); } /** * Support method to get a random Double for testing. */ public static Double randomDouble() { - return new Double((double) (Math.round(Math.random() * 5000d)) / 1000d); + return (double) (Math.round(Math.random() * 5000d)) / 1000d; } /** * Support method to get a random Float for testing. */ public static Float randomFloat() { - return new Float((float) (Math.round(Math.random() * 5000f)) / 1000f); + return (float) (Math.round(Math.random() * 5000f)) / 1000f; } /** * Support method to get a random Byte for testing. */ public static Byte randomByte() { - return new Byte((byte) (Math.random() * Byte.MAX_VALUE)); + return (byte) (Math.random() * Byte.MAX_VALUE); } /** * Support method to get a random Boolean for testing. */ public static Boolean randomBoolean() { - return new Boolean(Math.random() > 0.5 ? true : false); + return Math.random() > 0.5 ? true : false; } /** @@ -515,7 +515,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase { // up to 100K blob byte [] blob = new byte [(int) (Math.random() * 1024 * 100)]; for (int i = 0; i < blob.length; i++) - blob[i] = randomByte().byteValue(); + blob[i] = randomByte(); return blob; } @@ -1182,7 +1182,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase { if (collection instanceof List) { List ll = new ArrayList(); for (int i = 0; i < 100; i++) - ll.add(new Integer(i)); + ll.add(i); validateList((List) ll); validateList((List) collection); } @@ -1244,12 +1244,12 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase { // fill random access list List indices = new LinkedList(); for (int i = 0; i < list.size(); i++) - indices.add(new Integer(i)); + indices.add(i); for (int i = 0; i < list.size(); i++) { int rand = (int) (Math.random() * indices.size()); Integer randIndex = (Integer) indices.remove(rand); - values4[randIndex.intValue()] = list.get(randIndex.intValue()); + values4[randIndex] = list.get(randIndex); } assertEquals(Arrays.asList(coreValues), Arrays.asList(values1)); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/conf/TestOpenJPAConfiguration.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/conf/TestOpenJPAConfiguration.java index d09ebbbaa..8117f6e7c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/conf/TestOpenJPAConfiguration.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/conf/TestOpenJPAConfiguration.java @@ -60,8 +60,8 @@ public class TestOpenJPAConfiguration map.put("openjpa.ConnectionFactory", cfactory); map.put("openjpa.ConnectionFactory2", cfactory2); map.put("openjpa.Optimistic", Boolean.FALSE); - map.put("openjpa.LockTimeout", new Integer(503)); - map.put("javax.persistence.query.timeout", new Integer(1500)); + map.put("openjpa.LockTimeout", 503); + map.put("javax.persistence.query.timeout", 1500); // use new conf so no unexpected restrictions on type of connection // factory @@ -85,7 +85,7 @@ public class TestOpenJPAConfiguration assertEquals("503", p.get("openjpa.LockTimeout")); assertEquals(p, conf2.toProperties(false)); - map.put("openjpa.LockTimeout", new Integer(504)); + map.put("openjpa.LockTimeout", 504); OpenJPAConfiguration conf3 = new OpenJPAConfigurationImpl(true, false); conf3.fromProperties(map); assertNotEquals(conf, conf3); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestByteArray.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestByteArray.java index 7fcfb6b46..fde96bd5e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestByteArray.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestByteArray.java @@ -32,7 +32,7 @@ import org.apache.openjpa.persistence.test.SingleEMFTestCase; public class TestByteArray extends SingleEMFTestCase { protected CriteriaBuilder cb; String pic = "IamNotAPicture"; - Character[] chars = new Character[] { new Character('a'), new Character('b') }; + Character[] chars = new Character[] {'a', 'b'}; @Override public void setUp() { super.setUp(BlogUser.class diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/init/TestCriteriaInitialization.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/init/TestCriteriaInitialization.java index 7f0b60e8b..b6ddcdf1b 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/init/TestCriteriaInitialization.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/init/TestCriteriaInitialization.java @@ -37,11 +37,11 @@ public class TestCriteriaInitialization extends SingleEMFTestCase { try { em.getTransaction().begin(); - em.persist(new MyUserEntity("wayne", Long.valueOf(1))); - em.persist(new MyUserEntity("garth", Long.valueOf(2))); + em.persist(new MyUserEntity("wayne", 1L)); + em.persist(new MyUserEntity("garth", 2L)); - em.persist(new AddressEntity(new AddressPk("street_1", Long.valueOf(1)))); - em.persist(new AddressEntity(new AddressPk("street_2", Long.valueOf(2)))); + em.persist(new AddressEntity(new AddressPk("street_1", 1L))); + em.persist(new AddressEntity(new AddressPk("street_2", 2L))); em.getTransaction().commit(); } finally { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/multiselect/TestCriteriaMultiselectAliasing.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/multiselect/TestCriteriaMultiselectAliasing.java index bfb4c1104..80387b57d 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/multiselect/TestCriteriaMultiselectAliasing.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/multiselect/TestCriteriaMultiselectAliasing.java @@ -141,7 +141,7 @@ public class TestCriteriaMultiselectAliasing extends SQLListenerTestCase { //the 'outer' query has an affect....is it OK to use 'day' from the outer query?? I'm //assuming so since 'testGeneratedCriteriaQueryString' generates the expected SQL. // subQueryPredicates.add(cb.greaterThanOrEqualTo(day.get(DimDay_.monthStrtDate), new Long(20150201L))); - subQueryPredicates.add(cb.equal(day.get(DimDay_.monthStrtDate), new Long(20150201L))); + subQueryPredicates.add(cb.equal(day.get(DimDay_.monthStrtDate), 20150201L)); //Doing this places the 'T_DIM_DAY t3' in the 'inner'/sub query. Is this the proper solution?? Or just a //hacky work around? diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheLoadTest.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheLoadTest.java index 5c1b24e92..2c6ce30e1 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheLoadTest.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheLoadTest.java @@ -48,9 +48,9 @@ public class CacheLoadTest private EntityManagerFactory emf; protected int threadCount = - Integer.getInteger("cachetest.threads", 30).intValue(); + Integer.getInteger("cachetest.threads", 30); protected int interationCount = - Integer.getInteger("cachetest.iterations", 1000).intValue(); + Integer.getInteger("cachetest.iterations", 1000); @Override public void setUp() throws Exception { @@ -71,8 +71,8 @@ public class CacheLoadTest public void testCacheLoad() throws Exception { - mttest(Integer.getInteger("cachetest.threads", 30).intValue(), - Integer.getInteger("cachetest.iterations", 1000).intValue()); + mttest(Integer.getInteger("cachetest.threads", 30), + Integer.getInteger("cachetest.iterations", 1000)); switch ((int) (Math.random() * 4)) { case 0: @@ -91,7 +91,7 @@ public class CacheLoadTest } private int rnd(int num) { - return randomInt().intValue() % num; + return randomInt() % num; } private void insert() @@ -126,7 +126,7 @@ public class CacheLoadTest try { new ArrayList((Collection) em .createQuery("org.apache.openjpa.kernel.jpql.JPQL", - filters[randomInt().intValue() % filters.length]). + filters[randomInt() % filters.length]). getResultList()); } catch (IllegalStateException e) { e.printStackTrace(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java index 4371cb330..8da84e930 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java @@ -754,9 +754,9 @@ public abstract class CacheTest extends AbstractTestCase { q.setCandidateExtent(broker.newExtent(CacheObjectA.class, false)); start = System.currentTimeMillis(); assertInCache(q, inCache, new Object[]{ ORIG_NAME, - new Integer(ORIG_AGE) }); + ORIG_AGE}); l = (List) q.execute(new Object[]{ ORIG_NAME, - new Integer(ORIG_AGE) }); + ORIG_AGE}); iterate(l); q2p1 = System.currentTimeMillis() - start; @@ -764,7 +764,7 @@ public abstract class CacheTest extends AbstractTestCase { start = System.currentTimeMillis(); l2 = (List) q.execute(new Object[]{ ORIG_NAME, - new Integer(ORIG_AGE) }); + ORIG_AGE}); iterate(l2); q2p2 = System.currentTimeMillis() - start; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTestHelper.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTestHelper.java index d2055a8bc..0207f9e24 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTestHelper.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTestHelper.java @@ -97,7 +97,7 @@ class CacheTestHelper { if (res instanceof Collection) return res instanceof CacheTestBroker.CachedQueryResult; // no way to tell if unique results from cache - return expected.booleanValue(); + return expected; } static void iterate(Collection c) { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestMutableParameters.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestMutableParameters.java index 28cb5de18..e85d984fe 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestMutableParameters.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestMutableParameters.java @@ -105,7 +105,7 @@ public class TestMutableParameters new Object[]{ d }); c = (Collection) q.execute(new Object[]{ d }); - assertFalse(new Integer(initialSize).equals(new Integer(c.size()))); + assertFalse(new Integer(initialSize).equals(c.size())); } //FIXME Seetha Nov 10,2006 diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestResultShapes.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestResultShapes.java index bfe6de576..237198efe 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestResultShapes.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestResultShapes.java @@ -198,7 +198,7 @@ public class TestResultShapes extends AbstractTestCase { arrayResultHelper(iter.next(), recordClasses, inCache); } - CacheTestHelper.assertInCache(this, q, new Boolean(inCache)); + CacheTestHelper.assertInCache(this, q, inCache); if (unique) { arrayResultHelper(q.execute(), recordClasses, inCache); @@ -242,7 +242,7 @@ public class TestResultShapes extends AbstractTestCase { mapResultHelper(iter.next(), recordClasses, results, inCache); } - CacheTestHelper.assertInCache(this, q, new Boolean(inCache)); + CacheTestHelper.assertInCache(this, q, inCache); if (unique) { mapResultHelper(q.execute(), recordClasses, results, inCache); @@ -282,7 +282,7 @@ public class TestResultShapes extends AbstractTestCase { assertEquals(recordClass, iter.next().getClass()); } - CacheTestHelper.assertInCache(this, q, new Boolean(inCache)); + CacheTestHelper.assertInCache(this, q, inCache); if (unique) { assertEquals(recordClass, q.execute().getClass()); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detach/Entity10.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detach/Entity10.java index baf2cd5ac..3b11ef95f 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detach/Entity10.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detach/Entity10.java @@ -53,8 +53,8 @@ public class Entity10 { private void initialize() { intCollection = new ArrayList<>(); - intCollection.add(new Integer(1)); - intCollection.add(new Integer(99)); + intCollection.add(1); + intCollection.add(99); stringCollection = new HashSet<>(); stringCollection.add(new String("xxx")); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detach/Entity20.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detach/Entity20.java index 91c48c8f6..03cc29bf1 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detach/Entity20.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detach/Entity20.java @@ -57,7 +57,7 @@ public class Entity20 implements Serializable { } public Entity20(int id) { - this.id = new Integer(id); + this.id = id; this.name = this.id.toString(); Long time = System.currentTimeMillis(); this.sqlTime = new Time(time); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detach/TestDetachNoProxy.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detach/TestDetachNoProxy.java index 5c08618c9..071f5340c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detach/TestDetachNoProxy.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detach/TestDetachNoProxy.java @@ -61,7 +61,7 @@ public class TestDetachNoProxy extends SingleEMFTestCase { * Verify that an in-place detached entity does not use the proxy classes. */ public void testDetach20() { - Integer id = new Integer(0); + Integer id = 0; OpenJPAEntityManagerFactorySPI emf2 = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "NoProxy2New", "org/apache/openjpa/persistence/detach/persistence2.xml"); @@ -108,7 +108,7 @@ public class TestDetachNoProxy extends SingleEMFTestCase { * Verify that a detachCopy() returned entity does not contain any proxy classes. */ public void testDetachCopy20() { - Integer id = new Integer(0); + Integer id = 0; OpenJPAEntityManagerFactorySPI emf2 = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( "NoProxy2New", "org/apache/openjpa/persistence/detach/persistence2.xml"); @@ -183,7 +183,7 @@ public class TestDetachNoProxy extends SingleEMFTestCase { ArrayList e20List = new ArrayList<>(numEntities); for (int i=0; i e20List = new ArrayList<>(numEntities); for (int i=0; i e20List = new ArrayList<>(numEntities); for (int i=0; i e20List = new ArrayList<>(numEntities); for (int i=0; i 0); + .getSingleResult() > 0); }finally{ em.close(); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/EmbeddableEntityWithIDAnnotation.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/EmbeddableEntityWithIDAnnotation.java index 5e0190ea4..57268aae6 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/EmbeddableEntityWithIDAnnotation.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/EmbeddableEntityWithIDAnnotation.java @@ -36,7 +36,7 @@ public class EmbeddableEntityWithIDAnnotation implements java.io.Serializable private Long id; - private Long seqNo = new Long(2012); + private Long seqNo = 2012L; public EmbeddableEntityWithIDAnnotation( ) { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/IDOwningClassTestEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/IDOwningClassTestEntity.java index 5a38be9bb..6147d5230 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/IDOwningClassTestEntity.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/IDOwningClassTestEntity.java @@ -25,7 +25,7 @@ import javax.persistence.Entity; @Entity public class IDOwningClassTestEntity { @EmbeddedId - EmbeddableEntityWithIDAnnotation pk = new EmbeddableEntityWithIDAnnotation(new Long(2012), new Long(2000)); + EmbeddableEntityWithIDAnnotation pk = new EmbeddableEntityWithIDAnnotation(2012L, 2000L); String name; diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestParameterLogging.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestParameterLogging.java index c9b0fa0fa..38ce9eaba 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestParameterLogging.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestParameterLogging.java @@ -132,14 +132,14 @@ public class TestParameterLogging extends AbstractPersistenceTestCase implements props = new Object[] { PObject.class, CLEAR_TABLES, "openjpa.DataCache", "true", "openjpa.Log", "org.apache.openjpa.persistence.exception.TestParameterLogging", - "openjpa.ConnectionFactoryProperties", "PrintParameters=" + printParameters.booleanValue() }; + "openjpa.ConnectionFactoryProperties", "PrintParameters=" + printParameters}; } EntityManagerFactory emf = createEMF(props); EntityManager em = emf.createEntityManager(); String queryStr = "SELECT c FROM PObject c WHERE c.id=:id"; em.createQuery(queryStr).setParameter("id", Integer.MIN_VALUE).getResultList(); em.createQuery(queryStr).setParameter("id", Integer.MIN_VALUE).getResultList(); - boolean expected = (printParameters == null) ? false : printParameters.booleanValue(); + boolean expected = (printParameters == null) ? false : printParameters; boolean actual = false; // Look through all trace messages for the ID before doing asserts diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/fields/TestEnumsInJPQL.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/fields/TestEnumsInJPQL.java index f7faf1b0f..c6cf7d172 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/fields/TestEnumsInJPQL.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/fields/TestEnumsInJPQL.java @@ -119,7 +119,7 @@ public class TestEnumsInJPQL } public void testMemberOf() { - assertEquals(Long.valueOf(1), + assertEquals(1L, em.createQuery("select count(o) from EnumFieldType o where " + "(:param member of o.enumList or :param2 member of o.enumList)") .setParameter("param", SampleEnum.FOO) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestFloatingPointIds.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestFloatingPointIds.java index ef80c1ff4..237f4ad48 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestFloatingPointIds.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestFloatingPointIds.java @@ -57,18 +57,18 @@ public class TestFloatingPointIds public void testPersistDoubleObj() { DoubleObjIdEntity e = new DoubleObjIdEntity(); - e.setId(new Double(4D)); + e.setId(4D); e.setData(44); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); em.persist(e); em.getTransaction().commit(); - assertEquals(new Double(4D), e.getId()); + assertEquals(4D, e.getId()); em.close(); em = emf.createEntityManager(); - e = em.find(DoubleObjIdEntity.class, new Double(4D)); + e = em.find(DoubleObjIdEntity.class, 4D); assertEquals(44, e.getData()); em.close(); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/entityasidentity/AccountId.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/entityasidentity/AccountId.java index b8ca20906..f06d1db91 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/entityasidentity/AccountId.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/entityasidentity/AccountId.java @@ -80,7 +80,7 @@ public class AccountId implements java.io.Serializable { String hashStr = this.groupId + ":" + this.accountHolder + ":" + this.accountId; hashcode = hashStr.hashCode(); } - return hashcode.intValue(); + return hashcode; } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/TestInheritanceWithMSCID.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/TestInheritanceWithMSCID.java index 1fba4bc9a..f9ff9c0cc 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/TestInheritanceWithMSCID.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/TestInheritanceWithMSCID.java @@ -77,7 +77,7 @@ public class TestInheritanceWithMSCID extends SingleEMFTestCase { for (InheritanceEntityMapping tEntity : tEntities) { RootEntity entity = (RootEntity) EntityMapping.createEntityObjectInstance(tEntity); - entity.updateId(new Integer(idx++)); + entity.updateId(idx++); entity.setRootEntityData("Root " + (idx - 1)); em.getTransaction().begin(); @@ -127,7 +127,7 @@ public class TestInheritanceWithMSCID extends SingleEMFTestCase { for (InheritanceEntityMapping tEntity : tEntities) { RootEntity entity = (RootEntity) EntityMapping.createEntityObjectInstance(tEntity); - entity.updateId(new Integer(idx++)); + entity.updateId(idx++); entity.setRootEntityData("Root " + (idx - 1)); em.getTransaction().begin(); @@ -219,7 +219,7 @@ public class TestInheritanceWithMSCID extends SingleEMFTestCase { for (InheritanceEntityMapping tEntity : tEntities) { RootEntity entity = (RootEntity) EntityMapping.createEntityObjectInstance(tEntity); - entity.updateId(new Integer(idx++)); + entity.updateId(idx++); entity.setRootEntityData("Root " + (idx - 1)); em.getTransaction().begin(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/entities/idmsc/PrimitiveIDMappedSuperclass.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/entities/idmsc/PrimitiveIDMappedSuperclass.java index 02eb7c7a6..7be5cd0e7 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/entities/idmsc/PrimitiveIDMappedSuperclass.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/entities/idmsc/PrimitiveIDMappedSuperclass.java @@ -39,11 +39,11 @@ public abstract class PrimitiveIDMappedSuperclass { } public Object fetchId() { - return new Integer(getId()); + return getId(); } public void updateId(Object obj) { Integer i = (Integer) obj; - setId(i.intValue()); + setId(i); } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/TestInheritanceTypeJoinedQuery.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/TestInheritanceTypeJoinedQuery.java index e2bbc6c52..3f2eeb624 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/TestInheritanceTypeJoinedQuery.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/TestInheritanceTypeJoinedQuery.java @@ -250,7 +250,7 @@ public class TestInheritanceTypeJoinedQuery extends SQLListenerTestCase { for (Object[] resultElement : fResult) { Long oid = (Long)resultElement[0]; Contractor c = (Contractor)resultElement[1]; - assertTrue(oid.longValue() == c.getOID()); + assertTrue(oid == c.getOID()); assertEquals(dept.getOID(), c.getDept().getOID()); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestLobs.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestLobs.java index e1b4e36d5..bc8fe07df 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestLobs.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestLobs.java @@ -34,7 +34,7 @@ public class TestLobs extends SingleEMFTestCase { * Support method to get a random Byte for testing. */ public static Byte randomByte() { - return new Byte((byte) (Math.random() * Byte.MAX_VALUE)); + return (byte) (Math.random() * Byte.MAX_VALUE); } @Override @@ -66,7 +66,7 @@ public class TestLobs extends SingleEMFTestCase { Blobs lobs = new Blobs(); byte[] bytes = new byte[10]; for (int i = 0; i < bytes.length; i++) - bytes[i] = randomByte().byteValue(); + bytes[i] = randomByte(); em.getTransaction().begin(); lobs.setLobNotNullable(bytes); @@ -125,7 +125,7 @@ public class TestLobs extends SingleEMFTestCase { // test with large data byte[] bytes = new byte[5000]; for (int i = 0; i < bytes.length; i++) - bytes[i] = randomByte().byteValue(); + bytes[i] = randomByte(); EntityManager em = emf.createEntityManager(); Blobs lobs = new Blobs(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestOptimizeForClause.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestOptimizeForClause.java index d263d9780..2913b0e60 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestOptimizeForClause.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/TestOptimizeForClause.java @@ -92,7 +92,7 @@ public class TestOptimizeForClause "select o from AllFieldTypes o where o.intField = :p"); q.setParameter("p", 0); q.setHint("openjpa.hint.OptimizeResultCount" - ,new Integer(8)); + , 8); q.getResultList(); } else { @@ -100,7 +100,7 @@ public class TestOptimizeForClause ("select o from AllFieldTypes o where o.intField " + "= :p")); q.setParameter("p", 0); - q.setHint(OpenJPAQuery.HINT_RESULT_COUNT, new Integer(8)); + q.setHint(OpenJPAQuery.HINT_RESULT_COUNT, 8); q.getResultList(); } if (dict instanceof DB2Dictionary) { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/Generator.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/Generator.java index 45b34b76a..7037b5465 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/Generator.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/Generator.java @@ -88,7 +88,7 @@ public class Generator { StringTokenizer tok = new StringTokenizer(str, ","); pk = Integer.parseInt(tok.nextToken()); pk2 = Integer.valueOf(tok.nextToken()); - pk3 = Long.valueOf(tok.nextToken()); + pk3 = Long.parseLong(tok.nextToken()); } @Override diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestEmbeddedId.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestEmbeddedId.java index 8d4e7e39c..1391e0b4b 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestEmbeddedId.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestEmbeddedId.java @@ -176,7 +176,7 @@ public class TestEmbeddedId q = em.createQuery("select e.id.pk2 from EmbeddedIdEntity e " + "where e.id.pk1 = 1"); - assertEquals(new Long(_oid.getPk2()), q.getSingleResult()); + assertEquals(_oid.getPk2(), q.getSingleResult()); q = em.createQuery("select e.id from EmbeddedIdEntity e " + "where e.id.pk1 = 1"); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestEnumerated.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestEnumerated.java index 5c8b5a46d..25551fba2 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestEnumerated.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestEnumerated.java @@ -75,7 +75,7 @@ public class TestEnumerated em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(1)); + pc = em.find(AnnoTest1.class, 1L); assertEquals(InheritanceType.TABLE_PER_CLASS, pc.getEnumeration()); assertEquals(InheritanceType.TABLE_PER_CLASS, pc.getOrdinalEnumeration()); @@ -89,7 +89,7 @@ public class TestEnumerated em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(1)); + pc = em.find(AnnoTest1.class, 1L); assertEquals(InheritanceType.JOINED, pc.getEnumeration()); assertEquals(InheritanceType.JOINED, pc.getOrdinalEnumeration()); assertEquals(InheritanceType.TABLE_PER_CLASS, diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestExtensionAnnotations.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestExtensionAnnotations.java index 91e95419c..298b1b521 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestExtensionAnnotations.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestExtensionAnnotations.java @@ -122,10 +122,10 @@ public class TestExtensionAnnotations ("externalValues"); assertEquals(JavaTypes.CHAR, externalValues.getDeclaredTypeCode()); assertEquals(JavaTypes.INT, externalValues.getTypeCode()); - assertEquals(new Integer(1), externalValues.getExternalValueMap(). - get(new Character('M'))); - assertEquals(new Integer(2), externalValues.getExternalValueMap(). - get(new Character('F'))); + assertEquals(1, externalValues.getExternalValueMap(). + get('M')); + assertEquals(2, externalValues.getExternalValueMap(). + get('F')); } public void testExternalizer() { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestGenerators.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestGenerators.java index e02de6495..04a2c30d7 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestGenerators.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestGenerators.java @@ -94,7 +94,7 @@ public class TestGenerators extends SingleEMFTestCase { private void assertPks(Generator g) { assertNotEquals(0, g.getPk()); assertNotNull(g.getPk2()); - assertNotEquals(new Integer(0), g); + assertNotEquals(0, g); assertNotEquals(0, g.getPk3()); } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestJoinedInheritance.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestJoinedInheritance.java index 69184ca0d..ed8a17f69 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestJoinedInheritance.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestJoinedInheritance.java @@ -39,7 +39,7 @@ public class TestJoinedInheritance extends SingleEMFTestCase { EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); AnnoTest3 pc = new AnnoTest3(); - pc.setPk(new Long(1)); + pc.setPk(1L); pc.setBasic(10); pc.setBasic2(20); em.persist(pc); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestManyToMany.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestManyToMany.java index ced6dc92e..443c5af76 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestManyToMany.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestManyToMany.java @@ -52,7 +52,7 @@ public class TestManyToMany em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(4)); + pc = em.find(AnnoTest1.class, 4L); Set many = pc.getManyMany(); assertEquals(3, many.size()); for (AnnoTest2 manyPc2 : many) { @@ -88,7 +88,7 @@ public class TestManyToMany em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(4)); + pc = em.find(AnnoTest1.class, 4L); Set many = pc.getInverseOwnerManyMany(); assertEquals(3, many.size()); for (AnnoTest2 manyPc2 : many) { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestMapKey.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestMapKey.java index 002d74ff8..afbf57aa1 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestMapKey.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestMapKey.java @@ -106,7 +106,7 @@ public class TestMapKey em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(1)); + pc = em.find(AnnoTest1.class, 1L); assertEquals(2, pc.getDefaultMapKey().size()); assertEquals(1, pc.getDefaultMapKey().get(1).getPk()); assertEquals(2, pc.getDefaultMapKey().get(2).getPk()); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestOneToMany.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestOneToMany.java index ba55a9a70..0fddfe509 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestOneToMany.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestOneToMany.java @@ -48,7 +48,7 @@ public class TestOneToMany em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(5)); + pc = em.find(AnnoTest1.class, 5L); Collection many = pc.getOneMany(); assertEquals(2, many.size()); for (AnnoTest2 pc2 : many) { @@ -82,7 +82,7 @@ public class TestOneToMany em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(5)); + pc = em.find(AnnoTest1.class, 5L); Collection many = pc.getInverseOwnerOneMany(); assertEquals(2, many.size()); for (AnnoTest2 pc3 : many) { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestOneToOne.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestOneToOne.java index 4de2d575b..028fdc6cc 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestOneToOne.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestOneToOne.java @@ -47,7 +47,7 @@ public class TestOneToOne em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(5)); + pc = em.find(AnnoTest1.class, 5L); pc2 = pc.getOneOne(); assertNotNull(pc2); assertEquals(15, pc2.getPk1()); @@ -67,7 +67,7 @@ public class TestOneToOne em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(5)); + pc = em.find(AnnoTest1.class, 5L); pc2 = pc.getSelfOneOne(); assertNotNull(pc2); assertEquals(new Long(15), pc2.getPk()); @@ -86,7 +86,7 @@ public class TestOneToOne em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(5)); + pc = em.find(AnnoTest1.class, 5L); pc2 = pc.getSelfOneOne(); assertNotNull(pc2); assertEquals(new Long(15), pc2.getPk()); @@ -105,7 +105,7 @@ public class TestOneToOne em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(5)); + pc = em.find(AnnoTest1.class, 5L); pc2 = pc.getOtherTableOneOne(); assertNotNull(pc2); assertEquals(15, pc2.getPk1()); @@ -125,7 +125,7 @@ public class TestOneToOne em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(5)); + pc = em.find(AnnoTest1.class, 5L); pc2 = pc.getInverseOwnerOneOne(); assertNotNull(pc2); assertEquals(15, pc2.getPk1()); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestSerializedLobs.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestSerializedLobs.java index a0309182c..81e61dc4c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestSerializedLobs.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestSerializedLobs.java @@ -60,8 +60,8 @@ public class TestSerializedLobs extends SingleEMFTestCase { em.close(); em = emf.createEntityManager(); - pc1 = em.find(AnnoTest1.class, new Long(1)); - pc2 = em.find(AnnoTest1.class, new Long(2)); + pc1 = em.find(AnnoTest1.class, 1L); + pc2 = em.find(AnnoTest1.class, 2L); assertEquals("ASDASD", pc1.getSerialized()); assertEquals(DATE, pc2.getSerialized()); em.close(); @@ -79,7 +79,7 @@ public class TestSerializedLobs extends SingleEMFTestCase { em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(1)); + pc = em.find(AnnoTest1.class, 1L); assertEquals("Not Null", new String(pc.getBlob())); Connection conn = (Connection) em.getConnection(); Statement stmnt = conn.createStatement(); @@ -129,7 +129,7 @@ public class TestSerializedLobs extends SingleEMFTestCase { em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(1)); + pc = em.find(AnnoTest1.class, 1L); String str = pc.getClob(); assertEquals(1000, str.length()); for (int i = 0; i < str.length(); i++) @@ -147,7 +147,7 @@ public class TestSerializedLobs extends SingleEMFTestCase { em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(1)); + pc = em.find(AnnoTest1.class, 1L); String str = pc.getClob(); assertNull(str); em.close(); @@ -163,7 +163,7 @@ public class TestSerializedLobs extends SingleEMFTestCase { em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(1)); + pc = em.find(AnnoTest1.class, 1L); byte[] bl = pc.getBlob(); assertNull(bl); em.close(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestVersion.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestVersion.java index a4d0527f8..b2589c9ea 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestVersion.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestVersion.java @@ -43,7 +43,7 @@ public class TestVersion extends SingleEMFTestCase { EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); AnnoTest1 test1 = new AnnoTest1(); - test1.setPk(new Long(5)); + test1.setPk(5L); test1.setBasic(50); test1.setTransient(500); em.persist(test1); @@ -55,7 +55,7 @@ public class TestVersion extends SingleEMFTestCase { em.persist(test2); AnnoTest3 test3 = new AnnoTest3(); - test3.setPk(new Long(3)); + test3.setPk(3L); test3.setBasic2(50); em.persist(test3); em.getTransaction().commit(); @@ -68,8 +68,8 @@ public class TestVersion extends SingleEMFTestCase { EntityManager em2 = emf.createEntityManager(); em2.getTransaction().begin(); - AnnoTest1 pc1 = em1.find(AnnoTest1.class, new Long(5)); - AnnoTest1 pc2 = em2.find(AnnoTest1.class, new Long(5)); + AnnoTest1 pc1 = em1.find(AnnoTest1.class, 5L); + AnnoTest1 pc2 = em2.find(AnnoTest1.class, 5L); assertEquals(1, pc1.getVersion()); assertEquals(1, pc2.getVersion()); assertEquals(0, pc1.getTransient()); @@ -79,7 +79,7 @@ public class TestVersion extends SingleEMFTestCase { em1.close(); em1 = emf.createEntityManager(); - pc1 = em1.find(AnnoTest1.class, new Long(5)); + pc1 = em1.find(AnnoTest1.class, 5L); assertEquals(2, pc1.getVersion()); em1.close(); try { @@ -139,8 +139,8 @@ public class TestVersion extends SingleEMFTestCase { EntityManager em2 = emf.createEntityManager(); em2.getTransaction().begin(); - AnnoTest3 pc1 = em1.find(AnnoTest3.class, new Long(3)); - AnnoTest3 pc2 = em2.find(AnnoTest3.class, new Long(3)); + AnnoTest3 pc1 = em1.find(AnnoTest3.class, 3L); + AnnoTest3 pc2 = em2.find(AnnoTest3.class, 3L); assertEquals(1, pc1.getVersion()); assertEquals(1, pc2.getVersion()); pc1.setBasic2(75); @@ -149,7 +149,7 @@ public class TestVersion extends SingleEMFTestCase { em1.close(); em1 = emf.createEntityManager(); - pc1 = em1.find(AnnoTest3.class, new Long(3)); + pc1 = em1.find(AnnoTest3.class, 3L); assertEquals(2, pc1.getVersion()); em1.close(); try { @@ -165,7 +165,7 @@ public class TestVersion extends SingleEMFTestCase { EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); - AnnoTest1 pc = em.find(AnnoTest1.class, new Long(5)); + AnnoTest1 pc = em.find(AnnoTest1.class, 5L); assertEquals(1, pc.getVersion()); assertEquals(0, pc.getTransient()); pc.setTransient(750); @@ -173,7 +173,7 @@ public class TestVersion extends SingleEMFTestCase { em.close(); em = emf.createEntityManager(); - pc = em.find(AnnoTest1.class, new Long(5)); + pc = em.find(AnnoTest1.class, 5L); assertEquals(1, pc.getVersion()); assertEquals(0, pc.getTransient()); em.close(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/mapping/TestCompositeIdTraversalInSQLMapping.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/mapping/TestCompositeIdTraversalInSQLMapping.java index e4af19a95..6a03bd02a 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/mapping/TestCompositeIdTraversalInSQLMapping.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/mapping/TestCompositeIdTraversalInSQLMapping.java @@ -63,7 +63,7 @@ public class TestCompositeIdTraversalInSQLMapping extends AbstractTestCase { public void testTraversalWhenSQLSelectsBothEndOfTheRelation () { EntityManager em = currentEntityManager(); - Integer uid = new Integer((int) (System.currentTimeMillis()%100000)); + Integer uid = (int) (System.currentTimeMillis() % 100000); String uName = "P"+uid; String rName = "R"+uName; @@ -105,7 +105,7 @@ public class TestCompositeIdTraversalInSQLMapping extends AbstractTestCase { public void testTraversalWhenSQLSelectsOnlyOneEndOfTheRelation () { EntityManager em = currentEntityManager(); - Integer uid = new Integer((int) (System.currentTimeMillis()%100000)); + Integer uid = (int) (System.currentTimeMillis() % 100000); String uName = "P"+uid; String rName = "R"+uName; @@ -138,8 +138,8 @@ public class TestCompositeIdTraversalInSQLMapping extends AbstractTestCase { public void testTraversalWhenSQLSelectsUnrelatedInstances () { EntityManager em = currentEntityManager(); - Integer uid1 = new Integer((int) (System.currentTimeMillis()%100000)); - Integer uid2 = new Integer(uid1.intValue()+1); + Integer uid1 = (int) (System.currentTimeMillis() % 100000); + Integer uid2 = uid1.intValue() + 1; String uName1 = "P"+uid1; String rName1 = "R"+uName1; String uName2 = "P"+uid2; @@ -184,7 +184,7 @@ public class TestCompositeIdTraversalInSQLMapping extends AbstractTestCase { public void testRecursiveTraversal () { - Integer rootId = new Integer((int)(System.currentTimeMillis()%100000)); + Integer rootId = (int) (System.currentTimeMillis() % 100000); int depth = 3; persistChainedRelative(rootId, depth); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/meta/tableperclass/TestUnionPlaceholderTypes.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/meta/tableperclass/TestUnionPlaceholderTypes.java index 9f7f07752..3cc8b0d21 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/meta/tableperclass/TestUnionPlaceholderTypes.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/meta/tableperclass/TestUnionPlaceholderTypes.java @@ -95,7 +95,7 @@ public class TestUnionPlaceholderTypes broker.begin(); sql.clear(); ptb = (PlaceholderTypesB) broker.find(broker.newObjectId - (PlaceholderTypesB.class, new Long(idb)), true, null); + (PlaceholderTypesB.class, idb), true, null); assertEquals(2, ptb.getIntA()); assertEquals(3, ptb.getIntB()); assertTrue(ptb.getBooleanB()); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java index aa61da226..161b33ed0 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java @@ -952,7 +952,7 @@ public class TestOrderColumn extends SingleEMFTestCase { objMap.put(idx, objVal); } for (int i = 0; i < objs.length; i++) { - Object val = objMap.get((new Long(base + i))); + Object val = objMap.get(((long) (base + i))); assertEquals(val, objs[i]); } } @@ -979,7 +979,7 @@ public class TestOrderColumn extends SingleEMFTestCase { objMap.put(idx, objVal); } for (int i = 0; i < objs.length; i++) { - Object val = objMap.get((new Long(base + i))); + Object val = objMap.get(((long) (base + i))); assertEquals(val, objs[i]); } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumnXML.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumnXML.java index 06adc6272..d52f2d9c6 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumnXML.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumnXML.java @@ -201,8 +201,8 @@ public class TestOrderColumnXML extends AbstractCachedEMFTestCase { ObOcEntity ent = new ObOcEntity(); List intList = new ArrayList<>(); - intList.add(new Integer(10)); - intList.add(new Integer(20)); + intList.add(10); + intList.add(20); ent.setIntList(intList); em.getTransaction().begin(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/TestSQLQueries.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/TestSQLQueries.java index cbc5633b3..912910c37 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/TestSQLQueries.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/TestSQLQueries.java @@ -222,8 +222,8 @@ public class TestSQLQueries q.closeAll(); Map params = new HashMap(); - params.put(new Integer(1), "foo"); - params.put(new Integer(2), new Integer(2)); + params.put(1, "foo"); + params.put(2, 2); //FIXME jthomas /*itr = ((Collection) q.executeWithMap(params)).iterator(); assertTrue(itr.hasNext()); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/cache/AbstractQueryCacheTest.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/cache/AbstractQueryCacheTest.java index 95201e3e3..ce4dd3ebc 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/cache/AbstractQueryCacheTest.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/cache/AbstractQueryCacheTest.java @@ -134,7 +134,7 @@ public abstract class AbstractQueryCacheTest extends SingleEMFTestCase { String qry = "select p from PartBase p where p.cost > ?1"; for (int i=120; i<155; i++) { Query q = em.createQuery(qry); - q.setParameter(1, new Double(i)); + q.setParameter(1, (double) i); q.getResultList(); } em.getTransaction().commit(); @@ -261,7 +261,7 @@ public abstract class AbstractQueryCacheTest extends SingleEMFTestCase { em = emf.createEntityManager(); em.getTransaction().begin(); Query q = em.createQuery("select p from PartBase p where p.cost>?1"); - q.setParameter(1, new Double(120)); + q.setParameter(1, 120.0); int jpalistSize = q.getResultList().size(); em.getTransaction().commit(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/schema/TestClassSequenceFactory.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/schema/TestClassSequenceFactory.java index 91e2978f5..71b2e72da 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/schema/TestClassSequenceFactory.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/schema/TestClassSequenceFactory.java @@ -146,12 +146,12 @@ public class TestClassSequenceFactory extends BaseJDBCTest{ // hold a and c and start b Seq seq = conf.getSequenceInstance(); - long aid = ((Long) seq.next(_broker, aMapping)).longValue(); + long aid = (Long) seq.next(_broker, aMapping); for (int i = 0; i < 5; i++) seq.next(_broker, bMapping); - assertEquals(new Long(aid + 1), seq.next(_broker, aMapping)); - assertEquals(new Long(aid + 2), seq.next(_broker, cMapping)); + assertEquals(aid + 1, seq.next(_broker, aMapping)); + assertEquals(aid + 2, seq.next(_broker, cMapping)); } /** diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/schema/TestPerClassSequenceFactory.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/schema/TestPerClassSequenceFactory.java index 577ed2aed..07485c75f 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/schema/TestPerClassSequenceFactory.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/schema/TestPerClassSequenceFactory.java @@ -104,7 +104,7 @@ public class TestPerClassSequenceFactory @Override public Object current(StoreContext ctx, ClassMetaData meta) { - return new Long(_val); + return _val; } @Override diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/ParentId.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/ParentId.java index 84b81b9ff..02b4cb636 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/ParentId.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/ParentId.java @@ -79,7 +79,7 @@ public class ParentId implements java.io.Serializable { String hashStr = this.id + ":" + this.name + ":" + this.addrId; hashcode = hashStr.hashCode(); } - return hashcode.intValue(); + return hashcode; } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/clauses/TestBulkUpdate.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/clauses/TestBulkUpdate.java index a6b74d629..d8d2cd93e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/clauses/TestBulkUpdate.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/clauses/TestBulkUpdate.java @@ -91,7 +91,7 @@ public class TestBulkUpdate extends AbstractTestCase { + " where e.stringField = :val" + " and e.intField = 999"). setParameter("val", "value4"). - setParameter("intval", new Integer(987)). + setParameter("intval", 987). setParameter("nullval", null); assertEquals(num, updateQuery4.executeUpdate()); assertEquals(0, updateQuery4.executeUpdate()); // should be updated diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEntityTypeExpression.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEntityTypeExpression.java index c5e4caf87..d776dd2c8 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEntityTypeExpression.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEntityTypeExpression.java @@ -191,7 +191,7 @@ public class TestEntityTypeExpression extends AbstractTestCase { query = "select sum(e.age) FROM CompUser e GROUP BY e.age" + " HAVING ABS(e.age) = :param"; Long sum = (Long) em.createQuery(query). - setParameter("param", new Double(36)).getSingleResult(); + setParameter("param", 36.0).getSingleResult(); assertEquals(sum.intValue(), 72); String[] queries = { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestArrayValues2.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestArrayValues2.java index 76963ca8c..0123634b4 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestArrayValues2.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestArrayValues2.java @@ -66,7 +66,7 @@ public class TestArrayValues2 extends BaseKernelTest { int max = ((int) (Math.random() * 20)) + 5; long[] array = new long[max]; for (int i = 0; i < max; i++) - array[i] = randomLong().longValue(); + array[i] = randomLong(); try { saveArray(array, true, false); } catch (AssertionFailedError afe) { @@ -87,7 +87,7 @@ public class TestArrayValues2 extends BaseKernelTest { int max = ((int) (Math.random() * 20)) + 5; short[] array = new short[max]; for (int i = 0; i < max; i++) - array[i] = randomShort().shortValue(); + array[i] = randomShort(); saveArray(array, true, false); } @@ -105,7 +105,7 @@ public class TestArrayValues2 extends BaseKernelTest { int max = ((int) (Math.random() * 20)) + 5; int[] array = new int[max]; for (int i = 0; i < max; i++) - array[i] = randomInt().intValue(); + array[i] = randomInt(); saveArray(array, true, false); } // FixMe: Both tests hangs on Mysql @@ -140,7 +140,7 @@ public class TestArrayValues2 extends BaseKernelTest { throws Exception { int max = ((int) (Math.random() * 20)) + 5; Character[] array = new Character[max]; - array[0] = new Character((char) 1); + array[0] = (char) 1; for (int i = 1; i < max; i++) array[i] = randomChar(); saveArray(array, false, false); @@ -152,7 +152,7 @@ public class TestArrayValues2 extends BaseKernelTest { char[] array = new char[max]; array[0] = 1; for (int i = 1; i < max; i++) - array[i] = randomChar().charValue(); + array[i] = randomChar(); saveArray(array, true, false); } @@ -162,7 +162,7 @@ public class TestArrayValues2 extends BaseKernelTest { char[] array = new char[max]; array[0] = 1; for (int i = 1; i < max; i++) - array[i] = randomChar().charValue(); + array[i] = randomChar(); saveArray(array, true, true); } @@ -171,7 +171,7 @@ public class TestArrayValues2 extends BaseKernelTest { int max = ((int) (Math.random() * 20)) + 5; boolean[] array = new boolean[max]; for (int i = 0; i < max; i++) - array[i] = randomBoolean().booleanValue(); + array[i] = randomBoolean(); saveArray(array, true, false); } @@ -189,7 +189,7 @@ public class TestArrayValues2 extends BaseKernelTest { int max = ((int) (Math.random() * 20)) + 5; float[] array = new float[max]; for (int i = 0; i < max; i++) - array[i] = randomFloat().floatValue(); + array[i] = randomFloat(); saveArray(array, true, false); } @@ -207,7 +207,7 @@ public class TestArrayValues2 extends BaseKernelTest { int max = ((int) (Math.random() * 20)) + 5; double[] array = new double[max]; for (int i = 0; i < max; i++) - array[i] = randomDouble().doubleValue(); + array[i] = randomDouble(); saveArray(array, true, false); } @@ -315,12 +315,12 @@ public class TestArrayValues2 extends BaseKernelTest { // compare them to a certain precision, after which // we give up. if (o1 instanceof Double) - assertEquals(((Double) o1).doubleValue(), - ((Double) o2).doubleValue(), + assertEquals((Double) o1, + (Double) o2, DOUBLE_PRECISION); else if (o1 instanceof Float) - assertEquals(((Float) o1).floatValue(), - ((Float) o2).floatValue(), + assertEquals((Float) o1, + (Float) o2, FLOAT_PRECISION); else assertEquals("Object did not match (class1=" diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestCalendarFields.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestCalendarFields.java index 87e51f48f..d6a981c08 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestCalendarFields.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestCalendarFields.java @@ -232,7 +232,7 @@ public class TestCalendarFields extends BaseKernelTest { // Equivalent to: cal.setTimeInMillis (millis); cal.getClass().getMethod("setTimeInMillis", new Class[]{ long.class }).invoke(cal, - new Object[]{ new Long(millis) }); + new Object[]{millis}); } catch (Exception e) { cal.setTime(new Date(millis)); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestDetachedStateManager.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestDetachedStateManager.java index 005d625f1..bb219e0a6 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestDetachedStateManager.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestDetachedStateManager.java @@ -78,7 +78,7 @@ public class TestDetachedStateManager extends BaseKernelTest { pm.persist(b); b.setAint(5); b.setBstr("5"); - b.getStringIntMap().put("5", new Integer(5)); + b.getStringIntMap().put("5", 5); AttachE e = new AttachE(); e.setEstr("E"); @@ -114,7 +114,7 @@ public class TestDetachedStateManager extends BaseKernelTest { b.setAint(12); b.setBstr("12"); TreeMap map = new TreeMap(); - map.put("12", new Integer(12)); + map.put("12", 12); b.setStringIntMap(map); pm = getPM(); @@ -123,7 +123,7 @@ public class TestDetachedStateManager extends BaseKernelTest { assertEquals(12, attached.getAint()); assertEquals("12", attached.getBstr()); assertNull(attached.getStringIntMap().get("12")); - assertEquals(new Integer(5), attached.getStringIntMap().get("5")); + assertEquals(5, attached.getStringIntMap().get("5")); endTx(pm); endEm(pm); @@ -132,7 +132,7 @@ public class TestDetachedStateManager extends BaseKernelTest { assertEquals(12, b.getAint()); assertEquals("12", b.getBstr()); assertNull(b.getStringIntMap().get("12")); - assertEquals(new Integer(5), b.getStringIntMap().get("5")); + assertEquals(5, b.getStringIntMap().get("5")); endEm(pm); } @@ -158,16 +158,16 @@ public class TestDetachedStateManager extends BaseKernelTest { b.setAint(12); b.setBstr("12"); - b.getStringIntMap().put("12", new Integer(12)); + b.getStringIntMap().put("12", 12); pm = getPM(); startTx(pm); AttachB attached = (AttachB) pm.merge(b); assertEquals("not 12", 12, attached.getAint()); assertEquals("not 12str", "12", attached.getBstr()); - assertEquals("not newInteger(12)", new Integer(12), + assertEquals("not newInteger(12)", 12, attached.getStringIntMap().get("12")); - assertEquals("not newInteger(5)", new Integer(5), + assertEquals("not newInteger(5)", 5, attached.getStringIntMap().get("5")); endTx(pm); endEm(pm); @@ -176,9 +176,9 @@ public class TestDetachedStateManager extends BaseKernelTest { b = (AttachB) pm.find(AttachB.class, oid); assertEquals("not equal 12", 12, b.getAint()); assertEquals("not equal 12str", "12", b.getBstr()); - assertEquals("not equal newinteger(12)", new Integer(12), + assertEquals("not equal newinteger(12)", 12, b.getStringIntMap().get("12")); - assertEquals("not equal newInteger(5)", new Integer(5), + assertEquals("not equal newInteger(5)", 5, b.getStringIntMap().get("5")); endEm(pm); } @@ -222,7 +222,7 @@ public class TestDetachedStateManager extends BaseKernelTest { b.setAint(12); b.setBstr("12"); TreeMap map = new TreeMap(); - map.put("12", new Integer(12)); + map.put("12", 12); b.setStringIntMap(map); pm = getPM(); @@ -454,7 +454,7 @@ public class TestDetachedStateManager extends BaseKernelTest { DetachSMPC rel = new DetachSMPC(); rel.setIntField(2); pc.getRelSet().add(rel); - pc.getStringIntMap().put("a", new Integer(99)); + pc.getStringIntMap().put("a", 99); pm.persist(pc); endTx(pm); Object pcoid = pm.getObjectId(pc); @@ -478,7 +478,7 @@ public class TestDetachedStateManager extends BaseKernelTest { pc.setIntField(3); ((DetachSMPC) pc.getRelSet().iterator().next()).setIntField(4); - pc.getStringIntMap().put("b", new Integer(100)); + pc.getStringIntMap().put("b", 100); pc = (DetachSMPC) roundtrip(pc, false); @@ -488,7 +488,7 @@ public class TestDetachedStateManager extends BaseKernelTest { //assertDetachedSM (b.getDs ().iterator ().next ()); assertEquals(4, ((DetachSMPC) pc.getRelSet().iterator().next()) .getIntField()); - assertEquals(new Integer(100), pc.getStringIntMap().get("b")); + assertEquals(100, pc.getStringIntMap().get("b")); pm = (OpenJPAEntityManager) factory.createEntityManager(); startTx(pm); @@ -498,7 +498,7 @@ public class TestDetachedStateManager extends BaseKernelTest { assertEquals(4, ((DetachSMPC) pc.getRelSet().iterator().next()) .getIntField()); assertEquals(2, pc.getStringIntMap().size()); - assertEquals(new Integer(100), pc.getStringIntMap().get("b")); + assertEquals(100, pc.getStringIntMap().get("b")); endTx(pm); endEm(pm); @@ -509,7 +509,7 @@ public class TestDetachedStateManager extends BaseKernelTest { assertEquals(4, ((DetachSMPC) pc.getRelSet().iterator().next()) .getIntField()); assertEquals(2, pc.getStringIntMap().size()); - assertEquals(new Integer(100), pc.getStringIntMap().get("b")); + assertEquals(100, pc.getStringIntMap().get("b")); startTx(pm); deleteAll(DetachSMPC.class, pm); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestEJBEmbedded.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestEJBEmbedded.java index 4c96b821d..01ba7cf4b 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestEJBEmbedded.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestEJBEmbedded.java @@ -185,7 +185,7 @@ public class TestEJBEmbedded extends BaseKernelTest { EmbeddedPC embed1 = pc1.getEmbedded(); pm.persist(embed1); - Integer oid = new Integer(1); + Integer oid = 1; endTx(pm); assertEquals("embedString1", embed1.getStringField()); @@ -200,7 +200,7 @@ public class TestEJBEmbedded extends BaseKernelTest { assertNotNull("pc1 is null in testshare 2nd find", pc1); pc2 = pm.find(EmbeddedOwnerPC.class, id2); assertNotNull("pc2 is null in testshare 2nd find", pc2); - embed1 = pm.find(EmbeddedPC.class, oid.intValue()); + embed1 = pm.find(EmbeddedPC.class, oid); if (embed1 != null) { assertEquals("embedString1", embed1.getStringField()); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestEJBEntityManager.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestEJBEntityManager.java index aebd1b32e..84ca52b52 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestEJBEntityManager.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestEJBEntityManager.java @@ -99,7 +99,7 @@ public class TestEJBEntityManager extends AbstractTestCase { public void run() { try { em.close(); - result.add(new Integer(0)); + result.add(0); } catch (Exception jdoe) { result.add(jdoe); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestEJBTransactions.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestEJBTransactions.java index 0d48530f1..177c88fa7 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestEJBTransactions.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestEJBTransactions.java @@ -53,7 +53,7 @@ public class TestEJBTransactions extends AbstractTestCase { public void run() { try { endTx(em); - list.add(new Integer(0)); + list.add(0); } catch (Exception e) { list.add(e); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestIncrementalFlushes.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestIncrementalFlushes.java index 467ab8d6f..b2be3f355 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestIncrementalFlushes.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestIncrementalFlushes.java @@ -356,7 +356,7 @@ public class TestIncrementalFlushes extends BaseKernelTest { assertSize(0, readPM.createNativeQuery("stringField == '" + name + "'", ModRuntimeTest1.class)); - ModRuntimeTest1 a = new ModRuntimeTest1(name, randomInt().intValue()); + ModRuntimeTest1 a = new ModRuntimeTest1(name, randomInt()); flushPM.persist(a); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPersistenceManager.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPersistenceManager.java index 8cc97ad1f..cfa667ee9 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPersistenceManager.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPersistenceManager.java @@ -143,7 +143,7 @@ public class TestPersistenceManager extends BaseKernelTest { public void run() { try { endEm(pm); - result.add(new Integer(0)); + result.add(0); } catch (Exception jdoe) { result.add(jdoe); } catch (Throwable t) { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSecondClassValues.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSecondClassValues.java index 86aa7958e..c640ee4af 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSecondClassValues.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSecondClassValues.java @@ -81,10 +81,10 @@ public class TestSecondClassValues extends BaseKernelTest { SCOTest test = new SCOTest(); pm.persist(test); Map map = new HashMap(); - map.put("foo", new Integer(1)); - map.put("bar", new Integer(2)); + map.put("foo", 1); + map.put("bar", 2); for (int i = 0; i < 10; i++) - map.put("baz#" + i, new Integer(i)); + map.put("baz#" + i, i); test.setStrIntMap(map); Object id = pm.getObjectId(test); @@ -95,8 +95,8 @@ public class TestSecondClassValues extends BaseKernelTest { assertNotNull(test); map = test.getStrIntMap(); assertEquals(12, map.size()); - assertEquals(new Integer(1), map.get("foo")); - assertEquals(new Integer(2), map.get("bar")); + assertEquals(1, map.get("foo")); + assertEquals(2, map.get("bar")); map.remove("bar"); endTx(pm); @@ -105,7 +105,7 @@ public class TestSecondClassValues extends BaseKernelTest { assertNotNull(test); map = test.getStrIntMap(); assertEquals(11, map.size()); - assertEquals(new Integer(1), map.get("foo")); + assertEquals(1, map.get("foo")); assertTrue(map.get("bar") == null); map.clear(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSpecialNumbers.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSpecialNumbers.java index b607a3ea6..7a6627c47 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSpecialNumbers.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSpecialNumbers.java @@ -63,7 +63,7 @@ public class TestSpecialNumbers extends BaseKernelTest { public void testShortMax() { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestshort(Short.MAX_VALUE); - saveAndQuery(aftt, "testshort = :param", new Short(Short.MAX_VALUE)); + saveAndQuery(aftt, "testshort = :param", Short.MAX_VALUE); } public void testShortMin() { @@ -71,7 +71,7 @@ public class TestSpecialNumbers extends BaseKernelTest { aftt.setTestshort(Short.MIN_VALUE); try { saveAndQuery(aftt, "testshort = :param", - new Short(Short.MIN_VALUE)); + Short.MIN_VALUE); } catch (Throwable t) { bug(AbstractTestCase.Platform.EMPRESS, 889, t, "Empress cannot store min values"); @@ -81,14 +81,14 @@ public class TestSpecialNumbers extends BaseKernelTest { public void testLongMax() { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestlong(Long.MAX_VALUE); - saveAndQuery(aftt, "testlong = :param", new Long(Long.MAX_VALUE)); + saveAndQuery(aftt, "testlong = :param", Long.MAX_VALUE); } public void testLongMin() { try { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestlong(Long.MIN_VALUE); - saveAndQuery(aftt, "testlong = :param", new Long(Long.MIN_VALUE)); + saveAndQuery(aftt, "testlong = :param", Long.MIN_VALUE); } catch (Throwable t) { bug(AbstractTestCase.Platform.HYPERSONIC, 474, t, "Some databases cannot store Long.MIN_VALUE"); @@ -99,7 +99,7 @@ public class TestSpecialNumbers extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestint(Integer.MAX_VALUE); saveAndQuery(aftt, "testint = :param", - new Integer(Integer.MAX_VALUE)); + Integer.MAX_VALUE); } public void testIntegerMin() { @@ -107,7 +107,7 @@ public class TestSpecialNumbers extends BaseKernelTest { aftt.setTestint(Integer.MIN_VALUE); try { saveAndQuery(aftt, "testint = :param", - new Integer(Integer.MIN_VALUE)); + Integer.MIN_VALUE); } catch (Throwable t) { bug(AbstractTestCase.Platform.EMPRESS, 889, t, "Empress cannot store min values"); @@ -119,7 +119,7 @@ public class TestSpecialNumbers extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestfloat(Float.MAX_VALUE); saveAndQuery(aftt, "testfloat = :param", - new Float(Float.MAX_VALUE)); + Float.MAX_VALUE); } catch (Exception e) { bug(EnumSet.of(AbstractTestCase.Platform.POSTGRESQL, AbstractTestCase.Platform.DB2, @@ -135,7 +135,7 @@ public class TestSpecialNumbers extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestfloat(Float.MIN_VALUE); saveAndQuery(aftt, "testfloat = :param", - new Float(Float.MIN_VALUE)); + Float.MIN_VALUE); } catch (Exception e) { bug(EnumSet.of(AbstractTestCase.Platform.POSTGRESQL, AbstractTestCase.Platform.SQLSERVER, @@ -154,7 +154,7 @@ public class TestSpecialNumbers extends BaseKernelTest { try { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestfloat(Float.NaN); - saveAndQuery(aftt, "testfloat = :param", new Float(Float.NaN)); + saveAndQuery(aftt, "testfloat = :param", Float.NaN); } catch (Throwable t) { bug(461, t, "NaN problems"); } @@ -165,7 +165,7 @@ public class TestSpecialNumbers extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestfloat(Float.NEGATIVE_INFINITY); saveAndQuery(aftt, "testfloat = :param", - new Float(Float.NEGATIVE_INFINITY)); + Float.NEGATIVE_INFINITY); } catch (Exception e) { bug(EnumSet.of(AbstractTestCase.Platform.POINTBASE, AbstractTestCase.Platform.POSTGRESQL, @@ -185,7 +185,7 @@ public class TestSpecialNumbers extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestfloat(Float.POSITIVE_INFINITY); saveAndQuery(aftt, "testfloat = :param", - new Float(Float.POSITIVE_INFINITY)); + Float.POSITIVE_INFINITY); } catch (Exception e) { bug(EnumSet.of(AbstractTestCase.Platform.POINTBASE, AbstractTestCase.Platform.POSTGRESQL, @@ -205,7 +205,7 @@ public class TestSpecialNumbers extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestdouble(Double.MAX_VALUE); saveAndQuery(aftt, "testdouble = :param", - new Double(Double.MAX_VALUE)); + Double.MAX_VALUE); } catch (Exception e) { bug(EnumSet.of(AbstractTestCase.Platform.POINTBASE, AbstractTestCase.Platform.MARIADB, @@ -225,7 +225,7 @@ public class TestSpecialNumbers extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestdouble(Double.MIN_VALUE); saveAndQuery(aftt, "testdouble = :param", - new Double(Double.MIN_VALUE)); + Double.MIN_VALUE); } catch (Exception e) { bug(EnumSet.of(AbstractTestCase.Platform.POSTGRESQL, AbstractTestCase.Platform.SQLSERVER, @@ -245,7 +245,7 @@ public class TestSpecialNumbers extends BaseKernelTest { try { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestdouble(Double.NaN); - saveAndQuery(aftt, "testdouble = :param", new Double(Double.NaN)); + saveAndQuery(aftt, "testdouble = :param", Double.NaN); } catch (Throwable t) { bug(461, t, "NaN problems"); } @@ -256,7 +256,7 @@ public class TestSpecialNumbers extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestdouble(Double.NEGATIVE_INFINITY); saveAndQuery(aftt, "testdouble = :param", - new Double(Double.NEGATIVE_INFINITY)); + Double.NEGATIVE_INFINITY); } catch (Throwable t) { bug(461, t, "infinity problems"); } @@ -267,7 +267,7 @@ public class TestSpecialNumbers extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestdouble(Double.POSITIVE_INFINITY); saveAndQuery(aftt, "testdouble = :param", - new Double(Double.POSITIVE_INFINITY)); + Double.POSITIVE_INFINITY); } catch (Throwable t) { bug(461, t, "infinity problems"); } @@ -277,7 +277,7 @@ public class TestSpecialNumbers extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestbyte(Byte.MIN_VALUE); try { - saveAndQuery(aftt, "testbyte = :param", new Byte(Byte.MIN_VALUE)); + saveAndQuery(aftt, "testbyte = :param", Byte.MIN_VALUE); } catch (Throwable t) { bug(AbstractTestCase.Platform.EMPRESS, 889, t, "Empress cannot store min values"); @@ -287,7 +287,7 @@ public class TestSpecialNumbers extends BaseKernelTest { public void testByteMax() { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestbyte(Byte.MAX_VALUE); - saveAndQuery(aftt, "testbyte = :param", new Byte(Byte.MAX_VALUE)); + saveAndQuery(aftt, "testbyte = :param", Byte.MAX_VALUE); } public void testZeroBigInteger() { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSpecialNumbers2.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSpecialNumbers2.java index 70fb7dba2..82d8da7e0 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSpecialNumbers2.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSpecialNumbers2.java @@ -56,7 +56,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { public void testShortMax() { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestshort(Short.MAX_VALUE); - saveAndQuery(aftt, "testshort =", new Short(Short.MAX_VALUE)); + saveAndQuery(aftt, "testshort =", Short.MAX_VALUE); } public void testShortMin() { @@ -64,7 +64,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { aftt.setTestshort(Short.MIN_VALUE); try { saveAndQuery(aftt, "testshort =", - new Short(Short.MIN_VALUE)); + Short.MIN_VALUE); } catch (Throwable t) { bug(AbstractTestCase.Platform.EMPRESS, 889, t, "Empress cannot store min values"); @@ -74,14 +74,14 @@ public class TestSpecialNumbers2 extends BaseKernelTest { public void testLongMax() { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestlong(Long.MAX_VALUE); - saveAndQuery(aftt, "testlong =", new Long(Long.MAX_VALUE)); + saveAndQuery(aftt, "testlong =", Long.MAX_VALUE); } public void testLongMin() { try { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestlong(Long.MIN_VALUE); - saveAndQuery(aftt, "testlong =", new Long(Long.MIN_VALUE)); + saveAndQuery(aftt, "testlong =", Long.MIN_VALUE); } catch (Throwable t) { bug(AbstractTestCase.Platform.HYPERSONIC, 474, t, "Some databases cannot store Long.MIN_VALUE"); @@ -92,7 +92,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestint(Integer.MAX_VALUE); saveAndQuery(aftt, "testint =", - new Integer(Integer.MAX_VALUE)); + Integer.MAX_VALUE); } public void testIntegerMin() { @@ -100,7 +100,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { aftt.setTestint(Integer.MIN_VALUE); try { saveAndQuery(aftt, "testint =", - new Integer(Integer.MIN_VALUE)); + Integer.MIN_VALUE); } catch (Throwable t) { bug(AbstractTestCase.Platform.EMPRESS, 889, t, "Empress cannot store min values"); @@ -112,7 +112,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestfloat(Float.MAX_VALUE); saveAndQuery(aftt, "testfloat =", - new Float(Float.MAX_VALUE)); + Float.MAX_VALUE); } catch (Exception e) { bug(getCurrentPlatform(), 494, e, "Some datastores cannot store Float.MAX_VALUE"); @@ -124,7 +124,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestfloat(Float.MIN_VALUE); saveAndQuery(aftt, "testfloat =", - new Float(Float.MIN_VALUE)); + Float.MIN_VALUE); } catch (Exception e) { bug(getCurrentPlatform(), 494, e, "Some databases cannot store Float.MIN_VALUE"); @@ -138,7 +138,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { try { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestfloat(Float.NaN); - saveAndQuery(aftt, "testfloat =", new Float(Float.NaN)); + saveAndQuery(aftt, "testfloat =", Float.NaN); } catch (Throwable t) { bug(461, t, "NaN problems"); } @@ -149,7 +149,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestfloat(Float.NEGATIVE_INFINITY); saveAndQuery(aftt, "testfloat =", - new Float(Float.NEGATIVE_INFINITY)); + Float.NEGATIVE_INFINITY); } catch (Exception e) { bug(getCurrentPlatform(), 494, e, "Some databases cannot store Float.NEGATIVE_INFINITY"); @@ -161,7 +161,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestfloat(Float.POSITIVE_INFINITY); saveAndQuery(aftt, "testfloat =", - new Float(Float.POSITIVE_INFINITY)); + Float.POSITIVE_INFINITY); } catch (Exception e) { bug(getCurrentPlatform(), 494, e, "Some databases cannot store Float.POSITIVE_INFINITY"); @@ -173,7 +173,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestdouble(Double.MAX_VALUE); saveAndQuery(aftt, "testdouble =", - new Double(Double.MAX_VALUE)); + Double.MAX_VALUE); } catch (Exception e) { bug(getCurrentPlatform(), 494, e, "Some databases cannot store Double.MAX_VALUE"); @@ -185,7 +185,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestdouble(Double.MIN_VALUE); saveAndQuery(aftt, "testdouble =", - new Double(Double.MIN_VALUE)); + Double.MIN_VALUE); } catch (Exception e) { bug(EnumSet.of(AbstractTestCase.Platform.POSTGRESQL, AbstractTestCase.Platform.SQLSERVER, @@ -205,7 +205,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { try { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestdouble(Double.NaN); - saveAndQuery(aftt, "testdouble =", new Double(Double.NaN)); + saveAndQuery(aftt, "testdouble =", Double.NaN); } catch (Throwable t) { bug(461, t, "NaN problems"); } @@ -216,7 +216,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestdouble(Double.NEGATIVE_INFINITY); saveAndQuery(aftt, "testdouble =", - new Double(Double.NEGATIVE_INFINITY)); + Double.NEGATIVE_INFINITY); } catch (Throwable t) { bug(461, t, "infinity problems"); } @@ -227,7 +227,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestdouble(Double.POSITIVE_INFINITY); saveAndQuery(aftt, "testdouble =", - new Double(Double.POSITIVE_INFINITY)); + Double.POSITIVE_INFINITY); } catch (Throwable t) { bug(461, t, "infinity problems"); } @@ -237,7 +237,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestbyte(Byte.MIN_VALUE); try { - saveAndQuery(aftt, "testbyte =", new Byte(Byte.MIN_VALUE)); + saveAndQuery(aftt, "testbyte =", Byte.MIN_VALUE); } catch (Throwable t) { //bug(AbstractTestCase.Platform.EMPRESS, 889, t, // "Empress cannot store min values"); @@ -250,7 +250,7 @@ public class TestSpecialNumbers2 extends BaseKernelTest { public void testByteMax() { AllFieldTypesTest aftt = new AllFieldTypesTest(); aftt.setTestbyte(Byte.MAX_VALUE); - saveAndQuery(aftt, "testbyte =", new Byte(Byte.MAX_VALUE)); + saveAndQuery(aftt, "testbyte =", Byte.MAX_VALUE); } public void testZeroBigInteger() { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestStoreBlob.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestStoreBlob.java index 43c6d6643..56a2ba660 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestStoreBlob.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestStoreBlob.java @@ -57,7 +57,7 @@ public class TestStoreBlob extends BaseKernelTest { BlobTest blob = new BlobTest(); byte[] bytes = new byte[2048]; for (int i = 0; i < bytes.length; i++) - bytes[i] = randomByte().byteValue(); + bytes[i] = randomByte(); blob.setBlob(bytes); pm.persist(blob); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/AllFieldTypesTest.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/AllFieldTypesTest.java index 22d09b56e..1f8c4152c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/AllFieldTypesTest.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/AllFieldTypesTest.java @@ -278,14 +278,14 @@ public class AllFieldTypesTest { } public void randomize(boolean objects, boolean blobs) { - testint = AbstractTestCase.randomInt().intValue(); - testlong = AbstractTestCase.randomLong().longValue(); - testshort = AbstractTestCase.randomShort().shortValue(); - testfloat = AbstractTestCase.randomFloat().floatValue(); - testdouble = AbstractTestCase.randomDouble().doubleValue(); - testbyte = AbstractTestCase.randomByte().byteValue(); - testboolean = AbstractTestCase.randomBoolean().booleanValue(); - testchar = AbstractTestCase.randomChar().charValue(); + testint = AbstractTestCase.randomInt(); + testlong = AbstractTestCase.randomLong(); + testshort = AbstractTestCase.randomShort(); + testfloat = AbstractTestCase.randomFloat(); + testdouble = AbstractTestCase.randomDouble(); + testbyte = AbstractTestCase.randomByte(); + testboolean = AbstractTestCase.randomBoolean(); + testchar = AbstractTestCase.randomChar(); if (objects) { testString = AbstractTestCase.randomString(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/AppIdSubA.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/AppIdSubA.java index d26bacabb..7639db5a6 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/AppIdSubA.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/AppIdSubA.java @@ -83,7 +83,7 @@ public abstract class AppIdSubA @Override StringTokenizer fromString(String idString) { StringTokenizer tok = super.fromString(idString); - pka = new Integer(tok.nextToken()).intValue(); + pka = new Integer(tok.nextToken()); return tok; // return the tokenizer for subclasses to use } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/AttachVersionA.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/AttachVersionA.java index d1e8bb4df..5f31d4b5a 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/AttachVersionA.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/AttachVersionA.java @@ -63,7 +63,7 @@ public class AttachVersionA { } public Object getVersionObject() { - return new Integer(version); + return version; } public String getStringField() { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/SequenceAssigned3.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/SequenceAssigned3.java index 79974df91..6c20b1fb6 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/SequenceAssigned3.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/SequenceAssigned3.java @@ -59,7 +59,7 @@ public class SequenceAssigned3 { @Override public int hashCode() { - return (int) (pk == null ? 0 : pk.longValue() + return (int) (pk == null ? 0 : pk % Integer.MAX_VALUE); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/SingleIdWrapper.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/SingleIdWrapper.java index 73fe925ed..6cfef53d6 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/SingleIdWrapper.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/SingleIdWrapper.java @@ -41,11 +41,11 @@ public class SingleIdWrapper implements SingleId { } public int getPk() { - return pk.intValue(); + return pk; } public void setPk(int i) { - pk = new Integer(i); + pk = i; } @Override diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/managedinterface/TestManagedInterfaces.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/managedinterface/TestManagedInterfaces.java index 892044d39..51ce3a108 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/managedinterface/TestManagedInterfaces.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/managedinterface/TestManagedInterfaces.java @@ -158,9 +158,9 @@ public class TestManagedInterfaces extends SingleEMFTestCase { em.getTransaction().begin(); ManagedIface pc = em.createInstance(ManagedIface.class); Set set = new HashSet(); - set.add(new Integer(3)); - set.add(new Integer(4)); - set.add(new Integer(5)); + set.add(3); + set.add(4); + set.add(5); pc.setSetInteger(set); em.persist(pc); Object oid = em.getObjectId(pc); @@ -171,13 +171,13 @@ public class TestManagedInterfaces extends SingleEMFTestCase { pc = em.find(ManagedIface.class, oid); set = pc.getSetInteger(); assertEquals(3, set.size()); - assertTrue(set.contains(new Integer(3))); - assertTrue(set.contains(new Integer(4))); - assertTrue(set.contains(new Integer(5))); + assertTrue(set.contains(3)); + assertTrue(set.contains(4)); + assertTrue(set.contains(5)); em.getTransaction().begin(); - set.remove(new Integer(4)); - set.add(new Integer(14)); - set.add(new Integer(15)); + set.remove(4); + set.add(14); + set.add(15); em.getTransaction().commit(); em.close(); @@ -185,10 +185,10 @@ public class TestManagedInterfaces extends SingleEMFTestCase { pc = em.find(ManagedIface.class, oid); set = pc.getSetInteger(); assertEquals(4, set.size()); - assertTrue(set.contains(new Integer(3))); - assertTrue(set.contains(new Integer(5))); - assertTrue(set.contains(new Integer(14))); - assertTrue(set.contains(new Integer(15))); + assertTrue(set.contains(3)); + assertTrue(set.contains(5)); + assertTrue(set.contains(14)); + assertTrue(set.contains(15)); em.getTransaction().begin(); pc.setSetInteger(null); em.getTransaction().commit(); @@ -289,14 +289,14 @@ public class TestManagedInterfaces extends SingleEMFTestCase { ManagedIface toRem = null; for (Iterator it = set.iterator(); it.hasNext();) { rel = (ManagedIface) it.next(); - seen.add(new Integer(rel.getIntField())); + seen.add(rel.getIntField()); if (rel.getIntField() == 4) toRem = rel; } assertEquals(3, seen.size()); - assertTrue(seen.contains(new Integer(3))); - assertTrue(seen.contains(new Integer(4))); - assertTrue(seen.contains(new Integer(5))); + assertTrue(seen.contains(3)); + assertTrue(seen.contains(4)); + assertTrue(seen.contains(5)); em.getTransaction().begin(); assertNotNull(toRem); set.remove(toRem); @@ -312,13 +312,13 @@ public class TestManagedInterfaces extends SingleEMFTestCase { seen.clear(); for (Iterator it = set.iterator(); it.hasNext();) { rel = (ManagedIface) it.next(); - seen.add(new Integer(rel.getIntField())); + seen.add(rel.getIntField()); } assertEquals(4, seen.size()); - assertTrue(seen.contains(new Integer(3))); - assertTrue(seen.contains(new Integer(5))); - assertTrue(seen.contains(new Integer(14))); - assertTrue(seen.contains(new Integer(15))); + assertTrue(seen.contains(3)); + assertTrue(seen.contains(5)); + assertTrue(seen.contains(14)); + assertTrue(seen.contains(15)); em.getTransaction().begin(); pc.setSetPC(null); em.getTransaction().commit(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestSequenceAssigned.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestSequenceAssigned.java index 9115a2b4f..cd7ad690c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestSequenceAssigned.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestSequenceAssigned.java @@ -88,7 +88,7 @@ public class TestSequenceAssigned (OpenJPAEntityManager) currentEntityManager(); startTx(pm); pc.setPK(-100); - pc2.setPK(new Long(-100)); + pc2.setPK((long) -100); pm.persist(pc); pm.persist(pc2); pm.flush(); @@ -131,8 +131,8 @@ public class TestSequenceAssigned pm.flush(); assertNotNull(pc.getPK()); assertNotNull(pc2.getPK()); - assertTrue(0 != pc.getPK().longValue()); - assertTrue(0 != pc2.getPK().longValue()); + assertTrue(0 != pc.getPK()); + assertTrue(0 != pc2.getPK()); assertNotEquals(pc.getPK(), pc2.getPK()); endTx(pm); endEm(pm); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/common/apps/SequenceAssigned3.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/common/apps/SequenceAssigned3.java index 920ba41cc..777bca227 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/common/apps/SequenceAssigned3.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/common/apps/SequenceAssigned3.java @@ -48,7 +48,7 @@ public class SequenceAssigned3 { @Override public int hashCode() { - return (int) (pk == null ? 0 : pk.longValue() + return (int) (pk == null ? 0 : pk % (long) Integer.MAX_VALUE); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/GroupingTestCase.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/GroupingTestCase.java index a5af35f24..0c0a4ff31 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/GroupingTestCase.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/GroupingTestCase.java @@ -115,8 +115,8 @@ public abstract class GroupingTestCase List res = q.getResultList(); assertEquals(2, res.size()); Iterator itr = res.iterator(); - assertEquals(new Integer(1), itr.next()); - assertEquals(new Integer(2), itr.next()); + assertEquals(1, itr.next()); + assertEquals(2, itr.next()); assertTrue(!itr.hasNext()); } @@ -130,8 +130,8 @@ public abstract class GroupingTestCase List res = q.getResultList(); assertEquals(2, res.size()); Iterator itr = res.iterator(); - assertEquals(new Long(-4), itr.next()); - assertEquals(new Long(-2), itr.next()); + assertEquals((long) -4, itr.next()); + assertEquals((long) -2, itr.next()); assertTrue(!itr.hasNext()); } @@ -142,8 +142,8 @@ public abstract class GroupingTestCase List res = q.getResultList(); assertEquals(2, res.size()); Iterator itr = res.iterator(); - assertEquals(new Integer(2), itr.next()); - assertEquals(new Integer(1), itr.next()); + assertEquals(2, itr.next()); + assertEquals(1, itr.next()); assertTrue(!itr.hasNext()); } @@ -154,10 +154,10 @@ public abstract class GroupingTestCase List res = q.getResultList(); assertEquals(4, res.size()); Iterator itr = res.iterator(); - assertEquals(new Integer(1), itr.next()); - assertEquals(new Integer(1), itr.next()); - assertEquals(new Integer(2), itr.next()); - assertEquals(new Integer(2), itr.next()); + assertEquals(1, itr.next()); + assertEquals(1, itr.next()); + assertEquals(2, itr.next()); + assertEquals(2, itr.next()); assertTrue(!itr.hasNext()); } @@ -182,8 +182,8 @@ public abstract class GroupingTestCase List res = q.getResultList(); assertEquals(2, res.size()); Iterator itr = res.iterator(); - assertEquals(new Integer(1), itr.next()); - assertEquals(new Integer(2), itr.next()); + assertEquals(1, itr.next()); + assertEquals(2, itr.next()); assertTrue(!itr.hasNext()); } @@ -214,9 +214,9 @@ public abstract class GroupingTestCase List res = q.getResultList(); assertEquals(3, res.size()); Iterator itr = res.iterator(); - assertEquals(new Long(1), itr.next()); - assertEquals(new Long(2), itr.next()); - assertEquals(new Long(1), itr.next()); + assertEquals(1L, itr.next()); + assertEquals(2L, itr.next()); + assertEquals(1L, itr.next()); assertTrue(!itr.hasNext()); } @@ -228,11 +228,11 @@ public abstract class GroupingTestCase assertEquals(2, res.size()); Iterator itr = res.iterator(); Object[] o = (Object[]) itr.next(); - assertEquals(new Long(2), o[0]); - assertEquals(new Long(4), o[1]); + assertEquals(2L, o[0]); + assertEquals(4L, o[1]); o = (Object[]) itr.next(); - assertEquals(new Long(2), o[0]); - assertEquals(new Long(2), o[1]); + assertEquals(2L, o[0]); + assertEquals(2L, o[1]); assertTrue(!itr.hasNext()); } @@ -245,11 +245,11 @@ public abstract class GroupingTestCase assertEquals(2, res.size()); Iterator itr = res.iterator(); Object[] o = (Object[]) itr.next(); - assertEquals(new Long(2), o[0]); - assertEquals(new Short((short) -1), o[1]); + assertEquals(2L, o[0]); + assertEquals((short) -1, o[1]); o = (Object[]) itr.next(); - assertEquals(new Long(2), o[0]); - assertEquals(new Short((short) -2), o[1]); + assertEquals(2L, o[0]); + assertEquals((short) -2, o[1]); assertTrue(!itr.hasNext()); } @@ -257,14 +257,14 @@ public abstract class GroupingTestCase Query q = em.createQuery("select o.intField from AllFieldTypes o " + "group by o.intField having o.intField < 2"); prepareQuery(q); - assertEquals(new Integer(1), q.getSingleResult()); + assertEquals(1, q.getSingleResult()); } public void testAggregateHaving() { Query q = em.createQuery("select o.byteField from AllFieldTypes o " + "group by o.byteField having count(o) > 1"); prepareQuery(q); - assertEquals(new Byte((byte) 1), q.getSingleResult()); + assertEquals((byte) 1, q.getSingleResult()); } public void testMixedHaving() { @@ -275,8 +275,8 @@ public abstract class GroupingTestCase List res = q.getResultList(); assertEquals(2, res.size()); Iterator itr = res.iterator(); - assertEquals(new Byte((byte) 0), itr.next()); - assertEquals(new Byte((byte) 1), itr.next()); + assertEquals((byte) 0, itr.next()); + assertEquals((byte) 1, itr.next()); assertTrue(!itr.hasNext()); } @@ -289,8 +289,8 @@ public abstract class GroupingTestCase List res = q.getResultList(); assertEquals(2, res.size()); Iterator itr = res.iterator(); - assertEquals(new Long(2), itr.next()); - assertEquals(new Long(4), itr.next()); + assertEquals(2L, itr.next()); + assertEquals(4L, itr.next()); assertTrue(!itr.hasNext()); } @@ -307,6 +307,6 @@ public abstract class GroupingTestCase "where other member of o.selfOneMany " + "group by other.byteField having sum(other.intField) = 2"); prepareQuery(q); - assertEquals(new Long(3), ((Object[])q.getSingleResult())[0]); + assertEquals(3L, ((Object[])q.getSingleResult())[0]); } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryResults.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryResults.java index 80936ed30..0d4865806 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryResults.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryResults.java @@ -395,7 +395,7 @@ public class TestQueryResults extends BaseQueryTest { "SELECT r FROM RuntimeTest1 ORDER BY r.stringField ASC"); q.setSubclasses(false); q.setFirstResult(0); - Long l = new Long(Long.MAX_VALUE); + Long l = Long.MAX_VALUE; q.setMaxResults(l.intValue()); List res = (List) q.getResultList(); @@ -423,7 +423,7 @@ public class TestQueryResults extends BaseQueryTest { OpenJPAQuery q = em.createQuery( "SELECT r FROM RuntimeTest1 ORDER BY r.stringField ASC"); q.setFirstResult(0); - Long l = new Long(Long.MAX_VALUE); + Long l = Long.MAX_VALUE; q.setMaxResults(l.intValue()); List res = (List) q.getResultList(); @@ -478,7 +478,7 @@ public class TestQueryResults extends BaseQueryTest { for (int i = 0; i < 7; i++) { q.setFirstResult(i); - Long l = new Long(Long.MAX_VALUE); + Long l = Long.MAX_VALUE; q.setMaxResults(100000); List res = (List) q.getResultList(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryTimeout.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryTimeout.java index a83f87520..ea0deb079 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryTimeout.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryTimeout.java @@ -246,7 +246,7 @@ public class TestQueryTimeout extends SQLListenerTestCase { getLog().trace("testQueryTimeout21b() - Map(timeout=0)"); OpenJPAEntityManagerFactory emf = null; OpenJPAEntityManager em = null; - Integer setTime = new Integer(0); + Integer setTime = 0; // create the Map to test overrides Mapprops = new HashMap<>(); props.put("javax.persistence.query.timeout", "0"); @@ -354,7 +354,7 @@ public class TestQueryTimeout extends SQLListenerTestCase { "being skipped for " + dict.platform); return; } - Integer setTime = new Integer(0); + Integer setTime = 0; getLog().trace("testQueryTimeout23b() - setHint(" + setTime + ")"); EntityManager em = null; try { @@ -415,7 +415,7 @@ public class TestQueryTimeout extends SQLListenerTestCase { "executeUpdate timeout"); OpenJPAEntityManagerFactory emf = null; OpenJPAEntityManager em = null; - Integer setTime = new Integer(1000); + Integer setTime = 1000; boolean bRetry = true; try { @@ -495,7 +495,7 @@ public class TestQueryTimeout extends SQLListenerTestCase { "QueryHint(1000)"); OpenJPAEntityManagerFactory emf = null; OpenJPAEntityManager em = null; - Integer setTime = new Integer(0); + Integer setTime = 0; // create the Map to test overrides Map props = new HashMap<>(); @@ -566,7 +566,7 @@ public class TestQueryTimeout extends SQLListenerTestCase { "being skipped for " + dict.platform); return; } - Integer setTime = new Integer(1000); + Integer setTime = 1000; getLog().trace("testQueryTimeout33b() - setHint(" + setTime + ")"); EntityManager em = null; @@ -630,7 +630,7 @@ public class TestQueryTimeout extends SQLListenerTestCase { " executeUpdate timeout"); OpenJPAEntityManagerFactory emf = null; OpenJPAEntityManager em = null; - Integer setTime = new Integer(0); + Integer setTime = 0; boolean bRetry = true; try { @@ -722,7 +722,7 @@ public class TestQueryTimeout extends SQLListenerTestCase { "being skipped for " + dict.platform); return; } - Integer setTime = new Integer(-1); + Integer setTime = -1; getLog().trace("testQueryTimeout4() - setHint(" + setTime + ")"); EntityManager em = null; try { @@ -776,7 +776,7 @@ public class TestQueryTimeout extends SQLListenerTestCase { * Expected Results: IllegalArgumentException */ public void testQueryTimeout5() { - Integer setTime = new Integer(-2000); + Integer setTime = -2000; getLog().trace("testQueryTimeout5() - setHint(" + setTime + ")"); EntityManager em = null; try { @@ -821,7 +821,7 @@ public class TestQueryTimeout extends SQLListenerTestCase { getLog().trace("testQueryTimeout6() - No EM.find() update timeout"); OpenJPAEntityManagerFactory emf = null; OpenJPAEntityManager em = null; - Integer setTime = new Integer(1000); + Integer setTime = 1000; try { // create our EMF with our PU set timeout property @@ -839,7 +839,7 @@ public class TestQueryTimeout extends SQLListenerTestCase { try { long startTime = System.currentTimeMillis(); - QTimeout qt = em.find(QTimeout.class, new Integer(1)); + QTimeout qt = em.find(QTimeout.class, 1); em.getTransaction().begin(); qt.setStringField("updated"); em.flush(); @@ -852,7 +852,7 @@ public class TestQueryTimeout extends SQLListenerTestCase { assertTrue("Should have taken 2+ secs, but was msecs=" + runTime, runTime > 1900); em.clear(); - qt = em.find(QTimeout.class, new Integer(1)); + qt = em.find(QTimeout.class, 1); assertEquals("Verify the entity was updated.", qt.getStringField(), "updated"); } catch (Exception e) { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQuotedNumbersInFilters2.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQuotedNumbersInFilters2.java index 7b4246651..98c7d24d2 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQuotedNumbersInFilters2.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQuotedNumbersInFilters2.java @@ -184,7 +184,7 @@ public class TestQuotedNumbersInFilters2 extends BaseQueryTest { private long getResults(Query q, boolean shouldFail) { try { - Integer result = new Integer(q.getResultList().size()); + Integer result = q.getResultList().size(); if (shouldFail) { fail("should have failed"); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/querycache/TestQuerySQLCache.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/querycache/TestQuerySQLCache.java index 443c9da43..ad02992ef 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/querycache/TestQuerySQLCache.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/querycache/TestQuerySQLCache.java @@ -40,8 +40,8 @@ public class TestQuerySQLCache extends SQLListenerTestCase { em = emf.createEntityManager(); em.getTransaction().begin(); - QCEntity qc1 = new QCEntity("pk1", "description", Long.valueOf(1)); - QCEntity qc2 = new QCEntity("pk2", "description-2", Long.valueOf(1)); + QCEntity qc1 = new QCEntity("pk1", "description", 1L); + QCEntity qc2 = new QCEntity("pk2", "description-2", 1L); QCEntity qc3 = new QCEntity("pk3", null, null); em.persist(qc1); @@ -77,7 +77,7 @@ public class TestQuerySQLCache extends SQLListenerTestCase { // Test with non-NULL paramter, SQL should contain the = predicate resetSQL(); - q.setParameter(1, new Long(1)); + q.setParameter(1, 1L); List resultListNotNull = q.getResultList(); assertTrue((getLastSQL(sql) != null) && !(getLastSQL(sql).contains("IS NULL"))); assertNotNull(resultListNotNull); @@ -117,7 +117,7 @@ public class TestQuerySQLCache extends SQLListenerTestCase { // Test with non-NULL paramter, SQL should contain the = predicate resetSQL(); Query q3 = em.createQuery("SELECT o from QCEntity o WHERE o.amount=?1"); - q3.setParameter(1, new Long(1)); + q3.setParameter(1, 1L); List resultListNotNull = q3.getResultList(); assertTrue((getLastSQL(sql) != null) && !(getLastSQL(sql).contains("IS NULL"))); assertNotNull(resultListNotNull); @@ -159,7 +159,7 @@ public class TestQuerySQLCache extends SQLListenerTestCase { // Test with non-NULL parameter, SQL should contain the = predicate resetSQL(); - q.setParameter("amount", new Long(1)); + q.setParameter("amount", 1L); List resultListNotNull = q.getResultList(); assertTrue((getLastSQL(sql) != null) && !(getLastSQL(sql).contains("IS NULL"))); assertNotNull(resultListNotNull); @@ -203,7 +203,7 @@ public class TestQuerySQLCache extends SQLListenerTestCase { // Test with non-NULL parameter, SQL should contain the = predicate resetSQL(); Query q2 = em.createNamedQuery("QCEntity.getByAmount"); - q2.setParameter("amount", new Long(1)); + q2.setParameter("amount", 1L); List resultListNotNull = q2.getResultList(); assertTrue((getLastSQL(sql) != null) && !(getLastSQL(sql).contains("IS NULL"))); assertNotNull(resultListNotNull); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestRelationOrphanRemoval.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestRelationOrphanRemoval.java index 8d598b8f6..5e8c4671e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestRelationOrphanRemoval.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestRelationOrphanRemoval.java @@ -54,7 +54,7 @@ public class TestRelationOrphanRemoval extends SingleEMTestCase { tx.commit(); tx.begin(); - parent = em.find(Parent.class, new Integer(origId)); + parent = em.find(Parent.class, origId); child = parent.getChilds().iterator().next(); grandChild = child.getGrandChilds().iterator().next(); child.setName("Test"); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestBasicAnnotation.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestBasicAnnotation.java index c0f0d9044..bf0f76906 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestBasicAnnotation.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestBasicAnnotation.java @@ -60,7 +60,7 @@ public class TestBasicAnnotation extends SingleEMFTestCase { System.currentTimeMillis())); aft.setStringField("aft"); aft.setWByteLob(new Byte[1]); - aft.setWDoubleField(new Double(1)); + aft.setWDoubleField(1.0); aft.setLocalDateField(LocalDate.parse(VAL_LOCAL_DATE)); aft.setLocalTimeField(LocalTime.parse(VAL_LOCAL_TIME)); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestEntityManagerMethodsThrowAfterClose.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestEntityManagerMethodsThrowAfterClose.java index 648df4a0d..8849c5940 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestEntityManagerMethodsThrowAfterClose.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestEntityManagerMethodsThrowAfterClose.java @@ -77,7 +77,7 @@ public class TestEntityManagerMethodsThrowAfterClose public void testFindAfterClose() { try { - em.find(AllFieldTypes.class, Integer.valueOf(1)); + em.find(AllFieldTypes.class, 1); fail("Expected exception not thrown " + "when calling em.find " + "after calling em.close"); @@ -88,7 +88,7 @@ public class TestEntityManagerMethodsThrowAfterClose public void testGetReferenceAfterClose() { try { - em.getReference(AllFieldTypes.class, Integer.valueOf(1)); + em.getReference(AllFieldTypes.class, 1); fail("Expected exception not thrown " + "when calling em.getReference " + "after calling em.close"); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestPropertiesMethods.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestPropertiesMethods.java index fc501bf46..0f69b5261 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestPropertiesMethods.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestPropertiesMethods.java @@ -118,7 +118,7 @@ public class TestPropertiesMethods extends AbstractPersistenceTestCase { public void testFactoryPropertiesContainUserSpecifiedValue() { Map props = emf.getProperties(); - assertEquals(new Integer(300), props.get("openjpa.DataCacheTimeout")); + assertEquals(300, props.get("openjpa.DataCacheTimeout")); } public void testFactoryPropertiesAddPlatformOrVendor() { @@ -230,7 +230,7 @@ public class TestPropertiesMethods extends AbstractPersistenceTestCase { Boolean original = (Boolean)props.get("openjpa.IgnoreChanges"); assertNotNull(original); - Boolean invert = !original.booleanValue(); + Boolean invert = !original; em.setIgnoreChanges(invert); assertProperty("openjpa.IgnoreChanges", em.getProperties(), invert); @@ -245,7 +245,7 @@ public class TestPropertiesMethods extends AbstractPersistenceTestCase { assertNotNull(original); Map config = new HashMap<>(); - Boolean invert = !original.booleanValue(); + Boolean invert = !original; config.put("openjpa.IgnoreChanges", invert); EntityManager em2 = emf.createEntityManager(config); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java index 89aeb8e94..c9022d529 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AbstractPersistenceTestCase.java @@ -669,13 +669,13 @@ public abstract class AbstractPersistenceTestCase extends TestCase { protected void setTestsDisabled(boolean disable) { synchronized (testsDisabled) { - testsDisabled = new Boolean(disable); + testsDisabled = disable; } } protected boolean isTestsDisabled() { synchronized (testsDisabled) { - return testsDisabled.booleanValue(); + return testsDisabled; } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/util/TestJPAFacadeHelper.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/util/TestJPAFacadeHelper.java index 10fbe04b2..d365237e9 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/util/TestJPAFacadeHelper.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/util/TestJPAFacadeHelper.java @@ -180,7 +180,7 @@ public class TestJPAFacadeHelper extends SingleEMFTestCase { // expected } - Integer id = Integer.valueOf(1); + Integer id = 1; Person entity = new Person(); entity.setId(id); @@ -206,7 +206,7 @@ public class TestJPAFacadeHelper extends SingleEMFTestCase { // expected } - Double id = Double.valueOf(1); + Double id = 1.0; DoubleObjIdEntity entity = new DoubleObjIdEntity(); entity.setId(id); @@ -232,7 +232,7 @@ public class TestJPAFacadeHelper extends SingleEMFTestCase { // expected } - Float id = Float.valueOf(1); + Float id = 1F; FloatIdEntity entity = new FloatIdEntity(); entity.setId(id); @@ -258,7 +258,7 @@ public class TestJPAFacadeHelper extends SingleEMFTestCase { // expected } - Boolean id = Boolean.valueOf(true); + Boolean id = Boolean.TRUE; BooleanIdEntity entity = new BooleanIdEntity(); entity.setId(id); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/util/TestProviderUtil.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/util/TestProviderUtil.java index 642e78c43..33c1efb3c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/util/TestProviderUtil.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/util/TestProviderUtil.java @@ -258,7 +258,7 @@ public class TestProviderUtil extends SingleEMFTestCase{ } Set ints = new HashSet<>(); for (int i = 0; i < 12; i++) { - ints.add(new Integer(i)); + ints.add(i); } emb.setIntVals(ints); diff --git a/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java b/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java index b4a307fcc..e8fef7548 100644 --- a/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java +++ b/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java @@ -2426,8 +2426,8 @@ public class TestFetchHints extends SequencedActionsTest { } try { - fPlan.setHint("openjpa.FetchPlan.Isolation", new Integer(13)); - fPlan.setHint("openjpa.FetchPlan.Isolation", new Integer(14)); + fPlan.setHint("openjpa.FetchPlan.Isolation", 13); + fPlan.setHint("openjpa.FetchPlan.Isolation", 14); fail("Expecting a IllegalArgumentException."); } catch (Exception e) { assertTrue("Caught expected exception", diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java index eef70eef3..711e6ac6c 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AbstractQuery.java @@ -209,7 +209,7 @@ public abstract class AbstractQuery implements OpenJPAQuerySPI { Object[] result = new Object[calculateMaxKey(positionalKeys)]; for (Integer pos : positionalKeys) { Parameter param = getParameter(pos); - result[pos.intValue() - 1] = isBound(param) ? getParameterValue(pos) : null; + result[pos - 1] = isBound(param) ? getParameterValue(pos) : null; } return result; } finally { @@ -666,7 +666,7 @@ public abstract class AbstractQuery implements OpenJPAQuerySPI { if (value instanceof String) { _relaxBindParameterTypeChecking = "true".equalsIgnoreCase(value.toString()); } else if (value instanceof Boolean) { - _relaxBindParameterTypeChecking = ((Boolean) value).booleanValue(); + _relaxBindParameterTypeChecking = (Boolean) value; } } } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java index 68e492cf2..6ee765798 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java @@ -534,7 +534,7 @@ public class AnnotationPersistenceMetaDataParser if (num == null) num = mode; else - num = num.intValue() | mode; + num = num | mode; _pkgs.put(pkg, num); } @@ -548,12 +548,10 @@ public class AnnotationPersistenceMetaDataParser // setup defaults (ie: Basic fields). ClassMetaData m = getRepository().getCachedMetaData(_cls); if (m == null) { - if (!(AccessController.doPrivileged(J2DoPrivHelper.isAnnotationPresentAction(_cls, Entity.class))) - .booleanValue() - && !(AccessController.doPrivileged(J2DoPrivHelper.isAnnotationPresentAction(_cls, Embeddable.class))) - .booleanValue() - && !(AccessController.doPrivileged(J2DoPrivHelper.isAnnotationPresentAction(_cls, - MappedSuperclass.class))).booleanValue()) + if (!AccessController.doPrivileged(J2DoPrivHelper.isAnnotationPresentAction(_cls, Entity.class)) + && !AccessController.doPrivileged(J2DoPrivHelper.isAnnotationPresentAction(_cls, Embeddable.class)) + && !AccessController.doPrivileged(J2DoPrivHelper.isAnnotationPresentAction(_cls, + MappedSuperclass.class))) return null; } // find / create metadata @@ -931,9 +929,8 @@ public class AnnotationPersistenceMetaDataParser J2DoPrivHelper.getDeclaredFieldsAction( meta.getDescribedType())); for (int i = 0; i < fields.length; i++) - if ((AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(fields[i], DetachedState.class))) - .booleanValue()) + if (AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(fields[i], DetachedState.class))) meta.setDetachedState(fields[i].getName()); } } @@ -1173,8 +1170,8 @@ public class AnnotationPersistenceMetaDataParser fmd.setExplicit(true); AnnotatedElement el = (AnnotatedElement) member; - boolean lob = (AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(el, Lob.class))).booleanValue(); + boolean lob = AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(el, Lob.class)); if (isMetaDataMode()) { switch (pstrat) { case BASIC: diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java index 7faf3e108..88ddb0ce2 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java @@ -158,11 +158,11 @@ public class AnnotationPersistenceXMLMetaDataParser { private XMLMetaData parseXMLClassAnnotations(Class cls) { // check immediately whether the class has JAXB XML annotations if (cls == null || xmlTypeClass == null - || !((AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(cls, (Class) xmlTypeClass))).booleanValue() - && (AccessController + || !(AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(cls, (Class) xmlTypeClass)) + && AccessController .doPrivileged(J2DoPrivHelper.isAnnotationPresentAction(cls, - (Class) xmlRootElementClass))).booleanValue())) + (Class) xmlRootElementClass)))) return null; // find / create metadata @@ -210,9 +210,8 @@ public class AnnotationPersistenceXMLMetaDataParser { Class superclass = cls.getSuperclass(); // handle inheritance at sub-element level - if ((AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(superclass, (Class) xmlTypeClass))) - .booleanValue()) + if (AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(superclass, (Class) xmlTypeClass))) populateFromReflection(superclass, meta); try { @@ -232,9 +231,9 @@ public class AnnotationPersistenceXMLMetaDataParser { // avoid JAXB XML bind default name if (Objects.equals(XMLMetaData.defaultName, xmlname)) xmlname = member.getName(); - if ((AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(((Field) member).getType(), - (Class) xmlTypeClass))).booleanValue()) { + if (AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(((Field) member).getType(), + (Class) xmlTypeClass))) { field = _repos.addXMLClassMetaData(((Field) member).getType()); parseXmlRootElement(((Field) member).getType(), field); populateFromReflection(((Field) member).getType() diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintHandler.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintHandler.java index 5966cf14c..ef740d4d0 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintHandler.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintHandler.java @@ -146,7 +146,7 @@ public class HintHandler { if (QueryHints.HINT_SUBCLASSES.equals(key)) { if (value instanceof String) value = Boolean.valueOf((String) value); - owner.setSubclasses(((Boolean) value).booleanValue()); + owner.setSubclasses((Boolean) value); } else if (QueryHints.HINT_RELAX_BIND_PARAM_TYPE_CHECK.equals(key)) { owner.setRelaxBindParameterTypeChecking(value); } else if (QueryHints.HINT_FILTER_LISTENER.equals(key)) { diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java index ce5701a1e..adb4bc7b5 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java @@ -168,8 +168,8 @@ public class PersistenceMetaDataDefaults if (member == null) return null; AnnotatedElement el = (AnnotatedElement) member; - if (!ignoreTransient && (AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(el, Transient.class))).booleanValue()) + if (!ignoreTransient && AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(el, Transient.class))) return TRANSIENT; if (fmd != null && fmd.getManagement() != FieldMetaData.MANAGE_PERSISTENT) @@ -240,8 +240,8 @@ public class PersistenceMetaDataDefaults } //### EJB3: what if defined in XML? - if ((AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(type, Embeddable.class))).booleanValue()) + if (AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(type, Embeddable.class))) return EMBEDDED; if (Serializable.class.isAssignableFrom(type)) return BASIC; @@ -660,9 +660,9 @@ public class PersistenceMetaDataDefaults private boolean isAnnotatedTransient(Member member) { return member instanceof AnnotatedElement - && (AccessController.doPrivileged(J2DoPrivHelper + && AccessController.doPrivileged(J2DoPrivHelper .isAnnotationPresentAction(((AnnotatedElement) member), - Transient.class))).booleanValue(); + Transient.class)); } /** diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java index 195083233..740915de3 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java @@ -353,26 +353,22 @@ public class PersistenceMetaDataFactory return null; Collection> classes = repos.loadPersistentTypes(false, loader); for (Class cls : classes) { - if ((AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(cls, NamedQuery.class))) - .booleanValue() && hasNamedQuery + if (AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(cls, NamedQuery.class)) && hasNamedQuery (queryName, (NamedQuery) cls.getAnnotation(NamedQuery.class))) return cls; - if ((AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(cls, NamedQueries.class))) - .booleanValue() && + if (AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(cls, NamedQueries.class)) && hasNamedQuery(queryName, ((NamedQueries) cls. getAnnotation(NamedQueries.class)).value())) return cls; - if ((AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(cls, NamedNativeQuery.class))) - .booleanValue() && + if (AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(cls, NamedNativeQuery.class)) && hasNamedNativeQuery(queryName, (NamedNativeQuery) cls. getAnnotation(NamedNativeQuery.class))) return cls; - if ((AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(cls, NamedNativeQueries.class))) - .booleanValue() && + if (AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(cls, NamedNativeQueries.class)) && hasNamedNativeQuery(queryName, ((NamedNativeQueries) cls. getAnnotation(NamedNativeQueries.class)).value())) return cls; @@ -399,16 +395,14 @@ public class PersistenceMetaDataFactory Collection> classes = repos.loadPersistentTypes(false, loader); for (Class cls : classes) { - if ((AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(cls, SqlResultSetMapping.class))) - .booleanValue() && + if (AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(cls, SqlResultSetMapping.class)) && hasRSMapping(rsMappingName, (SqlResultSetMapping) cls. getAnnotation(SqlResultSetMapping.class))) return cls; - if ((AccessController.doPrivileged(J2DoPrivHelper - .isAnnotationPresentAction(cls, SqlResultSetMappings.class))) - .booleanValue() && + if (AccessController.doPrivileged(J2DoPrivHelper + .isAnnotationPresentAction(cls, SqlResultSetMappings.class)) && hasRSMapping(rsMappingName, ((SqlResultSetMappings) cls. getAnnotation(SqlResultSetMappings.class)).value())) return cls; @@ -546,8 +540,8 @@ public class PersistenceMetaDataFactory J2DoPrivHelper.getResourceAction(loader, "META-INF/orm.xml")); if (rsrc != null) { File file = new File(rsrc.getFile()); - if ((AccessController.doPrivileged( - J2DoPrivHelper.existsAction(file))).booleanValue()) + if (AccessController.doPrivileged( + J2DoPrivHelper.existsAction(file))) return file; } return new File(dir, "orm.xml"); diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java index ea8de9bfd..bca362c2f 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java @@ -340,7 +340,7 @@ public class PersistenceProductDerivation ConfigurationProviderImpl cp = new ConfigurationProviderImpl(); Boolean ret = load(cp, rsrc, name, m, null, explicit); if (ret != null) - return (ret.booleanValue()) ? cp : null; + return (ret) ? cp : null; if (explicit) return null; diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java index 181796486..bbe358d82 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java @@ -148,7 +148,7 @@ public class PersistenceProviderImpl throw new IllegalArgumentException(poolValue.toString()); } - if (poolValue == null || !((Boolean) poolValue).booleanValue()) + if (poolValue == null || !(Boolean) poolValue) return Bootstrap.newBrokerFactory(cp, loader); else return Bootstrap.getBrokerFactory(cp, loader); diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CompareByExample.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CompareByExample.java index 052239f31..d24083706 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CompareByExample.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CompareByExample.java @@ -107,7 +107,7 @@ class CompareByExample extends PredicateImpl { if (cls == Boolean.class || cls == boolean.class) { return Boolean.FALSE.equals(val); } else if (cls == Character.class || cls == char.class) { - return ((Character) val).charValue() == 0; + return (Character) val == 0; } else if (cls == Byte.class || cls == byte.class || cls == Double.class || cls == double.class || cls == Float.class || cls == float.class diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java index d1ca11ded..544f1a85f 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java @@ -601,7 +601,7 @@ class Expressions { } public static class Trim extends BinarayFunctionalExpression { - static Expression defaultTrim = new Constant<>(Character.class, Character.valueOf(' ')); + static Expression defaultTrim = new Constant<>(Character.class, ' '); static Trimspec defaultSpec = Trimspec.BOTH; private Trimspec ts; diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SelectionImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SelectionImpl.java index 71ff300ae..28d8b078a 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SelectionImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SelectionImpl.java @@ -93,7 +93,7 @@ abstract class SelectionImpl implements Selection, CriteriaExpression { * Affirms if the alias of this expression is assigned automatically. */ boolean isAutoAliased() { - return _autoAliased == null ? true : _autoAliased.booleanValue(); + return _autoAliased == null ? true : _autoAliased; } /** diff --git a/openjpa-slice/src/test/java/org/apache/openjpa/slice/TestQuery.java b/openjpa-slice/src/test/java/org/apache/openjpa/slice/TestQuery.java index 7c8f27ed0..02f5abe80 100644 --- a/openjpa-slice/src/test/java/org/apache/openjpa/slice/TestQuery.java +++ b/openjpa-slice/src/test/java/org/apache/openjpa/slice/TestQuery.java @@ -91,7 +91,7 @@ public class TestQuery extends SliceTestCase { Integer old = Integer.MIN_VALUE; for (Object row : result) { Object[] line = (Object[])row; - int value = ((Integer)line[0]).intValue(); + int value = (Integer) line[0]; PObject pc = (PObject)line[1]; assertTrue(value >= old); old = value; diff --git a/openjpa-slice/src/test/java/org/apache/openjpa/slice/TestQueryMultiThreaded.java b/openjpa-slice/src/test/java/org/apache/openjpa/slice/TestQueryMultiThreaded.java index 99a8c4d7b..b057fcbcb 100644 --- a/openjpa-slice/src/test/java/org/apache/openjpa/slice/TestQueryMultiThreaded.java +++ b/openjpa-slice/src/test/java/org/apache/openjpa/slice/TestQueryMultiThreaded.java @@ -126,7 +126,7 @@ public class TestQueryMultiThreaded extends SliceTestCase { Integer old = Integer.MIN_VALUE; for (Object row : result) { Object[] line = (Object[]) row; - int value = ((Integer) line[0]).intValue(); + int value = (Integer) line[0]; PObject pc = (PObject) line[1]; assertTrue(value >= old); old = value; @@ -212,7 +212,7 @@ public class TestQueryMultiThreaded extends SliceTestCase { int i = 0; for (Object row : result) { Object[] line = (Object[]) row; - int value = ((Integer) line[0]).intValue(); + int value = (Integer) line[0]; PObject pc = (PObject) line[1]; } assertEquals(limit, result.size()); diff --git a/openjpa-tools/openjpa-fetch-statistics/src/main/java/org/apache/openjpa/enhance/stats/FetchStatsCollector.java b/openjpa-tools/openjpa-fetch-statistics/src/main/java/org/apache/openjpa/enhance/stats/FetchStatsCollector.java index 5411d5610..0b552c2d6 100644 --- a/openjpa-tools/openjpa-fetch-statistics/src/main/java/org/apache/openjpa/enhance/stats/FetchStatsCollector.java +++ b/openjpa-tools/openjpa-fetch-statistics/src/main/java/org/apache/openjpa/enhance/stats/FetchStatsCollector.java @@ -76,7 +76,7 @@ public final class FetchStatsCollector { } public static AtomicInteger registerField(String field) { - return _used.putIfAbsent(field, new AtomicInteger(Integer.valueOf(0))); + return _used.putIfAbsent(field, new AtomicInteger(0)); } public static void hit(String field) { @@ -111,7 +111,7 @@ public final class FetchStatsCollector { StringBuilder message = new StringBuilder(); message.append(_loc.get("fields-never-fetched", - new Object[] { _entities, new Integer(zeroAccessFieldSet.size()) }).getMessage()); + new Object[] { _entities, zeroAccessFieldSet.size()}).getMessage()); for (String field : zeroAccessFieldSet) { message.append("\n\t" + field); diff --git a/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java b/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java index d8b138496..8a1aae460 100644 --- a/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java +++ b/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java @@ -81,10 +81,10 @@ public class XMLFileHandler { */ public Collection load(ClassMetaData meta) { File f = getFile(meta); - if (!(AccessController.doPrivileged( - J2DoPrivHelper.existsAction(f))).booleanValue() || - (AccessController.doPrivileged( - J2DoPrivHelper.lengthAction(f))).longValue() == 0) + if (!AccessController.doPrivileged( + J2DoPrivHelper.existsAction(f)) || + AccessController.doPrivileged( + J2DoPrivHelper.lengthAction(f)) == 0) return Collections.EMPTY_SET; try { return read(f); @@ -137,8 +137,8 @@ public class XMLFileHandler { throw new InternalException(); File f = getFile(meta); - if (!(AccessController.doPrivileged( - J2DoPrivHelper.existsAction(f.getParentFile()))).booleanValue()) + if (!AccessController.doPrivileged( + J2DoPrivHelper.existsAction(f.getParentFile()))) AccessController.doPrivileged( J2DoPrivHelper.mkdirsAction(f.getParentFile())); @@ -277,7 +277,7 @@ public class XMLFileHandler { case JavaTypes.CHAR_OBJ: // quote chars so we can distinguish whitespace chars; special // case for \0 - char c = ((Character) val).charValue(); + char c = (Character) val; out.write("'"); if (c == '\0') out.write("0x0"); @@ -493,8 +493,8 @@ public class XMLFileHandler { // strip quotes; special case for 0x0 str = str.substring(1, str.length() - 1); if (str.equals("0x0")) - return new Character('\0'); - return new Character(XMLEncoder.decode(str).charAt(0)); + return '\0'; + return XMLEncoder.decode(str).charAt(0); case JavaTypes.DOUBLE: case JavaTypes.DOUBLE_OBJ: diff --git a/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLStoreManager.java b/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLStoreManager.java index 5562c98c2..1b72cacd9 100644 --- a/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLStoreManager.java +++ b/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLStoreManager.java @@ -94,7 +94,7 @@ public class XMLStoreManager private static void incrementVersion(OpenJPAStateManager sm) { long version = 0; if (sm.getVersion() != null) - version = ((Long) sm.getVersion()).longValue() + 1; + version = (Long) sm.getVersion() + 1; sm.setNextVersion(version); }