From 60008b764e784cb60d3e076d5369ba00dcf9b45c Mon Sep 17 00:00:00 2001 From: Lukas Jungmann Date: Fri, 17 Sep 2021 18:08:07 +0200 Subject: [PATCH] code cleanup - reduntant method calls Signed-off-by: Lukas Jungmann --- README.md | 3 + .../dynamic/projectxml/SimpleMapProject.java | 4 +- .../projectxml/SimpleMapProjectNoLogin.java | 4 +- .../CacheStatementBatchWritingTest.java | 2 +- .../feature/SequencingConcurrencyTest.java | 2 +- .../inheritance/STI_JoinedAttributeTest.java | 4 +- .../testing/tests/plsql/PLSQLTestModel.java | 6 +- .../returning/DescriptorExceptionTest.java | 2 +- .../transparentindirection/ZTestCase.java | 4 +- .../transparentindirection/ZTestSuite.java | 2 +- .../CloneAttributeIfMutableTest.java | 2 +- .../tests/validation/GetTableNameTest.java | 2 +- .../junit/helper/JavaSEPlatformTest.java | 6 +- .../tests/junit/helper/JavaUtilTest.java | 12 +-- .../tests/junit/helper/JavaVersionTest.java | 8 +- .../tests/junit/identitymaps/CacheIdTest.java | 16 ++-- .../LocalizationResourcesTest.java | 4 +- .../tests/junit/logging/LogLevelHelper.java | 10 +-- .../testing/framework/JUnitTestCase.java | 16 ++-- .../framework/JoinedAttributeTestHelper.java | 4 +- .../framework/ui/TestingBrowserPanel.java | 2 +- .../testing/tests/TestRunModel.java | 6 +- .../i18n/ExceptionMessageGenerator.java | 2 +- .../core/queries/CoreAttributeConverter.java | 8 +- .../descriptors/DescriptorHelper.java | 6 +- .../expressions/SQLSelectStatement.java | 2 +- .../internal/helper/JavaSEPlatform.java | 6 +- .../internal/oxm/XPathObjectBuilder.java | 2 +- .../logging/AbstractSessionLog.java | 6 +- .../queries/ObjectLevelModifyQuery.java | 2 +- .../persistence/services/RuntimeServices.java | 2 +- .../TableSequenceDefinition.java | 2 +- .../UnaryTableSequenceDefinition.java | 4 +- .../logging/slf4j/SLF4JLoggerHelper.java | 8 +- .../tests/logging/slf4j/SLF4JLoggerTest.java | 4 +- .../eis/cobol/helper/ByteConverter.java | 21 +++-- .../DbChangeNotificationTest.java | 2 +- .../CustomFeaturesJUnitTestSuite.java | 4 +- .../jpa/test/lob/TestLobMerge.java | 10 +-- .../models/jpa/advanced/Customizer.java | 4 +- .../jpa/advanced/compositepk/NumberId.java | 2 +- .../testing/models/jpa22/jta/Animal.java | 4 +- .../jpa/advanced/AdvancedJPAJunitTest.java | 4 +- .../advanced/EntityManagerJUnitTestSuite.java | 4 +- .../advanced/EntityManagerJUnitTestSuite.java | 10 +-- .../DDLGenerationJUnitTestSuite.java | 4 +- .../advanced/EntityManagerJUnitTestSuite.java | 4 +- .../EntityManagerTLRJUnitTestSuite.java | 4 +- .../JUnitJPQLComplexAggregateTestSuite.java | 10 +-- .../jpa/jpql/JUnitJPQLComplexTestSuite.java | 12 +-- .../JPAPerformanceComparisonModel.java | 14 ++-- .../EntityMappingsAdvancedJUnitTestCase.java | 4 +- ...yMappingsDynamicAdvancedJUnitTestCase.java | 2 +- .../EntityMappingsAdvancedJUnitTestCase.java | 4 +- .../framework/wdf/AbstractBaseTest.java | 4 +- .../tests/wdf/jpa1/query/QueryTest.java | 2 +- .../query/TestConditionalExpressions.java | 6 +- .../persistence/jpa/jpql/ExpressionTools.java | 82 ++++++++++++++----- .../jpa/jpql/parser/ExpressionFactory.java | 8 +- .../jpa/modelgen/CanonicalModelProcessor.java | 2 +- .../framework/server/TestRunner1Bean.java | 4 +- .../framework/server/TestRunner2Bean.java | 4 +- .../framework/server/TestRunner3Bean.java | 4 +- .../framework/server/TestRunner4Bean.java | 4 +- .../framework/server/TestRunner5Bean.java | 4 +- .../framework/server/TestRunner6Bean.java | 4 +- .../internal/jpa/EJBQueryImpl.java | 2 +- .../internal/jpa/EntityManagerSetupImpl.java | 4 +- .../persistence/internal/jpa/QueryImpl.java | 2 +- .../ReflectiveDynamicClassLoader.java | 4 +- .../deployment/JavaSECMPInitializerAgent.java | 4 +- .../metadata/accessors/MetadataHelper.java | 4 +- .../accessors/classes/ClassAccessor.java | 2 +- .../objects/MetadataAnnotatedElement.java | 24 +++--- .../accessors/objects/MetadataAnnotation.java | 16 ++-- .../accessors/objects/MetadataAsmFactory.java | 6 +- .../accessors/objects/MetadataClass.java | 8 +- .../accessors/objects/MetadataFactory.java | 4 +- .../accessors/objects/MetadataField.java | 4 +- .../accessors/objects/MetadataMethod.java | 6 +- .../jpa/transaction/TransactionImpl.java | 2 +- .../jaxb/compiler/AnnotationsProcessor.java | 4 +- .../xsitype2/FooBarXsiTypeTestCases.java | 2 +- .../InheritanceWithTransientTestCases.java | 2 +- .../InheritanceWithXMLValueTestCases.java | 2 +- .../ExtendedList8ChildTestCases.java | 4 +- .../xmlmarshaller/UnmarshallerTestCases.java | 4 +- .../oxm/classloader/MappingTestProject.java | 16 ++-- .../testing/oxm/dynamic/DynamicTestCases.java | 8 +- .../sdo/helper/DynamicClassWriter.java | 6 +- .../sdo/helper/extension/OPStack.java | 6 +- .../dynamicimpl/DataTypesTestCases.java | 4 +- .../ChangeSummaryVolumetricsTest.java | 6 +- .../java/dbws/testing/mtom/MTOMTestSuite.java | 4 +- .../dbws/testing/soap12/SOAP12TestSuite.java | 2 +- .../tools/dbws/oracle/ShadowDDLGenerator.java | 2 +- 96 files changed, 314 insertions(+), 276 deletions(-) diff --git a/README.md b/README.md index bdf11adfa16..a62644e1d06 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,9 @@ [//]: # " " [//]: # " SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause " +[![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/eclipse-ee4j/eclipselink.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/eclipse-ee4j/eclipselink/context:java) +[![Total alerts](https://img.shields.io/lgtm/alerts/g/eclipse-ee4j/eclipselink.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/eclipse-ee4j/eclipselink/alerts/) + EclipseLink master (3.1.x) [![Maven Central](https://img.shields.io/maven-central/v/org.eclipse.persistence/eclipselink.svg?versionPrefix=3.1&label=Maven%20Central)](https://mvnrepository.com/artifact/org.eclipse.persistence/eclipselink) [![Jakarta Staging (Snapshots)](https://img.shields.io/nexus/s/https/jakarta.oss.sonatype.org/org.eclipse.persistence/eclipselink.svg)](https://jakarta.oss.sonatype.org/content/repositories/staging/org/eclipse/persistence/eclipselink) diff --git a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/dynamic/projectxml/SimpleMapProject.java b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/dynamic/projectxml/SimpleMapProject.java index c1eed47db2e..0e62ca79fe6 100644 --- a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/dynamic/projectxml/SimpleMapProject.java +++ b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/dynamic/projectxml/SimpleMapProject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -90,7 +90,7 @@ public static void setUp() { } dynamicHelper = new DynamicHelper(session); session.login(); - new DynamicSchemaManager(session).createTables(new DynamicType[0]); + new DynamicSchemaManager(session).createTables(); } @AfterClass diff --git a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/dynamic/projectxml/SimpleMapProjectNoLogin.java b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/dynamic/projectxml/SimpleMapProjectNoLogin.java index 410ff32cce8..8a92b552243 100644 --- a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/dynamic/projectxml/SimpleMapProjectNoLogin.java +++ b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/dynamic/projectxml/SimpleMapProjectNoLogin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -69,7 +69,7 @@ public static void setUp() { } dynamicHelper = new DynamicHelper(session); session.login(); - new DynamicSchemaManager(session).createTables(new DynamicType[0]); + new DynamicSchemaManager(session).createTables(); } } diff --git a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/feature/CacheStatementBatchWritingTest.java b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/feature/CacheStatementBatchWritingTest.java index 346df96de69..b93d2f956e3 100644 --- a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/feature/CacheStatementBatchWritingTest.java +++ b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/feature/CacheStatementBatchWritingTest.java @@ -74,7 +74,7 @@ public void test() { Map statementCache = null; String sql = getSession().getDescriptor(Address.class).getQueryManager().getInsertQuery().getSQLString(); try { - Method method = uow.getParent().getAccessor().getClass().getDeclaredMethod("getStatementCache", new Class[] { }); + Method method = uow.getParent().getAccessor().getClass().getDeclaredMethod("getStatementCache"); method.setAccessible(true); statementCache = (Map)method.invoke(uow.getParent().getAccessor(), new Object[] { }); statement = (PreparedStatement)statementCache.get(sql); diff --git a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/feature/SequencingConcurrencyTest.java b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/feature/SequencingConcurrencyTest.java index 66fd06189e4..6aa0986bfb3 100644 --- a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/feature/SequencingConcurrencyTest.java +++ b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/feature/SequencingConcurrencyTest.java @@ -245,7 +245,7 @@ public void verify() { // Verify for (int i = 0; i < nThreads; i++) { if (tests[i].exception != null) { - throw new org.eclipse.persistence.testing.framework.TestErrorException("exception in thread " + i + ", session(" + String.valueOf(System.identityHashCode(session)) + ") ", tests[i].exception); + throw new org.eclipse.persistence.testing.framework.TestErrorException("exception in thread " + i + ", session(" + System.identityHashCode(session) + ") ", tests[i].exception); } } diff --git a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/inheritance/STI_JoinedAttributeTest.java b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/inheritance/STI_JoinedAttributeTest.java index db7a7c99712..fe05a0092bb 100644 --- a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/inheritance/STI_JoinedAttributeTest.java +++ b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/inheritance/STI_JoinedAttributeTest.java @@ -104,8 +104,8 @@ protected void setup() throws Throwable { // executes the method with the same name as the test @Override protected void test() throws Exception { - Method method = this.getClass().getDeclaredMethod(getName(), new Class[]{}); - method.invoke(this, new Object[] {}); + Method method = this.getClass().getDeclaredMethod(getName()); + method.invoke(this); } @Override diff --git a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/plsql/PLSQLTestModel.java b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/plsql/PLSQLTestModel.java index ed64dcc103f..6245aa5d8da 100644 --- a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/plsql/PLSQLTestModel.java +++ b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/plsql/PLSQLTestModel.java @@ -366,7 +366,7 @@ public static TestSuite getCollectionTestSuite() { suite.addTest(test); args = new ArrayList(); - collection = new ArrayList(Arrays.asList(new String[] { "Ottawa", "Toronto" })); + collection = new ArrayList(Arrays.asList("Ottawa", "Toronto")); args.add(collection); args.add("Nepean"); result = new DatabaseRecord(); @@ -392,7 +392,7 @@ public static TestSuite getCollectionTestSuite() { suite.addTest(test); args = new ArrayList(); - collection = new ArrayList(Arrays.asList(new Object[] { address, address })); + collection = new ArrayList(Arrays.asList(address, address)); args.add(collection); args.add("Nepean"); result = new DatabaseRecord(); @@ -418,7 +418,7 @@ public static TestSuite getCollectionTestSuite() { suite.addTest(test); args = new ArrayList(); - collection = new ArrayList(Arrays.asList(new Object[] { employee, employee })); + collection = new ArrayList(Arrays.asList(employee, employee)); args.add(collection); args.add("Nepean"); result = new DatabaseRecord(); diff --git a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/returning/DescriptorExceptionTest.java b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/returning/DescriptorExceptionTest.java index e2db8f7738c..e4babc0ed66 100644 --- a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/returning/DescriptorExceptionTest.java +++ b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/returning/DescriptorExceptionTest.java @@ -32,7 +32,7 @@ public class DescriptorExceptionTest extends AutoVerifyTestCase { public DescriptorExceptionTest(int errorCode) { this.errorCode = errorCode; - setName(getName() + " errorCode=" + Integer.toString(errorCode)); + setName(getName() + " errorCode=" + errorCode); } public DescriptorExceptionTest(int errorCode, String more) { diff --git a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/transparentindirection/ZTestCase.java b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/transparentindirection/ZTestCase.java index c02457ee466..5f6dd63b41f 100644 --- a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/transparentindirection/ZTestCase.java +++ b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/transparentindirection/ZTestCase.java @@ -131,7 +131,7 @@ protected void initialize() { protected void invokeTest() throws Throwable { Method method = this.methodNamed(this.getZName()); try { - method.invoke(this, new Object[0]); + method.invoke(this); } catch (IllegalAccessException iae) { throw new RuntimeException("The method '" + method + "' (and its class) must be public."); } catch (InvocationTargetException ite) { @@ -145,7 +145,7 @@ protected void invokeTest() throws Throwable { */ private Method methodNamed(String name) { try { - return this.getClass().getMethod(zName, new Class[0]); + return this.getClass().getMethod(zName); } catch (NoSuchMethodException ex) { throw new RuntimeException("Method named " + name + " not found."); } diff --git a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/transparentindirection/ZTestSuite.java b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/transparentindirection/ZTestSuite.java index a44f3dbd0a7..96eb9cf727d 100644 --- a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/transparentindirection/ZTestSuite.java +++ b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/transparentindirection/ZTestSuite.java @@ -87,7 +87,7 @@ public Enumeration methodNamesStartingWithTestFor(Class testClass) { */ private Constructor singleArgumentConstructorFor(Class testCaseClass) { try { - return testCaseClass.getConstructor(new Class[] { String.class }); + return testCaseClass.getConstructor(String.class); } catch (NoSuchMethodException e) { String name = testCaseClass.getName(); throw new RuntimeException("The class '" + name + "' must implement the constructor '" + name + "(String)'"); diff --git a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/unitofwork/CloneAttributeIfMutableTest.java b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/unitofwork/CloneAttributeIfMutableTest.java index cb43ce1ca9a..c1632797a3d 100644 --- a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/unitofwork/CloneAttributeIfMutableTest.java +++ b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/unitofwork/CloneAttributeIfMutableTest.java @@ -131,7 +131,7 @@ public void verify() { buffer.append(Helper.cr()); for (int i = 0; i < errors.size(); i++) { Throwable t = (Throwable)errors.get(i); - buffer.append(String.valueOf(t)); + buffer.append(t); buffer.append(Helper.cr()); } throw new TestErrorException(buffer.toString()); diff --git a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/validation/GetTableNameTest.java b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/validation/GetTableNameTest.java index 0f9709f0f6c..8fea38e2d13 100644 --- a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/validation/GetTableNameTest.java +++ b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/validation/GetTableNameTest.java @@ -48,7 +48,7 @@ public void test() { @Override protected void verify() { if (caughtException != expectedException) { - throw new TestErrorException("The proper exception was not thrown:\n" + "[CAUGHT] " + caughtException + "\n\n[EXPECTING] " + String.valueOf(expectedException)); + throw new TestErrorException("The proper exception was not thrown:\n" + "[CAUGHT] " + caughtException + "\n\n[EXPECTING] " + expectedException); } } } diff --git a/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/helper/JavaSEPlatformTest.java b/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/helper/JavaSEPlatformTest.java index c89aadbd63b..08ca0d6392b 100644 --- a/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/helper/JavaSEPlatformTest.java +++ b/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/helper/JavaSEPlatformTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -72,8 +72,8 @@ public void testToValue() { for (final VersionData data : TO_VALUE_DATA) { final JavaSEPlatform out = JavaSEPlatform.toValue(data.major, data.minor); assertEquals("Expected " + data.platform.toString() - + " for version number " + Integer.toString(data.major) + "." - + Integer.toString(data.minor), data.platform, out); + + " for version number " + data.major + "." + + data.minor, data.platform, out); } } diff --git a/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/helper/JavaUtilTest.java b/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/helper/JavaUtilTest.java index 939d156b93c..05eca646a84 100644 --- a/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/helper/JavaUtilTest.java +++ b/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/helper/JavaUtilTest.java @@ -116,10 +116,10 @@ public void testStringToPlatform() { String versionString = JavaSEPlatform.versionString(major, minor); JavaSEPlatform platform = JavaSEPlatform.toValue(versionString); assertNotNull("There should exist platform for valid platform" - +" version number ["+Integer.toString(major)+","+Integer.toString(minor)+"]", platform); + +" version number ["+ major +","+ minor +"]", platform); int[] result = resultMapping(version); assertTrue("Returned platform version numbers do not match provided" - + " version number ["+Integer.toString(major)+","+Integer.toString(minor)+"]", + + " version number ["+ major +","+ minor +"]", result[0] == platform.getMajor() && result[1] == platform.getMinor()); } // Invalid version number pairs. @@ -129,7 +129,7 @@ public void testStringToPlatform() { String versionString = JavaSEPlatform.versionString(major, minor); JavaSEPlatform platform = JavaSEPlatform.toValue(major, minor); assertTrue("Returned platform shall be JavaSEPlatform.LATEST for invalid version " - + "number ["+Integer.toString(major)+","+Integer.toString(minor)+"]", + + "number ["+ major +","+ minor +"]", LATEST.getMajor() == platform.getMajor() && LATEST.getMinor() == platform.getMinor()); } } @@ -146,10 +146,10 @@ public void testMajorMinorToPlatform() { int minor = version[1]; JavaSEPlatform platform = JavaSEPlatform.toValue(major, minor); assertNotNull("There should exist platform for valid platform" - +" version number ["+Integer.toString(major)+","+Integer.toString(minor)+"]", platform); + +" version number ["+ major +","+ minor +"]", platform); int[] result = resultMapping(version); assertTrue("Returned platform version numbers do not match provided" - + " version number ["+Integer.toString(major)+","+Integer.toString(minor)+"]", + + " version number ["+ major +","+ minor +"]", result[0] == platform.getMajor() && result[1] == platform.getMinor()); } // Invalid version number pairs. @@ -158,7 +158,7 @@ public void testMajorMinorToPlatform() { int minor = version[1]; JavaSEPlatform platform = JavaSEPlatform.toValue(major, minor); assertTrue("Returned platform shall be JavaSEPlatform.LATEST for invalid version " - + "number ["+Integer.toString(major)+","+Integer.toString(minor)+"]", + + "number ["+ major +","+ minor +"]", LATEST.getMajor() == platform.getMajor() && LATEST.getMinor() == platform.getMinor()); } } diff --git a/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/helper/JavaVersionTest.java b/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/helper/JavaVersionTest.java index f590a4e4a82..dd8686341a3 100644 --- a/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/helper/JavaVersionTest.java +++ b/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/helper/JavaVersionTest.java @@ -92,9 +92,9 @@ public void testPropertyVersionParser() { final JavaVersion javaVersion = ReflectionHelper.invokeStaticMethod( "propertyVersionParser", JavaVersion.class, new Class[] {String.class}, JavaVersion.class, versionString); assertNotNull("JavaVersion instance must be returned for valid platform" - +" version number ["+Integer.toString(major)+","+Integer.toString(minor)+"]", javaVersion); + +" version number ["+ major +","+ minor +"]", javaVersion); assertTrue("Returned JavaVersion instance numbers do not match provided" - + " version number ["+Integer.toString(major)+","+Integer.toString(minor)+"]", major == javaVersion.getMajor() + + " version number ["+ major +","+ minor +"]", major == javaVersion.getMajor() && minor == javaVersion.getMinor()); } catch (ReflectiveOperationException e) { fail("Exception: " + e.getMessage()); @@ -109,9 +109,9 @@ public void testPropertyVersionParser() { final JavaVersion javaVersion = ReflectionHelper.invokeStaticMethod( "propertyVersionParser", JavaVersion.class, new Class[] {String.class}, JavaVersion.class, versionString); assertNotNull("JavaVersion instance must be returned for invalid platform" - +" version number ["+Integer.toString(major)+","+Integer.toString(minor)+"]", javaVersion); + +" version number ["+ major +","+ minor +"]", javaVersion); assertTrue("Returned JavaVersion instance numbers do not match provided" - + " version number ["+Integer.toString(major)+","+Integer.toString(minor)+"]", major == javaVersion.getMajor() + + " version number ["+ major +","+ minor +"]", major == javaVersion.getMajor() && minor == javaVersion.getMinor()); } catch (ReflectiveOperationException e) { fail("Exception: " + e.getMessage()); diff --git a/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/identitymaps/CacheIdTest.java b/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/identitymaps/CacheIdTest.java index e2c84d7c10e..f3a86271c0c 100644 --- a/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/identitymaps/CacheIdTest.java +++ b/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/identitymaps/CacheIdTest.java @@ -83,17 +83,17 @@ public void compareToForStringArrays() { newCacheId(new Object[] {"a", "b"}, new Object[] {"b", "c"}), newCacheId(new Object[] {"a", "b"}, new Object[] {"b", "c"})); equal("one primaryKey - equal", - newCacheId(new Object[] {"a", "b"}), - newCacheId(new Object[] {"a", "b"})); + newCacheId("a", "b"), + newCacheId("a", "b")); smaller("one primaryKey - smaller on first element", - newCacheId(new Object[] {"a", "b"}), newCacheId(new Object[] {"b", "c"})); + newCacheId("a", "b"), newCacheId("b", "c")); greater("one primaryKey - greater on first element", - newCacheId(new Object[] {"b", "c"}), newCacheId(new Object[] {"a", "c"})); + newCacheId("b", "c"), newCacheId("a", "c")); smaller("one primaryKey - smaller on last element", - newCacheId(new Object[] {"b", "a", "b"}), newCacheId(new Object[] {"b", "a", "c"})); + newCacheId("b", "a", "b"), newCacheId("b", "a", "c")); greater("one primaryKey - greater on last element", - newCacheId(new Object[] {"0", "0", "c"}), newCacheId(new Object[] {"0", "0", "b"})); + newCacheId("0", "0", "c"), newCacheId("0", "0", "b")); smaller("many primaryKey - smaller", newCacheId(new Object[] {"a", "b"}, new Object[] {"b", "b"}), newCacheId(new Object[] {"a", "b"}, new Object[] {"b", "c"})); @@ -101,9 +101,9 @@ public void compareToForStringArrays() { newCacheId(new Object[] {"b", "c"}, new Object[] {"a", "d"}), newCacheId(new Object[] {"b", "c"}, new Object[] {"a", "c"})); greater("one primaryKey - smaller by different size", - newCacheId(new Object[] {"a", "b"}), newCacheId(new Object[] {"a"})); + newCacheId("a", "b"), newCacheId("a")); smaller("one primaryKey - greater by different size", - newCacheId(new Object[] {"b"}), newCacheId(new Object[] {"b", "a"})); + newCacheId("b"), newCacheId("b", "a")); } @Test diff --git a/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/localization/LocalizationResourcesTest.java b/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/localization/LocalizationResourcesTest.java index b32f95b806b..89eb97b3aee 100644 --- a/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/localization/LocalizationResourcesTest.java +++ b/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/localization/LocalizationResourcesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2021 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2018 IBM Corporation. All rights reserved. * * This program and the accompanying materials are made available under the @@ -77,7 +77,7 @@ private static void verifyBundle(final Class c) { final Set keys = new HashSet<>(); Object[][] bundle; try { - Object instance = ReflectionHelper.getInstance(c, new Class[] {}, new Object[] {}); + Object instance = ReflectionHelper.getInstance(c, new Class[] {}); bundle = (Object[][])ReflectionHelper.invokeMethod("getContents", instance, new Class[] {}, new Object[] {}); } catch (ReflectiveOperationException | SecurityException e) { Assert.fail("Could not access " + bundleName + "#getContents()"); diff --git a/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/logging/LogLevelHelper.java b/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/logging/LogLevelHelper.java index 82f3affc371..d783008d60a 100644 --- a/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/logging/LogLevelHelper.java +++ b/foundation/eclipselink.core.test/src/test/java/org/eclipse/persistence/testing/tests/junit/logging/LogLevelHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -76,14 +76,14 @@ public static void testToValueInt() { for (LogLevel level : LogLevel.values()) { int id = level.getId(); LogLevel levelValue = LogLevel.toValue(id); - assertEquals("Log level was not found for ID: " + Integer.toString(id), level, levelValue); + assertEquals("Log level was not found for ID: " + id, level, levelValue); } // Check some invalid IDs. final int[] invalidIds = new int[] { -2, -1, LogLevel.length, LogLevel.length + 1}; for (int id : invalidIds) { try { LogLevel.toValue(-1); - fail("LogLevel.toValue(" + Integer.toString(id) + ") shall throw IllegalArgumentException"); + fail("LogLevel.toValue(" + id + ") shall throw IllegalArgumentException"); } catch (IllegalArgumentException ex) { // This exception is expected for illegal IDs. } @@ -99,13 +99,13 @@ public static void testToValueIntFallBack() { int id = level.getId(); LogLevel levelValue = level == LogLevel.ALL ? LogLevel.toValue(id, LogLevel.OFF) : LogLevel.toValue(id, LogLevel.ALL); - assertEquals("Log level was not found for ID: " + Integer.toString(id), level, levelValue); + assertEquals("Log level was not found for ID: " + id, level, levelValue); } // Check some invalid IDs, expecting LogLevel.ALL as fall back. final int[] invalidIds = new int[] { -2, -1, LogLevel.length, LogLevel.length + 1}; for (int id : invalidIds) { LogLevel level = LogLevel.toValue(id, LogLevel.ALL); - assertEquals("Expected log level " + LogLevel.ALL.getName() + " for ID: " + Integer.toString(id), + assertEquals("Expected log level " + LogLevel.ALL.getName() + " for ID: " + id, level, LogLevel.ALL); } } diff --git a/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/framework/JUnitTestCase.java b/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/framework/JUnitTestCase.java index 2498ddf11fe..af9d8c708c2 100644 --- a/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/framework/JUnitTestCase.java +++ b/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/framework/JUnitTestCase.java @@ -43,9 +43,9 @@ public JUnitTestCase(junit.framework.TestCase testCase) { @Override public void setup() throws Throwable { try { - Method setUp = testCase.getClass().getMethod("setUp", new Class[0]); + Method setUp = testCase.getClass().getMethod("setUp"); setUp.setAccessible(true); - setUp.invoke(testCase, new Object[0]); + setUp.invoke(testCase); } catch (InvocationTargetException exception) { throw exception.getTargetException(); } catch (Exception exception) { @@ -59,9 +59,9 @@ public void setup() throws Throwable { @Override public void reset() throws Throwable { try { - Method tearDown = testCase.getClass().getMethod("tearDown", new Class[0]); + Method tearDown = testCase.getClass().getMethod("tearDown"); tearDown.setAccessible(true); - tearDown.invoke(testCase, new Object[0]); + tearDown.invoke(testCase); } catch (InvocationTargetException exception) { throw exception.getTargetException(); } catch (Exception exception) { @@ -77,12 +77,12 @@ public void test() throws Throwable { try { Method runTest = null; try { - runTest = testCase.getClass().getMethod(testCase.getName(), new Class[0]); + runTest = testCase.getClass().getMethod(testCase.getName()); } catch (NoSuchMethodException exc) { - runTest = testCase.getClass().getMethod("runTest", new Class[0]); + runTest = testCase.getClass().getMethod("runTest"); } runTest.setAccessible(true); - runTest.invoke(testCase, new Object[0]); + runTest.invoke(testCase); } catch (InvocationTargetException exception) { throw exception.getTargetException(); } catch (Exception exception) { @@ -111,7 +111,7 @@ public static Vector suite(Class junitTestCaseClass) { } junit.framework.TestSuite suite; try { - Method suiteMethod = junitTestCaseClass.getMethod("suite", new Class[0]); + Method suiteMethod = junitTestCaseClass.getMethod("suite"); suiteMethod.setAccessible(true); junit.framework.Test test = (junit.framework.Test)suiteMethod.invoke(null, new Object[0]); while(test instanceof junit.extensions.TestDecorator) { diff --git a/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/framework/JoinedAttributeTestHelper.java b/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/framework/JoinedAttributeTestHelper.java index 0e313f17e06..afed342c2f1 100644 --- a/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/framework/JoinedAttributeTestHelper.java +++ b/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/framework/JoinedAttributeTestHelper.java @@ -215,7 +215,7 @@ protected static String compareCollections(Collection col1, Collection col2, Cla } } if(col1.size() != col2.size()) { - errorMsg = ": size1==" + Integer.toString(col1.size()) + "!= size2==" + Integer.toString(col2.size()) + "; "; + errorMsg = ": size1==" + col1.size() + "!= size2==" + col2.size() + "; "; return errorMsg; } @@ -284,7 +284,7 @@ protected static String compareMaps(Map map1, Map map2, AbstractSession session, } } if(map1.size() != map2.size()) { - errorMsg = ": size1==" + Integer.toString(map1.size()) + "!= size2==" + Integer.toString(map2.size()) + "; "; + errorMsg = ": size1==" + map1.size() + "!= size2==" + map2.size() + "; "; return errorMsg; } diff --git a/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/framework/ui/TestingBrowserPanel.java b/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/framework/ui/TestingBrowserPanel.java index d475ec40b6b..614154ec997 100644 --- a/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/framework/ui/TestingBrowserPanel.java +++ b/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/framework/ui/TestingBrowserPanel.java @@ -1310,7 +1310,7 @@ public void setupDefaultModels() { // Look for standard tests. try { testModelClass = Class.forName("org.eclipse.persistence.testing.tests.TestRunModel"); - java.lang.reflect.Method buildTestsMethod = testModelClass.getMethod("buildAllModels", new Class[0]); + java.lang.reflect.Method buildTestsMethod = testModelClass.getMethod("buildAllModels"); Vector result = (Vector)buildTestsMethod.invoke(null, new Object[0]); Helper.addAllToVector(allModels, result); } catch (Exception exception) { diff --git a/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/tests/TestRunModel.java b/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/tests/TestRunModel.java index 63fe1f58d90..9583c3525c0 100644 --- a/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/tests/TestRunModel.java +++ b/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/testing/tests/TestRunModel.java @@ -257,7 +257,7 @@ public static TestModel buildOracleTestModel() { if(TestModel.class.isAssignableFrom(cls)) { model.addTest((TestModel)cls.getConstructor().newInstance()); } else { - Method suite = cls.getDeclaredMethod("suite", new Class[]{}); + Method suite = cls.getDeclaredMethod("suite"); model.addTest((Test)suite.invoke(null, new Object[]{})); } } catch (Throwable exception) { @@ -286,7 +286,7 @@ public static TestModel buildOracleNoSQLTestModel() { if(TestModel.class.isAssignableFrom(cls)) { model.addTest((TestModel)cls.getConstructor().newInstance()); } else { - Method suite = cls.getDeclaredMethod("suite", new Class[]{}); + Method suite = cls.getDeclaredMethod("suite"); model.addTest((Test)suite.invoke(null, new Object[]{})); } } catch (Throwable exception) { @@ -314,7 +314,7 @@ public static TestModel buildNoSQLTestModel() { if(TestModel.class.isAssignableFrom(cls)) { model.addTest((TestModel)cls.getConstructor().newInstance()); } else { - Method suite = cls.getDeclaredMethod("suite", new Class[]{}); + Method suite = cls.getDeclaredMethod("suite"); model.addTest((Test)suite.invoke(null, new Object[]{})); } } catch (Throwable exception) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/exceptions/i18n/ExceptionMessageGenerator.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/exceptions/i18n/ExceptionMessageGenerator.java index d4b5408d0c0..ce1b81389bb 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/exceptions/i18n/ExceptionMessageGenerator.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/exceptions/i18n/ExceptionMessageGenerator.java @@ -104,7 +104,7 @@ protected static String format(String message, Object[] arguments) { } } } - return MessageFormat.format(errorMessage, new Object[] {message, vec}); + return MessageFormat.format(errorMessage, message, vec); } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/core/queries/CoreAttributeConverter.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/core/queries/CoreAttributeConverter.java index 6b6111b6971..a91ccfe3a3b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/core/queries/CoreAttributeConverter.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/core/queries/CoreAttributeConverter.java @@ -213,26 +213,26 @@ public static final String[] convert(final String... nameOrPath) item = nameOrPath[i]; if (item == null) { throw new IllegalArgumentException("Name or path value at index " - + Integer.toString(i) + " is null"); + + i + " is null"); } final int itemLen = item.length(); // Empty String. if (itemLen == 0) { throw new IllegalArgumentException("Name or path value at index " - + Integer.toString(i) + " is empty String"); + + i + " is empty String"); // String contains at least one character. } else { switch(item.charAt(0)) { case TAB: case LF: case FF: case CR: case SPACE: throw new IllegalArgumentException("Name or path value at index " - + Integer.toString(i) + " starts with whitespace"); + + i + " starts with whitespace"); } // String contains more than one character. if (itemLen > 0) { switch(item.charAt(itemLen - 1)) { case TAB: case LF: case FF: case CR: case SPACE: throw new IllegalArgumentException("Name or path value at index " - + Integer.toString(i) + " ends with whitespace"); + + i + " ends with whitespace"); } } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/descriptors/DescriptorHelper.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/descriptors/DescriptorHelper.java index 671b76366c8..1c5e6a79f59 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/descriptors/DescriptorHelper.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/descriptors/DescriptorHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -66,7 +66,7 @@ public static void buildValuesAsQMarksFromMappings(final StringBuilder target, if (i > 0) { target.append(separator); } - target.append(StringHelper.QUESTION_MARK).append(Integer.toString(i+1)); + target.append(StringHelper.QUESTION_MARK).append(i + 1); } } } @@ -91,7 +91,7 @@ public static void buildColsAndValuesBindingsFromMappings(final StringBuilder ta DatabaseMapping mapping = i.next(); DatabaseField field = mapping.getField(); if (!keys.contains(field)) { - target.append(field.getName()).append(binder).append(Integer.toString(++idx)); + target.append(field.getName()).append(binder).append(++idx); if (i.hasNext()) { target.append(separator); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/SQLSelectStatement.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/SQLSelectStatement.java index 742262ddf71..53064a85a8a 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/SQLSelectStatement.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/SQLSelectStatement.java @@ -2127,7 +2127,7 @@ public String getAliasFor(DatabaseField field) { * The alias is automatically truncated */ public String generatedAlias(String fieldName) { - return "a" + String.valueOf(getNextFieldCounterValue()); + return "a" + getNextFieldCounterValue(); } /** diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/JavaSEPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/JavaSEPlatform.java index df56e08944b..3c192317e88 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/JavaSEPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/JavaSEPlatform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -223,9 +223,9 @@ public static JavaSEPlatform toValue(final int major, final int minor) { */ public static final String versionString(final int major, final int minor) { StringBuilder sb = new StringBuilder(4); - sb.append(Integer.toString(major)); + sb.append(major); sb.append(JavaVersion.SEPARATOR); - sb.append(Integer.toString(minor)); + sb.append(minor); return sb.toString(); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XPathObjectBuilder.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XPathObjectBuilder.java index 4993b9eadcd..487197f5a79 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XPathObjectBuilder.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XPathObjectBuilder.java @@ -193,7 +193,7 @@ public XMLRecord buildRow(XMLRecord record, Object object, Object contextProxy = CycleRecoverableContextProxy.getProxy(cycleRecoverableContextClass, jaxbMarshaller); // Invoke onCycleDetected method, passing in proxy, and reset // 'object' to the returned value - Method onCycleDetectedMethod = object.getClass().getMethod(ON_CYCLE_DETECTED, new Class[] { cycleRecoverableContextClass }); + Method onCycleDetectedMethod = object.getClass().getMethod(ON_CYCLE_DETECTED, cycleRecoverableContextClass); object = PrivilegedAccessHelper.invokeMethod(onCycleDetectedMethod, object, new Object[] { contextProxy }); } catch (Exception e) { throw XMLMarshalException.marshalException(e); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/logging/AbstractSessionLog.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/logging/AbstractSessionLog.java index 14b9c1ebfb3..72d40ebfa30 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/logging/AbstractSessionLog.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/logging/AbstractSessionLog.java @@ -830,9 +830,9 @@ protected String getSessionString(Session session) { protected String getConnectionString(Accessor connection) { // Bug 3630182 - if possible, print the actual connection's hashcode instead of just the accessor if (connection.getDatasourceConnection() == null){ - return CONNECTION_STRING + "(" + String.valueOf(System.identityHashCode(connection)) + ")"; + return CONNECTION_STRING + "(" + System.identityHashCode(connection) + ")"; } else { - return CONNECTION_STRING + "(" + String.valueOf(System.identityHashCode(connection.getDatasourceConnection())) + ")"; + return CONNECTION_STRING + "(" + System.identityHashCode(connection.getDatasourceConnection()) + ")"; } } @@ -840,7 +840,7 @@ protected String getConnectionString(Accessor connection) { * Return the specified thread information. */ protected String getThreadString(Thread thread) { - return THREAD_STRING + "(" + String.valueOf(thread) + ")"; + return THREAD_STRING + "(" + thread + ")"; } /** diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ObjectLevelModifyQuery.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ObjectLevelModifyQuery.java index 22f8359acd7..447e6c28a8c 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ObjectLevelModifyQuery.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ObjectLevelModifyQuery.java @@ -275,6 +275,6 @@ public void setPrimaryKey(Object primaryKey) { @Override public String toString() { - return Helper.getShortClassName(getClass()) + "(" + String.valueOf(getObject()) + ")"; + return Helper.getShortClassName(getClass()) + "(" + getObject() + ")"; } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/services/RuntimeServices.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/services/RuntimeServices.java index 3ce49ff7e13..c4da40b5bd5 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/services/RuntimeServices.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/services/RuntimeServices.java @@ -1354,7 +1354,7 @@ private Object[][] tabularDataTo2DArray(TabularData tdata, String[] names) throw for (int j = 0; j < names.length; j++) { String name = names[j]; Object value = cdata.get(name); - returnRow[j] = name + " : " + String.valueOf(value); + returnRow[j] = name + " : " + value; } data[i] = returnRow; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/TableSequenceDefinition.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/TableSequenceDefinition.java index 0934517b025..ef361b33bfb 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/TableSequenceDefinition.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/TableSequenceDefinition.java @@ -66,7 +66,7 @@ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws writer.write("(" + getSequenceNameFieldName()); writer.write(", " + getSequenceCounterFieldName()); writer.write(") values ("); - writer.write("'" + getName() + "', " + Integer.toString(sequence.getInitialValue() - 1) + ")"); + writer.write("'" + getName() + "', " + (sequence.getInitialValue() - 1) + ")"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/UnaryTableSequenceDefinition.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/UnaryTableSequenceDefinition.java index 96bad729afe..bce6192798f 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/UnaryTableSequenceDefinition.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/UnaryTableSequenceDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -56,7 +56,7 @@ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws writer.write("INSERT INTO "); writer.write(getName()); writer.write("(" + getSequenceCounterFieldName()); - writer.write(") values ("+Integer.toString(sequence.getInitialValue() - 1)+")"); + writer.write(") values ("+ (sequence.getInitialValue() - 1) +")"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } diff --git a/foundation/org.eclipse.persistence.extension/src/test/java/org/eclipse/persistence/testing/tests/logging/slf4j/SLF4JLoggerHelper.java b/foundation/org.eclipse.persistence.extension/src/test/java/org/eclipse/persistence/testing/tests/logging/slf4j/SLF4JLoggerHelper.java index 2639eaea17a..f3ba43e696a 100644 --- a/foundation/org.eclipse.persistence.extension/src/test/java/org/eclipse/persistence/testing/tests/logging/slf4j/SLF4JLoggerHelper.java +++ b/foundation/org.eclipse.persistence.extension/src/test/java/org/eclipse/persistence/testing/tests/logging/slf4j/SLF4JLoggerHelper.java @@ -132,13 +132,13 @@ public void testCategoryDefaultLevels(final SLF4JLogger logger) { final int defaultLevel = logger.getLevel(category.getName()); switch(category) { case ALL: - assertEquals("SLF4J logging level " + Integer.toString(defaultLevel) - + " does not match configured/default level " + Integer.toString(configuredDefaultLevel) + assertEquals("SLF4J logging level " + defaultLevel + + " does not match configured/default level " + configuredDefaultLevel + " for category " + category.getName(), configuredDefaultLevel, defaultLevel); break; default: - assertEquals("SLF4J logging level " + Integer.toString(defaultLevel) - + " does not match configured/default level " + Integer.toString(configuredDefaultLevel) + assertEquals("SLF4J logging level " + defaultLevel + + " does not match configured/default level " + configuredDefaultLevel + " for category " + category.getName(), configuredDefaultLevel, defaultLevel); } } diff --git a/foundation/org.eclipse.persistence.extension/src/test/java/org/eclipse/persistence/testing/tests/logging/slf4j/SLF4JLoggerTest.java b/foundation/org.eclipse.persistence.extension/src/test/java/org/eclipse/persistence/testing/tests/logging/slf4j/SLF4JLoggerTest.java index 743ec09453c..9aeeb44d274 100644 --- a/foundation/org.eclipse.persistence.extension/src/test/java/org/eclipse/persistence/testing/tests/logging/slf4j/SLF4JLoggerTest.java +++ b/foundation/org.eclipse.persistence.extension/src/test/java/org/eclipse/persistence/testing/tests/logging/slf4j/SLF4JLoggerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -84,7 +84,7 @@ public void testGetLevel() { final int defaultLevel = logger.getLevel(); final String defaultLevelString = LogLevelHelper.logIdToName(defaultLevel); assertEquals("SLF4J logging level " + defaultLevelString + " did not match configured level " - + Integer.toString(configuredDefaultLevel), configuredDefaultLevel, defaultLevel); + + configuredDefaultLevel, configuredDefaultLevel, defaultLevel); helper.testCategoryDefaultLevels(logger); } diff --git a/foundation/org.eclipse.persistence.nosql/src/main/java/org/eclipse/persistence/internal/eis/cobol/helper/ByteConverter.java b/foundation/org.eclipse.persistence.nosql/src/main/java/org/eclipse/persistence/internal/eis/cobol/helper/ByteConverter.java index 7598b1ddd08..b936d4271c3 100644 --- a/foundation/org.eclipse.persistence.nosql/src/main/java/org/eclipse/persistence/internal/eis/cobol/helper/ByteConverter.java +++ b/foundation/org.eclipse.persistence.nosql/src/main/java/org/eclipse/persistence/internal/eis/cobol/helper/ByteConverter.java @@ -154,9 +154,7 @@ public String getStringValue() { stringValue = getStringFromBinaryData(offset, this.getFieldMetaData().getSize()); } else if (this.getFieldMetaData().getType() == FieldMetaData.PACKED_DECIMAL) { stringValue = this.getStringValueFromPackedDecimal(); - } else { - //todo: handle other types of data - stringValue = null; + //todo: else handle other types of data } return insertDecimalInString(stringValue); } @@ -189,8 +187,7 @@ public void setBytesToValue(String value) { this.setBinaryDataToStringValue(value, this.getFieldMetaData().getOffset(), this.getFieldMetaData().getSize()); } else if (this.getFieldMetaData().getType() == FieldMetaData.PACKED_DECIMAL) { this.setByteArrayToPackedDecimalValue(value); - } else { - //todo: handle other types of data + //todo: else handle other types of data } } @@ -292,9 +289,11 @@ protected void setByteArrayToPackedDecimalValue(String value) { } //add leading zeros - while (value.length() < (size * 2)) { - value = "0" + value; + StringBuilder sb = new StringBuilder(value); + while (sb.length() < (size * 2)) { + sb.insert(0, "0"); } + value = sb.toString(); //write one byte at a time to array for (int i = offset, j = 0; i < (offset + size); i++, j += 2) { @@ -346,11 +345,11 @@ protected void twosComplement(int offset, int length) { i--; //add one to value while ((i >= offset) && (Helper.intFromByte(myRecordData[i]) == -1)) { - myRecordData[i] += 1; + myRecordData[i]++; i--; } if (i >= offset) { - myRecordData[i] += 1; + myRecordData[i]++; } } @@ -383,7 +382,7 @@ protected String getStringFromBinaryData(int offset, int size) { total += (Helper.intFromByte(myRecordData[i]) * Helper.power(2, j * 8)); } if (signed) { - return sign + String.valueOf(total); + return sign + total; } else { return String.valueOf(total); } @@ -403,7 +402,7 @@ protected void setBinaryDataToStringValue(String value, int offset, int size) { } else if (value.startsWith("+")) { value = value.substring(1); } - int total = Helper.integerFromString(value); + int total = Integer.parseInt(value); //loop through total dividing down for (int i = offset, j = size - 1; i < (size + offset); i++, j--) { diff --git a/foundation/org.eclipse.persistence.oracle.test/src/it/java/org/eclipse/persistence/testing/tests/dbchangenotification/DbChangeNotificationTest.java b/foundation/org.eclipse.persistence.oracle.test/src/it/java/org/eclipse/persistence/testing/tests/dbchangenotification/DbChangeNotificationTest.java index be81b0b30cf..c7062e23b3d 100644 --- a/foundation/org.eclipse.persistence.oracle.test/src/it/java/org/eclipse/persistence/testing/tests/dbchangenotification/DbChangeNotificationTest.java +++ b/foundation/org.eclipse.persistence.oracle.test/src/it/java/org/eclipse/persistence/testing/tests/dbchangenotification/DbChangeNotificationTest.java @@ -83,7 +83,7 @@ protected void setup() throws Exception { ((DatabaseSession)session[i]).addDescriptors(new EmployeeProject()); session[i].setSessionLog(getSession().getSessionLog()); session[i].setLogLevel(getSession().getLogLevel()); - session[i].setName("session[" + Integer.toString(i) + "]"); + session[i].setName("session[" + i + "]"); ((DatabaseSession)session[i]).login(); employees[i] = session[i].readAllObjects(Employee.class); smallProjects[i] = session[i].readAllObjects(SmallProject.class); diff --git a/foundation/org.eclipse.persistence.oracle.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/customfeatures/CustomFeaturesJUnitTestSuite.java b/foundation/org.eclipse.persistence.oracle.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/customfeatures/CustomFeaturesJUnitTestSuite.java index 5d554de2040..52273bac667 100644 --- a/foundation/org.eclipse.persistence.oracle.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/customfeatures/CustomFeaturesJUnitTestSuite.java +++ b/foundation/org.eclipse.persistence.oracle.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/customfeatures/CustomFeaturesJUnitTestSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -76,7 +76,7 @@ public void testSetup() throws SQLException { try { accessor.incrementCallCount(session); DatabaseMetaData metaData = accessor.getConnection().getMetaData(); - String dbMajorMinorVersion = Integer.toString(metaData.getDatabaseMajorVersion()) + '.' + Integer.toString(metaData.getDatabaseMinorVersion()); + String dbMajorMinorVersion = Integer.toString(metaData.getDatabaseMajorVersion()) + '.' + metaData.getDatabaseMinorVersion(); String dbProductionVersion = metaData.getDatabaseProductVersion(); // For Helper.compareVersions to work the first digit in the passed version String should be part of the version, // i.e. "10.2.0.2 ..." is ok, but "Oracle 10g ... 10.2.0.2..." is not. diff --git a/jpa/eclipselink.jpa.test.jse/src/it/java/org/eclipse/persistence/jpa/test/lob/TestLobMerge.java b/jpa/eclipselink.jpa.test.jse/src/it/java/org/eclipse/persistence/jpa/test/lob/TestLobMerge.java index 4cbe712c4cb..cdcbd6567d9 100644 --- a/jpa/eclipselink.jpa.test.jse/src/it/java/org/eclipse/persistence/jpa/test/lob/TestLobMerge.java +++ b/jpa/eclipselink.jpa.test.jse/src/it/java/org/eclipse/persistence/jpa/test/lob/TestLobMerge.java @@ -58,10 +58,9 @@ public void testLobMerge() throws Exception { EntityManager em = emf.createEntityManager(); try { final Set col1 = new HashSet( - Arrays.asList(new CollectedEntity[] { - new CollectedEntity("label1", "content1"), + Arrays.asList(new CollectedEntity("label1", "content1"), new CollectedEntity("label2", "content2"), - new CollectedEntity("label3", "content3") })); + new CollectedEntity("label3", "content3"))); final ParentEntity pdo = new ParentEntity(9, Collections.unmodifiableSet(col1)); em.getTransaction().begin(); @@ -69,9 +68,8 @@ public void testLobMerge() throws Exception { em.getTransaction().commit(); final Set col2 = new HashSet( - Arrays.asList(new CollectedEntity[] { - new CollectedEntity("label1", "content1"), - new CollectedEntity("label2", "content2") })); + Arrays.asList(new CollectedEntity("label1", "content1"), + new CollectedEntity("label2", "content2"))); final ParentEntity newEntity = new ParentEntity(pdo.getId(), col2); em.getTransaction().begin(); diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/advanced/Customizer.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/advanced/Customizer.java index 6c3f2e6fd2b..28a626590ac 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/advanced/Customizer.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/advanced/Customizer.java @@ -68,7 +68,7 @@ public void postLogin(SessionEvent event) { Class sopClass = Class.forName("oracle.toplink.exalogic.sop.SerializedObjectPolicy"); Method setIsRecoverableMethod = null; if (isRecoverable) { - setIsRecoverableMethod = sopClass.getDeclaredMethod("setIsRecoverable", new Class[] {boolean.class}); + setIsRecoverableMethod = sopClass.getDeclaredMethod("setIsRecoverable", boolean.class); } Class[] sopEntities = {Employee.class, Address.class, Project.class}; @@ -76,7 +76,7 @@ public void postLogin(SessionEvent event) { ClassDescriptor descriptor = session.getDescriptor(sopEntity); Object sop = sopClass.getConstructor().newInstance(); if (isRecoverable) { - setIsRecoverableMethod.invoke(sop, new Object[] {true}); + setIsRecoverableMethod.invoke(sop, true); } ((SerializedObjectPolicy)sop).setField(new DatabaseField("SOP")); descriptor.setSerializedObjectPolicy((SerializedObjectPolicy)sop); diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/advanced/compositepk/NumberId.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/advanced/compositepk/NumberId.java index 65454c6405d..98092aa4692 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/advanced/compositepk/NumberId.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/advanced/compositepk/NumberId.java @@ -56,7 +56,7 @@ public final boolean equals(Object other) { } public final int hashCode() { - return Objects.hash(new Object[] { this.value }); + return Objects.hash(this.value); } public final String toString() { diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa22/jta/Animal.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa22/jta/Animal.java index e7a89814853..33ca1eeec6d 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa22/jta/Animal.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa22/jta/Animal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -95,7 +95,7 @@ public void setName(final String name) { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("id: ").append(Integer.toString(id)); + sb.append("id: ").append(id); sb.append(" name: \"").append(name).append('\"'); return sb.toString(); } diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/advanced/AdvancedJPAJunitTest.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/advanced/AdvancedJPAJunitTest.java index 37354d2bd8f..26a24c2b5bb 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/advanced/AdvancedJPAJunitTest.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/advanced/AdvancedJPAJunitTest.java @@ -3874,12 +3874,12 @@ protected List createEmployeesWithUnidirectionalMappings(String lastNa employees.add(emp); for(int j=0; j 0) { @@ -9075,7 +9075,7 @@ public void testSequencePreallocationUsingCallbackTest() { // report result if(assignedSequenceNumber + 1 != nextSequenceNumber) { - fail("Transaction that assigned sequence number committed, assignedSequenceNumber = " + assignedSequenceNumber +", but nextSequenceNumber = "+ nextSequenceNumber +"("+Integer.toString(assignedSequenceNumber+1)+" was expected)"); + fail("Transaction that assigned sequence number committed, assignedSequenceNumber = " + assignedSequenceNumber +", but nextSequenceNumber = "+ nextSequenceNumber +"("+ (assignedSequenceNumber + 1) +" was expected)"); } } diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/composite/advanced/EntityManagerJUnitTestSuite.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/composite/advanced/EntityManagerJUnitTestSuite.java index 2830c0f6937..94c40800de0 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/composite/advanced/EntityManagerJUnitTestSuite.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/composite/advanced/EntityManagerJUnitTestSuite.java @@ -2761,7 +2761,7 @@ public void testPersistRemoved() { } if(!msg.equals(localErrorMsg)) { - errorMsg = errorMsg + "i="+Integer.toString(i)+": "+ localErrorMsg + " "; + errorMsg = errorMsg + "i="+ i +": "+ localErrorMsg + " "; } } if(errorMsg.length() > 0) { @@ -7909,7 +7909,7 @@ public void testSequencePreallocationUsingCallbackTest() { + ", but nextSequenceNumber = " + nextSequenceNumber_Customer + "(" - + Integer.toString(assignedSequenceNumber_Customer + 1) + + (assignedSequenceNumber_Customer + 1) + " was expected)\n"; } if (assignedSequenceNumber_Employee + 1 != nextSequenceNumber_Employee) { @@ -7918,7 +7918,7 @@ public void testSequencePreallocationUsingCallbackTest() { + ", but nextSequenceNumber = " + nextSequenceNumber_Employee + "(" - + Integer.toString(assignedSequenceNumber_Employee + 1) + + (assignedSequenceNumber_Employee + 1) + " was expected)\n"; } if (assignedSequenceNumber_Dealer + 1 != nextSequenceNumber_Dealer) { @@ -7927,7 +7927,7 @@ public void testSequencePreallocationUsingCallbackTest() { + ", but nextSequenceNumber = " + nextSequenceNumber_Dealer + "(" - + Integer.toString(assignedSequenceNumber_Dealer + 1) + + (assignedSequenceNumber_Dealer + 1) + " was expected)\n"; } if (errorMsg.length() > 0) { @@ -10734,7 +10734,7 @@ public void testRollbackBroker() { public void testMustBeCompositeMember() { String errorMsg = ""; for(int i=1; i<=3; i++) { - String puName = "composite-advanced-member_" + Integer.toString(i); + String puName = "composite-advanced-member_" + i; try { EntityManager em = createEntityManager(puName); errorMsg += "createEntityManager(" + puName +") succeeded - should have failed\n"; diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/ddlgeneration/DDLGenerationJUnitTestSuite.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/ddlgeneration/DDLGenerationJUnitTestSuite.java index 9befc679745..8feac4699f1 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/ddlgeneration/DDLGenerationJUnitTestSuite.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/ddlgeneration/DDLGenerationJUnitTestSuite.java @@ -2115,10 +2115,10 @@ public void testElementMapOnEmbedded() { if (mapHolders.size() == 2) { for (MapHolder mh : mapHolders) { if (mh.getMapHolderEmbedded().getStringMap().size() != mh.getId() + 1) { - errorMsg += "Wrong getMapHolderEmbedded().getStringMap().size() " + mh.getMapHolderEmbedded().getStringMap().size() + "; expected " + Integer.toString(mh.getId() + 1) + "\n"; + errorMsg += "Wrong getMapHolderEmbedded().getStringMap().size() " + mh.getMapHolderEmbedded().getStringMap().size() + "; expected " + (mh.getId() + 1) + "\n"; } if (mh.getStringMap().size() != mh.getId() + 1) { - errorMsg += "Wrong getStringMap().size() " + mh.getStringMap().size() + "; expected " + Integer.toString(mh.getId() + 1) + "\n"; + errorMsg += "Wrong getStringMap().size() " + mh.getStringMap().size() + "; expected " + (mh.getId() + 1) + "\n"; } } } else { diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/EntityManagerJUnitTestSuite.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/EntityManagerJUnitTestSuite.java index c6442501207..7d74157a6cb 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/EntityManagerJUnitTestSuite.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/EntityManagerJUnitTestSuite.java @@ -1149,7 +1149,7 @@ public void testPersistRemoved() { } if(!msg.equals(localErrorMsg)) { - errorMsg = errorMsg + "i="+Integer.toString(i)+": "+ localErrorMsg + " "; + errorMsg = errorMsg + "i="+ i +": "+ localErrorMsg + " "; } } if(errorMsg.length() > 0) { @@ -4886,7 +4886,7 @@ public void testSequencePreallocationUsingCallbackTest() { // report result if(assignedSequenceNumber + 1 != nextSequenceNumber) { - fail("Transaction that assigned sequence number committed, assignedSequenceNumber = " + assignedSequenceNumber +", but nextSequenceNumber = "+ nextSequenceNumber +"("+Integer.toString(assignedSequenceNumber+1)+" was expected)"); + fail("Transaction that assigned sequence number committed, assignedSequenceNumber = " + assignedSequenceNumber +", but nextSequenceNumber = "+ nextSequenceNumber +"("+ (assignedSequenceNumber + 1) +" was expected)"); } } diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/EntityManagerTLRJUnitTestSuite.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/EntityManagerTLRJUnitTestSuite.java index ffc2a65db11..5a52167ad4c 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/EntityManagerTLRJUnitTestSuite.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/EntityManagerTLRJUnitTestSuite.java @@ -1016,7 +1016,7 @@ public void testPersistRemoved() { } if(!msg.equals(localErrorMsg)) { - errorMsg = errorMsg + "i="+Integer.toString(i)+": "+ localErrorMsg + " "; + errorMsg = errorMsg + "i="+ i +": "+ localErrorMsg + " "; } } if(errorMsg.length() > 0) { @@ -4681,7 +4681,7 @@ public void testSequencePreallocationUsingCallbackTest() { // report result if(assignedSequenceNumber + 1 != nextSequenceNumber) { - fail("Transaction that assigned sequence number committed, assignedSequenceNumber = " + assignedSequenceNumber +", but nextSequenceNumber = "+ nextSequenceNumber +"("+Integer.toString(assignedSequenceNumber+1)+" was expected)"); + fail("Transaction that assigned sequence number committed, assignedSequenceNumber = " + assignedSequenceNumber +", but nextSequenceNumber = "+ nextSequenceNumber +"("+ (assignedSequenceNumber + 1) +" was expected)"); } } } diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexAggregateTestSuite.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexAggregateTestSuite.java index c4c5f2d9ecd..016a0289907 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexAggregateTestSuite.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexAggregateTestSuite.java @@ -550,8 +550,8 @@ public void complexCountOnJoinedVariableSimplePK() // Need to create the expected result manually, because using the // TopLink query API would run into the same issue 2497. - List expectedResult = Arrays.asList(new Long[] {1L, 0L, - 0L, 1L}); + List expectedResult = Arrays.asList(1L, 0L, + 0L, 1L); Collections.sort(expectedResult); String jpql = "SELECT COUNT(o) FROM Customer c LEFT JOIN c.orders o GROUP BY c.name"; @@ -578,7 +578,7 @@ public void complexCountOnJoinedVariableCompositePK() // Need to create the expected result manually, because using the // TopLink query API would run into the same issue 2497. - List expectedResult = Arrays.asList(new Long[] {2L, 5L, 3L}); + List expectedResult = Arrays.asList(2L, 5L, 3L); Collections.sort(expectedResult); String jpql = "SELECT COUNT(p) FROM Employee e LEFT JOIN e.phoneNumbers p WHERE e.lastName LIKE 'S%' GROUP BY e.lastName"; @@ -619,7 +619,7 @@ public void complexCountOnJoinedCompositePK() // Need to create the expected result manually, because using the // TopLink query API would run into the same issue 6155093. - List expectedResult = Arrays.asList(new Long[] {1L}); + List expectedResult = Arrays.asList(1L); Collections.sort(expectedResult); // COUNT DISTINCT with inner join @@ -676,7 +676,7 @@ public void complexCountOnJoinedVariableOverManyToManySelfRefRelationship() EntityManager em = createEntityManager(); - List expectedResult = Arrays.asList(new Long[] { 0L, 1L, 0L, 0L }); + List expectedResult = Arrays.asList(0L, 1L, 0L, 0L); String jpql = "SELECT COUNT(cc) FROM Customer c LEFT JOIN c.CCustomers cc GROUP BY c.name order by c.name"; Query q = em.createQuery(jpql); diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexTestSuite.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexTestSuite.java index 8244e9a46a7..8281804e826 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexTestSuite.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexTestSuite.java @@ -1036,7 +1036,7 @@ public void complexJoinTest() query.setParameter("id1", empWithOutManager.getId()); query.setParameter("id2", empWithManager.getId()); List result = query.getResultList(); - List expectedResult = Arrays.asList(new Employee[] {empWithManager.getManager()}); + List expectedResult = Arrays.asList(empWithManager.getManager()); Assert.assertTrue("Complex Join test failed", comparer.compareObjects(result, expectedResult)); // Select the related manager of empWithOutManager and empWithManager @@ -1047,7 +1047,7 @@ public void complexJoinTest() query.setParameter("id1", empWithOutManager.getId()); query.setParameter("id2", empWithManager.getId()); result = query.getResultList(); - expectedResult = Arrays.asList(new Employee[] {empWithManager.getManager(), null}); + expectedResult = Arrays.asList(empWithManager.getManager(), null); Assert.assertTrue("Complex Join test failed", comparer.compareObjects(result, expectedResult)); } @@ -1084,7 +1084,7 @@ public void complexJoinTest2() query.setParameter("id1", empWithOutManager.getId()); query.setParameter("id2", empWithManager.getId()); List result = query.getResultList(); - List expectedResult = Arrays.asList(new Employee[] {empWithManager.getManager()}); + List expectedResult = Arrays.asList(empWithManager.getManager()); Assert.assertTrue("Complex Join test failed", comparer.compareObjects(result, expectedResult)); // Select the related manager of empWithOutManager and empWithManager @@ -1096,7 +1096,7 @@ public void complexJoinTest2() query.setParameter("id1", empWithOutManager.getId()); query.setParameter("id2", empWithManager.getId()); result = query.getResultList(); - expectedResult = Arrays.asList(new Employee[] {empWithManager.getManager(), null}); + expectedResult = Arrays.asList(empWithManager.getManager(), null); Assert.assertTrue("Complex Join test failed", comparer.compareObjects(result, expectedResult)); } @@ -4557,8 +4557,8 @@ public void testNestedArrays1() { EntityManager em = createEntityManager(); Query query = em.createQuery("Select e from Employee e where (e.firstName, e.lastName) IN :names"); List names = new ArrayList(); - names.add(new ArrayList(Arrays.asList(new String[]{"Bob", "Smith"}))); - names.add(new ArrayList(Arrays.asList(new String[]{"John", "Doe"}))); + names.add(new ArrayList(Arrays.asList("Bob", "Smith"))); + names.add(new ArrayList(Arrays.asList("John", "Doe"))); query.setParameter("names", names); query.getResultList(); query = em.createQuery("Select e from Employee e where (e.firstName, e.lastName) IN (Select e2.lastName, e2.firstName from Employee e2)"); diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/performance/JPAPerformanceComparisonModel.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/performance/JPAPerformanceComparisonModel.java index d7df46a2ab3..2d17028eb42 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/performance/JPAPerformanceComparisonModel.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/performance/JPAPerformanceComparisonModel.java @@ -990,21 +990,21 @@ protected void test() { } System.out.println(getName()); System.out.println("No optimization time:"); - System.out.println(Long.toString(time0 / 1000000)); + System.out.println(time0 / 1000000); System.out.println("Mean per test:"); - System.out.println(Double.toString((double)time0 / (n*1000000))); + System.out.println((double) time0 / (n * 1000000)); System.out.println("std dev:"); - System.out.println(Double.toString(Math.sqrt((double)time0square/n - (double)(time0/n)*(time0/n))/1000000)); + System.out.println(Math.sqrt((double) time0square / n - (double) (time0 / n) * (time0 / n)) / 1000000); System.out.println("zero time tests:"); System.out.println("ResultSet optimization time:"); - System.out.println(Long.toString(time1 / 1000000)); + System.out.println(time1 / 1000000); System.out.println("Mean per test:"); - System.out.println(Double.toString((double)time1 / (n*1000000))); + System.out.println((double) time1 / (n * 1000000)); System.out.println("std dev:"); - System.out.println(Double.toString(Math.sqrt((double)time1square/n - (double)(time1/n)*(time1/n))/1000000)); + System.out.println(Math.sqrt((double) time1square / n - (double) (time1 / n) * (time1 / n)) / 1000000); System.out.println("zero time tests:"); System.out.println("No Optimization - Optimization:"); - System.out.println(Long.toString((time0 - time1)/1000000)); + System.out.println((time0 - time1) / 1000000); } long test0() { diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/xml/advanced/EntityMappingsAdvancedJUnitTestCase.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/xml/advanced/EntityMappingsAdvancedJUnitTestCase.java index 3006c785a30..235e6d64726 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/xml/advanced/EntityMappingsAdvancedJUnitTestCase.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/xml/advanced/EntityMappingsAdvancedJUnitTestCase.java @@ -1733,12 +1733,12 @@ protected List createEmployeesWithUnidirectionalMappings(String lastNa employees.add(emp); for(int j=0; j expectedReturnType = mapping.getAttributeClassification(); if (mapping.isCollectionMapping()) { diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/xml/composite/advanced/EntityMappingsAdvancedJUnitTestCase.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/xml/composite/advanced/EntityMappingsAdvancedJUnitTestCase.java index 288d4eae34d..805199c2ea8 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/xml/composite/advanced/EntityMappingsAdvancedJUnitTestCase.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/xml/composite/advanced/EntityMappingsAdvancedJUnitTestCase.java @@ -1745,12 +1745,12 @@ protected List createEmployeesWithUnidirectionalMappings(String lastNa employees.add(emp); for(int j=0; j index - 1) && (originalPosition <= index + 5)) { position[0] -= (originalPosition - index + 1); - } - else if (index <= originalPosition) { + } else if (index <= originalPosition) { position[0] -= 5; } @@ -646,7 +690,7 @@ public static boolean valuesAreDifferent(Object value1, Object value2) { public static boolean valuesAreEqual(Object value1, Object value2) { // Both are equal or both are null - if ((value1 == value2) || (value1 == null) && (value2 == null)) { + if (value1 == value2) { return true; } diff --git a/jpa/org.eclipse.persistence.jpa.jpql/src/main/java/org/eclipse/persistence/jpa/jpql/parser/ExpressionFactory.java b/jpa/org.eclipse.persistence.jpa.jpql/src/main/java/org/eclipse/persistence/jpa/jpql/parser/ExpressionFactory.java index 9446a56fbba..7a39968e8e9 100644 --- a/jpa/org.eclipse.persistence.jpa.jpql/src/main/java/org/eclipse/persistence/jpa/jpql/parser/ExpressionFactory.java +++ b/jpa/org.eclipse.persistence.jpa.jpql/src/main/java/org/eclipse/persistence/jpa/jpql/parser/ExpressionFactory.java @@ -120,13 +120,9 @@ public final int compareTo(ExpressionFactory expressionFactory) { @Override public final boolean equals(Object object) { - if (object == null) { - return false; - } - if (this == object) { - return true; + if (!(object instanceof ExpressionFactory)) { + return false; } - ExpressionFactory factory = (ExpressionFactory) object; return id.equals(factory.id); } diff --git a/jpa/org.eclipse.persistence.jpa.modelgen/src/main/java/org/eclipse/persistence/internal/jpa/modelgen/CanonicalModelProcessor.java b/jpa/org.eclipse.persistence.jpa.modelgen/src/main/java/org/eclipse/persistence/internal/jpa/modelgen/CanonicalModelProcessor.java index 1f828980ecd..58f10359cf0 100644 --- a/jpa/org.eclipse.persistence.jpa.modelgen/src/main/java/org/eclipse/persistence/internal/jpa/modelgen/CanonicalModelProcessor.java +++ b/jpa/org.eclipse.persistence.jpa.modelgen/src/main/java/org/eclipse/persistence/internal/jpa/modelgen/CanonicalModelProcessor.java @@ -143,7 +143,7 @@ public synchronized void init(ProcessingEnvironment processingEnv) { // Log processing environment options for (Map.Entry option : options.entrySet()) { log(SessionLog.CONFIG, "Found Option: {0}, with value: {1}", - new Object[]{option.getKey(), option.getValue()}); + option.getKey(), option.getValue()); } useStaticFactory = Boolean.parseBoolean(CanonicalModelProperties.getOption( diff --git a/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner1Bean.java b/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner1Bean.java index 8fc2d5c2e52..1292be6aee2 100644 --- a/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner1Bean.java +++ b/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner1Bean.java @@ -61,8 +61,8 @@ public Throwable runTest(String className, String test, Properties props) { try { @SuppressWarnings({"unchecked"}) Class testClass = (Class) getClass().getClassLoader().loadClass(className); - Constructor c = testClass.getConstructor(new Class[] { String.class }); - testInstance = c.newInstance(new Object[] { test }); + Constructor c = testClass.getConstructor(String.class); + testInstance = c.newInstance(test); } catch (ClassNotFoundException e) { throw new EJBException(e); } catch (NoSuchMethodException e) { diff --git a/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner2Bean.java b/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner2Bean.java index 3d1e4a20233..de930c0ccc0 100644 --- a/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner2Bean.java +++ b/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner2Bean.java @@ -61,8 +61,8 @@ public Throwable runTest(String className, String test, Properties props) { try { @SuppressWarnings({"unchecked"}) Class testClass = (Class) getClass().getClassLoader().loadClass(className); - Constructor c = testClass.getConstructor(new Class[] { String.class }); - testInstance = c.newInstance(new Object[] { test }); + Constructor c = testClass.getConstructor(String.class); + testInstance = c.newInstance(test); } catch (ClassNotFoundException e) { throw new EJBException(e); } catch (NoSuchMethodException e) { diff --git a/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner3Bean.java b/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner3Bean.java index 4dd793e29d1..9b7ada044fd 100644 --- a/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner3Bean.java +++ b/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner3Bean.java @@ -61,8 +61,8 @@ public Throwable runTest(String className, String test, Properties props) { try { @SuppressWarnings({"unchecked"}) Class testClass = (Class) getClass().getClassLoader().loadClass(className); - Constructor c = testClass.getConstructor(new Class[] { String.class }); - testInstance = c.newInstance(new Object[] { test }); + Constructor c = testClass.getConstructor(String.class); + testInstance = c.newInstance(test); } catch (ClassNotFoundException e) { throw new EJBException(e); } catch (NoSuchMethodException e) { diff --git a/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner4Bean.java b/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner4Bean.java index 027951b9547..d3a9c8122c2 100644 --- a/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner4Bean.java +++ b/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner4Bean.java @@ -61,8 +61,8 @@ public Throwable runTest(String className, String test, Properties props) { try { @SuppressWarnings({"unchecked"}) Class testClass = (Class) getClass().getClassLoader().loadClass(className); - Constructor c = testClass.getConstructor(new Class[] { String.class }); - testInstance = c.newInstance(new Object[] { test }); + Constructor c = testClass.getConstructor(String.class); + testInstance = c.newInstance(test); } catch (ClassNotFoundException e) { throw new EJBException(e); } catch (NoSuchMethodException e) { diff --git a/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner5Bean.java b/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner5Bean.java index 017deb8f409..289b7e962f2 100644 --- a/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner5Bean.java +++ b/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner5Bean.java @@ -61,8 +61,8 @@ public Throwable runTest(String className, String test, Properties props) { try { @SuppressWarnings({"unchecked"}) Class testClass = (Class) getClass().getClassLoader().loadClass(className); - Constructor c = testClass.getConstructor(new Class[] { String.class }); - testInstance = c.newInstance(new Object[] { test }); + Constructor c = testClass.getConstructor(String.class); + testInstance = c.newInstance(test); } catch (ClassNotFoundException e) { throw new EJBException(e); } catch (NoSuchMethodException e) { diff --git a/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner6Bean.java b/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner6Bean.java index 86eba3290a1..745f785635e 100644 --- a/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner6Bean.java +++ b/jpa/org.eclipse.persistence.jpa.test.framework/src/main/java/org/eclipse/persistence/testing/framework/server/TestRunner6Bean.java @@ -61,8 +61,8 @@ public Throwable runTest(String className, String test, Properties props) { try { @SuppressWarnings({"unchecked"}) Class testClass = (Class) getClass().getClassLoader().loadClass(className); - Constructor c = testClass.getConstructor(new Class[] { String.class }); - testInstance = c.newInstance(new Object[] { test }); + Constructor c = testClass.getConstructor(String.class); + testInstance = c.newInstance(test); } catch (ClassNotFoundException e) { throw new EJBException(e); } catch (NoSuchMethodException e) { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EJBQueryImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EJBQueryImpl.java index e4cb5f91c32..9da5cb97411 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EJBQueryImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EJBQueryImpl.java @@ -616,6 +616,6 @@ public TypedQuery setParameter(String name, Object value) { @Override public String toString() { - return getClass().getSimpleName() + "(" + String.valueOf(this.databaseQuery) + ")"; + return getClass().getSimpleName() + "(" + this.databaseQuery + ")"; } } diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerSetupImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerSetupImpl.java index c9ab4c393fc..619fced4dda 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerSetupImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerSetupImpl.java @@ -1051,7 +1051,7 @@ protected boolean updateServerPlatform(Map m, ClassLoader loader) { Class cls = findClassForProperty(serverPlatformClassName, PersistenceUnitProperties.TARGET_SERVER, loader); boolean isTargetServerTransCtrl = false; try { - Constructor constructor = cls.getConstructor(new Class[]{org.eclipse.persistence.sessions.DatabaseSession.class}); + Constructor constructor = cls.getConstructor(org.eclipse.persistence.sessions.DatabaseSession.class); serverPlatform = (ServerPlatform)constructor.newInstance(new Object[]{session}); } catch (Exception ex) { if(ExternalTransactionController.class.isAssignableFrom(cls)) { @@ -1609,7 +1609,7 @@ protected void updateConnectionSettings(ServerSession serverSession, Map propert } else { String key = entry.getKey(); poolName = key.substring(0, dotIdx); - attribute = key.substring(dotIdx + 1, key.length()); + attribute = key.substring(dotIdx + 1); } ConnectionPool pool = null; if (poolName.equals("write")) { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/QueryImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/QueryImpl.java index 775a6b57728..5f98650aa50 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/QueryImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/QueryImpl.java @@ -1173,7 +1173,7 @@ public T unwrap(Class cls) { @Override public String toString() { - return getClass().getSimpleName() + "(" + String.valueOf(this.databaseQuery) + ")"; + return getClass().getSimpleName() + "(" + this.databaseQuery + ")"; } } diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/config/metadata/ReflectiveDynamicClassLoader.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/config/metadata/ReflectiveDynamicClassLoader.java index 24115d8e2e1..0c26f82b2b7 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/config/metadata/ReflectiveDynamicClassLoader.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/config/metadata/ReflectiveDynamicClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -38,7 +38,7 @@ public ReflectiveDynamicClassLoader(ClassLoader delegate) { protected Method getDefineClassMethod() { if (this.defineClassMethod == null) { try { - this.defineClassMethod = ClassLoader.class.getDeclaredMethod("defineClass", new Class[] { String.class, byte[].class, int.class, int.class }); + this.defineClassMethod = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class); this.defineClassMethod.setAccessible(true); } catch (Exception e) { throw new RuntimeException("ReflectiveDynamicClassLoader could not access defineClass method", e); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/JavaSECMPInitializerAgent.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/JavaSECMPInitializerAgent.java index 08eb8d9ecd9..dbe72ef2682 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/JavaSECMPInitializerAgent.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/JavaSECMPInitializerAgent.java @@ -48,9 +48,9 @@ public static void premain(String agentArgs, Instrumentation instr) throws Throw public static void initializeFromAgent(Instrumentation instr) throws Throwable { Class cls = Class.forName("org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializer"); - Method method = cls.getDeclaredMethod("initializeFromAgent", new Class[] { Instrumentation.class }); + Method method = cls.getDeclaredMethod("initializeFromAgent", Instrumentation.class); try { - method.invoke(null, new Object[] { instr }); + method.invoke(null, instr); } catch (InvocationTargetException exception) { throw exception.getCause(); } diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/MetadataHelper.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/MetadataHelper.java index 97969ad17cb..be40c468a38 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/MetadataHelper.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/MetadataHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -88,7 +88,7 @@ public static void buildColsAndValuesBindingsFromMappings(final StringBuilder ta final int valueIndex, final String binder, final String separator) { int idx = valueIndex; for (Iterator i = mappings.iterator(); i.hasNext();) { - target.append(i.next().getName().toUpperCase(Locale.ROOT)).append(binder).append(Integer.toString(++idx)); + target.append(i.next().getName().toUpperCase(Locale.ROOT)).append(binder).append(++idx); if (i.hasNext()) { target.append(separator); } diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/classes/ClassAccessor.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/classes/ClassAccessor.java index 8d52c6dd3b9..740353db2ca 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/classes/ClassAccessor.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/classes/ClassAccessor.java @@ -717,7 +717,7 @@ protected MetadataField getAccessibleField(MappingAccessor accessor) { protected MetadataMethod getAccessibleMethod(MappingAccessor accessor) { if (accessor.hasAccessMethods()) { MetadataMethod getMethod = getJavaClass().getMethod(accessor.getGetMethodName(), new String[]{}); - MetadataMethod setMethod = getJavaClass().getMethod(accessor.getSetMethodName(), Arrays.asList(new String[]{getMethod.getReturnType()})); + MetadataMethod setMethod = getJavaClass().getMethod(accessor.getSetMethodName(), Arrays.asList(getMethod.getReturnType())); getMethod.setSetMethod(setMethod); return getMethod; } else { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAnnotatedElement.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAnnotatedElement.java index 834bf60810f..9bac33f9136 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAnnotatedElement.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAnnotatedElement.java @@ -71,6 +71,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import org.eclipse.persistence.annotations.Array; @@ -96,7 +97,6 @@ * @author Guy Pelletier * @since EclipseLink 1.0 */ -@SuppressWarnings("deprecation") public class MetadataAnnotatedElement extends MetadataAccessibleObject { public static final String DEFAULT_RAW_CLASS = "java.lang.String"; @@ -149,7 +149,7 @@ public class MetadataAnnotatedElement extends MetadataAccessibleObject { public MetadataAnnotatedElement(MetadataFactory factory) { super(factory); - m_annotations = new HashMap(); + m_annotations = new HashMap<>(); m_metaAnnotations = new HashMap<>(); } @@ -172,7 +172,7 @@ public void addMetaAnnotation(MetadataAnnotation annotation) { */ public void addGenericType(String genericType) { if (m_genericType == null) { - m_genericType = new ArrayList(); + m_genericType = new ArrayList<>(); } m_genericType.add(genericType); @@ -183,15 +183,13 @@ public void addGenericType(String genericType) { */ @Override public boolean equals(Object object) { - if (object == null) { + if (object == null || getClass() != object.getClass()) { return false; } - if (getName() == null) { return ((MetadataAnnotatedElement)object).getName() == null; } - - return (object.getClass() == getClass()) && getName().equals(((MetadataAnnotatedElement)object).getName()); + return getName().equals(((MetadataAnnotatedElement)object).getName()); } /** @@ -199,7 +197,7 @@ public boolean equals(Object object) { * Return the annotated element for this accessor. Note: This method does * not check against a metadata complete. */ - public MetadataAnnotation getAnnotation(Class annotation) { + public MetadataAnnotation getAnnotation(Class annotation) { return getAnnotation(annotation.getName()); } @@ -221,7 +219,7 @@ public MetadataAnnotation getAnnotation(final String annotation) { * @param names meta-annotations names cycle detection set, shall not be {@code null} */ protected final MetadataAnnotation getAnnotation(final String annotation, final Set names) { - if (m_annotations == null && m_metaAnnotations == null) { + if (m_annotations == null) { return null; } MetadataAnnotation metadataAnnotation = m_annotations.get(annotation); @@ -509,7 +507,7 @@ public boolean areAnnotationsCompatibleWithTransient(ClassAccessor classAccessor * isAnnotationPresent calls can return a false when true because of the * meta-data complete feature. */ - public boolean isAnnotationNotPresent(Class annotation, ClassAccessor accessor) { + public boolean isAnnotationNotPresent(Class annotation, ClassAccessor accessor) { return isAnnotationNotPresent(annotation.getName(), accessor); } @@ -529,7 +527,7 @@ public boolean isAnnotationNotPresent(String annotation, ClassAccessor accessor) * Indicates whether the specified annotation is present on java class * for the given descriptor metadata. */ - public boolean isAnnotationPresent(Class annotationClass, ClassAccessor accessor) { + public boolean isAnnotationPresent(Class annotationClass, ClassAccessor accessor) { return isAnnotationPresent(annotationClass.getName(), accessor); } @@ -583,6 +581,7 @@ public boolean isBasic(ClassAccessor classAccessor) { * INTERNAL: * Return true if this accessor represents a basic collection mapping. */ + @SuppressWarnings("deprecation") public boolean isBasicCollection(ClassAccessor classAccessor) { return isAnnotationPresent(BasicCollection.class, classAccessor); } @@ -591,6 +590,7 @@ public boolean isBasicCollection(ClassAccessor classAccessor) { * INTERNAL: * Return true if this accessor represents a basic collection mapping. */ + @SuppressWarnings("deprecation") public boolean isBasicMap(ClassAccessor classAccessor) { return isAnnotationPresent(BasicMap.class, classAccessor); } @@ -894,6 +894,6 @@ public void setType(String type) { @Override public String toString() { String className = getClass().getSimpleName(); - return className.substring("Metadata".length(), className.length()).toLowerCase() + " " + getName(); + return className.substring("Metadata".length()).toLowerCase() + " " + getName(); } } diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAnnotation.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAnnotation.java index d0e5d712003..c7601d84aea 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAnnotation.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAnnotation.java @@ -58,13 +58,13 @@ public void addAttribute(String key, Object value) { * private method and callers should use one of the more specific * getAttribute calls. (and build one if necessary) * - * @see getAttributeAnnotation - * @see getAttributeArray - * @see getAttributeInteger - * @see getAttributeString - * @see getAttributeBoolean - * @see getAttributeBooleanDefaultFalse - * @see getAttributeBooleanDefaultTrue + * @see #getAttributeAnnotation(String) + * @see #getAttributeArray(String) + * @see #getAttributeInteger(String) + * @see #getAttributeString(String) + * @see #getAttributeBoolean(String, Boolean) + * @see #getAttributeBooleanDefaultFalse(String) + * @see #getAttributeBooleanDefaultTrue(String) */ private Object getAttribute(String name) { return m_attributes.get(name); @@ -119,7 +119,7 @@ public Boolean getAttributeBooleanDefaultTrue(String name) { * INTERNAL: * Return the Class attribute value, or the default provided. */ - public String getAttributeClass(String name, Class defaultClass) { + public String getAttributeClass(String name, Class defaultClass) { Object value = getAttribute(name); return (value == null) ? defaultClass.getName() : (String) value; } diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAsmFactory.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAsmFactory.java index 04988e8bcc2..0986203095c 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAsmFactory.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAsmFactory.java @@ -655,11 +655,11 @@ private static List processDescription(String desc, boolean isGeneric) { index ++; } } else if (myNext == ';' && next == 'T') { - arguments.add(new String(new char[] { next })); + arguments.add(String.valueOf(next)); arguments.add(desc.substring(start + 1, end)); index = end - 1; } else { - arguments.add(new String(new char[] { next })); + arguments.add(String.valueOf(next)); } } } @@ -692,7 +692,7 @@ private static String getPrimitiveName(char primitive) { } else if (primitive == 'S') { return "short"; } else { - return new String(new char[] { primitive }); + return String.valueOf(primitive); } } diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataClass.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataClass.java index 6b222d18146..d188389941b 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataClass.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataClass.java @@ -100,7 +100,7 @@ public MetadataClass(MetadataFactory factory, String name) { * Create the metadata class based on the class. * Mainly used for primitive defaults. */ - public MetadataClass(MetadataFactory factory, Class cls) { + public MetadataClass(MetadataFactory factory, Class cls) { this(factory, cls.getName(), false); m_isPrimitive = cls.isPrimitive(); } @@ -163,7 +163,7 @@ public boolean isClass(Class clazz) { * INTERNAL: * Return if this class is or extends, or super class extends the class. */ - public boolean extendsClass(Class javaClass) { + public boolean extendsClass(Class javaClass) { return extendsClass(javaClass.getName()); } @@ -195,7 +195,7 @@ public boolean extendsClass(String className) { * INTERNAL: * Return if this class is or extends, or super class extends the interface. */ - public boolean extendsInterface(Class javaClass) { + public boolean extendsInterface(Class javaClass) { return extendsInterface(javaClass.getName()); } @@ -304,7 +304,7 @@ protected MetadataMethod getMethod(String name) { * INTERNAL: * Return the method with the name and argument types. */ - public MetadataMethod getMethod(String name, Class[] arguments) { + public MetadataMethod getMethod(String name, Class[] arguments) { List argumentNames = new ArrayList<>(arguments.length); for (int index = 0; index < arguments.length; index++) { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataFactory.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataFactory.java index c7807616355..47a32db907e 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataFactory.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -49,7 +49,7 @@ public MetadataFactory(MetadataLogger logger, ClassLoader loader) { m_logger = logger; m_loader = loader; - m_metadataClasses = new HashMap(); + m_metadataClasses = new HashMap<>(); m_metadataClasses.put("void", new MetadataClass(this, void.class)); m_metadataClasses.put("", new MetadataClass(this, void.class)); m_metadataClasses.put(null, new MetadataClass(this, void.class)); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataField.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataField.java index 34fed27e920..d76c86c255b 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataField.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -56,7 +56,6 @@ public MetadataClass getDeclaringClass() { /** * INTERNAL: * Used to determine if this is a field EclipseLink weaved into the class. - * @return */ public boolean isEclipseLinkWeavedField(){ return getName().startsWith(ClassWeaver.PERSISTENCE_FIELDNAME_PREFIX); @@ -106,7 +105,6 @@ public void setDeclaringClass(MetadataClass declaringClass) { /** * INTERNAL * Some fields should automatically be ignored, return true if this field should be ignored - * @return */ public boolean shouldBeIgnored(){ return (getName() != null) && (getName().startsWith(ClassWeaver.PERSISTENCE_FIELDNAME_PREFIX)); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataMethod.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataMethod.java index 15a5067a4f1..f27acfd5827 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataMethod.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -141,8 +141,8 @@ public void setSetMethod(MetadataMethod method) { */ public MetadataMethod getSetMethod(MetadataClass cls) { String getMethodName = getName(); - List params = Arrays.asList(new String[] {getReturnType()}); - MetadataMethod setMethod = null; + List params = Arrays.asList(getReturnType()); + MetadataMethod setMethod; if (getMethodName.startsWith(Helper.GET_PROPERTY_METHOD_PREFIX)) { // Replace 'get' with 'set'. diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/transaction/TransactionImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/transaction/TransactionImpl.java index 47699a58680..8dc21b334e8 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/transaction/TransactionImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/transaction/TransactionImpl.java @@ -43,7 +43,7 @@ public class TransactionImpl implements Transaction { // The transactional connection we use Connection connection; - static Class proxyClass = Proxy.getProxyClass(Connection.class.getClassLoader(), new Class[] { Connection.class }); + static Class proxyClass = Proxy.getProxyClass(Connection.class.getClassLoader(), Connection.class); // The enlisted data source DataSourceImpl dataSource; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/AnnotationsProcessor.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/AnnotationsProcessor.java index 5c627f9f8d6..51c60f42ce9 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/AnnotationsProcessor.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/AnnotationsProcessor.java @@ -4231,7 +4231,7 @@ private Class generateWrapperForMapClass(JavaClass mapClass, JavaClass keyClass, AnnotationVisitor av = fv.visitAnnotation(L + annotationClassName.replace(DOT_CHR, SLASH_CHR) + SEMI_COLON, true); for (Method next : nextAnnotation.annotationType().getDeclaredMethods()) { try { - Object nextValue = next.invoke(nextAnnotation, new Object[] { }); + Object nextValue = next.invoke(nextAnnotation); if (nextValue instanceof Class) { Type nextType = Type.getType(L + ((Class) nextValue).getName().replace(DOT_CHR, SLASH_CHR) + SEMI_COLON); nextValue = nextType; @@ -4640,7 +4640,7 @@ private void generateManyValueClass(EclipseLinkASMClassWriter cw, TypeMappingInf av = mv.visitAnnotation(L + annotationType.getName().replace(DOT_CHR, SLASH_CHR) + SEMI_COLON, true); for (Method next : annotation.annotationType().getDeclaredMethods()) { try { - Object nextValue = next.invoke(annotation, new Object[] {}); + Object nextValue = next.invoke(annotation); if (nextValue instanceof Class) { nextValue = Type.getType(L + ((Class) nextValue).getName().replace(DOT_CHR, SLASH_CHR) + SEMI_COLON); } diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/annotations/xmlelementdecl/xsitype2/FooBarXsiTypeTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/annotations/xmlelementdecl/xsitype2/FooBarXsiTypeTestCases.java index 78164637bf4..4bfd093e06e 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/annotations/xmlelementdecl/xsitype2/FooBarXsiTypeTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/annotations/xmlelementdecl/xsitype2/FooBarXsiTypeTestCases.java @@ -52,7 +52,7 @@ public JAXBElement getReadControlObject() { } public void testRi() throws Exception{ - JAXBContext riContext = JAXBContext.newInstance(new Class[]{Foo.class, Bar.class, ObjectFactory.class}); + JAXBContext riContext = JAXBContext.newInstance(Foo.class, Bar.class, ObjectFactory.class); InputStream is = getClass().getClassLoader().getResourceAsStream(XML_RESOURCE); Object unmarshalled = riContext.createUnmarshaller().unmarshal(is); System.out.println(unmarshalled.getClass()); diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/schemagen/inheritance/InheritanceWithTransientTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/schemagen/inheritance/InheritanceWithTransientTestCases.java index 63d7beeb463..ff31076916d 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/schemagen/inheritance/InheritanceWithTransientTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/schemagen/inheritance/InheritanceWithTransientTestCases.java @@ -47,7 +47,7 @@ public String getName() { } public void testSchemaGen() throws Exception { - JAXBContext jaxbContext = JAXBContext.newInstance(new Class[]{Z.class, X.class, Y.class, X2.class}); + JAXBContext jaxbContext = JAXBContext.newInstance(Z.class, X.class, Y.class, X2.class); StringOutputResolver sor = new StringOutputResolver(); jaxbContext.generateSchema(sor); diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/schemagen/inheritance/InheritanceWithXMLValueTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/schemagen/inheritance/InheritanceWithXMLValueTestCases.java index 9f96f8275b3..d233eaaef1d 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/schemagen/inheritance/InheritanceWithXMLValueTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/schemagen/inheritance/InheritanceWithXMLValueTestCases.java @@ -43,7 +43,7 @@ public String getName() { } public void testSchemaGen() throws Exception { - JAXBContext jaxbContext = JAXBContext.newInstance(new Class[]{ParentEntity.class, ChildEntity.class}); + JAXBContext jaxbContext = JAXBContext.newInstance(ParentEntity.class, ChildEntity.class); StringOutputResolver sor = new StringOutputResolver(); jaxbContext.generateSchema(sor); diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/typevariable/ExtendedList8ChildTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/typevariable/ExtendedList8ChildTestCases.java index a2e7636e3ee..28ff8799dde 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/typevariable/ExtendedList8ChildTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/typevariable/ExtendedList8ChildTestCases.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -42,7 +42,7 @@ protected ExtendedList8ChildRoot getControlObject() { } public void testRI() throws Exception{ - JAXBContext ctx = JAXBContext.newInstance(new Class[]{ExtendedList8ChildRoot.class}); + JAXBContext ctx = JAXBContext.newInstance(ExtendedList8ChildRoot.class); System.out.println(ctx.getClass()); Marshaller m = ctx.createMarshaller(); m.marshal(getControlObject(), System.out); diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/xmlmarshaller/UnmarshallerTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/xmlmarshaller/UnmarshallerTestCases.java index 95260125d30..96f590c204e 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/xmlmarshaller/UnmarshallerTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/xmlmarshaller/UnmarshallerTestCases.java @@ -245,8 +245,8 @@ public void testJAXBClassLoader() throws Exception { // Set up a control object using this ClassLoader Object controlObject = Class.forName("org.eclipse.persistence.testing.jaxb.xmlmarshaller.Employee", true, classLoader).getConstructor().newInstance(); - Method setMethod = controlObject.getClass().getMethod("setName", new Class[] { String.class }); - setMethod.invoke(controlObject, new Object[] { CONTROL_EMPLOYEE_NAME }); + Method setMethod = controlObject.getClass().getMethod("setName", String.class); + setMethod.invoke(controlObject, CONTROL_EMPLOYEE_NAME); // Unmarshall the control file, passing JAXB this classLoader JAXBContext jaxbContext = JAXBContext.newInstance(contextPath, classLoader); diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/oxm/classloader/MappingTestProject.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/oxm/classloader/MappingTestProject.java index 263fcc90043..bfe87469109 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/oxm/classloader/MappingTestProject.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/oxm/classloader/MappingTestProject.java @@ -98,8 +98,8 @@ public ClassDescriptor buildRootObjectDescriptor() { ContainerPolicy listPolicy; try { listPolicy = (ContainerPolicy) listContainerPolicyClass.getConstructor().newInstance(); - Method meth = listContainerPolicyClass.getDeclaredMethod("setContainerClassName", new Class[] { String.class }); - meth.invoke(listPolicy, new Object[] { "java.util.ArrayList" }); + Method meth = listContainerPolicyClass.getDeclaredMethod("setContainerClassName", String.class); + meth.invoke(listPolicy, "java.util.ArrayList"); } catch (Exception e) { throw new RuntimeException(e); } @@ -120,8 +120,8 @@ public ClassDescriptor buildMappingTestObjectDescriptor() { ContainerPolicy mapPolicy; try { mapPolicy = (ContainerPolicy) mapContainerPolicyClass.getConstructor().newInstance(); - Method meth = mapContainerPolicyClass.getDeclaredMethod("setContainerClassName", new Class[] { String.class }); - meth.invoke(mapPolicy, new Object[] { "java.util.HashMap" }); + Method meth = mapContainerPolicyClass.getDeclaredMethod("setContainerClassName", String.class); + meth.invoke(mapPolicy, "java.util.HashMap"); } catch (Exception e) { throw new RuntimeException(e); } @@ -200,8 +200,8 @@ public ClassDescriptor buildMappingTestObjectDescriptor() { ContainerPolicy listPolicy; try { listPolicy = (ContainerPolicy) listContainerPolicyClass.getConstructor().newInstance(); - Method meth = listContainerPolicyClass.getDeclaredMethod("setContainerClassName", new Class[] { String.class }); - meth.invoke(listPolicy, new Object[] { "java.util.ArrayList" }); + Method meth = listContainerPolicyClass.getDeclaredMethod("setContainerClassName", String.class); + meth.invoke(listPolicy, "java.util.ArrayList"); } catch (Exception e) { throw new RuntimeException(e); } @@ -216,8 +216,8 @@ public ClassDescriptor buildMappingTestObjectDescriptor() { ContainerPolicy listPolicy1; try { listPolicy1 = (ContainerPolicy) listContainerPolicyClass.getConstructor().newInstance(); - Method meth = listContainerPolicyClass.getDeclaredMethod("setContainerClassName", new Class[] { String.class }); - meth.invoke(listPolicy1, new Object[] { "java.util.ArrayList" }); + Method meth = listContainerPolicyClass.getDeclaredMethod("setContainerClassName", String.class); + meth.invoke(listPolicy1, "java.util.ArrayList"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/oxm/dynamic/DynamicTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/oxm/dynamic/DynamicTestCases.java index 2335b386b32..ab70655b437 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/oxm/dynamic/DynamicTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/oxm/dynamic/DynamicTestCases.java @@ -142,13 +142,13 @@ private Object newInstance(String name) throws Exception { } private void setValue(Object owner, String attributeName, Object value) throws Exception { - Method setMethod = owner.getClass().getMethod("set", new Class[] { String.class, Object.class }); - setMethod.invoke(owner, new Object[] { attributeName, value }); + Method setMethod = owner.getClass().getMethod("set", String.class, Object.class); + setMethod.invoke(owner, attributeName, value); } private Object getValue(Object owner, String attributeName) throws Exception { - Method getMethod = owner.getClass().getMethod("get", new Class[] { String.class }); - Object value = getMethod.invoke(owner, new Object[] { attributeName }); + Method getMethod = owner.getClass().getMethod("get", String.class); + Object value = getMethod.invoke(owner, attributeName); return value; } diff --git a/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/DynamicClassWriter.java b/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/DynamicClassWriter.java index 7ccd85c878c..c6fd54da898 100644 --- a/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/DynamicClassWriter.java +++ b/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/DynamicClassWriter.java @@ -143,9 +143,9 @@ private void addPropertyIndices(ClassWriter cw) { } private void addConstructors(ClassWriter cw) { - MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "", Type.getMethodDescriptor(Type.VOID_TYPE, new Type[0]), null, new String[] { Type.getInternalName(Serializable.class) }); + MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "", Type.getMethodDescriptor(Type.VOID_TYPE), null, new String[] { Type.getInternalName(Serializable.class) }); mv.visitVarInsn(Opcodes.ALOAD, 0); - mv.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getType(parentClass).getInternalName(), "", Type.getMethodDescriptor(Type.VOID_TYPE, new Type[0]), false); + mv.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getType(parentClass).getInternalName(), "", Type.getMethodDescriptor(Type.VOID_TYPE), false); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(1, 1); mv.visitEnd(); @@ -240,7 +240,7 @@ private void addPropertySetMethod(ClassWriter cw, SDOProperty property) { private void addWriteReplace(ClassWriter cw) { Method method; try { - method = parentClass.getDeclaredMethod(WRITE_REPLACE, new Class[0]); + method = parentClass.getDeclaredMethod(WRITE_REPLACE); } catch (NoSuchMethodException e) { return; } diff --git a/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/extension/OPStack.java b/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/extension/OPStack.java index 4798649be6d..1570d6859fa 100644 --- a/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/extension/OPStack.java +++ b/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/extension/OPStack.java @@ -156,7 +156,7 @@ private void parseExpression(String exp) { tok = new Token(sbuf.toString(), Token.ARG); tokens.add(tok); sbuf = new StringBuffer(); - sbuf.append(Character.toString(ch)); + sbuf.append(ch); sbuf.append(exp.charAt(++i)); tok = new Token(sbuf.toString().trim(), Token.DI, Token.NEQ_PR); tokens.add(tok); @@ -165,7 +165,7 @@ private void parseExpression(String exp) { tok = new Token(sbuf.toString(), Token.ARG); tokens.add(tok); sbuf = new StringBuffer(); - sbuf.append(Character.toString(ch)); + sbuf.append(ch); if (((i + 1) < exp.length()) && (exp.charAt(i + 1) == '=')) { sbuf.append(exp.charAt(++i)); tok = new Token(sbuf.toString().trim(), Token.DI, Token.LEQ_PR); @@ -178,7 +178,7 @@ private void parseExpression(String exp) { tok = new Token(sbuf.toString(), Token.ARG); tokens.add(tok); sbuf = new StringBuffer(); - sbuf.append(Character.toString(ch)); + sbuf.append(ch); if (((i + 1) < exp.length()) && (exp.charAt(i + 1) == '=')) { sbuf.append(exp.charAt(++i)); tok = new Token(sbuf.toString().trim(), Token.DI, Token.GEQ_PR); diff --git a/sdo/org.eclipse.persistence.sdo/src/test/java/org/eclipse/persistence/testing/sdo/helper/classgen/dynamicimpl/DataTypesTestCases.java b/sdo/org.eclipse.persistence.sdo/src/test/java/org/eclipse/persistence/testing/sdo/helper/classgen/dynamicimpl/DataTypesTestCases.java index c9c3bfb87f3..94993934438 100644 --- a/sdo/org.eclipse.persistence.sdo/src/test/java/org/eclipse/persistence/testing/sdo/helper/classgen/dynamicimpl/DataTypesTestCases.java +++ b/sdo/org.eclipse.persistence.sdo/src/test/java/org/eclipse/persistence/testing/sdo/helper/classgen/dynamicimpl/DataTypesTestCases.java @@ -202,9 +202,9 @@ public void testBooleanMethodsExist() throws Exception { Class implClass = theType.getImplClass(); assertNotNull(implClass); - Method isMethod = implClass.getMethod("isBooleanProperty", new Class[0]); + Method isMethod = implClass.getMethod("isBooleanProperty"); assertNotNull(isMethod); - Method getMethod = implClass.getMethod("getBooleanProperty", new Class[0]); + Method getMethod = implClass.getMethod("getBooleanProperty"); assertNotNull(getMethod); } diff --git a/sdo/org.eclipse.persistence.sdo/src/test/java/org/eclipse/persistence/testing/sdo/model/changesummary/ChangeSummaryVolumetricsTest.java b/sdo/org.eclipse.persistence.sdo/src/test/java/org/eclipse/persistence/testing/sdo/model/changesummary/ChangeSummaryVolumetricsTest.java index d2315caa8aa..f94e0bc3509 100644 --- a/sdo/org.eclipse.persistence.sdo/src/test/java/org/eclipse/persistence/testing/sdo/model/changesummary/ChangeSummaryVolumetricsTest.java +++ b/sdo/org.eclipse.persistence.sdo/src/test/java/org/eclipse/persistence/testing/sdo/model/changesummary/ChangeSummaryVolumetricsTest.java @@ -159,12 +159,12 @@ protected void buildDeepTree() { // setup object array for (int i = 0; i < NUM_B_LEVELS; i++) { - DataObject typeB_childreniDO = defineType("D_uri" + String.valueOf(i), "D" + String.valueOf(i)); + DataObject typeB_childreniDO = defineType("D_uri" + i, "D" + i); - DataObject propDo = addProperty(typeB_childreniDO, "propertyD" + String.valueOf(i), dataObjectType); + DataObject propDo = addProperty(typeB_childreniDO, "propertyD" + i, dataObjectType); propDo.set("containment", true); typeB_children[i] = (SDOType)typeHelper.define(typeB_childreniDO); - propertyB_children[i] = (SDOProperty)typeB_children[i].getDeclaredPropertiesMap().get("propertyD" + String.valueOf(i)); + propertyB_children[i] = (SDOProperty)typeB_children[i].getDeclaredPropertiesMap().get("propertyD" + i); } dataObjectB_children[0] = dataObjectB.createDataObject(propertyB, typeB_children[0]); diff --git a/utils/org.eclipse.persistence.dbws.builder/src/it/java/dbws/testing/mtom/MTOMTestSuite.java b/utils/org.eclipse.persistence.dbws.builder/src/it/java/dbws/testing/mtom/MTOMTestSuite.java index 81ab1a060d2..81c6464a1d6 100644 --- a/utils/org.eclipse.persistence.dbws.builder/src/it/java/dbws/testing/mtom/MTOMTestSuite.java +++ b/utils/org.eclipse.persistence.dbws.builder/src/it/java/dbws/testing/mtom/MTOMTestSuite.java @@ -336,7 +336,7 @@ public void start() { portQName = new QName(MTOM_SERVICE_NAMESPACE, MTOM_PORT); testService = Service.create(serviceQName); testService.addPort(portQName, SOAP11HTTP_BINDING, ENDPOINT_ADDRESS); - dispatch = testService.createDispatch(portQName, SOAPMessage.class, MESSAGE, new WebServiceFeature[]{new MTOMFeature(100)}); + dispatch = testService.createDispatch(portQName, SOAPMessage.class, MESSAGE, new MTOMFeature(100)); } @AfterClass @@ -475,7 +475,7 @@ public void testCreateFindRemove() { MessageFactory factory = ((SOAPBinding)dispatch.getBinding()).getMessageFactory(); DataHandler dataHandler = new DataHandler(new ByteArrayDataSource(LOREM_IPSUM.getBytes(), "application/octet-stream")); for (int i = 1; i <= NUM_CREATE; i ++) { - dispatch = testService.createDispatch(portQName, SOAPMessage.class, MESSAGE, new WebServiceFeature[]{new MTOMFeature(100)}); + dispatch = testService.createDispatch(portQName, SOAPMessage.class, MESSAGE, new MTOMFeature(100)); SOAPMessage request = factory.createMessage(); SOAPPart part = request.getSOAPPart(); DOMSource domSource = new DOMSource(getDocumentBuilder().parse(new InputSource(new StringReader(SOAP_CREATE_REQUEST_ID + i + SOAP_CREATE_REQUEST_END)))); diff --git a/utils/org.eclipse.persistence.dbws.builder/src/it/java/dbws/testing/soap12/SOAP12TestSuite.java b/utils/org.eclipse.persistence.dbws.builder/src/it/java/dbws/testing/soap12/SOAP12TestSuite.java index 2b5e4406f65..663e7edfbd8 100644 --- a/utils/org.eclipse.persistence.dbws.builder/src/it/java/dbws/testing/soap12/SOAP12TestSuite.java +++ b/utils/org.eclipse.persistence.dbws.builder/src/it/java/dbws/testing/soap12/SOAP12TestSuite.java @@ -341,7 +341,7 @@ public void start() { testService = Service.create(serviceQName); testService.addPort(portQName, SOAP12HTTP_BINDING, ENDPOINT_ADDRESS); dispatch = testService.createDispatch(portQName, SOAPMessage.class, - MESSAGE, new WebServiceFeature[]{new MTOMFeature(100)}); + MESSAGE, new MTOMFeature(100)); } @AfterClass diff --git a/utils/org.eclipse.persistence.dbws.builder/src/main/java/org/eclipse/persistence/tools/dbws/oracle/ShadowDDLGenerator.java b/utils/org.eclipse.persistence.dbws.builder/src/main/java/org/eclipse/persistence/tools/dbws/oracle/ShadowDDLGenerator.java index f07a6ebe83d..63078bd0b4e 100644 --- a/utils/org.eclipse.persistence.dbws.builder/src/main/java/org/eclipse/persistence/tools/dbws/oracle/ShadowDDLGenerator.java +++ b/utils/org.eclipse.persistence.dbws.builder/src/main/java/org/eclipse/persistence/tools/dbws/oracle/ShadowDDLGenerator.java @@ -366,7 +366,7 @@ else if (dataType.isPrecisionType()) { long precision = pDataType.getPrecision(); long scale = pDataType.getScale(); if (precision != defaultPrecision) { - shadowTypeName += LBRACKET + Long.toString(precision); + shadowTypeName += LBRACKET + precision; if (scale != 0) { shadowTypeName += COMMA + SINGLE_SPACE + scale; }