From ad4c095314dfb979b100ce4f13ea2a02728a751c Mon Sep 17 00:00:00 2001 From: Lukas Jungmann Date: Wed, 22 Sep 2021 00:36:38 +0200 Subject: [PATCH 1/6] warnings in core/oxm/schema, jpa/parser, helpers changes applied through the codebase Signed-off-by: Lukas Jungmann --- .../internal/dbws/ProviderHelper.java | 5 +- .../testing/tests/corba/CorbaTestModel.java | 4 +- .../tools/history/HistoryFacade.java | 14 +- .../core/queries/CoreAttributeItem.java | 14 +- .../persistence/descriptors/CacheIndex.java | 7 +- .../persistence/descriptors/CachePolicy.java | 2 - .../descriptors/ReturningPolicy.java | 32 +-- .../SingleTableMultitenantPolicy.java | 6 +- .../persistence/eis/EISConnectionSpec.java | 4 +- .../eclipse/persistence/eis/EISPlatform.java | 1 - .../eis/interactions/XMLInteraction.java | 1 - .../internal/codegen/ClassDefinition.java | 2 - .../internal/codegen/MethodDefinition.java | 2 +- .../databaseaccess/DatabaseAccessor.java | 41 ++-- .../databaseaccess/DatabasePlatform.java | 57 +++-- .../internal/dynamic/DynamicEntityImpl.java | 10 +- .../expressions/ExpressionJavaPrinter.java | 1 - .../expressions/RelationExpression.java | 16 +- .../internal/helper/BasicTypeHelperImpl.java | 4 +- .../internal/helper/ConcurrencyUtil.java | 24 +-- .../internal/helper/ConversionManager.java | 6 +- .../internal/helper/DatabaseType.java | 12 +- .../internal/helper/ExplainDeadLockUtil.java | 4 +- .../persistence/internal/helper/Helper.java | 160 +++++++------- .../internal/helper/ReadLockManager.java | 1 - .../internal/jpa/jpql/JPQLQueryContext.java | 4 +- .../internal/jpa/parsing/AggregateNode.java | 7 +- .../internal/jpa/parsing/AttributeNode.java | 8 +- .../internal/jpa/parsing/CaseNode.java | 19 +- .../internal/jpa/parsing/CoalesceNode.java | 27 ++- .../internal/jpa/parsing/ConcatNode.java | 14 +- .../internal/jpa/parsing/ConstructorNode.java | 26 +-- .../jpa/parsing/DateFunctionNode.java | 4 +- .../internal/jpa/parsing/DotNode.java | 9 +- .../internal/jpa/parsing/FromNode.java | 14 +- .../internal/jpa/parsing/FuncNode.java | 11 +- .../jpa/parsing/GenerationContext.java | 16 +- .../internal/jpa/parsing/GroupByNode.java | 28 +-- .../internal/jpa/parsing/InNode.java | 24 +-- .../internal/jpa/parsing/ModifyNode.java | 6 +- .../internal/jpa/parsing/Node.java | 12 +- .../internal/jpa/parsing/NodeFactory.java | 24 +-- .../internal/jpa/parsing/NodeFactoryImpl.java | 28 +-- .../internal/jpa/parsing/OrNode.java | 10 +- .../internal/jpa/parsing/OrderByNode.java | 17 +- .../internal/jpa/parsing/ParseTree.java | 84 ++++---- .../jpa/parsing/ParseTreeContext.java | 109 +++++----- .../internal/jpa/parsing/QueryNode.java | 4 +- .../jpa/parsing/SelectGenerationContext.java | 8 +- .../internal/jpa/parsing/SelectNode.java | 54 ++--- .../internal/jpa/parsing/SetNode.java | 20 +- .../internal/jpa/parsing/SubqueryNode.java | 6 +- .../internal/jpa/parsing/SumNode.java | 10 +- .../internal/jpa/parsing/TypeHelper.java | 2 +- .../internal/jpa/parsing/TypeHelperImpl.java | 7 +- .../internal/jpa/parsing/VariableNode.java | 22 +- .../converters/AttributeNamePrefix.java | 4 +- .../persistence/internal/oxm/Context.java | 2 +- .../internal/oxm/NamespaceResolver.java | 16 +- .../internal/oxm/UnmarshalXPathEngine.java | 1 - .../persistence/internal/oxm/VectorUtils.java | 28 ++- ...oiceCollectionMappingMarshalNodeValue.java | 6 +- ...MLCompositeCollectionMappingNodeValue.java | 2 +- .../XMLCompositeObjectMappingNodeValue.java | 2 +- .../internal/oxm/XMLConversionManager.java | 1 - .../internal/oxm/XMLMarshaller.java | 12 +- .../oxm/XMLVariableXPathMappingNodeValue.java | 2 +- .../persistence/internal/oxm/XPathEngine.java | 2 +- .../record/CharacterEscapeHandlerWrapper.java | 8 +- .../oxm/record/DomToXMLEventWriter.java | 6 +- .../oxm/record/DomToXMLStreamWriter.java | 4 +- .../NamespacePrefixMapperWrapper.java | 24 +-- .../oxm/schema/SchemaModelGenerator.java | 11 +- .../internal/oxm/schema/model/Annotation.java | 18 +- .../oxm/schema/model/AttributeGroup.java | 11 +- .../internal/oxm/schema/model/Choice.java | 21 +- .../oxm/schema/model/ComplexType.java | 20 +- .../internal/oxm/schema/model/Extension.java | 11 +- .../oxm/schema/model/NestedParticle.java | 12 +- .../oxm/schema/model/Restriction.java | 12 +- .../internal/oxm/schema/model/Schema.java | 115 +++++----- .../internal/oxm/schema/model/Sequence.java | 21 +- .../oxm/schema/model/SimpleComponent.java | 9 +- .../internal/oxm/schema/model/SimpleType.java | 11 +- .../oxm/schema/model/TypeDefParticle.java | 8 +- .../internal/oxm/schema/model/Union.java | 22 +- .../queries/DatasourceCallQueryMechanism.java | 2 - .../queries/InterfaceContainerPolicy.java | 2 +- .../sequencing/ClientSessionSequencing.java | 1 - .../sequencing/SequencingManager.java | 5 +- .../internal/sessions/AbstractRecord.java | 1 - .../internal/sessions/AbstractSession.java | 5 +- .../internal/sessions/ArrayRecord.java | 3 +- .../sessions/IdentityMapAccessor.java | 2 +- .../ObjectPersistenceRuntimeXMLProject.java | 2 +- ...ctPersistenceRuntimeXMLProject_11_1_1.java | 2 +- .../sessions/factories/SessionsFactory.java | 4 +- .../factories/XMLSessionConfigWriter.java | 3 +- .../mappings/DirectCollectionMapping.java | 2 +- .../persistence/mappings/OneToOneMapping.java | 2 +- .../mappings/converters/ConverterClass.java | 2 +- .../eclipse/persistence/oxm/MediaType.java | 4 +- .../persistence/oxm/XMLDescriptor.java | 4 +- .../persistence/oxm/XMLMarshaller.java | 4 +- .../oxm/mappings/XMLChoiceObjectMapping.java | 2 +- .../mappings/XMLInverseReferenceMapping.java | 4 +- .../persistence/oxm/record/WriterRecord.java | 4 +- .../platform/database/DB2ZPlatform.java | 77 ++++--- .../platform/database/DerbyPlatform.java | 10 +- .../platform/database/H2Platform.java | 6 +- .../platform/database/HSQLPlatform.java | 10 +- .../platform/database/Informix11Platform.java | 4 +- .../platform/database/MySQLPlatform.java | 9 +- .../platform/database/Oracle8Platform.java | 1 - .../platform/database/OraclePlatform.java | 6 +- .../platform/database/PostgreSQLPlatform.java | 17 +- .../platform/database/SQLServerPlatform.java | 4 +- .../platform/database/SybasePlatform.java | 5 +- .../platform/database/jdbc/JDBCTypes.java | 1 - .../oracle/plsql/OraclePLSQLTypes.java | 3 +- .../database/oracle/plsql/PLSQLCursor.java | 3 +- .../plsql/PLSQLStoredProcedureCall.java | 11 +- .../database/oracle/plsql/PLSQLrecord.java | 3 +- .../server/JMXServerPlatformBase.java | 18 +- .../platform/server/NoServerPlatform.java | 1 - .../platform/server/ServerPlatform.java | 1 - .../platform/server/ServerPlatformBase.java | 1 - .../platform/server/ServerPlatformUtils.java | 3 +- .../server/glassfish/GlassfishPlatform.java | 2 +- .../server/was/WebSpherePlatform.java | 1 - .../server/was/WebSpherePlatformDetector.java | 4 +- .../server/was/WebSphere_7_Platform.java | 2 +- .../platform/server/wls/WebLogicPlatform.java | 2 - .../server/wls/WebLogicPlatformDetector.java | 2 +- .../server/wls/WebLogic_10_Platform.java | 2 - .../server/wls/WebLogic_12_Platform.java | 7 +- .../platform/xml/jaxp/JAXPPlatform.java | 2 +- .../persistence/queries/AttributeGroup.java | 4 +- .../persistence/queries/BatchFetchPolicy.java | 4 +- .../persistence/queries/DatabaseQuery.java | 31 +-- .../persistence/queries/DoesExistQuery.java | 2 +- .../persistence/queries/FetchGroup.java | 2 +- .../queries/ObjectLevelModifyQuery.java | 3 - .../queries/ObjectLevelReadQuery.java | 2 +- .../persistence/queries/ReadAllQuery.java | 2 +- .../queries/ReportQueryResult.java | 2 +- .../eclipse/persistence/queries/SQLCall.java | 7 +- .../sequencing/DefaultSequence.java | 1 - .../sessions/factories/XMLProjectReader.java | 10 +- .../sessions/factories/XMLProjectWriter.java | 4 +- .../interceptors/CacheInterceptor.java | 1 - .../RMIServerSessionManagerDispatcher.java | 4 +- .../sessions/server/ClientSession.java | 1 - .../persistence/tools/PackageRenamer.java | 10 +- .../tools/profiler/FetchGroupMonitor.java | 4 +- .../tools/profiler/PerformanceProfiler.java | 2 +- .../tools/profiler/QueryMonitor.java | 2 +- .../StoredProcedureDefinition.java | 1 - .../StoredProcedureGenerator.java | 11 +- .../tools/schemaframework/TableCreator.java | 3 +- .../schemaframework/TableDefinition.java | 2 +- .../jotm/JotmTransactionController.java | 2 +- .../database/oracle/Oracle12Platform.java | 5 +- .../oracle/converters/JGeometryConverter.java | 4 +- .../ucp/GridLinkDataPartitioningCallback.java | 6 +- .../ucp/UCPDataPartitioningCallback.java | 4 +- .../oracle/DMSPerformanceProfiler.java | 42 ++-- .../models/jpa/inherited/Consumable.java | 3 +- .../persistence/internal/jpa/CMP3Policy.java | 10 - .../persistence/internal/jpa/CacheImpl.java | 8 +- .../internal/jpa/EJBQueryImpl.java | 26 --- .../jpa/EntityManagerFactoryDelegate.java | 9 +- .../jpa/EntityManagerFactoryImpl.java | 10 - .../jpa/EntityManagerFactoryProvider.java | 19 -- .../internal/jpa/EntityManagerImpl.java | 32 --- .../internal/jpa/EntityManagerSetupImpl.java | 11 - .../persistence/internal/jpa/JPAQuery.java | 4 - .../persistence/internal/jpa/QueryImpl.java | 10 - .../jpa/StoredProcedureQueryImpl.java | 26 --- .../jpa/deployment/ArchiveFactoryImpl.java | 1 - .../BeanValidationInitializationHelper.java | 2 - .../jpa/deployment/JPAInitializer.java | 4 - .../jpa/deployment/JavaSECMPInitializer.java | 2 - .../deployment/PersistenceUnitProcessor.java | 3 - .../deployment/xml/parser/XPathEngine.java | 2 - .../jpa/metadata/MetadataProject.java | 1 - .../metadata/accessors/MetadataAccessor.java | 3 +- .../mappings/ElementCollectionAccessor.java | 1 - .../mappings/ManyToManyAccessor.java | 3 +- .../listeners/JPAEntityListenerHolder.java | 2 - .../queries/OracleArrayTypeMetadata.java | 3 +- .../queries/OracleComplexTypeMetadata.java | 4 +- .../queries/OracleObjectTypeMetadata.java | 3 +- .../metadata/xml/XMLEntityMappingsReader.java | 7 - .../internal/jpa/metamodel/AttributeImpl.java | 8 +- .../internal/jpa/metamodel/BasicTypeImpl.java | 6 +- .../metamodel/CollectionAttributeImpl.java | 7 +- .../jpa/metamodel/EmbeddableTypeImpl.java | 4 +- .../jpa/metamodel/EntityTypeImpl.java | 4 +- .../jpa/metamodel/IdentifiableTypeImpl.java | 3 - .../jpa/metamodel/ListAttributeImpl.java | 7 +- .../jpa/metamodel/ManagedTypeImpl.java | 14 -- .../jpa/metamodel/MapAttributeImpl.java | 5 +- .../metamodel/MappedSuperclassTypeImpl.java | 8 - .../internal/jpa/metamodel/MetamodelImpl.java | 17 -- .../jpa/metamodel/PluralAttributeImpl.java | 4 - .../jpa/metamodel/SetAttributeImpl.java | 7 +- .../jpa/metamodel/SingularAttributeImpl.java | 6 - .../internal/jpa/metamodel/TypeImpl.java | 4 - .../jpa/querydef/CriteriaBuilderImpl.java | 9 - .../jpa/querydef/CriteriaQueryImpl.java | 3 - .../internal/jpa/querydef/ExpressionImpl.java | 1 - .../jpa/querydef/ParameterExpressionImpl.java | 3 +- .../internal/jpa/querydef/SubQueryImpl.java | 1 - .../transaction/EntityTransactionImpl.java | 3 +- .../AbstractStaticWeaveOutputHandler.java | 12 +- .../internal/jpa/weaving/ClassDetails.java | 11 +- .../StaticWeaveDirectoryOutputHandler.java | 12 +- .../weaving/StaticWeaveJAROutputHandler.java | 11 +- .../persistence/jpa/ArchiveFactory.java | 4 - .../jpa/JpaEntityManagerFactory.java | 2 - .../persistence/jpa/PersistenceProvider.java | 6 - .../jpa/metadata/XMLMetadataSource.java | 2 - .../tools/weaving/jpa/StaticWeaveAntTask.java | 1 - .../weaving/jpa/StaticWeaveProcessor.java | 3 - .../jaxb/JAXBSchemaOutputResolver.java | 6 +- .../jaxb/JAXBSetMethodAttributeAccessor.java | 2 - .../internal/jaxb/SessionEventListener.java | 3 +- .../internal/jaxb/XMLJavaTypeConverter.java | 10 - .../jaxb/json/schema/JsonSchemaGenerator.java | 2 - .../eclipse/persistence/jaxb/IDResolver.java | 3 +- .../persistence/jaxb/JAXBBeanValidator.java | 3 +- .../eclipse/persistence/jaxb/JAXBContext.java | 6 +- .../persistence/jaxb/JAXBContextFactory.java | 4 +- .../persistence/jaxb/JAXBErrorHandler.java | 3 +- .../eclipse/persistence/jaxb/JAXBHelper.java | 34 +-- .../persistence/jaxb/JAXBMarshaller.java | 2 - .../persistence/jaxb/JAXBUnmarshaller.java | 2 - .../persistence/jaxb/JAXBValidator.java | 3 - .../persistence/jaxb/TypeMappingInfo.java | 2 - .../jaxb/compiler/AnnotationsProcessor.java | 10 +- .../jaxb/compiler/CompilerHelper.java | 3 - .../jaxb/compiler/ElementDeclaration.java | 4 +- .../jaxb/compiler/EnumTypeInfo.java | 13 +- .../persistence/jaxb/compiler/Generator.java | 24 +-- .../jaxb/compiler/JAXBMetadataLogger.java | 4 +- .../jaxb/compiler/MappingsGenerator.java | 53 +---- .../jaxb/compiler/MarshalCallback.java | 2 - .../persistence/jaxb/compiler/Property.java | 2 +- .../jaxb/compiler/SchemaGenerator.java | 135 ++++-------- .../persistence/jaxb/compiler/TypeInfo.java | 60 ------ .../jaxb/compiler/UnmarshalCallback.java | 2 - .../jaxb/compiler/XMLProcessor.java | 81 ------- .../persistence/jaxb/javamodel/Helper.java | 54 ++--- .../persistence/jaxb/javamodel/JavaClass.java | 14 +- .../javamodel/reflection/JavaClassImpl.java | 11 +- .../javamodel/reflection/JavaModelImpl.java | 1 - .../reflection/JavaModelInputImpl.java | 4 +- .../persistence/jaxb/rs/MOXyJsonProvider.java | 4 - .../jaxb/xmlmodel/XmlAttribute.java | 5 +- .../persistence/jaxb/xmlmodel/XmlElement.java | 4 +- .../jaxb/xmlmodel/XmlTransformation.java | 9 +- .../persistence/jaxb/xmlmodel/XmlValue.java | 4 +- .../compiler/SchemaGeneratorTestCase.java | 14 +- .../org/eclipse/persistence/sdo/SDOType.java | 4 +- .../sdo/helper/SDOSchemaGenerator.java | 20 +- .../sdo/helper/SDOTypesGenerator.java | 198 +++++++++--------- .../SimpleTableWithNestedSQLTestSuite.java | 8 +- .../SimpleTableWithNestedSQLTestSuite.java | 8 +- 269 files changed, 1199 insertions(+), 1980 deletions(-) diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/dbws/ProviderHelper.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/dbws/ProviderHelper.java index 29ca2269d2f..7562b8a010b 100644 --- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/dbws/ProviderHelper.java +++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/dbws/ProviderHelper.java @@ -564,8 +564,7 @@ public byte[] getAttachmentAsByteArray(String id) { * binary objects, we must convert */ org.eclipse.persistence.internal.oxm.schema.model.Element invocationElement = - (org.eclipse.persistence.internal.oxm.schema.model.Element) - dbwsAdapter.getExtendedSchema().getTopLevelElements().get(invocation.getName()); + dbwsAdapter.getExtendedSchema().getTopLevelElements().get(invocation.getName()); String typeName = invocationElement.getType(); int idx = typeName.indexOf(':'); if (idx != -1) { @@ -573,7 +572,7 @@ public byte[] getAttachmentAsByteArray(String id) { typeName = typeName.substring(idx+1); } ComplexType complexType = - (ComplexType)dbwsAdapter.getExtendedSchema().getTopLevelComplexTypes().get(typeName); + dbwsAdapter.getExtendedSchema().getTopLevelComplexTypes().get(typeName); if (complexType.getSequence() != null) { // for each operation, there is a corresponding top-level Request type // which has the arguments to the operation diff --git a/foundation/org.eclipse.persistence.corba/src/it/java/org/eclipse/persistence/testing/tests/corba/CorbaTestModel.java b/foundation/org.eclipse.persistence.corba/src/it/java/org/eclipse/persistence/testing/tests/corba/CorbaTestModel.java index 50a60410e0b..bbb14e1ed25 100644 --- a/foundation/org.eclipse.persistence.corba/src/it/java/org/eclipse/persistence/testing/tests/corba/CorbaTestModel.java +++ b/foundation/org.eclipse.persistence.corba/src/it/java/org/eclipse/persistence/testing/tests/corba/CorbaTestModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019 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 @@ -46,7 +46,7 @@ public void addTests() { for (int index = 0; index < tests.size(); ++index) { try { - addTest((TestModel) Class.forName(tests.get(index)).newInstance()); + addTest((TestModel) Class.forName(tests.get(index)).getConstructor().newInstance()); } catch (Throwable exception) { System.out.println("Failed to set up " + tests.get(index) + " \n" + exception); // exception.printStackTrace(); diff --git a/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/tools/history/HistoryFacade.java b/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/tools/history/HistoryFacade.java index 03f679a60a8..5f144c59a54 100644 --- a/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/tools/history/HistoryFacade.java +++ b/foundation/org.eclipse.persistence.core.test.framework/src/main/java/org/eclipse/persistence/tools/history/HistoryFacade.java @@ -36,7 +36,7 @@ */ public class HistoryFacade { - private static Map timeOffsetsMap = new IdentityHashMap(); + private static Map timeOffsetsMap = new IdentityHashMap<>(); protected HistoryFacade() { } @@ -62,7 +62,7 @@ protected static void buildHistoricalTableDefinition(HistoryPolicy policy, fieldDef.setType(ClassConstants.TIMESTAMP); fieldDef.setSize(6); histDef.addField(fieldDef); - histDef.setForeignKeys(new Vector()); + histDef.setForeignKeys(new Vector<>()); for (FieldDefinition fieldDef2 : histDef.getFields()) { // For now foreign key constraints are not supported, because shallow inserts are not... @@ -107,7 +107,7 @@ public static long currentDatabaseTimeMillis(org.eclipse.persistence.sessions.Se } } if (timeOffsetsMap.containsKey(rootSession)) { - Long offset = (Long)timeOffsetsMap.get(rootSession); + Long offset = timeOffsetsMap.get(rootSession); return System.currentTimeMillis() + offset; } else { DatabaseQuery query = @@ -132,11 +132,11 @@ public static long currentDatabaseTimeMillis(org.eclipse.persistence.sessions.Se public static void generateHistoricalTableDefinitions(TableCreator creator, Session session) { // First add all table definitions to a hashtable. - Map tableDefinitions = new HashMap(creator.getTableDefinitions().size()); + Map tableDefinitions = new HashMap<>(creator.getTableDefinitions().size()); for (TableDefinition def : creator.getTableDefinitions()) { tableDefinitions.put(def.getFullName(), def); } - Set generatedTables = new HashSet(); + Set generatedTables = new HashSet<>(); for (ClassDescriptor descriptor : session.getDescriptors().values()) { HistoryPolicy policy = descriptor.getHistoryPolicy(); if (policy != null) { @@ -188,7 +188,7 @@ public static void generateHistoricalTableDefinitions(TableCreator creator, Sess * being the current table name with a _HIST suffix. Hence Employee would * become Employee_Hist. */ - public static void generateHistoryPolicies(Iterator descriptors, DatasourcePlatform platform) { + public static void generateHistoryPolicies(Iterator descriptors, DatasourcePlatform platform) { HistoryPolicy basePolicy = new HistoryPolicy(); basePolicy.addStartFieldName("ROW_START"); basePolicy.addEndFieldName("ROW_END"); @@ -196,7 +196,7 @@ public static void generateHistoryPolicies(Iterator descriptors, DatasourcePlatf HistoryPolicy policy = null; while (descriptors.hasNext()) { - ClassDescriptor descriptor = (ClassDescriptor)descriptors.next(); + ClassDescriptor descriptor = descriptors.next(); policy = (HistoryPolicy)basePolicy.clone(); List tables = descriptor.getTables(); int size = tables.size(); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/core/queries/CoreAttributeItem.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/core/queries/CoreAttributeItem.java index 7fdde4dbd33..c99c3ceef3b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/core/queries/CoreAttributeItem.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/core/queries/CoreAttributeItem.java @@ -104,7 +104,7 @@ public void addSubGroup(ATTRIBUTE_GROUP group) { if (this.group == null){ this.group = group; } - Object type = group.getType(); + Serializable type = group.getType(); if (type == null){ type = group.getTypeName(); } @@ -202,9 +202,9 @@ public boolean equals(Object obj) { if(obj == null) { return false; } - CoreAttributeItem anotherItem = null; + CoreAttributeItem anotherItem = null; try { - anotherItem = (CoreAttributeItem)obj; + anotherItem = (CoreAttributeItem)obj; } catch (ClassCastException cce) { return false; } @@ -215,7 +215,7 @@ public boolean equals(Object obj) { } if (this.subGroups.size() == anotherItem.subGroups.size()){ for (Map.Entry entry : this.subGroups.entrySet()){ - ATTRIBUTE_GROUP anotherGroup = (ATTRIBUTE_GROUP)anotherItem.subGroups.get(entry.getKey()); + ATTRIBUTE_GROUP anotherGroup = anotherItem.subGroups.get(entry.getKey()); if (! entry.getValue().equals(anotherGroup)){ return false; } @@ -233,7 +233,7 @@ public boolean equals(Object obj) { } if (this.keyGroups.size() == anotherItem.keyGroups.size()){ for (Map.Entry entry : this.keyGroups.entrySet()){ - ATTRIBUTE_GROUP anotherGroup = (ATTRIBUTE_GROUP)anotherItem.keyGroups.get(entry.getKey()); + ATTRIBUTE_GROUP anotherGroup = anotherItem.keyGroups.get(entry.getKey()); if (! entry.getValue().equals(anotherGroup)){ return false; } @@ -344,10 +344,10 @@ public void setRootGroup(ATTRIBUTE_GROUP group) { @Override public String toString() { - return getClass().getSimpleName() + "(" + getAttributeName() + ")" + (this.subGroups!=null ? " => " + this.subGroups.toString() : "") + (this.keyGroups!=null ? " => " + this.keyGroups.toString() : ""); + return getClass().getSimpleName() + "(" + getAttributeName() + ")" + (this.subGroups!=null ? " => " + this.subGroups : "") + (this.keyGroups!=null ? " => " + this.keyGroups : ""); } public String toStringNoClassName() { - return getAttributeName() + (this.subGroups!=null ? " => " + this.subGroups.toString() : "")+ (this.keyGroups!=null ? " => " + this.keyGroups.toString() : ""); + return getAttributeName() + (this.subGroups!=null ? " => " + this.subGroups : "")+ (this.keyGroups!=null ? " => " + this.keyGroups : ""); } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/CacheIndex.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/CacheIndex.java index dd3262f988b..6fd099cf69c 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/CacheIndex.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/CacheIndex.java @@ -16,6 +16,7 @@ import java.io.Serializable; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.eclipse.persistence.internal.helper.ClassConstants; @@ -43,11 +44,9 @@ public CacheIndex() { this.fields = new ArrayList<>(); } - public CacheIndex(DatabaseField fields[]) { + public CacheIndex(DatabaseField[] fields) { this.fields = new ArrayList<>(fields.length); - for (DatabaseField field : fields) { - this.fields.add(field); - } + Collections.addAll(this.fields, fields); } public CacheIndex(String... fields) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/CachePolicy.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/CachePolicy.java index 6d375228f55..9f8cee41564 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/CachePolicy.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/CachePolicy.java @@ -25,7 +25,6 @@ import java.util.Map; import java.util.Set; -import jakarta.persistence.Cache; import org.eclipse.persistence.annotations.CacheCoordinationType; import org.eclipse.persistence.annotations.CacheKeyType; import org.eclipse.persistence.annotations.DatabaseChangeNotificationType; @@ -47,7 +46,6 @@ import org.eclipse.persistence.mappings.DatabaseMapping; import org.eclipse.persistence.sessions.DatabaseSession; import org.eclipse.persistence.sessions.interceptors.CacheInterceptor; -import org.eclipse.persistence.sessions.interceptors.CacheKeyInterceptor; /** *

Purpose: diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/ReturningPolicy.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/ReturningPolicy.java index 07178828780..97de2d59563 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/ReturningPolicy.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/ReturningPolicy.java @@ -177,7 +177,7 @@ public static boolean areCollectionsEqualAsSets(Collection col1, if (col1.size() != col2.size()) { return false; } - Collection c1 = new ArrayList(col1); + Collection c1 = new ArrayList<>(col1); Collection c2 = new ArrayList<>(col2); for (Iterator i = c1.iterator(); i.hasNext();) { Info o = i.next(); @@ -349,7 +349,7 @@ public static class Info implements Cloneable { private boolean isInsert; private boolean isInsertModeReturnOnly; private boolean isUpdate; - private Class referenceClass; + private Class referenceClass; private String referenceClassName; Info() { @@ -403,7 +403,7 @@ public void setIsUpdate(boolean isUpdate) { this.isUpdate = isUpdate; } - public Class getReferenceClass() { + public Class getReferenceClass() { return referenceClass; } @@ -498,7 +498,7 @@ boolean equals(Info infoToCompare) { @Override public int hashCode() { DatabaseField field = getField(); - Class type = field != null ? field.getType() : null; + Class type = field != null ? field.getType() : null; boolean isInsert = isInsert(); boolean isInsertModeReturnOnly = isInsertModeReturnOnly(); boolean isUpdate = isUpdate(); @@ -622,7 +622,7 @@ protected void addUnmappedFieldToMain(DatabaseField field, Info info) { } protected Hashtable removeDuplicateAndValidateInfos(AbstractSession session) { - Hashtable infoHashtable = new Hashtable(); + Hashtable infoHashtable = new Hashtable<>(); for (int i = 0; i < infos.size(); i++) { Info info1 = infos.get(i); info1 = (Info)info1.clone(); @@ -670,12 +670,12 @@ public void initialize(AbstractSession session) { } if (!infos.isEmpty()) { - Hashtable infoHashtable = removeDuplicateAndValidateInfos(session); - Hashtable infoHashtableUnmapped = (Hashtable)infoHashtable.clone(); + Hashtable infoHashtable = removeDuplicateAndValidateInfos(session); + Hashtable infoHashtableUnmapped = (Hashtable)infoHashtable.clone(); for (Enumeration fields = getDescriptor().getFields().elements(); fields.hasMoreElements();) { DatabaseField field = fields.nextElement(); - Info info = (Info)infoHashtableUnmapped.get(field); + Info info = infoHashtableUnmapped.get(field); if (info != null) { infoHashtableUnmapped.remove(field); if (verifyFieldAndMapping(session, field)) { @@ -690,10 +690,10 @@ public void initialize(AbstractSession session) { } if (!infoHashtableUnmapped.isEmpty()) { - Enumeration fields = infoHashtableUnmapped.keys(); + Enumeration fields = infoHashtableUnmapped.keys(); while (fields.hasMoreElements()) { - DatabaseField field = (DatabaseField)fields.nextElement(); - Info info = (Info)infoHashtableUnmapped.get(field); + DatabaseField field = fields.nextElement(); + Info info = infoHashtableUnmapped.get(field); if (verifyField(session, field, getDescriptor())) { if (field.getType() != null) { addUnmappedFieldToMain(field, info); @@ -726,7 +726,7 @@ protected void copyMainFrom(ReturningPolicy policy) { * Both ReturningPolicies should be initialized */ public boolean hasEqualMains(ReturningPolicy policy) { - Collection[][] mainToCompare = policy.main; + Collection[][] mainToCompare = policy.main; if (main == mainToCompare) { return true; } @@ -745,7 +745,7 @@ public boolean hasEqualMains(ReturningPolicy policy) { } // now compare types - Hashtable allFields = new Hashtable(); + Hashtable allFields = new Hashtable<>(); for (int operation = INSERT; operation <= UPDATE; operation++) { if (main[operation][ALL] != null) { Iterator it = main[operation][ALL].iterator(); @@ -757,9 +757,9 @@ public boolean hasEqualMains(ReturningPolicy policy) { } for (int operation = INSERT; operation <= UPDATE; operation++) { if (mainToCompare[operation][ALL] != null) { - Iterator it = mainToCompare[operation][ALL].iterator(); + Iterator it = mainToCompare[operation][ALL].iterator(); while (it.hasNext()) { - DatabaseField fieldToCompare = (DatabaseField)it.next(); + DatabaseField fieldToCompare = it.next(); DatabaseField field = allFields.get(fieldToCompare); if (!field.getType().equals(fieldToCompare.getType())) { return false; @@ -879,7 +879,7 @@ protected static boolean verifyField(AbstractSession session, DatabaseField fiel * INTERNAL: */ public void validationAfterDescriptorInitialization(AbstractSession session) { - Hashtable mapped = new Hashtable(); + Hashtable mapped = new Hashtable<>(); for (int operation = INSERT; operation <= UPDATE; operation++) { if ((main[operation][MAPPED] != null) && !main[operation][MAPPED].isEmpty()) { Iterator it = main[operation][MAPPED].iterator(); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/SingleTableMultitenantPolicy.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/SingleTableMultitenantPolicy.java index 66d2b6328cd..82924b1abab 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/SingleTableMultitenantPolicy.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/SingleTableMultitenantPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 class SingleTableMultitenantPolicy implements MultitenantPolicy { public SingleTableMultitenantPolicy(ClassDescriptor desc) { descriptor = desc; includeTenantCriteria = true; - tenantDiscriminatorFields = new HashMap(5); + tenantDiscriminatorFields = new HashMap<>(5); tenantDiscriminatorFieldsKeyedOnContext = new HashMap<>(5); } @@ -109,7 +109,7 @@ public void addTenantDiscriminatorField(String property, DatabaseField field) { tenantDiscriminatorFields.put(field, property); if (! tenantDiscriminatorFieldsKeyedOnContext.containsKey(property)) { - tenantDiscriminatorFieldsKeyedOnContext.put(property, new ArrayList()); + tenantDiscriminatorFieldsKeyedOnContext.put(property, new ArrayList<>()); } tenantDiscriminatorFieldsKeyedOnContext.get(property).add(field); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/eis/EISConnectionSpec.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/eis/EISConnectionSpec.java index 2ae7bfb5e4e..e5e3c1d8943 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/eis/EISConnectionSpec.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/eis/EISConnectionSpec.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 @@ -312,6 +312,6 @@ public String toString() { */ @Override public void toString(java.io.PrintWriter writer) { - writer.println(toString()); + writer.println(this); } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/eis/EISPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/eis/EISPlatform.java index 0f88006b4fd..e7cf254f344 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/eis/EISPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/eis/EISPlatform.java @@ -277,7 +277,6 @@ public Object getValueFromRecord(String key, MappedRecord record, EISAccessor ac */ public void setDOMInRecord(Element dom, jakarta.resource.cci.Record record, EISInteraction call, EISAccessor accessor) { if (domMethod == null) { - @SuppressWarnings({"unchecked", "rawtypes"}) Class[] argumentTypes = (Class[]) new Class[1]; argumentTypes[0] = Element.class; try { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/eis/interactions/XMLInteraction.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/eis/interactions/XMLInteraction.java index da80b9b62dd..a99c366fb0b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/eis/interactions/XMLInteraction.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/eis/interactions/XMLInteraction.java @@ -23,7 +23,6 @@ import org.eclipse.persistence.oxm.XMLField; import org.w3c.dom.Element; import org.eclipse.persistence.internal.databaseaccess.Accessor; -import org.eclipse.persistence.internal.helper.DatabaseField; import org.eclipse.persistence.oxm.record.XMLRecord; import org.eclipse.persistence.internal.helper.*; import org.eclipse.persistence.eis.*; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/codegen/ClassDefinition.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/codegen/ClassDefinition.java index 709533226cc..67aa798c1b1 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/codegen/ClassDefinition.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/codegen/ClassDefinition.java @@ -24,8 +24,6 @@ import java.util.TreeSet; import java.util.Vector; -import org.eclipse.persistence.internal.helper.Helper; - /** * INTERNAL: *

Purpose: Model a class for code generation purposes. diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/codegen/MethodDefinition.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/codegen/MethodDefinition.java index 9c19977a6b7..8c8cb6114fd 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/codegen/MethodDefinition.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/codegen/MethodDefinition.java @@ -74,7 +74,7 @@ private void adjustExceptions(Map> typeNameMap) { * unambiguous. */ private void adjustLine(String line, Map> typeNameMap) { - StringBuffer lineInProgress = new StringBuffer(line); + StringBuilder lineInProgress = new StringBuilder(line); Set typeNames = parseForTypeNames(lineInProgress.toString()); for (Iterator i = typeNames.iterator(); i.hasNext();) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/databaseaccess/DatabaseAccessor.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/databaseaccess/DatabaseAccessor.java index 3c9da3bdea9..0bf59772dc1 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/databaseaccess/DatabaseAccessor.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/databaseaccess/DatabaseAccessor.java @@ -289,10 +289,10 @@ public AbstractRecord buildOutputRow(CallableStatement statement, DatabaseCall c * If the fields passed in are null, this means that the field are not known and should be * built from the column names. This case occurs for DataReadQuery's. */ - public Vector buildSortedFields(Vector fields, ResultSet resultSet, AbstractSession session) throws DatabaseException { - Vector sortedFields; + public Vector buildSortedFields(Vector fields, ResultSet resultSet, AbstractSession session) throws DatabaseException { + Vector sortedFields; try { - Vector columnNames = getColumnNames(resultSet, session); + Vector columnNames = getColumnNames(resultSet, session); if (fields == null) {// Means fields not known. sortedFields = columnNames; } else { @@ -460,7 +460,7 @@ public void basicCommitTransaction(AbstractSession session) throws DatabaseExcep * with values from the next valid row in the result set. Intended solely * for cursored stream support. */ - public AbstractRecord cursorRetrieveNextRow(Vector fields, ResultSet resultSet, AbstractSession session) throws DatabaseException { + public AbstractRecord cursorRetrieveNextRow(Vector fields, ResultSet resultSet, AbstractSession session) throws DatabaseException { try { if (resultSet.next()) { return fetchRow(fields, resultSet, resultSet.getMetaData(), session); @@ -479,7 +479,7 @@ public AbstractRecord cursorRetrieveNextRow(Vector fields, ResultSet resultSet, * with values from the next valid row in the result set. Intended solely * for scrollable cursor support. */ - public AbstractRecord cursorRetrievePreviousRow(Vector fields, ResultSet resultSet, AbstractSession session) throws DatabaseException { + public AbstractRecord cursorRetrievePreviousRow(Vector fields, ResultSet resultSet, AbstractSession session) throws DatabaseException { try { if (resultSet.previous()) { return fetchRow(fields, resultSet, resultSet.getMetaData(), session); @@ -1040,14 +1040,14 @@ public ResultSet executeSelect(DatabaseCall call, Statement statement, AbstractS * match the number of column names available on the database. * PERF: This method must be highly optimized. */ - protected AbstractRecord fetchRow(Vector fields, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session) throws DatabaseException { + protected AbstractRecord fetchRow(Vector fields, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session) throws DatabaseException { int size = fields.size(); Vector values = NonSynchronizedVector.newInstance(size); // PERF: Pass platform and optimize data flag. DatabasePlatform platform = getPlatform(); boolean optimizeData = platform.shouldOptimizeDataConversion(); for (int index = 0; index < size; index++) { - DatabaseField field = (DatabaseField)fields.elementAt(index); + DatabaseField field = fields.elementAt(index); // Field can be null for fetch groups. if (field != null) { values.add(getObject(resultSet, field, metaData, index + 1, platform, optimizeData, session)); @@ -1207,9 +1207,9 @@ public Vector getColumnInfo(String catalog, String schema, String tableName, Str * This is required for custom SQL execution only, * as generated SQL already knows the fields returned. */ - protected Vector getColumnNames(ResultSet resultSet, AbstractSession session) throws SQLException { + protected Vector getColumnNames(ResultSet resultSet, AbstractSession session) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); - Vector columnNames = new Vector(metaData.getColumnCount()); + Vector columnNames = new Vector<>(metaData.getColumnCount()); for (int index = 0; index < metaData.getColumnCount(); index++) { // Changed the following code to use metaData#getColumnLabel() instead of metaData.getColumnName() @@ -1370,7 +1370,7 @@ protected Object getObjectThroughOptimizedDataConversion(ResultSet resultSet, Da // Optimize numeric values to avoid conversion into big-dec and back to primitives. if ((fieldType == ClassConstants.PLONG) || (fieldType == ClassConstants.LONG)) { value = resultSet.getLong(columnNumber); - isPrimitive = (Long) value == 0l; + isPrimitive = (Long) value == 0L; } else if ((fieldType == ClassConstants.INTEGER) || (fieldType == ClassConstants.PINT)) { value = resultSet.getInt(columnNumber); isPrimitive = (Integer) value == 0; @@ -1385,7 +1385,7 @@ protected Object getObjectThroughOptimizedDataConversion(ResultSet resultSet, Da isPrimitive = (Short) value == 0; } else if ((fieldType == ClassConstants.BOOLEAN) || (fieldType == ClassConstants.PBOOLEAN)) { value = resultSet.getBoolean(columnNumber); - isPrimitive = (Boolean) value == false; + isPrimitive = !((Boolean) value); } else if ((type == Types.TIME) || (type == Types.DATE) || (type == Types.TIMESTAMP)) { if (Helper.shouldOptimizeDates) { // Optimize dates by avoid conversion to timestamp then back to date or time or util.date. @@ -1495,7 +1495,7 @@ public Vector getTableInfo(String catalog, String schema, String tableName, Stri try { incrementCallCount(session); resultSet = getConnectionMetaData().getTables(catalog, schema, tableName, types); - Vector fields = buildSortedFields(null, resultSet, session); + Vector fields = buildSortedFields(null, resultSet, session); ResultSetMetaData metaData = resultSet.getMetaData(); while (resultSet.next()) { @@ -1790,7 +1790,7 @@ public void setActiveBatchWritingMechanism(BatchWritingMechanism mechanism) { /** * The statement cache stores a fixed sized number of prepared statements. */ - protected void setStatementCache(Hashtable statementCache) { + protected void setStatementCache(Hashtable statementCache) { this.statementCache = statementCache; } @@ -1798,20 +1798,21 @@ protected void setStatementCache(Hashtable statementCache) { * This method will sort the fields in correct order based * on the column names. */ - protected Vector sortFields(Vector fields, Vector columnNames) { - Vector sortedFields = new Vector(columnNames.size()); - Vector eligableFields = (Vector)fields.clone();// Must clone to allow removing to support the same field twice. - Enumeration columnNamesEnum = columnNames.elements(); + protected Vector sortFields(Vector fields, Vector columnNames) { + Vector sortedFields = new Vector<>(columnNames.size()); + @SuppressWarnings({"unchecked"}) + Vector eligableFields = (Vector)fields.clone();// Must clone to allow removing to support the same field twice. + Enumeration columnNamesEnum = columnNames.elements(); boolean valueFound; DatabaseField field; DatabaseField column;//DatabaseField from the columnNames vector while (columnNamesEnum.hasMoreElements()) { field = null; valueFound = false; - column = (DatabaseField)columnNamesEnum.nextElement(); - Enumeration fieldEnum = eligableFields.elements(); + column = columnNamesEnum.nextElement(); + Enumeration fieldEnum = eligableFields.elements(); while (fieldEnum.hasMoreElements()) { - field = (DatabaseField)fieldEnum.nextElement(); + field = fieldEnum.nextElement(); if(field != null && field.equals(column)){ valueFound = true; sortedFields.addElement(field); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java index 301862b09de..d40fdb4c9d2 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java @@ -669,7 +669,7 @@ public Expression buildBatchCriteriaForComplexId(ExpressionBuilder builder,List< * INTERNAL * Returns null unless the platform supports call with returning */ - public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector returnFields) { + public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector returnFields) { throw ValidationException.platformDoesNotSupportCallWithReturning(Helper.getShortClassName(this)); } @@ -1317,7 +1317,7 @@ public int getJDBCType(Class javaType) { return Types.SMALLINT; } else if (javaType == ClassConstants.CALENDAR ) { return Types.TIMESTAMP; - } else if (javaType == ClassConstants.UTILDATE ) { + } else if (javaType == ClassConstants.UTILDATE ) {//bug 5237080, return TIMESTAMP for java.util.Date as well return Types.TIMESTAMP; } else if (javaType == ClassConstants.TIME || javaType == ClassConstants.TIME_LTIME) { //bug 546312 @@ -1326,7 +1326,6 @@ public int getJDBCType(Class javaType) { javaType == ClassConstants.TIME_LDATE) { //bug 546312 return Types.DATE; } else if (javaType == ClassConstants.TIMESTAMP || - javaType == ClassConstants.UTILDATE || //bug 5237080, return TIMESTAMP for java.util.Date as well javaType == ClassConstants.TIME_LDATETIME) { //bug 546312 return Types.TIMESTAMP; } else if(javaType == ClassConstants.TIME_OTIME) { //bug 546312 @@ -2965,23 +2964,23 @@ protected boolean shouldTempTableSpecifyPrimaryKeys() { * @param allFields all mapped fields for the original table. */ public void writeCreateTempTableSql(Writer writer, DatabaseTable table, AbstractSession session, - Collection pkFields, - Collection usedFields, - Collection allFields) throws IOException + Collection pkFields, + Collection usedFields, + Collection allFields) throws IOException { String body = getCreateTempTableSqlBodyForTable(table); if(body == null) { TableDefinition tableDef = new TableDefinition(); - Collection fields; + Collection fields; if(supportsLocalTempTables()) { fields = usedFields; } else { // supportsGlobalTempTables() == true fields = allFields; } - Iterator itFields = fields.iterator(); + Iterator itFields = fields.iterator(); while (itFields.hasNext()) { - DatabaseField field = (DatabaseField)itFields.next(); + DatabaseField field = itFields.next(); FieldDefinition fieldDef; //gfbug3307, should use columnDefinition if it was defined. if ((field.getColumnDefinition()!= null) && (field.getColumnDefinition().length() == 0)) { @@ -3021,7 +3020,7 @@ public void writeCreateTempTableSql(Writer writer, DatabaseTable table, Abstract * @param table is original table for which temp table is created. * @param usedFields fields that will be used by operation for which temp table is created. */ - public void writeInsertIntoTableSql(Writer writer, DatabaseTable table, Collection usedFields) throws IOException { + public void writeInsertIntoTableSql(Writer writer, DatabaseTable table, Collection usedFields) throws IOException { writer.write("INSERT INTO "); writer.write(getTempTableForTable(table).getQualifiedNameDelimited(this)); @@ -3075,8 +3074,8 @@ public void writeTableCreationSuffix(Writer writer, String tableCreationSuffix) * @param assignedFields fields to be assigned a new value. */ public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, - Collection pkFields, - Collection assignedFields) throws IOException + Collection pkFields, + Collection assignedFields) throws IOException { writer.write("UPDATE "); String tableName = table.getQualifiedNameDelimited(this); @@ -3090,7 +3089,7 @@ public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable tab writer.write(tempTableName); writeAutoJoinWhereClause(writer, null, tableName, pkFields, this); writer.write(") WHERE EXISTS(SELECT "); - writer.write(((DatabaseField)pkFields.iterator().next()).getNameDelimited(this)); + writer.write(pkFields.iterator().next().getNameDelimited(this)); writer.write(" FROM "); writer.write(tempTableName); writeAutoJoinWhereClause(writer, null, tableName, pkFields, this); @@ -3113,14 +3112,14 @@ public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable tab * @param targetPkFields primary key fields for the target table. */ public void writeDeleteFromTargetTableUsingTempTableSql(Writer writer, DatabaseTable table, DatabaseTable targetTable, - Collection pkFields, - Collection targetPkFields, DatasourcePlatform platform) throws IOException + Collection pkFields, + Collection targetPkFields, DatasourcePlatform platform) throws IOException { writer.write("DELETE FROM "); String targetTableName = targetTable.getQualifiedNameDelimited(this); writer.write(targetTableName); writer.write(" WHERE EXISTS(SELECT "); - writer.write(((DatabaseField)pkFields.iterator().next()).getNameDelimited(platform)); + writer.write(pkFields.iterator().next().getNameDelimited(platform)); writer.write(" FROM "); String tempTableName = getTempTableForTable(table).getQualifiedNameDelimited(this); writer.write(tempTableName); @@ -3215,16 +3214,16 @@ public boolean dontBindUpdateAllQueryUsingTempTables() { * INTERNAL: * helper method, don't override. */ - protected static void writeFieldsList(Writer writer, Collection fields, DatasourcePlatform platform) throws IOException { + protected static void writeFieldsList(Writer writer, Collection fields, DatasourcePlatform platform) throws IOException { boolean isFirst = true; - Iterator itFields = fields.iterator(); + Iterator itFields = fields.iterator(); while(itFields.hasNext()) { if(isFirst) { isFirst = false; } else { writer.write(", "); } - DatabaseField field = (DatabaseField)itFields.next(); + DatabaseField field = itFields.next(); writer.write(field.getNameDelimited(platform)); } } @@ -3233,7 +3232,7 @@ protected static void writeFieldsList(Writer writer, Collection fields, Datasour * INTERNAL: * helper method, don't override. */ - protected static void writeAutoAssignmentSetClause(Writer writer, String tableName1, String tableName2, Collection fields, DatasourcePlatform platform) throws IOException { + protected static void writeAutoAssignmentSetClause(Writer writer, String tableName1, String tableName2, Collection fields, DatasourcePlatform platform) throws IOException { writer.write(" SET "); writeFieldsAutoClause(writer, tableName1, tableName2, fields, ", ", platform); } @@ -3242,7 +3241,7 @@ protected static void writeAutoAssignmentSetClause(Writer writer, String tableNa * INTERNAL: * helper method, don't override. */ - protected static void writeAutoJoinWhereClause(Writer writer, String tableName1, String tableName2, Collection pkFields, DatasourcePlatform platform) throws IOException { + protected static void writeAutoJoinWhereClause(Writer writer, String tableName1, String tableName2, Collection pkFields, DatasourcePlatform platform) throws IOException { writer.write(" WHERE "); writeFieldsAutoClause(writer, tableName1, tableName2, pkFields, " AND ", platform); } @@ -3251,14 +3250,14 @@ protected static void writeAutoJoinWhereClause(Writer writer, String tableName1, * INTERNAL: * helper method, don't override. */ - protected static void writeFieldsAutoClause(Writer writer, String tableName1, String tableName2, Collection fields, String separator, DatasourcePlatform platform) throws IOException { + protected static void writeFieldsAutoClause(Writer writer, String tableName1, String tableName2, Collection fields, String separator, DatasourcePlatform platform) throws IOException { writeFields(writer, tableName1, tableName2, fields, fields, separator, platform); } /** * INTERNAL: * helper method, don't override. */ - protected static void writeJoinWhereClause(Writer writer, String tableName1, String tableName2, Collection pkFields1, Collection pkFields2, DatasourcePlatform platform) throws IOException { + protected static void writeJoinWhereClause(Writer writer, String tableName1, String tableName2, Collection pkFields1, Collection pkFields2, DatasourcePlatform platform) throws IOException { writer.write(" WHERE "); writeFields(writer, tableName1, tableName2, pkFields1, pkFields2, " AND ", platform); } @@ -3267,10 +3266,10 @@ protected static void writeJoinWhereClause(Writer writer, String tableName1, Str * INTERNAL: * helper method, don't override. */ - protected static void writeFields(Writer writer, String tableName1, String tableName2, Collection fields1, Collection fields2, String separator, DatasourcePlatform platform) throws IOException { + protected static void writeFields(Writer writer, String tableName1, String tableName2, Collection fields1, Collection fields2, String separator, DatasourcePlatform platform) throws IOException { boolean isFirst = true; - Iterator itFields1 = fields1.iterator(); - Iterator itFields2 = fields2.iterator(); + Iterator itFields1 = fields1.iterator(); + Iterator itFields2 = fields2.iterator(); while(itFields1.hasNext()) { if(isFirst) { isFirst = false; @@ -3281,14 +3280,14 @@ protected static void writeFields(Writer writer, String tableName1, String table writer.write(tableName1); writer.write("."); } - String fieldName1 = ((DatabaseField)itFields1.next()).getNameDelimited(platform); + String fieldName1 = itFields1.next().getNameDelimited(platform); writer.write(fieldName1); writer.write(" = "); if(tableName2 != null) { writer.write(tableName2); writer.write("."); } - String fieldName2 = ((DatabaseField)itFields2.next()).getNameDelimited(platform); + String fieldName2 = itFields2.next().getNameDelimited(platform); writer.write(fieldName2); } } @@ -3392,7 +3391,7 @@ public Struct createStruct(String structTypeName, Object[] attributes, AbstractS * This method builds a Struct using the unwrapped connection within the session * @return Struct */ - public Struct createStruct(String structTypeName, Object[] attributes, AbstractRecord row, Vector orderedFields, AbstractSession session, Connection connection) throws SQLException { + public Struct createStruct(String structTypeName, Object[] attributes, AbstractRecord row, Vector orderedFields, AbstractSession session, Connection connection) throws SQLException { java.sql.Connection unwrappedConnection = getConnection(session, connection); return createStruct(structTypeName,attributes,unwrappedConnection); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/dynamic/DynamicEntityImpl.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/dynamic/DynamicEntityImpl.java index e46297111b6..0116b54d5e0 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/dynamic/DynamicEntityImpl.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/dynamic/DynamicEntityImpl.java @@ -125,6 +125,7 @@ public DynamicTypeImpl getType() throws DynamicException { * @see org.eclipse.persistence.dynamic.DynamicEntity#get(java.lang.String) */ @Override + @SuppressWarnings({"unchecked"}) public T get(String propertyName) throws DynamicException { DynamicPropertiesManager dpm = fetchPropertiesManager(); if (dpm.contains(propertyName)) { @@ -143,10 +144,10 @@ public T get(String propertyName) throws DynamicException { Object value = wrapper.getValue(); // trigger any indirection if (value instanceof ValueHolderInterface) { - value = ((ValueHolderInterface) value).getValue(); + value = ((ValueHolderInterface) value).getValue(); } else if (value instanceof IndirectContainer) { - value = ((IndirectContainer) value).getValueHolder().getValue(); + value = ((IndirectContainer) value).getValueHolder().getValue(); } try { return (T) value; @@ -225,6 +226,7 @@ public DynamicEntity set(String propertyName, Object value, boolean fireProperty Object oldValue = null; Object wrapperValue = wrapper.getValue(); if (wrapperValue instanceof ValueHolderInterface) { + @SuppressWarnings({"unchecked"}) ValueHolderInterface vh = (ValueHolderInterface) wrapperValue; if (vh.isInstantiated()) { oldValue = vh.getValue(); @@ -321,7 +323,7 @@ public String toString() { sb.append(""); } else { - sb.append(value.toString()); + sb.append(value); } return sb.toString(); } @@ -442,7 +444,6 @@ public void mergeIntoObject(Object target, boolean isTargetUninitialized, Object * @see org.eclipse.persistence.internal.descriptors.PersistenceEntity#_persistence_getId() */ @Override - @SuppressWarnings("unchecked") public Object _persistence_getId() { return this.primaryKey; } @@ -451,7 +452,6 @@ public Object _persistence_getId() { * @see org.eclipse.persistence.internal.descriptors.PersistenceEntity#_persistence_setId(java.lang.Object) */ @Override - @SuppressWarnings("unchecked") public void _persistence_setId(Object pk) { this.primaryKey = pk; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/ExpressionJavaPrinter.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/ExpressionJavaPrinter.java index 012a9961a35..265a9ee5a12 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/ExpressionJavaPrinter.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/ExpressionJavaPrinter.java @@ -15,7 +15,6 @@ package org.eclipse.persistence.internal.expressions; import java.io.*; -import java.math.*; import java.util.Calendar; import org.eclipse.persistence.internal.databaseaccess.*; import org.eclipse.persistence.internal.helper.ClassConstants; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/RelationExpression.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/RelationExpression.java index e09dd6bc2a7..15adaad9aea 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/RelationExpression.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/RelationExpression.java @@ -193,7 +193,7 @@ public boolean doesObjectConform(Object leftValue, Object rightValue, AbstractSe return performSelector(false); } - Class javaClass = leftValue.getClass(); + Class javaClass = leftValue.getClass(); if (javaClass != rightValue.getClass()) { return performSelector(false); } @@ -623,8 +623,8 @@ public Expression normalize(ExpressionNormalizer normalizer) { descriptor = mapping.getReferenceDescriptor(); left = left.normalize(normalizer); Map targetToSourceKeyFields = ((OneToOneMapping)mapping).getTargetToSourceKeyFields(); - sourceFields = new ArrayList(targetToSourceKeyFields.size()); - targetFields = new ArrayList(targetToSourceKeyFields.size()); + sourceFields = new ArrayList<>(targetToSourceKeyFields.size()); + targetFields = new ArrayList<>(targetToSourceKeyFields.size()); for (Map.Entry entry : targetToSourceKeyFields.entrySet()) { sourceFields.add(entry.getValue()); targetFields.add(entry.getKey()); @@ -642,7 +642,7 @@ public Expression normalize(ExpressionNormalizer normalizer) { Expression newLeft = null; if (composite) { // For composite ids an array comparison is used, this only works on some databases. - List fieldExpressions = new ArrayList(); + List fieldExpressions = new ArrayList<>(); for (DatabaseField field : sourceFields) { fieldExpressions.add(left.getField(field)); } @@ -657,12 +657,12 @@ public Expression normalize(ExpressionNormalizer normalizer) { ConstantExpression constant = (ConstantExpression)right; if (constant.getValue() instanceof Collection) { Collection objects = (Collection)constant.getValue(); - List newObjects = new ArrayList(objects.size()); + List newObjects = new ArrayList<>(objects.size()); for (Object object : objects) { if (object instanceof Expression) { if (composite) { // For composite ids an array comparison is used, this only works on some databases. - List values = new ArrayList(); + List values = new ArrayList<>(); for (DatabaseField field : targetFields) { values.add(((Expression)object).getField(field)); } @@ -673,7 +673,7 @@ public Expression normalize(ExpressionNormalizer normalizer) { } else if (descriptor.getJavaClass().isInstance(object)) { if (composite) { // For composite ids an array comparison is used, this only works on some databases. - List values = new ArrayList(); + List values = new ArrayList<>(); for (DatabaseField field : targetFields) { values.add(descriptor.getObjectBuilder().extractValueFromObjectForField(object, field, normalizer.getSession())); } @@ -800,7 +800,7 @@ public Expression normalize(ExpressionNormalizer normalizer) { // If FK joins go in the WHERE clause, want to get hold of it and // not put it in normalizer.additionalExpressions. - List foreignKeyJoinPointer = new ArrayList(1); + List foreignKeyJoinPointer = new ArrayList<>(1); QueryKeyExpression queryKey = (QueryKeyExpression)second; // If inside an OR the foreign key join must be on both sides. diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/BasicTypeHelperImpl.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/BasicTypeHelperImpl.java index 5d7eb4d72a8..05ab57124b3 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/BasicTypeHelperImpl.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/BasicTypeHelperImpl.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 @@ -121,7 +121,7 @@ public String getTypeName(Object type) { } /** Returns the class object of the specified type. */ - public Class getJavaClass(Object type) { + public Class getJavaClass(Object type) { Class clazz = null; if (type instanceof Class) { clazz = (Class)type; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConcurrencyUtil.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConcurrencyUtil.java index f767721cd1f..5223d0e581d 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConcurrencyUtil.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConcurrencyUtil.java @@ -363,7 +363,7 @@ public String createToStringExplainingOwnedCacheKey(ConcurrencyManager concurren String.valueOf(System.identityHashCode(cacheKeyObject)), cacheKeyClass, String.valueOf(System.identityHashCode(cacheKey)), activeThread, concurrencyManager.getNumberOfReaders(), concurrencyManagerId, - ConversionManager.getDefaultManager().convertObject(concurrencyManagerCreationDate, String.class).toString() + ConversionManager.getDefaultManager().convertObject(concurrencyManagerCreationDate, String.class) // metadata of number of times the cache key suffered increases in number readers , cacheKey.getTotalNumberOfKeysAcquiredForReading(), cacheKey.getTotalNumberOfKeysReleasedForReading(), @@ -372,7 +372,7 @@ public String createToStringExplainingOwnedCacheKey(ConcurrencyManager concurren } else { return TraceLocalization.buildMessage("concurrency_util_owned_cache_key_is_not_cache_key", new Object[] {cacheKeyClass, concurrencyManager, activeThread, - concurrencyManagerId, ConversionManager.getDefaultManager().convertObject(concurrencyManagerCreationDate, String.class).toString(), + concurrencyManagerId, ConversionManager.getDefaultManager().convertObject(concurrencyManagerCreationDate, String.class), concurrencyManager.getTotalNumberOfKeysAcquiredForReading(), concurrencyManager.getTotalNumberOfKeysReleasedForReading(), concurrencyManager .getTotalNumberOfKeysReleasedForReadingBlewUpExceptionDueToCacheKeyHavingReachedCounterZero(), @@ -640,7 +640,7 @@ protected String dumpDeadLockExplanationIfPossible(ConcurrencyManagerState concu // (a) Step one - try to detect dead lock final long startTimeMillis = System.currentTimeMillis(); List deadLockExplanation = Collections.emptyList(); - long deadLockDetectionTotalExecutionTimeMs = 0l; + long deadLockDetectionTotalExecutionTimeMs = 0L; try { deadLockExplanation = ExplainDeadLockUtil.SINGLETON.explainPossibleDeadLockStartRecursion(concurrencyManagerState); } catch (Exception codeIsBuggyAndBlowingUp) { @@ -787,7 +787,6 @@ private String createStringWithSummaryOfDeferredLocksOnThread(DeferredLockManage } // (b) Try to build a string that lists all of the active locks on the thread // Loop over all of the deferred locks and print them - @SuppressWarnings("unchecked") List deferredLocks = new ArrayList<>(lockManager.getDeferredLocks()); writer.write(TraceLocalization.buildMessage("concurrency_util_summary_deferred_locks_on_thread_3", new Object[] {deferredLocks.size()})); for (int deferredLockNumber = 0; deferredLockNumber < deferredLocks.size(); deferredLockNumber++) { @@ -821,7 +820,6 @@ private String createStringWithSummaryOfReadLocksAcquiredByThread(ReadLockManage } // (b) Try to build a string that lists all of the acitve locks on the thread // Loop over al of the active locks and print them - @SuppressWarnings("unchecked") List readLocks = readLockManager.getReadLocks(); writer.write(TraceLocalization.buildMessage("concurrency_util_summary_read_locks_on_thread_step001_3", new Object[] {readLocks.size()})); for (int readLockNumber = 0; readLockNumber < readLocks.size(); readLockNumber++) { @@ -850,7 +848,7 @@ private String createStringWithSummaryOfReadLocksAcquiredByThread(ReadLockManage readLockNumber++; writer.write(TraceLocalization.buildMessage("concurrency_util_summary_read_locks_on_thread_step002_3", new Object[] {readLockNumber, SINGLETON.createToStringExplainingOwnedCacheKey(currentReadLockAcquiredAndNeverReleased.getCacheKeyWhoseNumberOfReadersThreadIsIncrementing()), - ConversionManager.getDefaultManager().convertObject(currentReadLockAcquiredAndNeverReleased.getDateOfReadLockAcquisition(), String.class).toString(), + ConversionManager.getDefaultManager().convertObject(currentReadLockAcquiredAndNeverReleased.getDateOfReadLockAcquisition(), String.class), currentReadLockAcquiredAndNeverReleased.getNumberOfReadersOnCacheKeyBeforeIncrementingByOne(), currentReadLockAcquiredAndNeverReleased.getCurrentThreadStackTraceInformationCpuTimeCostMs()})); String stackTraceInformation = currentReadLockAcquiredAndNeverReleased.getCurrentThreadStackTraceInformation(); @@ -1543,8 +1541,7 @@ public void enrichMapOfCacheKeyToDtosExplainingThreadExpectationsOnCacheKeyInfoA // (b) First we focus on the active locks owned by the thread // enrich the map of cache key to thread doing something in respect to the cache key - for (Object activeLockObj : currentValue.getActiveLocks()) { - ConcurrencyManager activeLock = (ConcurrencyManager) activeLockObj; + for (ConcurrencyManager activeLock : currentValue.getActiveLocks()) { CacheKeyToThreadRelationships dto = get(activeLock, mapOfCacheKeyToDtosExplainingThreadExpectationsOnCacheKey); dto.addThreadsThatAcquiredActiveLock(currentThread); } @@ -1552,8 +1549,7 @@ public void enrichMapOfCacheKeyToDtosExplainingThreadExpectationsOnCacheKeyInfoA // (c) Now we go over the defferred locks on this thread // (e.g. object locks that it could not acquire because some other thread was active at the time owning the // lock) - for (Object deferredLockObj : currentValue.getDeferredLocks()) { - ConcurrencyManager deferredLock = (ConcurrencyManager) deferredLockObj; + for (ConcurrencyManager deferredLock : currentValue.getDeferredLocks()) { CacheKeyToThreadRelationships dto = get(deferredLock, mapOfCacheKeyToDtosExplainingThreadExpectationsOnCacheKey); dto.addThreadsThatAcquiredDeferredLock(currentThread); } @@ -1599,7 +1595,7 @@ public String readLockManagerProblem01CreateLogErrorMessageToIndicateThatCurrent Thread currentThread = Thread.currentThread(); StringWriter writer = new StringWriter(); writer.write(TraceLocalization.buildMessage("concurrency_util_read_lock_manager_problem01", new Object[] {currentThread.getName(), currentNumberOfReaders, decrementedNumberOfReaders, - ConcurrencyUtil.SINGLETON.createToStringExplainingOwnedCacheKey(cacheKey), enrichGenerateThreadDumpForCurrentThread(), ConversionManager.getDefaultManager().convertObject(new Date(), String.class).toString()})); + ConcurrencyUtil.SINGLETON.createToStringExplainingOwnedCacheKey(cacheKey), enrichGenerateThreadDumpForCurrentThread(), ConversionManager.getDefaultManager().convertObject(new Date(), String.class)})); AbstractSessionLog.getLog().log(SessionLog.SEVERE, SessionLog.CACHE, writer.toString(), new Object[] {}, false); return writer.toString(); } @@ -1608,7 +1604,7 @@ public String readLockManagerProblem02ReadLockManageHasNoEntriesForThread(Concur Thread currentThread = Thread.currentThread(); StringWriter writer = new StringWriter(); writer.write(TraceLocalization.buildMessage("concurrency_util_read_lock_manager_problem02", new Object[] {currentThread.getName(), SINGLETON.createToStringExplainingOwnedCacheKey(cacheKey), - threadId, enrichGenerateThreadDumpForCurrentThread(), ConversionManager.getDefaultManager().convertObject(new Date(), String.class).toString()})); + threadId, enrichGenerateThreadDumpForCurrentThread(), ConversionManager.getDefaultManager().convertObject(new Date(), String.class)})); // We do log immediately the error as we spot it AbstractSessionLog.getLog().log(SessionLog.SEVERE, SessionLog.CACHE, writer.toString(), new Object[] {}, false); // we also return the error message we just logged to added it to our tracing permanently @@ -1619,7 +1615,7 @@ public String readLockManagerProblem03ReadLockManageHasNoEntriesForThread(Concur Thread currentThread = Thread.currentThread(); StringWriter writer = new StringWriter(); writer.write(TraceLocalization.buildMessage("concurrency_util_read_lock_manager_problem03", new Object[] {currentThread.getName(), SINGLETON.createToStringExplainingOwnedCacheKey(cacheKey), - threadId, enrichGenerateThreadDumpForCurrentThread(), ConversionManager.getDefaultManager().convertObject(new Date(), String.class).toString()})); + threadId, enrichGenerateThreadDumpForCurrentThread(), ConversionManager.getDefaultManager().convertObject(new Date(), String.class)})); // We do log immediately the error as we spot it AbstractSessionLog.getLog().log(SessionLog.SEVERE, SessionLog.CACHE, writer.toString(), new Object[] {}, false); // we also return the error message we just logged to added it to our tracing permanently @@ -1638,7 +1634,7 @@ public String readLockManagerProblem03ReadLockManageHasNoEntriesForThread(Concur public ReadLockAcquisitionMetadata createReadLockAcquisitionMetadata(ConcurrencyManager concurrencyManager) { final boolean isAllowTakingStackTraceDuringReadLockAcquisition = isAllowTakingStackTraceDuringReadLockAcquisition(); String currentThreadStackTraceInformation = TraceLocalization.buildMessage("concurrency_util_read_lock_acquisition_metadata"); - long currentThreadStackTraceInformationCpuTimeCostMs = 0l; + long currentThreadStackTraceInformationCpuTimeCostMs = 0L; if (isAllowTakingStackTraceDuringReadLockAcquisition) { long startTimeMillis = System.currentTimeMillis(); currentThreadStackTraceInformation = enrichGenerateThreadDumpForCurrentThread(); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConversionManager.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConversionManager.java index 2bf15f1351c..f20182b3bae 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConversionManager.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConversionManager.java @@ -36,7 +36,6 @@ import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZoneOffset; -import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.Hashtable; @@ -286,7 +285,7 @@ protected BigDecimal convertObjectToBigDecimal(Object sourceObject) throws Conve // treated as BigDecimal(1). String numberString = String.valueOf(sourceObject); if(numberString.endsWith(".0") || numberString.contains(".0E+")) { - bigDecimal = new BigDecimal(((Number)sourceObject).doubleValue()); + bigDecimal = BigDecimal.valueOf(((Number) sourceObject).doubleValue()); } else { bigDecimal = new BigDecimal(numberString); } @@ -687,7 +686,7 @@ protected BigDecimal convertObjectToNumber(Object sourceObject) throws Conversio } if (sourceObject instanceof Number) { - return new BigDecimal(((Number)sourceObject).doubleValue()); + return BigDecimal.valueOf(((Number) sourceObject).doubleValue()); } if (sourceObject instanceof Boolean) { @@ -1106,7 +1105,6 @@ protected java.util.Date convertObjectToUtilDate(Object sourceObject) throws Con * Resolve the given String className into a class using this * ConversionManager's classloader. */ - @SuppressWarnings({"unchecked"}) public Class convertClassNameToClass(String className) throws ConversionException { return convertObjectToClass(className); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DatabaseType.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DatabaseType.java index c5a8f2af68f..80be3fbc790 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DatabaseType.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DatabaseType.java @@ -107,7 +107,7 @@ static String getTruncatedSHA1Hash(String s) { return sb.toString(); } - protected String getTruncatedSHA1Name(String argName, String prefix) { + private String getTruncatedSHA1Name(String argName, String prefix) { if (argName.length() >= ARGNAME_SIZE_LIMIT) { StringBuilder sb = new StringBuilder(); //the truncated SHA is great, but a PL/SQL identifier @@ -170,12 +170,12 @@ public void buildOutAssignment(StringBuilder sb, PLSQLargument outArg, PLSQLStor } public void translate(PLSQLargument arg, AbstractRecord translationRow, - AbstractRecord copyOfTranslationRow, List copyOfTranslationFields, - List translationRowFields, List translationRowValues, - StoredProcedureCall call) { + AbstractRecord copyOfTranslationRow, List copyOfTranslationFields, + List translationRowFields, List translationRowValues, + StoredProcedureCall call) { DatabaseField field = null; - for (Iterator i = copyOfTranslationFields.iterator(); i.hasNext(); ) { - DatabaseField f = (DatabaseField)i.next(); + for (Iterator i = copyOfTranslationFields.iterator(); i.hasNext(); ) { + DatabaseField f = i.next(); if (f.getName().equals(arg.name)) { field = f; break; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ExplainDeadLockUtil.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ExplainDeadLockUtil.java index cc6d074ee4e..ee97256a069 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ExplainDeadLockUtil.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ExplainDeadLockUtil.java @@ -23,8 +23,6 @@ import java.io.StringWriter; import java.util.*; -import static java.lang.String.format; - /** * The purpose of this class is to try explain the nature of a dead lock */ @@ -103,7 +101,7 @@ protected List createListExplainingDeadLock( Map helperMap = new HashMap<>(); // (c) start our correction loop - List deadLockAsSimpleList = new ArrayList(); + List deadLockAsSimpleList = new ArrayList<>(); while (currentElementToIterate != null) { // (d) In this chaing of DTOs we built during our recursion diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/Helper.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/Helper.java index a18b402f79e..691ba0de220 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/Helper.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/Helper.java @@ -32,7 +32,6 @@ import java.io.Serializable; import java.io.StringWriter; import java.io.Writer; -import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.math.BigDecimal; @@ -43,7 +42,6 @@ import java.security.PrivilegedActionException; import java.sql.Timestamp; import java.util.ArrayList; -import java.util.Arrays; import java.util.Calendar; import java.util.Collection; import java.util.Date; @@ -240,8 +238,8 @@ public static void releaseCalendar(Calendar calendar) { getCalendarCache().offer(calendar); } - public static void addAllToVector(Vector theVector, Vector elementsToAdd) { - for (Enumeration stream = elementsToAdd.elements(); stream.hasMoreElements();) { + public static void addAllToVector(Vector theVector, Vector elementsToAdd) { + for (Enumeration stream = elementsToAdd.elements(); stream.hasMoreElements();) { theVector.addElement(stream.nextElement()); } } @@ -277,7 +275,7 @@ public static List addAllUniqueToList(List objects, List objectsToA /** * Convert the specified vector into an array. */ - public static Object[] arrayFromVector(Vector vector) { + public static Object[] arrayFromVector(Vector vector) { Object[] result = new Object[vector.size()]; for (int i = 0; i < vector.size(); i++) { result[i] = vector.elementAt(i); @@ -421,8 +419,8 @@ public static boolean classImplementsInterface(Class aClass, Class anI * Return whether a Class is a subclass of, or the same as, another Class. * @return boolean */ - public static boolean classIsSubclass(Class subClass, Class superClass) { - Class temp = subClass; + public static boolean classIsSubclass(Class subClass, Class superClass) { + Class temp = subClass; if (superClass == null) { return false; @@ -523,8 +521,8 @@ static protected int compareVersions(List list1, Listlist2) { return res; } - public static Class getClassFromClasseName(String className, ClassLoader classLoader){ - Class convertedClass = null; + public static Class getClassFromClasseName(String className, ClassLoader classLoader){ + Class convertedClass = null; if(className==null){ return null; } @@ -552,12 +550,12 @@ public static String getComponentTypeNameFromArrayString(String aString) { if (aString.length() > 3 && (aString.startsWith("[L") && aString.endsWith(";"))) { return aString.substring(2, aString.length() - 1); } else if (aString.startsWith("[")){ - Class primitiveClass = null; + Class primitiveClass = null; try { primitiveClass = Class.forName(aString); } catch (ClassNotFoundException cnf) { // invalid name specified - do not rethrow exception - primitiveClass = null; + // primitiveClass is still null; } if (primitiveClass != null) { return primitiveClass.getComponentType().getName(); @@ -633,15 +631,15 @@ public static boolean compareCharArrays(char[] array1, char[] array2) { * same and each of the types in the first Vector are assignable from the types * in the corresponding objects in the second Vector. */ - public static boolean areTypesAssignable(List types1, List types2) { + public static boolean areTypesAssignable(List> types1, List> types2) { if ((types1 == null) || (types2 == null)) { return false; } if (types1.size() == types2.size()) { for (int i = 0; i < types1.size(); i++) { - Class type1 = (Class)types1.get(i); - Class type2 = (Class)types2.get(i); + Class type1 = types1.get(i); + Class type2 = types2.get(i); // if either are null then we assume assignability. if ((type1 != null) && (type2 != null)) { @@ -662,16 +660,15 @@ public static boolean areTypesAssignable(List types1, List types2) { * * Added Nov 9, 2000 JED Patch 2.5.1.8 */ - public static boolean compareHashtables(Hashtable hashtable1, Hashtable hashtable2) { - Enumeration enumtr; + public static boolean compareHashtables(Hashtable hashtable1, Hashtable hashtable2) { + Enumeration enumtr; Object element; - Hashtable clonedHashtable; if (hashtable1.size() != hashtable2.size()) { return false; } - clonedHashtable = (Hashtable)hashtable2.clone(); + Hashtable clonedHashtable = (Hashtable)hashtable2.clone(); enumtr = hashtable1.elements(); while (enumtr.hasMoreElements()) { @@ -689,8 +686,8 @@ public static boolean compareHashtables(Hashtable hashtable1, Hashtable hashtabl * check for BigDecimals as well. */ public static boolean comparePotentialArrays(Object firstValue, Object secondValue) { - Class firstClass = firstValue.getClass(); - Class secondClass = secondValue.getClass(); + Class firstClass = firstValue.getClass(); + Class secondClass = secondValue.getClass(); // Arrays must be checked for equality because default does identity if ((firstClass == ClassConstants.APBYTE) && (secondClass == ClassConstants.APBYTE)) { @@ -711,8 +708,8 @@ public static boolean comparePotentialArrays(Object firstValue, Object secondVal /** * Merge the two Maps into a new HashMap. */ - public static Map concatenateMaps(Map first, Map second) { - Map concatenation = new HashMap(first.size() + second.size() + 4); + public static Map concatenateMaps(Map first, Map second) { + Map concatenation = new HashMap<>(first.size() + second.size() + 4); concatenation.putAll(first); concatenation.putAll(second); @@ -723,17 +720,17 @@ public static Map concatenateMaps(Map first, Map second) { /** * Return a new vector with no duplicated values. */ - public static Vector concatenateUniqueVectors(Vector first, Vector second) { - Vector concatenation; - Object element; + public static Vector concatenateUniqueVectors(Vector first, Vector second) { + Vector concatenation; + E element; concatenation = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(); - for (Enumeration stream = first.elements(); stream.hasMoreElements();) { + for (Enumeration stream = first.elements(); stream.hasMoreElements();) { concatenation.addElement(stream.nextElement()); } - for (Enumeration stream = second.elements(); stream.hasMoreElements();) { + for (Enumeration stream = second.elements(); stream.hasMoreElements();) { element = stream.nextElement(); if (!concatenation.contains(element)) { concatenation.addElement(element); @@ -747,11 +744,11 @@ public static Vector concatenateUniqueVectors(Vector first, Vector second) { /** * Return a new List with no duplicated values. */ - public static List concatenateUniqueLists(List first, List second) { - List concatenation = new ArrayList(first.size() + second.size()); + public static List concatenateUniqueLists(List first, List second) { + List concatenation = new ArrayList<>(first.size() + second.size()); concatenation.addAll(first); - for (Object element : second) { + for (E element : second) { if (!concatenation.contains(element)) { concatenation.add(element); } @@ -761,16 +758,16 @@ public static List concatenateUniqueLists(List first, List second) { } - public static Vector concatenateVectors(Vector first, Vector second) { - Vector concatenation; + public static Vector concatenateVectors(Vector first, Vector second) { + Vector concatenation; concatenation = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(); - for (Enumeration stream = first.elements(); stream.hasMoreElements();) { + for (Enumeration stream = first.elements(); stream.hasMoreElements();) { concatenation.addElement(stream.nextElement()); } - for (Enumeration stream = second.elements(); stream.hasMoreElements();) { + for (Enumeration stream = second.elements(); stream.hasMoreElements();) { concatenation.addElement(stream.nextElement()); } @@ -784,8 +781,8 @@ public static Vector concatenateVectors(Vector first, Vector second) { * @param startIndex - starting position in vector * @param stopIndex - ending position in vector */ - public static Vector copyVector(List originalVector, int startIndex, int stopIndex) throws ValidationException { - Vector newVector; + public static Vector copyVector(List originalVector, int startIndex, int stopIndex) throws ValidationException { + Vector newVector; if (stopIndex < startIndex) { return NonSynchronizedVector.newInstance(); @@ -1001,7 +998,7 @@ public static String fileSeparator() { * the superclass is checked, and so on, recursively. * Set accessible to true, so we can access private/package/protected fields. */ - public static Field getField(Class javaClass, String fieldName) throws NoSuchFieldException { + public static Field getField(Class javaClass, String fieldName) throws NoSuchFieldException { if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){ try { return AccessController.doPrivileged(new PrivilegedGetField(javaClass, fieldName, true)); @@ -1021,7 +1018,7 @@ public static Field getField(Class javaClass, String fieldName) throws NoSuchFie * is checked, and so on, recursively. Set accessible to true, so we can * access private/package/protected methods. */ - public static Method getDeclaredMethod(Class javaClass, String methodName) throws NoSuchMethodException { + public static Method getDeclaredMethod(Class javaClass, String methodName) throws NoSuchMethodException { return getDeclaredMethod(javaClass, methodName, null); } @@ -1033,7 +1030,7 @@ public static Method getDeclaredMethod(Class javaClass, String methodName) throw * superclass is checked, and so on, recursively. Set accessible to true, * so we can access private/package/protected methods. */ - public static Method getDeclaredMethod(Class javaClass, String methodName, Class[] methodParameterTypes) throws NoSuchMethodException { + public static Method getDeclaredMethod(Class javaClass, String methodName, Class[] methodParameterTypes) throws NoSuchMethodException { if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){ try { return AccessController.doPrivileged( @@ -1056,7 +1053,7 @@ public static Method getDeclaredMethod(Class javaClass, String methodName, Class /** * Return the class instance from the class */ - public static Object getInstanceFromClass(Class classFullName) { + public static Object getInstanceFromClass(Class classFullName) { if (classFullName == null) { return null; } @@ -1064,7 +1061,7 @@ public static Object getInstanceFromClass(Class classFullName) { try { if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){ try { - return AccessController.doPrivileged(new PrivilegedNewInstanceFromClass(classFullName)); + return AccessController.doPrivileged(new PrivilegedNewInstanceFromClass<>(classFullName)); } catch (PrivilegedActionException exception) { Exception throwableException = exception.getException(); if (throwableException instanceof InstantiationException) { @@ -1080,14 +1077,10 @@ public static Object getInstanceFromClass(Class classFullName) { } else { return PrivilegedAccessHelper.newInstanceFromClass(classFullName); } - } catch (InstantiationException notInstantiatedException) { + } catch (ReflectiveOperationException notInstantiatedException) { ValidationException exception = new ValidationException(); exception.setInternalException(notInstantiatedException); throw exception; - } catch (IllegalAccessException notAccessedException) { - ValidationException exception = new ValidationException(); - exception.setInternalException(notAccessedException); - throw exception; } } @@ -1101,7 +1094,7 @@ public static Class getObjectClass(Class javaClass) { /** * Answers the unqualified class name for the provided class. */ - public static String getShortClassName(Class javaClass) { + public static String getShortClassName(Class javaClass) { return getShortClassName(javaClass.getName()); } @@ -1122,7 +1115,7 @@ public static String getShortClassName(Object object) { /** * return a package name for the specified class. */ - public static String getPackageName(Class javaClass) { + public static String getPackageName(Class javaClass) { String className = Helper.getShortClassName(javaClass); return javaClass.getName().substring(0, (javaClass.getName().length() - (className.length() + 1))); } @@ -1146,7 +1139,7 @@ public static String getTabs(int noOfTabs) { * This is needed in jdk1.1, where Vector.contains(Object) * for a null element will result in a NullPointerException.... */ - public static int indexOfNullElement(Vector v, int index) { + public static int indexOfNullElement(Vector v, int index) { int size = v.size(); for (int i = index; i < size; i++) { if (v.elementAt(i) == null) { @@ -1160,7 +1153,7 @@ public static int indexOfNullElement(Vector v, int index) { * ADVANCED * returns true if the class in question is a primitive wrapper */ - public static boolean isPrimitiveWrapper(Class classInQuestion) { + public static boolean isPrimitiveWrapper(Class classInQuestion) { return classInQuestion.equals(Character.class) || classInQuestion.equals(Boolean.class) || classInQuestion.equals(Byte.class) || classInQuestion.equals(Short.class) || classInQuestion.equals(Integer.class) || classInQuestion.equals(Long.class) || classInQuestion.equals(Float.class) || classInQuestion.equals(Double.class); } @@ -1201,22 +1194,21 @@ public static File[] listFilesIn(File directory) { * If it's a Collection, iterate over the collection and add each item to the Vector. * If it's not a collection create a Vector and add the object to it. */ - public static Vector makeVectorFromObject(Object theObject) { + @SuppressWarnings({"unchecked"}) + public static Vector makeVectorFromObject(Object theObject) { if (theObject instanceof Vector) { - return ((Vector)theObject); + return ((Vector)theObject); } if (theObject instanceof Collection) { - Vector returnVector = new Vector(((Collection)theObject).size()); - Iterator iterator = ((Collection)theObject).iterator(); - while (iterator.hasNext()) { - returnVector.add(iterator.next()); - } + Collection col = ((Collection)theObject); + Vector returnVector = new Vector<>(col.size()); + returnVector.addAll(col); return returnVector; } - Vector returnVector = new Vector(); + Vector returnVector = new Vector<>(); returnVector.addElement(theObject); - return returnVector; + return (Vector) returnVector; } /** @@ -1232,7 +1224,7 @@ public static void outputClassFile(String className, byte[] classBytes, while (tokenizer.hasMoreTokens()) { token = tokenizer.nextToken(); if (tokenizer.hasMoreTokens()) { - directoryName.append(token + File.separator); + directoryName.append(token).append(File.separator); } } FileOutputStream fos = null; @@ -1314,10 +1306,10 @@ public static String printTimeFromMilliseconds(long milliseconds) { /** * Given a Vector, print it, even if there is a null in it */ - public static String printVector(Vector vector) { + public static String printVector(Vector vector) { StringWriter stringWriter = new StringWriter(); stringWriter.write("["); - Enumeration enumtr = vector.elements(); + Enumeration enumtr = vector.elements(); stringWriter.write(String.valueOf(enumtr.nextElement())); while (enumtr.hasMoreElements()) { stringWriter.write(" "); @@ -1328,26 +1320,26 @@ public static String printVector(Vector vector) { } - public static Hashtable rehashHashtable(Hashtable table) { - Hashtable rehashedTable = new Hashtable(table.size() + 2); + public static Hashtable rehashHashtable(Hashtable table) { + Hashtable rehashedTable = new Hashtable<>(table.size() + 2); - Enumeration values = table.elements(); - for (Enumeration keys = table.keys(); keys.hasMoreElements();) { - Object key = keys.nextElement(); - Object value = values.nextElement(); + Enumeration values = table.elements(); + for (Enumeration keys = table.keys(); keys.hasMoreElements();) { + K key = keys.nextElement(); + V value = values.nextElement(); rehashedTable.put(key, value); } return rehashedTable; } - public static Map rehashMap(Map table) { - HashMap rehashedTable = new HashMap(table.size() + 2); + public static Map rehashMap(Map table) { + Map rehashedTable = new HashMap<>(table.size() + 2); - Iterator values = table.values().iterator(); - for (Iterator keys = table.keySet().iterator(); keys.hasNext();) { - Object key = keys.next(); - Object value = values.next(); + Iterator values = table.values().iterator(); + for (Iterator keys = table.keySet().iterator(); keys.hasNext();) { + K key = keys.next(); + V value = values.next(); rehashedTable.put(key, value); } @@ -1457,9 +1449,9 @@ public static String replaceFirstSubString(String source, String subString, Stri return null; } - public static Vector reverseVector(Vector theVector) { - Vector tempVector = new Vector(theVector.size()); - Object currentElement; + public static Vector reverseVector(Vector theVector) { + Vector tempVector = new Vector<>(theVector.size()); + T currentElement; for (int i = theVector.size() - 1; i > -1; i--) { currentElement = theVector.elementAt(i); @@ -1542,7 +1534,7 @@ public static String shortenStringsByRemovingVowelsToFit(String s1, String s2, i } // - return buf1.toString() + buf2.toString(); + return buf1.toString() + buf2; } /** @@ -2156,14 +2148,14 @@ public static String truncate(String originalString, int size) { //need to reverse the string //bug fix: 3016423. append(BunfferString) is jdk1.4 version api. Use append(String) instead //in order to support jdk1.3. - newStringBuffer.append(newStringBufferTmp.reverse().toString()); + newStringBuffer.append(newStringBufferTmp.reverse()); return newStringBuffer.toString(); } } } //the shrunk string still too long, revrese the order back and truncate it! - return newStringBufferTmp.reverse().toString().substring(0, size); + return newStringBufferTmp.reverse().substring(0, size); } /** @@ -2219,8 +2211,8 @@ public static java.util.Date utilDateFromTimestamp(java.sql.Timestamp timestampO /** * Convert the specified array into a vector. */ - public static Vector vectorFromArray(Object[] array) { - Vector result = new Vector(array.length); + public static Vector vectorFromArray(T[] array) { + Vector result = new Vector<>(array.length); for (int i = 0; i < array.length; i++) { result.addElement(array[i]); } @@ -2258,7 +2250,7 @@ public static boolean isNumberNegativeOrZero(Object value) { * specified object in the specified list. * If the list is null or empty (or both the object and the list is null), 0 is returned. */ - public static int countOccurrencesOf(Object comparisonObject, List list) { + public static int countOccurrencesOf(Object comparisonObject, List list) { int instances = 0; boolean comparisonObjectIsNull = comparisonObject == null; if (list != null) { @@ -2422,7 +2414,7 @@ public static String convertLikeToRegex(String like) { public static boolean isLob(DatabaseField field) { int sqlType = field.sqlType; if (sqlType == DatabaseField.NULL_SQL_TYPE) { - Class type = field.getType(); + Class type = field.getType(); if (type != null) { return ClassConstants.BLOB.equals(type) || ClassConstants.CLOB.equals(type); } else { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ReadLockManager.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ReadLockManager.java index 24d7cb3a175..97ebd064f70 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ReadLockManager.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ReadLockManager.java @@ -150,7 +150,6 @@ public synchronized boolean isEmpty() { * that want to dump a snapshot of the current state of the system * or to go about doing */ - @SuppressWarnings("unchecked") @Override public synchronized ReadLockManager clone() { ReadLockManager clone = new ReadLockManager(); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/jpql/JPQLQueryContext.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/jpql/JPQLQueryContext.java index 15fc9518e89..8d5ff3f7a6b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/jpql/JPQLQueryContext.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/jpql/JPQLQueryContext.java @@ -16,7 +16,6 @@ package org.eclipse.persistence.internal.jpa.jpql; import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.security.AccessController; import java.security.PrivilegedActionException; import java.util.Collection; @@ -59,7 +58,6 @@ * @author Pascal Filion * @author John Bracken */ -@SuppressWarnings("nls") final class JPQLQueryContext { /** @@ -964,7 +962,7 @@ private Class loadInnerType(String typeName) { StringBuilder sb = new StringBuilder(); sb.append(typeName.substring(0, index)); sb.append("$"); - sb.append(typeName.substring(index + 1, typeName.length())); + sb.append(typeName.substring(index + 1)); typeName = sb.toString(); return loadTypeImp(typeName); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/AggregateNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/AggregateNode.java index 1129ccc6fc1..7b76b55aee7 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/AggregateNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/AggregateNode.java @@ -14,6 +14,8 @@ // Oracle - initial API and implementation from Oracle TopLink package org.eclipse.persistence.internal.jpa.parsing; +import org.eclipse.persistence.expressions.Expression; + /** * INTERNAL *

Purpose: Superclass for Aggregate Nodes @@ -23,9 +25,6 @@ * @author Jon Driscoll * @since TopLink 5.0 */ - -import org.eclipse.persistence.expressions.Expression; - public abstract class AggregateNode extends Node implements AliasableNode { private boolean distinct = false; @@ -43,7 +42,7 @@ public String resolveAttribute() { * resolveClass: Answer the class associated with my left node. */ @Override - public Class resolveClass(GenerationContext context) { + public Class resolveClass(GenerationContext context) { return getLeft().resolveClass(context); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/AttributeNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/AttributeNode.java index 3eaa0bcdb5f..817bb3d17a4 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/AttributeNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/AttributeNode.java @@ -87,7 +87,7 @@ public Expression appendCast(Expression exp, GenerationContext context){ return exp; } TypeHelper typeHelper = context.getParseTreeContext().getTypeHelper(); - Class cast = (Class)typeHelper.resolveSchema(castClassName); + Class cast = (Class)typeHelper.resolveSchema(castClassName); return exp.treat(cast); } @@ -195,7 +195,7 @@ public boolean isCollectionAttribute() { * resolveMapping: Answer the mapping which corresponds to my variableName. */ @Override - public DatabaseMapping resolveMapping(GenerationContext context, Class ownerClass) { + public DatabaseMapping resolveMapping(GenerationContext context, Class ownerClass) { ClassDescriptor descriptor = context.getSession().getDescriptor(ownerClass); return (descriptor==null) ? null : descriptor.getObjectBuilder().getMappingForAttributeName(getAttributeName()); } @@ -205,7 +205,7 @@ public DatabaseMapping resolveMapping(GenerationContext context, Class ownerClas * Answer null if the node represents a mapping that doesn't exist */ @Override - public Class resolveClass(GenerationContext context, Class ownerClass) { + public Class resolveClass(GenerationContext context, Class ownerClass) { DatabaseMapping mapping; mapping = resolveMapping(context, ownerClass); @@ -227,7 +227,7 @@ public Class resolveClass(GenerationContext context, Class ownerClass) { public String toString(int indent) { StringBuilder buffer = new StringBuilder(); toStringIndent(indent, buffer); - buffer.append(toStringDisplayName() + "[" + getAttributeName() + "]"); + buffer.append(toStringDisplayName()).append("[").append(getAttributeName()).append("]"); return buffer.toString(); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/CaseNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/CaseNode.java index 1643e289d98..a6ca75dc36b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/CaseNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/CaseNode.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 @@ -17,6 +17,7 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import org.eclipse.persistence.expressions.Expression; import org.eclipse.persistence.queries.ObjectLevelReadQuery; @@ -33,7 +34,7 @@ */ public class CaseNode extends Node implements AliasableNode { - private List whenClauses = null; + private List whenClauses = null; public CaseNode(){ @@ -49,7 +50,7 @@ public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext genera if (theQuery instanceof ReportQuery) { ReportQuery reportQuery = (ReportQuery)theQuery; Expression expression = generateExpression(generationContext); - reportQuery.addAttribute("Case", expression, (Class)getType()); + reportQuery.addAttribute("Case", expression, (Class)getType()); } } @@ -59,8 +60,8 @@ public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext genera */ @Override public Expression generateExpression(GenerationContext context) { - LinkedHashMap whenClauseMap = new LinkedHashMap(whenClauses.size()); - Iterator i = whenClauses.iterator(); + Map whenClauseMap = new LinkedHashMap<>(whenClauses.size()); + Iterator i = whenClauses.iterator(); while (i.hasNext()){ WhenThenNode clause = (WhenThenNode)i.next(); whenClauseMap.put(clause.generateExpressionForWhen(context), clause.generateExpressionForThen(context)); @@ -82,10 +83,10 @@ public void validate(ParseTreeContext context) { left.validate(context); } right.validate(context); - Iterator i = whenClauses.iterator(); + Iterator i = whenClauses.iterator(); Object type = null; while (i.hasNext()){ - Node node = ((Node)i.next()); + Node node = i.next(); node.validate(context); if (type == null){ type = node.getType(); @@ -100,11 +101,11 @@ public void validate(ParseTreeContext context) { } - public List getWhenClauses() { + public List getWhenClauses() { return whenClauses; } - public void setWhenClauses(List whenClauses) { + public void setWhenClauses(List whenClauses) { this.whenClauses = whenClauses; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/CoalesceNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/CoalesceNode.java index 5b4c78cfcc8..387951ca52a 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/CoalesceNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/CoalesceNode.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 @@ -33,7 +33,7 @@ */ public class CoalesceNode extends Node implements AliasableNode { - private List clauses = null; + private List clauses = null; public CoalesceNode(){ super(); @@ -58,23 +58,22 @@ public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext genera */ @Override public Expression generateExpression(GenerationContext context) { - List expressions = new ArrayList(); - Iterator i = clauses.iterator(); + List expressions = new ArrayList<>(); + Iterator i = clauses.iterator(); while (i.hasNext()){ - expressions.add(((Node)i.next()).generateExpression(context)); + expressions.add(i.next().generateExpression(context)); } - Expression whereClause = context.getBaseExpression().coalesce(expressions); - return whereClause; + return context.getBaseExpression().coalesce(expressions); } @Override public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); - Iterator i = clauses.iterator(); + Iterator i = clauses.iterator(); Object type = null; while (i.hasNext()){ - Node node = ((Node)i.next()); + Node node = i.next(); node.validate(context); if (type == null){ type = node.getType(); @@ -82,14 +81,14 @@ public void validate(ParseTreeContext context) { type = typeHelper.getObjectType(); } } - setType(((Node)clauses.get(0)).getType()); + setType(clauses.get(0).getType()); } - public List getClauses() { + public List getClauses() { return clauses; } - public void setClauses(List clauses) { + public void setClauses(List clauses) { this.clauses = clauses; } @@ -104,9 +103,9 @@ public String toString(int indent) { buffer.append("COALESCE"); buffer.append("("); - Iterator i = clauses.iterator(); + Iterator i = clauses.iterator(); while (i.hasNext()) { - Node n = (Node) i.next(); + Node n = i.next(); buffer.append(n.toString(indent)); buffer.append("\r\n"); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ConcatNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ConcatNode.java index 0364fc3a221..f1b8d8b878c 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ConcatNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ConcatNode.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 @@ -30,7 +30,7 @@ */ public class ConcatNode extends StringFunctionNode { - protected List objects = null; + protected List objects = null; /** * ConcatNode constructor comment. @@ -47,9 +47,9 @@ public ConcatNode() { public void validate(ParseTreeContext context) { super.validate(context); TypeHelper typeHelper = context.getTypeHelper(); - Iterator i = objects.iterator(); + Iterator i = objects.iterator(); while (i.hasNext()){ - Node node = (Node)i.next(); + Node node = i.next(); node.validate(context); node.validateParameter(context, typeHelper.getStringType()); } @@ -62,14 +62,14 @@ public void validate(ParseTreeContext context) { */ @Override public Expression generateExpression(GenerationContext context) { - Expression whereClause = ((Node)objects.get(0)).generateExpression(context); + Expression whereClause = objects.get(0).generateExpression(context); for (int i=1;i objects){ this.objects = objects; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ConstructorNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ConstructorNode.java index 6244bb99493..57e528b2d04 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ConstructorNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ConstructorNode.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 @@ -34,7 +34,7 @@ public class ConstructorNode extends Node implements AliasableNode { private String className = null; /** The list of constructor call argument nodes */ - public List constructorItems = new ArrayList(); + public List constructorItems = new ArrayList<>(); /** * Return a new ConstructorNode @@ -54,8 +54,8 @@ public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext contex ReportQuery reportQuery = (ReportQuery)theQuery; reportQuery.beginAddingConstructorArguments( getConstructorClass(context.getParseTreeContext())); - for (Iterator i = constructorItems.iterator(); i.hasNext();) { - Node node = (Node)i.next(); + for (Iterator i = constructorItems.iterator(); i.hasNext();) { + Node node = i.next(); if (selectingRelationshipField(node, context)) { selectContext.useOuterJoins(); } @@ -72,8 +72,8 @@ public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext contex */ @Override public void validate(ParseTreeContext context) { - for (Iterator i = constructorItems.iterator(); i.hasNext();) { - Node item = (Node)i.next(); + for (Iterator i = constructorItems.iterator(); i.hasNext();) { + Node item = i.next(); item.validate(context); } @@ -105,7 +105,7 @@ public boolean isConstructorNode() { * INTERNAL * Add an Order By Item to this node */ - public void addConstructorItem(Object theNode) { + public void addConstructorItem(Node theNode) { constructorItems.add(theNode); } @@ -113,7 +113,7 @@ public void addConstructorItem(Object theNode) { * INTERNAL * Set the list of constructor items of this node. */ - public void setConstructorItems(List items) { + public void setConstructorItems(List items) { this.constructorItems = items; } @@ -121,7 +121,7 @@ public void setConstructorItems(List items) { * INTERNAL * Get the list of constructor items of this node. */ - public List getConstructorItems() { + public List getConstructorItems() { return this.constructorItems; } @@ -130,13 +130,13 @@ public List getConstructorItems() { * @exception JPQLException if the specified constructor class could not * be found. */ - private Class getConstructorClass(ParseTreeContext context) { + private Class getConstructorClass(ParseTreeContext context) { Object type = getType(); if (type == null) { throw JPQLException.constructorClassNotFound( context.getQueryInfo(), getLine(), getColumn(), className); } - return (Class)type; + return (Class)type; } /** @@ -163,8 +163,8 @@ public String getAsString() { StringBuilder repr = new StringBuilder(); repr.append("NEW ").append(className); repr.append("("); - for (Iterator i = constructorItems.iterator(); i.hasNext();) { - Node node = (Node)i.next(); + for (Iterator i = constructorItems.iterator(); i.hasNext();) { + Node node = i.next(); repr.append(node.getAsString()); if (i.hasNext()) { repr.append(", "); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/DateFunctionNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/DateFunctionNode.java index d2619dbdf42..ba0822af7a9 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/DateFunctionNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/DateFunctionNode.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 @@ -32,7 +32,7 @@ */ public class DateFunctionNode extends FunctionalExpressionNode { - private Class type; + private Class type; /** * DateFunctionNode constructor. diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/DotNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/DotNode.java index 84f9c3a8249..3ecabfb2257 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/DotNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/DotNode.java @@ -18,7 +18,6 @@ import org.eclipse.persistence.expressions.*; import org.eclipse.persistence.internal.expressions.*; import org.eclipse.persistence.mappings.DatabaseMapping; -import org.eclipse.persistence.mappings.foundation.AbstractDirectMapping; import org.eclipse.persistence.queries.ObjectLevelReadQuery; import org.eclipse.persistence.queries.ReportQuery; @@ -217,7 +216,7 @@ public boolean endsWithDirectToField(GenerationContext context) { * INTERNAL * Returns the attribute type if the right represents a direct-to-field mapping. */ - public Class getTypeOfDirectToField(GenerationContext context) { + public Class getTypeOfDirectToField(GenerationContext context) { DatabaseMapping mapping = resolveMapping(context); if ((mapping != null) && mapping.isDirectToFieldMapping()) { return mapping.getAttributeClassification(); @@ -261,7 +260,7 @@ public String resolveAttribute() { */ @Override public DatabaseMapping resolveMapping(GenerationContext context) { - Class leftClass = getLeft().resolveClass(context); + Class leftClass = getLeft().resolveClass(context); return getRight().resolveMapping(context, leftClass); } @@ -269,8 +268,8 @@ public DatabaseMapping resolveMapping(GenerationContext context) { * resolveClass: Answer the class which results from traversing the mappings for the receiver's nodes */ @Override - public Class resolveClass(GenerationContext context) { - Class leftClass = getLeft().resolveClass(context); + public Class resolveClass(GenerationContext context) { + Class leftClass = getLeft().resolveClass(context); return getRight().resolveClass(context, leftClass); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/FromNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/FromNode.java index 0f04eba5acd..2edd91a7d52 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/FromNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/FromNode.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 @@ -29,7 +29,7 @@ */ public class FromNode extends MajorNode { - private List declarations; + private List declarations; public String getFirstVariable() { String variable = null; @@ -39,11 +39,11 @@ public String getFirstVariable() { return variable; } - public List getDeclarations() { + public List getDeclarations() { return declarations; } - public void setDeclarations(List decls) { + public void setDeclarations(List decls) { declarations = decls; } @@ -56,7 +56,7 @@ public void setDeclarations(List decls) { @Override public Node qualifyAttributeAccess(ParseTreeContext context) { for (int i = 0; i < declarations.size(); i++) { - Node decl = (Node)declarations.get(i); + Node decl = declarations.get(i); declarations.set(i, decl.qualifyAttributeAccess(context)); } return this; @@ -68,8 +68,8 @@ public Node qualifyAttributeAccess(ParseTreeContext context) { */ @Override public void validate(ParseTreeContext context) { - for (Iterator i = declarations.iterator(); i.hasNext();) { - Node decl = (Node)i.next(); + for (Iterator i = declarations.iterator(); i.hasNext();) { + Node decl = i.next(); decl.validate(context); } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/FuncNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/FuncNode.java index c4114d8a114..518bc82151a 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/FuncNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/FuncNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -47,11 +47,11 @@ public String getName() { return this.name; } - public void setParameters(List parameters) { + public void setParameters(List parameters) { this.parameters = parameters; } - public List getParameters() { + public List getParameters() { return this.parameters; } @@ -73,13 +73,12 @@ public Expression generateExpression(GenerationContext context) { return context.getBaseExpression().getFunction(this.name); } - List vExpressions = new ArrayList(size - 1); + List vExpressions = new ArrayList<>(size - 1); Expression base = this.parameters.get(0).generateExpression(context); for(int i=1; i < size; i++) { Expression child = this.parameters.get(i).generateExpression(context); vExpressions.add(child); } - Expression expression = base.getFunctionWithArguments(this.name, vExpressions); - return expression; + return base.getFunctionWithArguments(this.name, vExpressions); } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/GenerationContext.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/GenerationContext.java index b7526f15989..e3dc134ad6f 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/GenerationContext.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/GenerationContext.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 @@ -38,9 +38,9 @@ public class GenerationContext { protected AbstractSession session; protected ParseTreeContext parseTreeContext; - protected Class baseQueryClass; + protected Class baseQueryClass; protected Expression baseExpression; - protected Hashtable expressions; + protected Hashtable expressions; protected ParseTree parseTree; protected boolean isNotIndicatedInMemberOf = false; @@ -51,7 +51,7 @@ public class GenerationContext { public GenerationContext() { super(); - expressions = new Hashtable(); + expressions = new Hashtable<>(); } public GenerationContext(ParseTreeContext newContext, AbstractSession newSession, ParseTree newParseTree) { @@ -66,7 +66,7 @@ public void addExpression(Expression expression, String aliasName) { } public Expression expressionFor(String aliasName) { - Expression exp = (Expression) expressions.get(aliasName); + Expression exp = expressions.get(aliasName); if (exp == null && (! expressions.isEmpty()) && isSelectGenerationContext()) { GenerationContext outerContext = ((SelectGenerationContext) this).getOuterContext(); @@ -79,7 +79,7 @@ public Expression expressionFor(String aliasName) { return exp; } - public Class getBaseQueryClass() { + public Class getBaseQueryClass() { return baseQueryClass; } @@ -95,7 +95,7 @@ public AbstractSession getSession() { return session; } - public void setBaseQueryClass(java.lang.Class newBaseQueryClass) { + public void setBaseQueryClass(Class newBaseQueryClass) { baseQueryClass = newBaseQueryClass; } @@ -164,7 +164,7 @@ public boolean shouldUseOuterJoins() { } /** */ - public Expression joinVariables(Set variables) { + public Expression joinVariables(Set variables) { return null; } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/GroupByNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/GroupByNode.java index cc01b84e805..9a4f86b5676 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/GroupByNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/GroupByNode.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 @@ -28,7 +28,7 @@ */ public class GroupByNode extends MajorNode { - List groupByItems = null; + List groupByItems = null; /** * Return a new GroupByNode. @@ -42,8 +42,8 @@ public GroupByNode() { * Validate the current node. */ public void validate(ParseTreeContext context, SelectNode selectNode) { - for (Iterator i = groupByItems.iterator(); i.hasNext(); ) { - Node item = (Node)i.next(); + for (Iterator i = groupByItems.iterator(); i.hasNext(); ) { + Node item = i.next(); item.validate(context); } } @@ -54,9 +54,9 @@ public void validate(ParseTreeContext context, SelectNode selectNode) { */ public void addGroupingToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) { if (theQuery.isReportQuery()) { - Iterator iter = getGroupByItems().iterator(); + Iterator iter = getGroupByItems().iterator(); while (iter.hasNext()) { - Node nextNode = (Node)iter.next(); + Node nextNode = iter.next(); ((ReportQuery)theQuery).addGrouping(nextNode.generateExpression(context)); } } @@ -85,8 +85,8 @@ public boolean isValidHavingExpr(Node expr) { private boolean isGroupbyItem(Node expr) { if (expr.isDotNode() || expr.isVariableNode()) { String exprRepr = expr.getAsString(); - for (Iterator i = groupByItems.iterator(); i.hasNext();) { - Node item = (Node)i.next(); + for (Iterator i = groupByItems.iterator(); i.hasNext();) { + Node item = i.next(); String itemRepr = item.getAsString(); if (exprRepr.equals(itemRepr)) { return true; @@ -100,9 +100,9 @@ private boolean isGroupbyItem(Node expr) { * INTERNAL * Return the GROUP BY statements */ - public List getGroupByItems() { + public List getGroupByItems() { if (groupByItems == null) { - setGroupByItems(new Vector()); + setGroupByItems(new Vector<>()); } return groupByItems; } @@ -111,7 +111,7 @@ public List getGroupByItems() { * INTERNAL * Set the GROUP BY statements */ - public void setGroupByItems(List newItems) { + public void setGroupByItems(List newItems) { groupByItems = newItems; } @@ -122,14 +122,14 @@ public void setGroupByItems(List newItems) { @Override public String getAsString() { StringBuilder repr = new StringBuilder(); - for (Iterator i = groupByItems.iterator(); i.hasNext(); ) { - Node expr = (Node)i.next(); + for (Iterator i = groupByItems.iterator(); i.hasNext(); ) { + Node expr = i.next(); if (repr.length() > 0) { repr.append(", "); } repr.append(expr.getAsString()); } - return "GROUP BY " + repr.toString(); + return "GROUP BY " + repr; } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/InNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/InNode.java index 8076d44d983..d12d7514325 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/InNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/InNode.java @@ -34,7 +34,7 @@ */ public class InNode extends SimpleConditionalExpressionNode { - private List theObjects = null; + private List theObjects = null; //Was NOT indicated? "WHERE emp.lastName NOT IN (...) private boolean notIndicated = false; @@ -68,14 +68,14 @@ public void validate(ParseTreeContext context) { if (left != null) { left.validate(context); // check to see if the argument is a parameter - if (isListParameterOrSubquery && !getTheObjects().isEmpty() && ((Node)getTheObjects().get(0)).isParameterNode()){ + if (isListParameterOrSubquery && !getTheObjects().isEmpty() && getTheObjects().get(0).isParameterNode()){ leftType = Collection.class; } else { leftType = left.getType(); } } - for (Iterator i = getTheObjects().iterator(); i.hasNext();) { - Node node = (Node)i.next(); + for (Iterator i = getTheObjects().iterator(); i.hasNext();) { + Node node = i.next(); node.validate(context); node.validateParameter(context, leftType); Object nodeType = node.getType(); @@ -95,8 +95,8 @@ public void validate(ParseTreeContext context) { @Override public Expression generateExpression(GenerationContext context) { Expression whereClause = getLeft().generateExpression(context); - List arguments = getTheObjects(); - Node firstArg = (Node)arguments.get(0); + List arguments = getTheObjects(); + Node firstArg = arguments.get(0); if (firstArg.isSubqueryNode()) { SubqueryNode subqueryNode = (SubqueryNode)firstArg; ReportQuery reportQuery = subqueryNode.getReportQuery(context); @@ -113,9 +113,9 @@ public Expression generateExpression(GenerationContext context) { whereClause = whereClause.in(firstArg.generateExpression(context)); } } else { - Vector inArguments = new Vector(arguments.size()); - for (Iterator iter = arguments.iterator(); iter.hasNext();) { - Node nextNode = (Node)iter.next(); + Vector inArguments = new Vector<>(arguments.size()); + for (Iterator iter = arguments.iterator(); iter.hasNext();) { + Node nextNode = iter.next(); inArguments.add(nextNode.generateExpression(context)); } if (inArguments.size() > 0) { @@ -133,9 +133,9 @@ public Expression generateExpression(GenerationContext context) { * INTERNAL * Return the collection of the objects used as parameters for this node */ - public List getTheObjects() { + public List getTheObjects() { if (theObjects == null) { - setTheObjects(new Vector()); + setTheObjects(new Vector<>()); } return theObjects; } @@ -153,7 +153,7 @@ public void setIsListParameterOrSubquery(boolean isListParameterOrSubquery){ * INTERNAL * Set this node's object collection to the passed value */ - public void setTheObjects(List newTheObjects) { + public void setTheObjects(List newTheObjects) { theObjects = newTheObjects; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ModifyNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ModifyNode.java index 14d1fcb10a2..b30bb3b4a64 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ModifyNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ModifyNode.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 @@ -102,7 +102,7 @@ public String getCanonicalAbstractSchemaIdentifier() { * an alias, where the variableName is registered to an alias. */ @Override - public Class resolveClass(GenerationContext context) { + public Class resolveClass(GenerationContext context) { String alias = abstractSchemaName; ClassDescriptor descriptor = context.getSession().getDescriptorForAlias(alias); if (descriptor == null) { @@ -110,7 +110,7 @@ public Class resolveClass(GenerationContext context) { context.getParseTreeContext().getQueryInfo(), getLine(), getColumn(), alias); } - Class theClass = descriptor.getJavaClass(); + Class theClass = descriptor.getJavaClass(); if (theClass == null) { throw JPQLException.resolutionClassNotFoundException2( context.getParseTreeContext().getQueryInfo(), diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/Node.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/Node.java index fd27534c85a..28707cdf489 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/Node.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/Node.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 @@ -286,7 +286,7 @@ public String resolveAttribute() { * resolveClass: Answer the class associated with the content of this node. Default is to return null. * Subclasses should override this. */ - public Class resolveClass(GenerationContext context) { + public Class resolveClass(GenerationContext context) { return null; } @@ -294,7 +294,7 @@ public Class resolveClass(GenerationContext context) { * resolveClass: Answer the class associated with the content of this node. Default is to return null. * Subclasses should override this. */ - public Class resolveClass(GenerationContext context, Class ownerClass) { + public Class resolveClass(GenerationContext context, Class ownerClass) { return null; } @@ -311,7 +311,7 @@ public DatabaseMapping resolveMapping(GenerationContext context) { * class as the context. * Subclasses should override this. */ - public DatabaseMapping resolveMapping(GenerationContext context, Class ownerClass) { + public DatabaseMapping resolveMapping(GenerationContext context, Class ownerClass) { return null; } @@ -394,7 +394,7 @@ public String toString(int indent) { buffer.append("\r\n"); toStringIndent(indent, buffer); if (hasLeft()) { - buffer.append("Left: " + getLeft().toString(indent + 1)); + buffer.append("Left: ").append(getLeft().toString(indent + 1)); } else { buffer.append("Left: null"); } @@ -402,7 +402,7 @@ public String toString(int indent) { buffer.append("\r\n"); toStringIndent(indent, buffer); if (hasRight()) { - buffer.append("Right: " + getRight().toString(indent + 1)); + buffer.append("Right: ").append(getRight().toString(indent + 1)); } else { buffer.append("Right: null"); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/NodeFactory.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/NodeFactory.java index 16d9d13f547..eed65ae79d5 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/NodeFactory.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/NodeFactory.java @@ -62,24 +62,24 @@ Object newDeleteStatement(int line, int column, /** */ Object newSelectClause(int line, int column, - boolean distinct, List selectExprs); + boolean distinct, List selectExprs); - Object newSelectClause(int line, int column, boolean distinct, List selectExprs, List identifiers); + Object newSelectClause(int line, int column, boolean distinct, List selectExprs, List identifiers); /** */ - Object newFromClause(int line, int column, List varDecls); + Object newFromClause(int line, int column, List varDecls); /** */ Object newWhereClause(int line, int column, Object condition); /** */ - Object newGroupByClause(int line, int column, List items); + Object newGroupByClause(int line, int column, List items); /** */ Object newHavingClause(int line, int column, Object arg); /** */ - Object newOrderByClause(int line, int column, List items); + Object newOrderByClause(int line, int column, List items); /** */ Object newUpdateClause(int line, int column, @@ -220,7 +220,7 @@ Object newLike(int line, int column, boolean not, Object string, /** */ Object newIn(int line, int column, - boolean not, Object expr, List items); + boolean not, Object expr, List items); /** */ Object newIsNull(int line, int column, boolean not, Object expr); @@ -272,7 +272,7 @@ Object newMemberOf(int line, int column, boolean not, // ------------------------------------------ /** */ - Object newConcat(int line, int column, List objects); + Object newConcat(int line, int column, List objects); /** */ Object newSubstring(int line, int column, @@ -329,7 +329,7 @@ Object newLocate(int line, int column, // ------------------------------------------ /** */ - Object newFunc(int line, int column, String name, List parameters); + Object newFunc(int line, int column, String name, List parameters); // ------------------------------------------ // Subquery nodes @@ -366,10 +366,10 @@ Object newSubquery(int line, int column, Object select, Object from, Object wher /** */ Object newConstructor(int line, int colimn, - String className, List args); + String className, List args); /** */ - Object newSetClause(int line, int colimn, List assignments); + Object newSetClause(int line, int colimn, List assignments); /** */ Object newSetAssignmentClause(int line, int column, @@ -381,9 +381,9 @@ Object newSetAssignmentClause(int line, int column, Object newType(int line, int column, Object left); - Object newCaseClause(int line, int column, Object base, List whenClauses, Object elseClause); + Object newCaseClause(int line, int column, Object base, List whenClauses, Object elseClause); - Object newCoalesceClause(int line, int column, List clauses); + Object newCoalesceClause(int line, int column, List clauses); Object newNullIfClause(int line, int column, Object left, Object right); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/NodeFactoryImpl.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/NodeFactoryImpl.java index d2ccc3b80e4..62a9bc0e9c8 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/NodeFactoryImpl.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/NodeFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019 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 @@ -112,12 +112,12 @@ public Object newDeleteStatement(int line, int column, @Override public Object newSelectClause(int line, int column, - boolean distinct, List selectExprs) { + boolean distinct, List selectExprs) { return newSelectClause(line, column, distinct, selectExprs, null); } @Override - public Object newSelectClause(int line, int column, boolean distinct, List selectExprs, List identifiers) { + public Object newSelectClause(int line, int column, boolean distinct, List selectExprs, List identifiers) { SelectNode node = new SelectNode(); node.setContext(context); node.setSelectExpressions(selectExprs); @@ -125,7 +125,7 @@ public Object newSelectClause(int line, int column, boolean distinct, List selec if (identifiers != null){ for (int i=0;i decls) { FromNode node = new FromNode(); node.setContext(context); node.setDeclarations(decls); @@ -156,7 +156,7 @@ public Object newWhereClause(int line, int column, Object condition) { /** */ @Override - public Object newGroupByClause(int line, int column, List items) { + public Object newGroupByClause(int line, int column, List items) { GroupByNode node = new GroupByNode(); node.setContext(context); node.setGroupByItems(items); @@ -176,7 +176,7 @@ public Object newHavingClause(int line, int column, Object arg) { /** */ @Override - public Object newOrderByClause(int line, int column, List items) { + public Object newOrderByClause(int line, int column, List items) { OrderByNode node = new OrderByNode(); node.setContext(context); node.setOrderByItems(items); @@ -587,7 +587,7 @@ public Object newEscape(int line, int column, Object arg) { /** */ @Override public Object newIn(int line, int column, - boolean not, Object expr, List items) { + boolean not, Object expr, List items) { InNode node = new InNode(); if (not) node.indicateNot(); node.setLeft((Node)expr); @@ -723,7 +723,7 @@ public Object newNullLiteral(int line, int column) { /** */ @Override - public Object newConcat(int line, int column, List objects) { + public Object newConcat(int line, int column, List objects) { ConcatNode node = new ConcatNode(); node.setObjects(objects); setPosition(node, line, column); @@ -882,7 +882,7 @@ public Object newCurrentTimestamp(int line, int column) { /** */ @Override - public Object newFunc(int line, int column, String name, List parameters) { + public Object newFunc(int line, int column, String name, List parameters) { FuncNode node = new FuncNode(); if(name.startsWith("'") && name.endsWith("'")) { name = name.substring(1, name.length()-1); @@ -998,7 +998,7 @@ public Object newDescOrdering(int line, int column, Object arg) { /** */ @Override public Object newConstructor(int line, int column, - String className, List args) { + String className, List args) { ConstructorNode node = new ConstructorNode(className); node.setConstructorItems(args); setPosition(node, line, column); @@ -1007,7 +1007,7 @@ public Object newConstructor(int line, int column, /** */ @Override - public Object newSetClause(int line, int column, List assignments) { + public Object newSetClause(int line, int column, List assignments) { SetNode node = new SetNode(); node.setAssignmentNodes(assignments); setPosition(node, line, column); @@ -1077,7 +1077,7 @@ public Object newType(int line, int column, Object left){ } @Override - public Object newCaseClause(int line, int column, Object base, List whenClauses, Object elseClause){ + public Object newCaseClause(int line, int column, Object base, List whenClauses, Object elseClause){ CaseNode node = new CaseNode(); node.setWhenClauses(whenClauses); if (base != null){ @@ -1089,7 +1089,7 @@ public Object newCaseClause(int line, int column, Object base, List whenClauses, } @Override - public Object newCoalesceClause(int line, int column, List clauses){ + public Object newCoalesceClause(int line, int column, List clauses){ CoalesceNode node = new CoalesceNode(); node.setClauses(clauses); setPosition(node, line, column); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/OrNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/OrNode.java index 376382468f7..8187e374a60 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/OrNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/OrNode.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 @@ -29,8 +29,8 @@ */ public class OrNode extends LogicalOperatorNode { - private Set leftOuterScopeVariables = null; - private Set rightOuterScopeVariables = null; + private Set leftOuterScopeVariables = null; + private Set rightOuterScopeVariables = null; /** * Return a new OrNode. @@ -45,7 +45,7 @@ public OrNode() { */ @Override public void validate(ParseTreeContext context) { - Set saved = context.getOuterScopeVariables(); + Set saved = context.getOuterScopeVariables(); if (left != null) { context.resetOuterScopeVariables(); left.validate(context); @@ -89,7 +89,7 @@ public Expression generateExpression(GenerationContext context) { * INTERNAL */ private Expression appendOuterScopeVariableJoins( - Expression expr, Set outerScopeVariables, GenerationContext context) { + Expression expr, Set outerScopeVariables, GenerationContext context) { if ((outerScopeVariables == null) || outerScopeVariables.isEmpty()) { // no outer scope variables => nothing to be done return expr; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/OrderByNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/OrderByNode.java index 7508a5f24dc..105b8d30592 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/OrderByNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/OrderByNode.java @@ -16,7 +16,6 @@ import java.util.*; -import org.eclipse.persistence.queries.ReadAllQuery; import org.eclipse.persistence.queries.ObjectLevelReadQuery; /** @@ -30,7 +29,7 @@ */ public class OrderByNode extends MajorNode { - List orderByItems = null; + List orderByItems = null; /** * Return a new OrderByNode. @@ -45,9 +44,9 @@ public OrderByNode() { */ public void addOrderingToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) { if (theQuery.isReadAllQuery()) { - Iterator iter = getOrderByItems().iterator(); + Iterator iter = getOrderByItems().iterator(); while (iter.hasNext()) { - Node nextNode = (Node)iter.next(); + Node nextNode = iter.next(); theQuery.addOrdering(nextNode.generateExpression(context)); } } @@ -58,8 +57,8 @@ public void addOrderingToQuery(ObjectLevelReadQuery theQuery, GenerationContext * Validate node. */ public void validate(ParseTreeContext context, SelectNode selectNode) { - for (Iterator i = orderByItems.iterator(); i.hasNext(); ) { - Node item = (Node)i.next(); + for (Iterator i = orderByItems.iterator(); i.hasNext(); ) { + Node item = i.next(); item.validate(context); } } @@ -68,9 +67,9 @@ public void validate(ParseTreeContext context, SelectNode selectNode) { * INTERNAL * Return the order by statements */ - public List getOrderByItems() { + public List getOrderByItems() { if (orderByItems == null) { - setOrderByItems(new Vector()); + setOrderByItems(new Vector<>()); } return orderByItems; } @@ -79,7 +78,7 @@ public List getOrderByItems() { * INTERNAL * Set the order by statements */ - public void setOrderByItems(List newItems) { + public void setOrderByItems(List newItems) { orderByItems = newItems; } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ParseTree.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ParseTree.java index e2f889a9611..5e302c3216f 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ParseTree.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ParseTree.java @@ -14,12 +14,18 @@ // Oracle - initial API and implementation from Oracle TopLink package org.eclipse.persistence.internal.jpa.parsing; -import java.util.*; - -import org.eclipse.persistence.expressions.*; -import org.eclipse.persistence.queries.*; -import org.eclipse.persistence.internal.localization.*; +import org.eclipse.persistence.expressions.Expression; +import org.eclipse.persistence.expressions.ExpressionBuilder; +import org.eclipse.persistence.internal.localization.ToStringLocalization; import org.eclipse.persistence.internal.sessions.AbstractSession; +import org.eclipse.persistence.queries.DatabaseQuery; +import org.eclipse.persistence.queries.DeleteAllQuery; +import org.eclipse.persistence.queries.ModifyAllQuery; +import org.eclipse.persistence.queries.ObjectLevelReadQuery; +import org.eclipse.persistence.queries.UpdateAllQuery; + +import java.util.Iterator; +import java.util.Set; /** * INTERNAL @@ -49,7 +55,7 @@ public class ParseTree { private ClassLoader classLoader = null; private short distinctState = ObjectLevelReadQuery.UNCOMPUTED_DISTINCT; private boolean validated = false; - private Set unusedVariables = null; + private Set unusedVariables = null; /** * Return a new ParseTree. @@ -74,7 +80,7 @@ public DatabaseQuery createDatabaseQuery() { * Need to test this for Employee, employee.getAddress(), report query */ public void adjustReferenceClassForQuery(DatabaseQuery theQuery, GenerationContext generationContext) { - Class referenceClass = getReferenceClass(theQuery, generationContext); + Class referenceClass = getReferenceClass(theQuery, generationContext); if ((referenceClass != null) && (referenceClass != theQuery.getReferenceClass())) { if (theQuery.isObjectLevelReadQuery()) { // The referenceClass needs to be changed. @@ -98,7 +104,7 @@ public void initBaseExpression(ObjectLevelReadQuery theQuery, GenerationContext String variable = getFromNode().getFirstVariable(); ParseTreeContext context = generationContext.getParseTreeContext(); if (context.isRangeVariable(variable)) { - Class referenceClass = theQuery.getReferenceClass(); + Class referenceClass = theQuery.getReferenceClass(); // Create a new expression builder for the reference class ExpressionBuilder builder = new ExpressionBuilder(referenceClass); // Use the expression builder as the default expression builder for the query @@ -109,7 +115,7 @@ public void initBaseExpression(ObjectLevelReadQuery theQuery, GenerationContext // Get the declaring node for the variable Node path = context.pathForVariable(variable); // Get the ExpressionBuilder of the range variable for the path - Class baseClass = getBaseExpressionClass(path, generationContext); + Class baseClass = getBaseExpressionClass(path, generationContext); // and change the reference class accordingly theQuery.setReferenceClass(baseClass); theQuery.changeDescriptor(generationContext.getSession()); @@ -129,7 +135,7 @@ public void initBaseExpression(ObjectLevelReadQuery theQuery, GenerationContext public void initBaseExpression(ModifyAllQuery theQuery, GenerationContext generationContext) { ModifyNode queryNode = (ModifyNode)getQueryNode(); String variable = queryNode.getCanonicalAbstractSchemaIdentifier(); - Class referenceClass = theQuery.getReferenceClass(); + Class referenceClass = theQuery.getReferenceClass(); // Create a new expression builder for the reference class ExpressionBuilder builder = new ExpressionBuilder(referenceClass); // Use the expression builder as the default expression builder for the query @@ -139,28 +145,28 @@ public void initBaseExpression(ModifyAllQuery theQuery, GenerationContext genera } /** */ - private Class getBaseExpressionClass(Node node, GenerationContext generationContext) { + private Class getBaseExpressionClass(Node node, GenerationContext generationContext) { ParseTreeContext context = generationContext.getParseTreeContext(); - Class clazz = null; - if (node == null) { - clazz = null; - } else if (node.isDotNode()) { - // DotNode: delegate to left - clazz = getBaseExpressionClass(node.getLeft(), generationContext); - } else if (node.isVariableNode()) { - // VariableNode - String variable = ((VariableNode)node).getCanonicalVariableName(); - if (!context.isRangeVariable(variable)) { - Node path = context.pathForVariable(variable); - // Variable is defined in JOIN/IN clause => - // return the Class from its definition - clazz = getBaseExpressionClass(path, generationContext); - } else { - // Variable is defined in range variable decl => - // return its class - String schema = context.schemaForVariable(variable); - if (schema != null) { - clazz = context.classForSchemaName(schema, generationContext); + Class clazz = null; + if (node != null) { + if (node.isDotNode()) { + // DotNode: delegate to left + clazz = getBaseExpressionClass(node.getLeft(), generationContext); + } else if (node.isVariableNode()) { + // VariableNode + String variable = ((VariableNode) node).getCanonicalVariableName(); + if (!context.isRangeVariable(variable)) { + Node path = context.pathForVariable(variable); + // Variable is defined in JOIN/IN clause => + // return the Class from its definition + clazz = getBaseExpressionClass(path, generationContext); + } else { + // Variable is defined in range variable decl => + // return its class + String schema = context.schemaForVariable(variable); + if (schema != null) { + clazz = context.classForSchemaName(schema, generationContext); + } } } } @@ -280,8 +286,8 @@ public void addHavingToQuery(ObjectLevelReadQuery theQuery, GenerationContext ge */ public void addNonFetchJoinAttributes(ObjectLevelReadQuery theQuery, GenerationContext generationContext) { ParseTreeContext context = generationContext.getParseTreeContext(); - for (Iterator i = unusedVariables.iterator(); i.hasNext();) { - String variable = (String)i.next(); + for (Iterator i = unusedVariables.iterator(); i.hasNext();) { + String variable = i.next(); Expression expr = null; if (!context.isRangeVariable(variable)) { Node path = context.pathForVariable(variable); @@ -314,10 +320,10 @@ public void addParametersToQuery(DatabaseQuery query) { //Bug#4646580 Add arguments to query if (context.hasParameters()) { TypeHelper typeHelper = context.getTypeHelper(); - for (Iterator i = context.getParameterNames().iterator(); i.hasNext();) { - String param = (String)i.next(); + for (Iterator i = context.getParameterNames().iterator(); i.hasNext();) { + String param = i.next(); Object type = context.getParameterType(param); - Class clazz = typeHelper.getJavaClass(type); + Class clazz = typeHelper.getJavaClass(type); if (clazz == null) { clazz = Object.class; } @@ -431,7 +437,7 @@ public HavingNode getHavingNode() { * getReferenceClass(): Answer the class which will be the reference class for the query. * Resolve this using the node parsed from the "SELECT" of the EJBQL query string */ - public Class getReferenceClass(DatabaseQuery query, GenerationContext generationContext) { + public Class getReferenceClass(DatabaseQuery query, GenerationContext generationContext) { if (getQueryNode() == null) { return null; } @@ -584,9 +590,7 @@ public void setDistinctState(short newDistinctState) { */ @Override public String toString() { - StringBuilder buffer = new StringBuilder(); - buffer.append(getContext().toString()); - return ToStringLocalization.buildMessage("context", null) + " " + buffer.toString(); + return ToStringLocalization.buildMessage("context", null) + " " + getContext().toString(); } /** diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ParseTreeContext.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ParseTreeContext.java index 458c20628e3..56e9b93a3ee 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ParseTreeContext.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/ParseTreeContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019 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 @@ -43,14 +43,14 @@ * @since TopLink 4.0 */ public class ParseTreeContext { - private Map variableDecls; + private Map variableDecls; private String baseVariable; private int currentScope; - private Set outerScopeVariables; - private Map fetchJoins; + private Set outerScopeVariables; + private Map> fetchJoins; private TypeHelper typeHelper; - private Map parameterTypes; - private List parameterNames; + private Map parameterTypes; + private List parameterNames; private NodeFactory nodeFactory; private String queryInfo; @@ -60,12 +60,12 @@ public class ParseTreeContext { */ public ParseTreeContext(NodeFactory nodeFactory, String queryInfo) { super(); - variableDecls = new HashMap(); + variableDecls = new HashMap<>(); currentScope = 0; - fetchJoins = new HashMap(); + fetchJoins = new HashMap<>(); typeHelper = null; - parameterTypes = new HashMap(); - parameterNames = new ArrayList(); + parameterTypes = new HashMap<>(); + parameterNames = new ArrayList<>(); this.nodeFactory = nodeFactory; this.queryInfo = queryInfo; } @@ -75,7 +75,7 @@ public ParseTreeContext(NodeFactory nodeFactory, String queryInfo) { * Associate the given schema with the given variable. */ public void registerSchema(String variable, String schema, int line, int column) { - VariableDecl decl = (VariableDecl)variableDecls.get(variable); + VariableDecl decl = variableDecls.get(variable); if (decl == null) { decl = new VariableDecl(variable, schema); variableDecls.put(variable, decl); @@ -91,7 +91,7 @@ public void registerSchema(String variable, String schema, int line, int column) * Associate the given path with the given variable. */ public void registerJoinVariable(String variable, Node path, int line, int column) { - VariableDecl decl = (VariableDecl)variableDecls.get(variable); + VariableDecl decl = variableDecls.get(variable); if (decl == null) { decl = new VariableDecl(variable, path); variableDecls.put(variable, decl); @@ -113,7 +113,7 @@ public void unregisterVariable(String variable) { * Returns true if the specified string denotes a variable. */ public boolean isVariable(String variable) { - VariableDecl decl = (VariableDecl)variableDecls.get(variable); + VariableDecl decl = variableDecls.get(variable); return decl != null; } @@ -121,9 +121,8 @@ public boolean isVariable(String variable) { * INTERNAL * Returns true if the specified string denotes a range variable. */ - /** */ public boolean isRangeVariable(String variable) { - VariableDecl decl = (VariableDecl)variableDecls.get(variable); + VariableDecl decl = variableDecls.get(variable); return (decl != null) && decl.isRangeVariable; } @@ -133,7 +132,7 @@ public boolean isRangeVariable(String variable) { * range variable. */ public String schemaForVariable(String variable) { - VariableDecl decl = (VariableDecl)variableDecls.get(variable); + VariableDecl decl = variableDecls.get(variable); return (decl != null) ? decl.schema : null; } @@ -141,12 +140,12 @@ public String schemaForVariable(String variable) { * INTERNAL * Answer the class associated with the provided schema name */ - public Class classForSchemaName(String schemaName, GenerationContext context) { + public Class classForSchemaName(String schemaName, GenerationContext context) { ClassDescriptor descriptor = context.getSession().getDescriptorForAlias(schemaName); if (descriptor == null) { throw JPQLException.entityTypeNotFound(getQueryInfo(), schemaName); } - Class theClass = descriptor.getJavaClass(); + Class theClass = descriptor.getJavaClass(); if (theClass == null) { throw JPQLException.resolutionClassNotFoundException(getQueryInfo(), schemaName); } @@ -160,11 +159,11 @@ public Class classForSchemaName(String schemaName, GenerationContext context) { * SELECT OBJECT (emp) FROM Employee emp * getVariableNameForClass(Employee.class) => "emp" */ - public String getVariableNameForClass(Class theClass, GenerationContext context) { - for (Iterator i = variableDecls.entrySet().iterator(); i.hasNext(); ) { - Map.Entry entry = (Map.Entry)i.next(); - String nextVariable = (String)entry.getKey(); - VariableDecl decl = (VariableDecl)entry.getValue(); + public String getVariableNameForClass(Class theClass, GenerationContext context) { + for (Iterator> i = variableDecls.entrySet().iterator(); i.hasNext(); ) { + Map.Entry entry = i.next(); + String nextVariable = entry.getKey(); + VariableDecl decl = entry.getValue(); if ((decl.schema != null) && (theClass == this.classForSchemaName(decl.schema, context))) { return nextVariable; @@ -179,7 +178,7 @@ public String getVariableNameForClass(Class theClass, GenerationContext context) * member variable. */ public Node pathForVariable(String variable) { - VariableDecl decl = (VariableDecl)variableDecls.get(variable); + VariableDecl decl = variableDecls.get(variable); return (decl != null) ? decl.path : null; } @@ -209,8 +208,8 @@ public String getQueryInfo() { * outer scope. */ public boolean isDeclaredInOuterScope(String variable) { - VariableDecl decl = (VariableDecl)variableDecls.get(variable); - return (decl != null) ? (decl.scope < currentScope) : false; + VariableDecl decl = variableDecls.get(variable); + return decl != null && (decl.scope < currentScope); } /** @@ -218,7 +217,7 @@ public boolean isDeclaredInOuterScope(String variable) { * Sets the scope of the specified variable to the current scope. */ public void setScopeOfVariable(String variable) { - VariableDecl decl = (VariableDecl)variableDecls.get(variable); + VariableDecl decl = variableDecls.get(variable); if (decl != null) { decl.scope = currentScope; } @@ -253,7 +252,7 @@ public void registerOuterScopeVariable(String variable) { * INTERNAL * Returns the set of outer scope variables. */ - public Set getOuterScopeVariables() { + public Set getOuterScopeVariables() { return outerScopeVariables; } @@ -262,14 +261,14 @@ public Set getOuterScopeVariables() { * Resets the set of outer scope variables. */ public void resetOuterScopeVariables() { - outerScopeVariables = new HashSet(); + outerScopeVariables = new HashSet<>(); } /** * INTERNAL * Resets the set of outer scope variables. */ - public void resetOuterScopeVariables(Set variables) { + public void resetOuterScopeVariables(Set variables) { outerScopeVariables = variables; } @@ -278,37 +277,39 @@ public void resetOuterScopeVariables(Set variables) { * JOIN FETCH node. */ public void registerFetchJoin(String variableName, Node node) { - List joins = (List)fetchJoins.get(variableName); + List joins = fetchJoins.get(variableName); if (joins == null) { - joins = new ArrayList(); + joins = new ArrayList<>(); fetchJoins.put(variableName, joins); } joins.add(node); } /** Returns a list of FETCH JOIN nodes for the specified attached to the - * specified variable. */ - public List getFetchJoins(String variableName) { - return (List)fetchJoins.get(variableName); + * specified variable. + */ + public List getFetchJoins(String variableName) { + return fetchJoins.get(variableName); } /** Mark the specified variable as used if it is declared in the current * scope. */ public void usedVariable(String variable) { - VariableDecl decl = (VariableDecl)variableDecls.get(variable); + VariableDecl decl = variableDecls.get(variable); if ((decl != null) && (decl.scope == currentScope)) { decl.used = true; } } /** Returns s set of variables that are declared in the current scope, - * but not used in the query. */ - public Set getUnusedVariables() { - Set unused = new HashSet(); - for (Iterator i = variableDecls.entrySet().iterator(); i.hasNext();) { - Map.Entry entry = (Map.Entry)i.next(); - String variable = (String)entry.getKey(); - VariableDecl decl = (VariableDecl)entry.getValue(); + * but not used in the query. + */ + public Set getUnusedVariables() { + Set unused = new HashSet<>(); + for (Iterator> i = variableDecls.entrySet().iterator(); i.hasNext();) { + Map.Entry entry = i.next(); + String variable = entry.getKey(); + VariableDecl decl = entry.getValue(); if ((decl.scope == currentScope) && !decl.used) { unused.add(variable); } @@ -320,13 +321,13 @@ public Set getUnusedVariables() { //true => "SELECT OBJECT (emp1) FROM Employee emp1, Employee emp2 WHERE ..." //false => "SELECT OBJECT (emp) FROM Employee emp WHERE ..." public boolean hasMoreThanOneVariablePerType() { - Map typeNamesToVariables = new HashMap(); + Map typeNamesToVariables = new HashMap<>(); int nrOfRangeVariables = 0; //Map the Aliases to the variable names, then check the count - for (Iterator i = variableDecls.entrySet().iterator(); i.hasNext(); ) { - Map.Entry entry = (Map.Entry)i.next(); - String variable = (String)entry.getKey(); - VariableDecl decl = (VariableDecl)entry.getValue(); + for (Iterator> i = variableDecls.entrySet().iterator(); i.hasNext(); ) { + Map.Entry entry = i.next(); + String variable = entry.getKey(); + VariableDecl decl = entry.getValue(); if (decl.isRangeVariable) { nrOfRangeVariables++; typeNamesToVariables.put(decl.schema, variable); @@ -340,11 +341,11 @@ public boolean hasMoreThanOneVariablePerType() { //false => "SELECT OBJECT (emp) FROM Employee emp WHERE ..." //false => "SELECT OBJECT (emp1) FROM Employee emp1, Employee emp2 WHERE ..." public boolean hasMoreThanOneAliasInFrom() { - Map typeNamesToVariables = new HashMap(); - for (Iterator i = variableDecls.entrySet().iterator(); i.hasNext(); ) { - Map.Entry entry = (Map.Entry)i.next(); - String variable = (String)entry.getKey(); - VariableDecl decl = (VariableDecl)entry.getValue(); + Map typeNamesToVariables = new HashMap<>(); + for (Iterator> i = variableDecls.entrySet().iterator(); i.hasNext(); ) { + Map.Entry entry = i.next(); + String variable = entry.getKey(); + VariableDecl decl = entry.getValue(); if (decl.isRangeVariable) { typeNamesToVariables.put(decl.schema, variable); } @@ -425,7 +426,7 @@ public Object getParameterType(String parameter) { * INTERNAL * Return the parameter names. */ - public List getParameterNames() { + public List getParameterNames() { return parameterNames; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/QueryNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/QueryNode.java index 6873a0aa9ab..e16a9989d69 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/QueryNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/QueryNode.java @@ -55,7 +55,7 @@ protected QueryNode() { * Compute the Reference class for this query * @return the class this query is querying for */ - public Class getReferenceClass(GenerationContext genContext) { + public Class getReferenceClass(GenerationContext genContext) { return resolveClass(genContext); } @@ -75,7 +75,7 @@ public boolean isDeleteNode() { * Return the class represented in this node. */ @Override - public abstract Class resolveClass(GenerationContext context); + public abstract Class resolveClass(GenerationContext context); /** * Set the parseTree diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SelectGenerationContext.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SelectGenerationContext.java index df797d6ed8e..a55a7f8c24a 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SelectGenerationContext.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SelectGenerationContext.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 @@ -142,14 +142,14 @@ public GenerationContext getOuterContext() { * connect the inner variable expression with the outer one. */ @Override - public Expression joinVariables(Set variables) { + public Expression joinVariables(Set variables) { if ((outer == null) || (variables == null) || variables.isEmpty()) { // not an inner query or no variables to join return null; } Expression expr = null; - for (Iterator i = variables.iterator(); i.hasNext(); ) { - String name = (String)i.next(); + for (Iterator i = variables.iterator(); i.hasNext(); ) { + String name = i.next(); VariableNode var = new VariableNode(name); Expression innerExpr = var.generateExpression(this); Expression outerExpr = var.generateExpression(outer); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SelectNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SelectNode.java index 25f60eae2a6..3c3d5999b23 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SelectNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SelectNode.java @@ -54,27 +54,27 @@ */ public class SelectNode extends QueryNode { - private List selectExpressions = new ArrayList(); - private List identifiers = new ArrayList(); + private List selectExpressions = new ArrayList<>(); + private List identifiers = new ArrayList<>(); private boolean distinct = false; public SelectNode() { } - public List getSelectExpressions() { + public List getSelectExpressions() { return selectExpressions; } - public void setSelectExpressions(List exprs) { + public void setSelectExpressions(List exprs) { selectExpressions = exprs; } - public List getIdentifiers() { + public List getIdentifiers() { return identifiers; } - public void setIdentifiers(List identifiers) { + public void setIdentifiers(List identifiers) { this.identifiers = identifiers; } @@ -174,12 +174,12 @@ public void applyToQuery(DatabaseQuery theQuery, GenerationContext context) { } SelectGenerationContext selectContext = (SelectGenerationContext)context; for (int i=0;i i = selectExpressions.iterator(); i.hasNext();) { + Node node = i.next(); if (hasOneToOneSelected(node, context)) { return true; } @@ -230,9 +230,9 @@ private boolean hasOneToOneSelected(Node node, GenerationContext context) { } if (node.isConstructorNode()) { - List args = ((ConstructorNode)node).getConstructorItems(); - for (Iterator i = args.iterator(); i.hasNext();) { - Node arg = (Node)i.next(); + List args = ((ConstructorNode)node).getConstructorItems(); + for (Iterator i = args.iterator(); i.hasNext();) { + Node arg = i.next(); if (hasOneToOneSelected(arg, context)) { return true; } @@ -252,8 +252,8 @@ private boolean hasOneToOneSelected(Node node, GenerationContext context) { * Invalid: SELECT OBJECT(badAlias) FROM Employee emp WHERE ... */ public void verifySelectedAlias(GenerationContext context) { - for (Iterator i = selectExpressions.iterator(); i.hasNext();) { - Node node = (Node)i.next(); + for (Iterator i = selectExpressions.iterator(); i.hasNext();) { + Node node = i.next(); //if the node is a DotNode, there is no selected alias if (node.isDotNode()) { return; @@ -269,8 +269,8 @@ public void verifySelectedAlias(GenerationContext context) { * False: "SELECT OBJECT(somethingElse) ..." & variableName = "emp" */ public boolean isSelected(String variableName) { - for (Iterator i = selectExpressions.iterator(); i.hasNext();) { - Node node = (Node)i.next(); + for (Iterator i = selectExpressions.iterator(); i.hasNext();) { + Node node = i.next(); //Make sure we've SELECted a VariableNode if (node.isVariableNode() && ((VariableNode)node).getCanonicalVariableName().equals(variableName)) { @@ -293,7 +293,7 @@ public boolean isSelectNode() { @Override public Node qualifyAttributeAccess(ParseTreeContext context) { for (int i = 0; i < selectExpressions.size(); i++) { - Node item = (Node)selectExpressions.get(i); + Node item = selectExpressions.get(i); selectExpressions.set(i, item.qualifyAttributeAccess(context)); } return this; @@ -304,8 +304,8 @@ public Node qualifyAttributeAccess(ParseTreeContext context) { */ @Override public void validate(ParseTreeContext context) { - for (Iterator i = selectExpressions.iterator(); i.hasNext(); ) { - Node item = (Node)i.next(); + for (Iterator i = selectExpressions.iterator(); i.hasNext(); ) { + Node item = i.next(); item.validate(context); } } @@ -314,7 +314,7 @@ public void validate(ParseTreeContext context) { * Answer the class associated with my left node. */ @Override - public Class resolveClass(GenerationContext context) { + public Class resolveClass(GenerationContext context) { return getReferenceClass(context); } @@ -331,12 +331,12 @@ public Expression generateExpression(GenerationContext context) { * @return the class this query is querying for */ @Override - public Class getReferenceClass(GenerationContext context) { + public Class getReferenceClass(GenerationContext context) { return getClassOfFirstVariable(context); } - private Class getClassOfFirstVariable(GenerationContext context) { - Class clazz = null; + private Class getClassOfFirstVariable(GenerationContext context) { + Class clazz = null; String variable = getParseTree().getFromNode().getFirstVariable(); ParseTreeContext parseTreeContext = context.getParseTreeContext(); if (parseTreeContext.isRangeVariable(variable)) { @@ -357,8 +357,8 @@ private Class getClassOfFirstVariable(GenerationContext context) { * Answer true if a variable in the IN clause is SELECTed */ public boolean isVariableInINClauseSelected(GenerationContext context) { - for (Iterator i = selectExpressions.iterator(); i.hasNext();) { - Node node = (Node)i.next(); + for (Iterator i = selectExpressions.iterator(); i.hasNext();) { + Node node = i.next(); if (node.isVariableNode()) { String variableNameForLeft = ((VariableNode)node).getCanonicalVariableName(); @@ -419,7 +419,7 @@ private boolean selectingDirectToField(Node node, GenerationContext context) { */ private Node getFirstSelectExpressionNode() { return selectExpressions.size() > 0 ? - (Node)selectExpressions.get(0) : null; + selectExpressions.get(0) : null; } private boolean isSingleSelectExpression() { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SetNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SetNode.java index cb6843f74bd..f81895fab6b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SetNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SetNode.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 @@ -24,11 +24,11 @@ * Slightly different from other nodes since holds more than two children in a list. */ public class SetNode extends MajorNode { - private List assignmentNodes = null; + private List assignmentNodes = null; public SetNode() { super(); - assignmentNodes = new Vector(); + assignmentNodes = new Vector<>(); } /** @@ -36,7 +36,7 @@ public SetNode() { * built expressions on the query. */ public void addUpdatesToQuery(UpdateAllQuery theQuery, GenerationContext context) { - Iterator iterator = assignmentNodes.iterator(); + Iterator iterator = assignmentNodes.iterator(); while (iterator.hasNext()) { EqualsAssignmentNode node = (EqualsAssignmentNode)iterator.next(); Expression leftExpression = getExpressionForNode(node.getLeft(), theQuery.getReferenceClass(), context); @@ -53,8 +53,8 @@ public void addUpdatesToQuery(UpdateAllQuery theQuery, GenerationContext context */ @Override public Node qualifyAttributeAccess(ParseTreeContext context) { - for (Iterator i = assignmentNodes.iterator(); i.hasNext(); ) { - Node item = (Node)i.next(); + for (Iterator i = assignmentNodes.iterator(); i.hasNext(); ) { + Node item = i.next(); item.qualifyAttributeAccess(context); } return this; @@ -66,8 +66,8 @@ public Node qualifyAttributeAccess(ParseTreeContext context) { */ @Override public void validate(ParseTreeContext context) { - for (Iterator i = assignmentNodes.iterator(); i.hasNext(); ) { - Node item = (Node)i.next(); + for (Iterator i = assignmentNodes.iterator(); i.hasNext(); ) { + Node item = i.next(); item.validate(context); } } @@ -77,7 +77,7 @@ public void validate(ParseTreeContext context) { * We will assume that set_to nodes change elements that are direct mappings on the reference * class of the query. */ - protected Expression getExpressionForNode(Node node, Class referenceClass, GenerationContext context) { + protected Expression getExpressionForNode(Node node, Class referenceClass, GenerationContext context) { Expression expression = null; if (node.isAttributeNode()) { // look up a preexisting expression based on the reference class of the query. @@ -97,7 +97,7 @@ protected Expression getExpressionForNode(Node node, Class referenceClass, Gener /** * INTERNAL */ - public void setAssignmentNodes(List nodes) { + public void setAssignmentNodes(List nodes) { assignmentNodes = nodes; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SubqueryNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SubqueryNode.java index b6df68406f2..8f2052413f6 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SubqueryNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SubqueryNode.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 @@ -29,7 +29,7 @@ public class SubqueryNode extends Node { /** Set of names of variables declared in an outer scope and used in teh * subquery. */ - private Set outerVars; + private Set outerVars; /** * Return a new SubqueryNode. @@ -85,7 +85,7 @@ public void validate(ParseTreeContext context) { outerVars = context.getOuterScopeVariables(); SelectNode selectNode = (SelectNode)subqueryParseTree.getQueryNode(); // Get the select expression, subqueries only have one - Node selectExpr = (Node)selectNode.getSelectExpressions().get(0); + Node selectExpr = selectNode.getSelectExpressions().get(0); setType(selectExpr.getType()); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SumNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SumNode.java index 5fafc157d93..1cd3bb9f1c4 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SumNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/SumNode.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 @@ -67,13 +67,13 @@ protected Expression addAggregateExression(Expression expr) { * INTERNAL * This method calculates the return type of the SUM operation. */ - protected Class calculateReturnType(GenerationContext context) { - Class returnType = null; + protected Class calculateReturnType(GenerationContext context) { + Class returnType = null; if (getLeft().isDotNode()){ DotNode arg = (DotNode)getLeft(); - Class fieldType = arg.getTypeOfDirectToField(context); + Class fieldType = arg.getTypeOfDirectToField(context); TypeHelper helper = context.getParseTreeContext().getTypeHelper(); - returnType = (Class)calculateReturnType(fieldType, helper); + returnType = (Class)calculateReturnType(fieldType, helper); } return returnType; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/TypeHelper.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/TypeHelper.java index 48ca1240b3d..4766f71abaa 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/TypeHelper.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/TypeHelper.java @@ -26,7 +26,7 @@ public interface TypeHelper { String getTypeName(Object type); /** Returns the class object of the specified type. */ - Class getJavaClass(Object type); + Class getJavaClass(Object type); /** Returns a type representation for the specified type name or null if * there is no such type. */ diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/TypeHelperImpl.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/TypeHelperImpl.java index b0fe3ec4c73..c0e3b3bd4e0 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/TypeHelperImpl.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/TypeHelperImpl.java @@ -18,9 +18,6 @@ import java.security.PrivilegedActionException; import org.eclipse.persistence.descriptors.ClassDescriptor; -import org.eclipse.persistence.mappings.AggregateCollectionMapping; -import org.eclipse.persistence.mappings.AggregateMapping; -import org.eclipse.persistence.mappings.CollectionMapping; import org.eclipse.persistence.mappings.DatabaseMapping; import org.eclipse.persistence.mappings.DirectCollectionMapping; import org.eclipse.persistence.mappings.querykeys.ForeignReferenceQueryKey; @@ -119,7 +116,7 @@ public Object resolveSchema(String schemaName) { */ @Override public Object resolveEnumConstant(Object type, String constant) { - Class clazz = getJavaClass(type); + Class clazz = getJavaClass(type); Object[] constants = clazz.getEnumConstants(); if (constants != null) { for (int i = 0; i < constants.length; i++) { @@ -209,7 +206,7 @@ public boolean isCollectionValuedRelationship(Object ownerClass, private ClassDescriptor getDescriptor(Object type) { ClassDescriptor desc = null; if (type instanceof Class) { - desc = session.getDescriptor((Class)type); + desc = session.getDescriptor((Class)type); } else if (type instanceof ClassDescriptor) { desc = (ClassDescriptor)type; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/VariableNode.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/VariableNode.java index c87564eb536..842df22e2f4 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/VariableNode.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/jpa/parsing/VariableNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019 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 @@ -107,13 +107,13 @@ private void addAttributeWithFetchJoins(ReportQuery reportQuery, Expression expression, GenerationContext context) { String name = getCanonicalVariableName(); - List fetchJoinNodes = context.getParseTreeContext().getFetchJoins(name); + List fetchJoinNodes = context.getParseTreeContext().getFetchJoins(name); if (fetchJoinNodes == null) { reportQuery.addAttribute(name, expression); } else { - List fetchJoinExprs = new ArrayList(fetchJoinNodes.size()); - for (Iterator i = fetchJoinNodes.iterator(); i.hasNext(); ) { - Node node = (Node)i.next(); + List fetchJoinExprs = new ArrayList<>(fetchJoinNodes.size()); + for (Iterator i = fetchJoinNodes.iterator(); i.hasNext(); ) { + Node node = i.next(); fetchJoinExprs.add(node.generateExpression(context)); } reportQuery.addItem(name, expression, fetchJoinExprs); @@ -129,10 +129,10 @@ private void addAttributeWithFetchJoins(ReportQuery reportQuery, private void addFetchJoins(ObjectLevelReadQuery theQuery, GenerationContext context) { String name = getCanonicalVariableName(); - List fetchJoinNodes = context.getParseTreeContext().getFetchJoins(name); + List fetchJoinNodes = context.getParseTreeContext().getFetchJoins(name); if (fetchJoinNodes != null) { - for (Iterator i = fetchJoinNodes.iterator(); i.hasNext(); ) { - Node node = (Node)i.next(); + for (Iterator i = fetchJoinNodes.iterator(); i.hasNext(); ) { + Node node = i.next(); theQuery.addJoinedAttribute(node.generateExpression(context)); } } @@ -261,8 +261,8 @@ public boolean isAlias(ParseTreeContext context) { * an alias, where the variableName is registered to an alias. */ @Override - public Class resolveClass(GenerationContext generationContext) { - Class clazz = null; + public Class resolveClass(GenerationContext generationContext) { + Class clazz = null; String name = getCanonicalVariableName(); ParseTreeContext context = generationContext.getParseTreeContext(); if (context.isRangeVariable(name)) { @@ -284,7 +284,7 @@ public Class resolveClass(GenerationContext generationContext) { public String toString(int indent) { StringBuilder buffer = new StringBuilder(); toStringIndent(indent, buffer); - buffer.append(toStringDisplayName() + "[" + getVariableName() + "]"); + buffer.append(toStringDisplayName()).append("[").append(getVariableName()).append("]"); return buffer.toString(); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/mappings/converters/AttributeNamePrefix.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/mappings/converters/AttributeNamePrefix.java index 8e057ed6d3f..304604fbf96 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/mappings/converters/AttributeNamePrefix.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/mappings/converters/AttributeNamePrefix.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019 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 @@ -73,7 +73,7 @@ public static AttributeNamePrefix toValue(final String name) { * Creates an instance of attribute name prefix enumeration element. * @param name Attribute name prefix identifier. */ - private AttributeNamePrefix(final String name) { + AttributeNamePrefix(final String name) { this.name = name; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/Context.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/Context.java index d062f91f8d8..d73dc24bcb4 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/Context.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/Context.java @@ -266,7 +266,7 @@ public void storeDescriptorsByQName(CoreSession session) { } - private class XPathQueryResult { + private static class XPathQueryResult { /* * Mapping corresponding to the XPath query */ diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/NamespaceResolver.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/NamespaceResolver.java index a4648d63755..d6698afc52e 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/NamespaceResolver.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/NamespaceResolver.java @@ -248,11 +248,11 @@ public void put(String prefix, String namespaceURI) { * Returns the list of prefixes in the NamespaceResolver * @return An Enumeration containing the prefixes in the NamespaceResolver */ - public Enumeration getPrefixes() { + public Enumeration getPrefixes() { if (hasPrefixesToNamespaces()) { - return new IteratorEnumeration(getPrefixesToNamespaces().keySet().iterator()); + return new IteratorEnumeration<>(getPrefixesToNamespaces().keySet().iterator()); } else { - return new IteratorEnumeration(null); + return new IteratorEnumeration<>(null); } } @@ -262,7 +262,7 @@ public Enumeration getPrefixes() { * Used for deployment XML * @return A Vector containing the namespace URIs in the namespace resolver */ - public Vector getNamespaces() { + public Vector getNamespaces() { if (!hasPrefixesToNamespaces()) { return EMPTY_VECTOR; } @@ -320,11 +320,11 @@ public String getDefaultNamespaceURI() { return null; } - private static class IteratorEnumeration implements Enumeration { + private static class IteratorEnumeration implements Enumeration { - private Iterator iterator; + private final Iterator iterator; - public IteratorEnumeration(Iterator iterator) { + public IteratorEnumeration(Iterator iterator) { this.iterator = iterator; } @@ -337,7 +337,7 @@ public boolean hasMoreElements() { } @Override - public Object nextElement() { + public E nextElement() { return iterator.next(); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/UnmarshalXPathEngine.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/UnmarshalXPathEngine.java index 29fb44bc321..ca8dc714ddb 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/UnmarshalXPathEngine.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/UnmarshalXPathEngine.java @@ -26,7 +26,6 @@ import org.eclipse.persistence.platform.xml.XMLNamespaceResolver; import org.eclipse.persistence.platform.xml.XMLNodeList; import org.eclipse.persistence.platform.xml.XMLPlatform; -import org.eclipse.persistence.platform.xml.XMLPlatformException; import org.eclipse.persistence.platform.xml.XMLPlatformFactory; import org.w3c.dom.Attr; import org.w3c.dom.Element; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/VectorUtils.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/VectorUtils.java index 2f7806f24d5..f1dad4f98d0 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/VectorUtils.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/VectorUtils.java @@ -210,27 +210,39 @@ public List subList(int fromIndex, int toIndex) { @Override public ListIterator listIterator(final int index) { - return new ListIterator() { + return new ListIterator<>() { private final ListIterator i - = listIterator(index); + = listIterator(index); @Override - public boolean hasNext() {return i.hasNext();} + public boolean hasNext() { + return i.hasNext(); + } @Override - public E next() {return i.next();} + public E next() { + return i.next(); + } @Override - public boolean hasPrevious() {return i.hasPrevious();} + public boolean hasPrevious() { + return i.hasPrevious(); + } @Override - public E previous() {return i.previous();} + public E previous() { + return i.previous(); + } @Override - public int nextIndex() {return i.nextIndex();} + public int nextIndex() { + return i.nextIndex(); + } @Override - public int previousIndex() {return i.previousIndex();} + public int previousIndex() { + return i.previousIndex(); + } @Override public void remove() { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLChoiceCollectionMappingMarshalNodeValue.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLChoiceCollectionMappingMarshalNodeValue.java index 8c0a46fff29..87e9e12582b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLChoiceCollectionMappingMarshalNodeValue.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLChoiceCollectionMappingMarshalNodeValue.java @@ -328,7 +328,7 @@ private NodeValue getNodeValueForValue(Object value){ if(xmlChoiceCollectionMapping.isAny()) { return this.anyNodeValue; } - Class theClass = fieldValue.getClass(); + Class theClass = fieldValue.getClass(); while(associatedField == null) { associatedField = (Field) xmlChoiceCollectionMapping.getClassToFieldMappings().get(theClass); if(theClass.getSuperclass() != null) { @@ -342,7 +342,7 @@ private NodeValue getNodeValueForValue(Object value){ nodeValue = this.fieldToNodeValues.get(associatedField); } } else { - Class theClass = value.getClass(); + Class theClass = value.getClass(); while(associatedField == null) { associatedField = (Field) xmlChoiceCollectionMapping.getClassToFieldMappings().get(theClass); List fieldNodes = classToNodeValues.get(theClass); @@ -374,7 +374,7 @@ private NodeValue getNodeValueForValue(Object value){ if(associatedField == null) { //check the field associations List sourceFields = null; - Class theClass = value.getClass(); + Class theClass = value.getClass(); while(theClass != null) { sourceFields = (List) xmlChoiceCollectionMapping.getClassToSourceFieldsMappings().get(theClass); if(sourceFields != null) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLCompositeCollectionMappingNodeValue.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLCompositeCollectionMappingNodeValue.java index ab820921a7a..e172cd2a89d 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLCompositeCollectionMappingNodeValue.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLCompositeCollectionMappingNodeValue.java @@ -303,7 +303,7 @@ public boolean marshalSingleValue(XPathFragment xPathFragment, MarshalRecord mar if(descriptor == null){ descriptor = (Descriptor) session.getDescriptor(value.getClass()); }else if(descriptor.hasInheritance()){ - Class objectValueClass = value.getClass(); + Class objectValueClass = value.getClass(); if(!(objectValueClass == descriptor.getJavaClass())){ descriptor = (Descriptor) session.getDescriptor(objectValueClass); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLCompositeObjectMappingNodeValue.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLCompositeObjectMappingNodeValue.java index 6fad5f2fcc4..c55ad0c296d 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLCompositeObjectMappingNodeValue.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLCompositeObjectMappingNodeValue.java @@ -215,7 +215,7 @@ public boolean marshalSingleValue(XPathFragment xPathFragment, MarshalRecord mar if(descriptor == null){ descriptor = (Descriptor) session.getDescriptor(objectValue.getClass()); }else if(descriptor.hasInheritance()){ - Class objectValueClass = objectValue.getClass(); + Class objectValueClass = objectValue.getClass(); if(!(objectValueClass == descriptor.getJavaClass())){ descriptor = (Descriptor) session.getDescriptor(objectValueClass); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLConversionManager.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLConversionManager.java index 3bde5768702..92997316d5e 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLConversionManager.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLConversionManager.java @@ -1695,7 +1695,6 @@ public Collection convertStringToList(Object sourceObject, Class eleme public String convertListToString(Object sourceObject, QName schemaType) throws ConversionException { StringBuilder returnStringBuilder = new StringBuilder(); if (sourceObject instanceof List) { - @SuppressWarnings({"unchecked"}) List list = (List) sourceObject; for (int i = 0, listSize = list.size(); i < listSize; i++) { Object next = list.get(i); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLMarshaller.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLMarshaller.java index d4c02c20c4d..b21f9ac73aa 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLMarshaller.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLMarshaller.java @@ -487,7 +487,7 @@ public boolean isWrapperAsCollectionName() { } protected boolean isSimpleXMLRoot(Root xmlRoot) { - Class xmlRootObjectClass = xmlRoot.getObject().getClass(); + Class xmlRootObjectClass = xmlRoot.getObject().getClass(); ConversionManager conversionManager = (ConversionManager) context.getSession().getDatasourcePlatform().getConversionManager(); if (conversionManager.schemaType(xmlRootObjectClass) != null || CoreClassConstants.List_Class.isAssignableFrom(xmlRootObjectClass) || CoreClassConstants.XML_GREGORIAN_CALENDAR.isAssignableFrom(xmlRootObjectClass) || CoreClassConstants.DURATION.isAssignableFrom(xmlRootObjectClass)) { @@ -545,7 +545,7 @@ public void marshal(Object object, ContentHandler contentHandler, LexicalHandler } } }else{ - Class objectClass = object.getClass(); + Class objectClass = object.getClass(); session = context.getSession(objectClass); xmlDescriptor = getDescriptor(objectClass, session); } @@ -587,7 +587,7 @@ public void marshal(Object object, MarshalRecord marshalRecord) { } } }else{ - Class objectClass = object.getClass(); + Class objectClass = object.getClass(); session = context.getSession(objectClass); xmlDescriptor = getDescriptor(objectClass, session); } @@ -853,7 +853,7 @@ public void marshal(Object object, Node node) throws XMLMarshalException { } } }else{ - Class objectClass = object.getClass(); + Class objectClass = object.getClass(); session = context.getSession(objectClass); xmlDescriptor = getDescriptor(objectClass, session); } @@ -980,7 +980,7 @@ public void marshal(Object object, Result result) throws XMLMarshalException { } } }else{ - Class objectClass = object.getClass(); + Class objectClass = object.getClass(); session = context.getSession(objectClass); xmlDescriptor = getDescriptor(objectClass, session); } @@ -1135,7 +1135,7 @@ private void marshalStreamOrWriter(Object object, MarshalRecord marshalRecord, A } } }else{ - Class objectClass = object.getClass(); + Class objectClass = object.getClass(); if(object instanceof Collection) { int valueSize = ((Collection)object).size(); if(marshalRecord.getMarshaller().isApplicationJSON() && (valueSize > 1 || !marshalRecord.getMarshaller().isReduceAnyArrays())) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLVariableXPathMappingNodeValue.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLVariableXPathMappingNodeValue.java index ceef000823e..31fc8058100 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLVariableXPathMappingNodeValue.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XMLVariableXPathMappingNodeValue.java @@ -86,7 +86,7 @@ public boolean marshalSingleValue(XPathFragment xPathFragment, MarshalRecord mar Descriptor descriptor = (Descriptor)mapping.getReferenceDescriptor(); if(descriptor.hasInheritance()){ - Class objectValueClass = value.getClass(); + Class objectValueClass = value.getClass(); if(!(objectValueClass == descriptor.getJavaClass())){ descriptor = (Descriptor) session.getDescriptor(objectValueClass); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XPathEngine.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XPathEngine.java index a36a4f29c9e..18c3edd1cab 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XPathEngine.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/XPathEngine.java @@ -674,7 +674,7 @@ private void addTypeAttributes(NodeList elements, Field field, Object value, Str for (int i = 0; i < size; i++) { next = elements.item(i); if (next.getNodeType() == Node.ELEMENT_NODE) { - Class valueClass = values.get(i).getClass(); + Class valueClass = values.get(i).getClass(); if(valueClass != CoreClassConstants.STRING){ ConversionManager conversionManager = (ConversionManager) session.getDatasourcePlatform().getConversionManager(); QName qname = field.getXMLType(valueClass, conversionManager); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/CharacterEscapeHandlerWrapper.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/CharacterEscapeHandlerWrapper.java index 723f4114af6..4cabc5567c8 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/CharacterEscapeHandlerWrapper.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/CharacterEscapeHandlerWrapper.java @@ -33,15 +33,15 @@ public class CharacterEscapeHandlerWrapper implements CharacterEscapeHandler { private final static String ESCAPE_METHOD_NAME = "escape"; - private final static Class[] PARAMS = new Class[] { + private final static Class[] PARAMS = new Class[] { CoreClassConstants.APCHAR, CoreClassConstants.PINT, CoreClassConstants.PINT, CoreClassConstants.PBOOLEAN, Writer.class }; - private Object handler; - private Method escapeMethod; + private final Object handler; + private final Method escapeMethod; public CharacterEscapeHandlerWrapper(Object sunHandler) { this.handler = sunHandler; - Class handlerClass = sunHandler.getClass(); + Class handlerClass = sunHandler.getClass(); try { this.escapeMethod = PrivilegedAccessHelper.getMethod(handlerClass, ESCAPE_METHOD_NAME, PARAMS, false); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/DomToXMLEventWriter.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/DomToXMLEventWriter.java index 1c0fefd98c9..0b7debe1644 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/DomToXMLEventWriter.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/DomToXMLEventWriter.java @@ -28,10 +28,9 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import org.w3c.dom.Text; public class DomToXMLEventWriter{ - private XMLEventFactory xmlEventFactory; + private final XMLEventFactory xmlEventFactory; public DomToXMLEventWriter() { this.xmlEventFactory = XMLEventFactory.newInstance(); @@ -128,7 +127,6 @@ private void writeElement(Element elem, String newNamespace, String newName, XML for(int i = 0; i < attrs.getLength(); i++) { Attr next = (Attr)attrs.item(i); if(next.getNodeType() == Node.ATTRIBUTE_NODE) { - Attr attribute = next; if(next.getPrefix() != null && next.getPrefix().equals(javax.xml.XMLConstants.XMLNS_ATTRIBUTE)) { String currentUri = xew.getNamespaceContext().getNamespaceURI(next.getLocalName()); if(currentUri == null || !currentUri.equals(next.getValue())) { @@ -140,7 +138,7 @@ private void writeElement(Element elem, String newNamespace, String newName, XML xew.add(xmlEventFactory.createNamespace(next.getValue())); needToAddDefaultNS = false; }else{ - nonNamespaceDeclAttrs.add(attribute); + nonNamespaceDeclAttrs.add(next); } } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/DomToXMLStreamWriter.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/DomToXMLStreamWriter.java index 47d131b4ae2..a0329c8bb89 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/DomToXMLStreamWriter.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/DomToXMLStreamWriter.java @@ -28,7 +28,6 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import org.w3c.dom.Text; public class DomToXMLStreamWriter{ @@ -123,7 +122,6 @@ private void writeElement(Element elem, String newNamespace, String newName, XML for(int i = 0; i < attrs.getLength(); i++) { Attr next = (Attr)attrs.item(i); if(next.getNodeType() == Node.ATTRIBUTE_NODE) { - Attr attribute = next; if(next.getPrefix() != null && next.getPrefix().equals(javax.xml.XMLConstants.XMLNS_ATTRIBUTE)) { String currentUri = xsw.getNamespaceContext().getNamespaceURI(next.getLocalName()); if(currentUri == null || !currentUri.equals(next.getValue())) { @@ -135,7 +133,7 @@ private void writeElement(Element elem, String newNamespace, String newName, XML xsw.writeDefaultNamespace(next.getValue()); needToAddDefaultNS = false; }else{ - nonNamespaceDeclAttrs.add(attribute); + nonNamespaceDeclAttrs.add(next); } } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/namespaces/NamespacePrefixMapperWrapper.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/namespaces/NamespacePrefixMapperWrapper.java index 19a49b17f6b..51abccfbd8e 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/namespaces/NamespacePrefixMapperWrapper.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/record/namespaces/NamespacePrefixMapperWrapper.java @@ -28,23 +28,23 @@ * This allows for backwards compatibility with the JAXB RI. */ public class NamespacePrefixMapperWrapper extends NamespacePrefixMapper { - private static String GET_PREF_PREFIX_METHOD_NAME = "getPreferredPrefix"; - private static String GET_PRE_DECL_NAMESPACE_URIS_METHOD_NAME = "getPreDeclaredNamespaceUris"; - private static String GET_PRE_DECL_NAMESPACE_URIS2_METHOD_NAME = "getPreDeclaredNamespaceUris2"; - private static String GET_CONTEXTUAL_NAMESPACE_DECL_METHOD_NAME = "getContextualNamespaceDecls"; + private static final String GET_PREF_PREFIX_METHOD_NAME = "getPreferredPrefix"; + private static final String GET_PRE_DECL_NAMESPACE_URIS_METHOD_NAME = "getPreDeclaredNamespaceUris"; + private static final String GET_PRE_DECL_NAMESPACE_URIS2_METHOD_NAME = "getPreDeclaredNamespaceUris2"; + private static final String GET_CONTEXTUAL_NAMESPACE_DECL_METHOD_NAME = "getContextualNamespaceDecls"; - private static final Class[] EMPTY_CLASS_ARRAY = new Class[]{}; - private static final Class[] PREF_PREFIX_PARAM_TYPES = new Class[] {CoreClassConstants.STRING, CoreClassConstants.STRING, CoreClassConstants.PBOOLEAN}; + private static final Class[] EMPTY_CLASS_ARRAY = new Class[]{}; + private static final Class[] PREF_PREFIX_PARAM_TYPES = new Class[] {CoreClassConstants.STRING, CoreClassConstants.STRING, CoreClassConstants.PBOOLEAN}; - private Object prefixMapper; - private Method getPreferredPrefixMethod; - private Method getPredeclaredNamespaceUrisMethod; - private Method getPredeclaredNamespaceUris2Method; - private Method getContextualNamespaceDeclsMethod; + private final Object prefixMapper; + private final Method getPreferredPrefixMethod; + private final Method getPredeclaredNamespaceUrisMethod; + private final Method getPredeclaredNamespaceUris2Method; + private final Method getContextualNamespaceDeclsMethod; public NamespacePrefixMapperWrapper(Object prefixMapper) { this.prefixMapper = prefixMapper; - Class prefixMapperClass = prefixMapper.getClass(); + Class prefixMapperClass = prefixMapper.getClass(); try { this.getPreferredPrefixMethod = PrivilegedAccessHelper.getMethod(prefixMapperClass, GET_PREF_PREFIX_METHOD_NAME, PREF_PREFIX_PARAM_TYPES, false); } catch(Exception ex) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/SchemaModelGenerator.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/SchemaModelGenerator.java index 5f544110b0c..7a3218646f4 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/SchemaModelGenerator.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/SchemaModelGenerator.java @@ -963,7 +963,7 @@ protected Element handleFragNamespace(XPathFragment frag, HashMap 0)) { - globalElement = (Element) s.getTopLevelElements().get(frag.getLocalName()); + globalElement = s.getTopLevelElements().get(frag.getLocalName()); if (globalElement == null) { globalElement = new Element(); globalElement.setName(frag.getLocalName()); @@ -1040,7 +1040,7 @@ protected Sequence buildSchemaComponentsForXPath(XPathFragment frag, Sequence se if ((s.isElementFormDefault() && !fragUri.equals(targetNS)) || (!s.isElementFormDefault() && fragUri.length() > 0)) { // must generate a global element are create a reference to it // if the global element exists, use it; otherwise create a new one - globalElement = (Element) s.getTopLevelElements().get(frag.getLocalName()); + globalElement = s.getTopLevelElements().get(frag.getLocalName()); if (globalElement == null) { globalElement = new Element(); globalElement.setName(frag.getLocalName()); @@ -1375,7 +1375,7 @@ protected boolean isSimple(Descriptor desc) { * */ protected boolean isComplexTypeWithSimpleContentRequired(Descriptor desc) { - return desc.getMappings().size() > 1 ? true : false; + return desc.getMappings().size() > 1; } /** @@ -1393,10 +1393,7 @@ protected void processEnumeration(String schemaTypeString, XPathFragment frag, D } Collection fieldValues = ((EnumTypeConverter) converter).getAttributeToFieldValues().values(); - ArrayList facets = new ArrayList(); - for (String field : fieldValues) { - facets.add(field); - } + List facets = new ArrayList<>(fieldValues); Restriction restriction = new Restriction(); restriction.setEnumerationFacets(facets); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Annotation.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Annotation.java index a381ba0b939..c181eb8c51d 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Annotation.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Annotation.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 @@ -14,26 +14,30 @@ // Oracle - initial API and implementation from Oracle TopLink package org.eclipse.persistence.internal.oxm.schema.model; +import org.w3c.dom.Element; + +import java.util.List; + public class Annotation { - private java.util.List documentation; - private java.util.List appInfo; + private java.util.List documentation; + private java.util.List appInfo; public Annotation() { } - public void setDocumentation(java.util.List documentation) { + public void setDocumentation(List documentation) { this.documentation = documentation; } - public java.util.List getDocumentation() { + public List getDocumentation() { return documentation; } - public void setAppInfo(java.util.List appInfo) { + public void setAppInfo(List appInfo) { this.appInfo = appInfo; } - public java.util.List getAppInfo() { + public List getAppInfo() { return appInfo; } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/AttributeGroup.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/AttributeGroup.java index 37ad429ae4b..601b1099640 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/AttributeGroup.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/AttributeGroup.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 @@ -15,22 +15,23 @@ package org.eclipse.persistence.internal.oxm.schema.model; import java.util.ArrayList; +import java.util.List; public class AttributeGroup { - private java.util.List attributes; + private java.util.List attributes; private AnyAttribute anyAttribute; private String name; private String ref; public AttributeGroup() { - attributes = new ArrayList(); + attributes = new ArrayList<>(); } - public void setAttributes(java.util.List attributes) { + public void setAttributes(List attributes) { this.attributes = attributes; } - public java.util.List getAttributes() { + public List getAttributes() { return attributes; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Choice.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Choice.java index 3141a0f8b41..f260eff9670 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Choice.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Choice.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 @@ -15,6 +15,7 @@ package org.eclipse.persistence.internal.oxm.schema.model; import java.util.ArrayList; +import java.util.List; /** *

Purpose: Class to represent a Choice in a Schema @@ -35,16 +36,16 @@ public void setOrderedElements(java.util.List newElements) { for (int i = 0; i < newElements.size(); i++) { Object next = newElements.get(i); if (next instanceof Element) { - getElements().add(next); + getElements().add((Element) next); } } } @Override - public void setSequences(java.util.List sequences) { + public void setSequences(List sequences) { if ((sequences != null) && (sequences.size() > 0)) { for (int i = 0; i < sequences.size(); i++) { - ((Sequence)sequences.get(i)).setOwner(this); + sequences.get(i).setOwner(this); } orderedElements.addAll(sequences); @@ -52,19 +53,19 @@ public void setSequences(java.util.List sequences) { } @Override - public void setChoices(java.util.List choices) { + public void setChoices(List choices) { if ((choices != null) && (choices.size() > 0)) { for (int i = 0; i < choices.size(); i++) { - ((Choice)choices.get(i)).setOwner(this); + choices.get(i).setOwner(this); } orderedElements.addAll(choices); } } - public void setNestedParticles(java.util.List nestedParticles) { + public void setNestedParticles(java.util.List nestedParticles) { for (int i = 0; i < nestedParticles.size(); i++) { - NestedParticle next = (NestedParticle)nestedParticles.get(i); + NestedParticle next = nestedParticles.get(i); if (next instanceof Choice) { addChoice((Choice)next); } else if (next instanceof Sequence) { @@ -98,13 +99,13 @@ public void addAny(Any any) { } @Override - public void setElements(java.util.List elements) { + public void setElements(List elements) { orderedElements.addAll(elements); getElements().addAll(elements); } @Override - public void setAnys(java.util.List anys) { + public void setAnys(List anys) { orderedElements.addAll(anys); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/ComplexType.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/ComplexType.java index 5d6d7d392e2..cc98073b450 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/ComplexType.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/ComplexType.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 @@ -14,8 +14,10 @@ // Oracle - initial API and implementation from Oracle TopLink package org.eclipse.persistence.internal.oxm.schema.model; +import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -34,13 +36,13 @@ public final class ComplexType implements TypeDefParticleOwner { //simple content or complex content or typedef and attrDecls private ComplexContent complexContent; private SimpleContent simpleContent; - private Map attributesMap; + private Map attributesMap; private Annotation annotation; - private java.util.List orderedAttributes; + private java.util.List orderedAttributes; public ComplexType() { - orderedAttributes = new ArrayList(); - attributesMap = new HashMap(); + orderedAttributes = new ArrayList<>(); + attributesMap = new HashMap<>(); } public void setName(String name) { @@ -166,11 +168,11 @@ public void setOwner(Element owner) { this.owner = owner; } - public void setAttributesMap(Map attributesMap) { + public void setAttributesMap(Map attributesMap) { this.attributesMap = attributesMap; } - public Map getAttributesMap() { + public Map getAttributesMap() { return attributesMap; } @@ -182,11 +184,11 @@ public Annotation getAnnotation() { return annotation; } - public void setOrderedAttributes(java.util.List orderedAttributes) { + public void setOrderedAttributes(List orderedAttributes) { this.orderedAttributes = orderedAttributes; } - public java.util.List getOrderedAttributes() { + public List getOrderedAttributes() { return orderedAttributes; } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Extension.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Extension.java index c3c169a62c4..97015fff74d 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Extension.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Extension.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 @@ -15,12 +15,13 @@ package org.eclipse.persistence.internal.oxm.schema.model; import java.util.ArrayList; +import java.util.List; public class Extension { private String baseType;//QName lateR?? private java.util.List attributes; private Content owner; - private java.util.List orderedAttributes; + private java.util.List orderedAttributes; private TypeDefParticle typeDefParticle; private Choice choice; private Sequence sequence; @@ -28,7 +29,7 @@ public class Extension { private AnyAttribute anyAttribute; public Extension() { - orderedAttributes = new ArrayList(); + orderedAttributes = new ArrayList<>(); } public void setBaseType(String baseType) { @@ -102,11 +103,11 @@ public String getOwnerName() { return null; } - public void setOrderedAttributes(java.util.List orderedAttributes) { + public void setOrderedAttributes(List orderedAttributes) { this.orderedAttributes = orderedAttributes; } - public java.util.List getOrderedAttributes() { + public List getOrderedAttributes() { return orderedAttributes; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/NestedParticle.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/NestedParticle.java index 7170f785299..7d7c9d23899 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/NestedParticle.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/NestedParticle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019 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 @@ -14,6 +14,8 @@ // Oracle - initial API and implementation from Oracle TopLink package org.eclipse.persistence.internal.oxm.schema.model; +import java.util.List; + /** *

Purpose: Interface to represent a Choice or Sequence * @see org.eclipse.persistence.internal.oxm.schema.model.Sequence @@ -30,13 +32,13 @@ public interface NestedParticle extends TypeDefParticleOwner { boolean hasAny(); - void setSequences(java.util.List sequences); + void setSequences(List sequences); - void setChoices(java.util.List choices); + void setChoices(List choices); - void setAnys(java.util.List anys); + void setAnys(List anys); - void setElements(java.util.List elements); + void setElements(List elements); void setMinOccurs(String minOccurs); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Restriction.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Restriction.java index 2aac77d3854..6286cefc85b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Restriction.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Restriction.java @@ -26,7 +26,7 @@ public class Restriction implements SimpleDerivation { private Sequence sequence; private All all; private SimpleType simpleType; - private java.util.ArrayList enumerationFacets; + private List enumerationFacets; private AnyAttribute anyAttribute; private String minInclusive; private String maxInclusive; @@ -40,7 +40,7 @@ public class Restriction implements SimpleDerivation { private String maxLength; //private List facets - private java.util.List attributes; + private List attributes; private Restrictable owner; public Restriction() { @@ -142,19 +142,19 @@ public SimpleType getSimpleType() { return simpleType; } - public void setAttributes(java.util.List attributes) { + public void setAttributes(List attributes) { this.attributes = attributes; } - public java.util.List getAttributes() { + public List getAttributes() { return attributes; } - public java.util.ArrayList getEnumerationFacets() { + public List getEnumerationFacets() { return enumerationFacets; } - public void setEnumerationFacets(java.util.ArrayList values) { + public void setEnumerationFacets(List values) { enumerationFacets = values; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Schema.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Schema.java index 0a9d4c91c1b..541a1f7be39 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Schema.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Schema.java @@ -17,6 +17,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -27,38 +28,38 @@ public class Schema { private String name;//non-persistant, used to give a schema an identifier - private java.util.List imports; - private java.util.List includes; + private List imports; + private List includes; private String targetNamespace; private String defaultNamespace; private boolean elementFormDefault;//error mapping in mw private boolean attributeFormDefault;//error mapping in mw - private Map topLevelSimpleTypes; - private Map topLevelComplexTypes; - private Map topLevelElements; - private Map topLevelAttributes; + private Map topLevelSimpleTypes; + private Map topLevelComplexTypes; + private Map topLevelElements; + private Map topLevelAttributes; private NamespaceResolver namespaceResolver; - private Map attributesMap; - private Map attributeGroups; - private Map groups; + private Map attributesMap; + private Map attributeGroups; + private Map groups; private Annotation annotation; private Result result; public Schema() { namespaceResolver = new NamespaceResolver(); - imports = new ArrayList(); - includes = new ArrayList(); + imports = new ArrayList<>(); + includes = new ArrayList<>(); //LinkedHashMaps are needed to force determinism of generated schemas. //It is important to generate always the same schema (e.g. with SchemaGenerator) with given input Schema. //Without LinkedHashMap it would be JDK dependent and the output schema would be different with different JDKs used. - topLevelSimpleTypes = new LinkedHashMap(); - topLevelComplexTypes = new LinkedHashMap(); - topLevelElements = new LinkedHashMap(); - topLevelAttributes = new LinkedHashMap(); - attributesMap = new LinkedHashMap(); - attributeGroups = new LinkedHashMap(); - groups = new LinkedHashMap(); + topLevelSimpleTypes = new LinkedHashMap<>(); + topLevelComplexTypes = new LinkedHashMap<>(); + topLevelElements = new LinkedHashMap<>(); + topLevelAttributes = new LinkedHashMap<>(); + attributesMap = new LinkedHashMap<>(); + attributeGroups = new LinkedHashMap<>(); + groups = new LinkedHashMap<>(); } public void setTargetNamespace(String targetNamespace) { @@ -77,11 +78,11 @@ public String getDefaultNamespace() { return this.defaultNamespace; } - public void setTopLevelSimpleTypes(Map topLevelSimpleTypes) { + public void setTopLevelSimpleTypes(Map topLevelSimpleTypes) { this.topLevelSimpleTypes = topLevelSimpleTypes; } - public Map getTopLevelSimpleTypes() { + public Map getTopLevelSimpleTypes() { return topLevelSimpleTypes; } @@ -89,11 +90,11 @@ public void addTopLevelSimpleTypes(SimpleType simpleType) { topLevelSimpleTypes.put(simpleType.getName(), simpleType); } - public void setTopLevelComplexTypes(Map topLevelComplexTypes) { + public void setTopLevelComplexTypes(Map topLevelComplexTypes) { this.topLevelComplexTypes = topLevelComplexTypes; } - public Map getTopLevelComplexTypes() { + public Map getTopLevelComplexTypes() { return topLevelComplexTypes; } @@ -101,11 +102,11 @@ public void addTopLevelComplexTypes(ComplexType complexType) { topLevelComplexTypes.put(complexType.getName(), complexType); } - public void setTopLevelElements(Map topLevelElements) { + public void setTopLevelElements(Map topLevelElements) { this.topLevelElements = topLevelElements; } - public Map getTopLevelElements() { + public Map getTopLevelElements() { return topLevelElements; } @@ -129,11 +130,11 @@ public boolean isAttributeFormDefault() { return attributeFormDefault; } - public void setTopLevelAttributes(Map topLevelAttributes) { + public void setTopLevelAttributes(Map topLevelAttributes) { this.topLevelAttributes = topLevelAttributes; } - public Map getTopLevelAttributes() { + public Map getTopLevelAttributes() { return topLevelAttributes; } @@ -145,30 +146,30 @@ public NamespaceResolver getNamespaceResolver() { return namespaceResolver; } - public void setImports(java.util.List imports) { + public void setImports(List imports) { this.imports = imports; } - public java.util.List getImports() { + public List getImports() { return imports; } - public void setIncludes(java.util.List includes) { + public void setIncludes(List includes) { this.includes = includes; } - public java.util.List getIncludes() { + public List getIncludes() { return includes; } - public void setAttributesMap(Map attributesMap) { + public void setAttributesMap(Map attributesMap) { this.attributesMap = attributesMap; - Iterator iter = attributesMap.entrySet().iterator(); + Iterator> iter = attributesMap.entrySet().iterator(); while (iter.hasNext()) { - Entry nextEntry = iter.next(); - QName key = (QName)nextEntry.getKey(); + Entry nextEntry = iter.next(); + QName key = nextEntry.getKey(); if (key.getNamespaceURI().equals(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) { - String value = (String)nextEntry.getValue(); + String value = nextEntry.getValue(); String prefix = key.getLocalPart(); int index = prefix.indexOf(':'); if (index > -1) { @@ -179,7 +180,7 @@ public void setAttributesMap(Map attributesMap) { } } - public Map getAttributesMap() { + public Map getAttributesMap() { return attributesMap; } @@ -191,76 +192,70 @@ public String getName() { return this.name; } - public void setAttributeGroups(Map attributeGroups) { + public void setAttributeGroups(Map attributeGroups) { this.attributeGroups = attributeGroups; } - public Map getAttributeGroups() { + public Map getAttributeGroups() { return attributeGroups; } public AttributeGroup getAttributeGroup(String uri, String localName) { - AttributeGroup globalAttributeGroup = null; if (uri.equals(targetNamespace)) { - globalAttributeGroup = (AttributeGroup)getAttributeGroups().get(localName); + AttributeGroup globalAttributeGroup = getAttributeGroups().get(localName); if (globalAttributeGroup != null) { return globalAttributeGroup; } } - globalAttributeGroup = getAttributeGroupFromReferencedSchemas(uri, localName); - - return globalAttributeGroup; + return getAttributeGroupFromReferencedSchemas(uri, localName); } protected AttributeGroup getAttributeGroupFromReferencedSchemas(String uri, String localName) { AttributeGroup globalAttributeGroup = null; - Iterator iter = getIncludes().iterator(); + Iterator iter = getIncludes().iterator(); while (iter.hasNext() && (globalAttributeGroup == null)) { - Schema includedSchema = ((Include)iter.next()).getSchema(); + Schema includedSchema = iter.next().getSchema(); globalAttributeGroup = includedSchema.getAttributeGroup(uri, localName); } if (globalAttributeGroup == null) { - iter = getImports().iterator(); - while (iter.hasNext() && (globalAttributeGroup == null)) { - Schema importedSchema = ((Import)iter.next()).getSchema(); + Iterator iter2 = getImports().iterator(); + while (iter2.hasNext() && (globalAttributeGroup == null)) { + Schema importedSchema = iter2.next().getSchema(); globalAttributeGroup = importedSchema.getAttributeGroup(uri, localName); } } return globalAttributeGroup; } - public void setGroups(Map groups) { + public void setGroups(Map groups) { this.groups = groups; } - public Map getGroups() { + public Map getGroups() { return groups; } public Group getGroup(String uri, String localName) { - Group globalGroup = null; if (uri.equals(targetNamespace)) { - globalGroup = (Group)getGroups().get(localName); + Group globalGroup = getGroups().get(localName); if (globalGroup != null) { return globalGroup; } } - globalGroup = getGroupFromReferencedSchemas(uri, localName); - - return globalGroup; + return getGroupFromReferencedSchemas(uri, localName); } protected Group getGroupFromReferencedSchemas(String uri, String localName) { Group globalGroup = null; - Iterator iter = getIncludes().iterator(); + Iterator iter = getIncludes().iterator(); while (iter.hasNext() && (globalGroup == null)) { - Schema includedSchema = ((Include)iter.next()).getSchema(); + Schema includedSchema = iter.next().getSchema(); globalGroup = includedSchema.getGroup(uri, localName); } if (globalGroup == null) { - iter = getImports().iterator(); - while (iter.hasNext() && (globalGroup == null)) { - Schema importedSchema = ((Import)iter.next()).getSchema(); + Iterator iter2 = getImports().iterator(); + while (iter2.hasNext() && (globalGroup == null)) { + Schema importedSchema = iter2.next().getSchema(); globalGroup = importedSchema.getGroup(uri, localName); } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Sequence.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Sequence.java index c9797781865..7a8073222c9 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Sequence.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Sequence.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 @@ -15,6 +15,7 @@ package org.eclipse.persistence.internal.oxm.schema.model; import java.util.ArrayList; +import java.util.List; /** *

Purpose: Class to represent a Sequence in a Schema @@ -35,16 +36,16 @@ public void setOrderedElements(java.util.List newElements) { for (int i = 0; i < newElements.size(); i++) { Object next = newElements.get(i); if (next instanceof Element) { - getElements().add(next); + getElements().add((Element) next); } } } @Override - public void setSequences(java.util.List sequences) { + public void setSequences(List sequences) { if ((sequences != null) && (sequences.size() > 0)) { for (int i = 0; i < sequences.size(); i++) { - ((Sequence)sequences.get(i)).setOwner(this); + sequences.get(i).setOwner(this); } orderedElements.addAll(sequences); @@ -52,19 +53,19 @@ public void setSequences(java.util.List sequences) { } @Override - public void setChoices(java.util.List choices) { + public void setChoices(List choices) { if ((choices != null) && (choices.size() > 0)) { for (int i = 0; i < choices.size(); i++) { - ((Choice)choices.get(i)).setOwner(this); + choices.get(i).setOwner(this); } orderedElements.addAll(choices); } } - public void setNestedParticles(java.util.List nestedParticles) { + public void setNestedParticles(List nestedParticles) { for (int i = 0; i < nestedParticles.size(); i++) { - NestedParticle next = (NestedParticle)nestedParticles.get(i); + NestedParticle next = nestedParticles.get(i); if (next instanceof Choice) { addChoice((Choice)next); } else if (next instanceof Sequence) { @@ -98,13 +99,13 @@ public void addAny(Any any) { } @Override - public void setElements(java.util.List elements) { + public void setElements(List elements) { orderedElements.addAll(elements); getElements().addAll(elements); } @Override - public void setAnys(java.util.List anys) { + public void setAnys(List anys) { orderedElements.addAll(anys); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/SimpleComponent.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/SimpleComponent.java index 6bb3fc68583..a803e514673 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/SimpleComponent.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/SimpleComponent.java @@ -14,6 +14,7 @@ // Oracle - initial API and implementation from Oracle TopLink package org.eclipse.persistence.internal.oxm.schema.model; +import javax.xml.namespace.QName; import java.util.HashMap; import java.util.Map; @@ -24,13 +25,13 @@ public abstract class SimpleComponent { private String defaultValue; private boolean isSetDefaultValue = false; private String fixed; - private Map attributesMap; + private Map attributesMap; private Annotation annotation; private String form; private String ref; protected SimpleComponent() { - attributesMap = new HashMap(); + attributesMap = new HashMap<>(); } public void setSimpleType(SimpleType simpleType) { @@ -74,11 +75,11 @@ public String getFixed() { return fixed; } - public void setAttributesMap(Map attributesMap) { + public void setAttributesMap(Map attributesMap) { this.attributesMap = attributesMap; } - public Map getAttributesMap() { + public Map getAttributesMap() { return attributesMap; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/SimpleType.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/SimpleType.java index 553bb3db238..268ba28adb6 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/SimpleType.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/SimpleType.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 @@ -14,6 +14,7 @@ // Oracle - initial API and implementation from Oracle TopLink package org.eclipse.persistence.internal.oxm.schema.model; +import javax.xml.namespace.QName; import java.util.HashMap; import java.util.Map; @@ -22,11 +23,11 @@ public class SimpleType implements Restrictable { private List list; private Union union; private Restriction restriction; - private Map attributesMap; + private Map attributesMap; private Annotation annotation; public SimpleType() { - attributesMap = new HashMap(); + attributesMap = new HashMap<>(); } public void setName(String name) { @@ -80,11 +81,11 @@ public Union getUnion() { return union; } - public void setAttributesMap(Map attributesMap) { + public void setAttributesMap(Map attributesMap) { this.attributesMap = attributesMap; } - public Map getAttributesMap() { + public Map getAttributesMap() { return attributesMap; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/TypeDefParticle.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/TypeDefParticle.java index 338fa034bef..62806ff80d5 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/TypeDefParticle.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/TypeDefParticle.java @@ -27,7 +27,7 @@ public abstract class TypeDefParticle { private TypeDefParticleOwner owner; private String minOccurs; private String maxOccurs; - private java.util.List elements; + private java.util.List elements; //Group?? protected TypeDefParticle() { @@ -37,13 +37,13 @@ public void addElement(Element elem) { getElements().add(elem); } - public void setElements(List elements) { + public void setElements(List elements) { this.elements = elements; } - public List getElements() { + public List getElements() { if (elements == null) { - elements = new ArrayList(); + elements = new ArrayList<>(); } return elements; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Union.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Union.java index fd1815d3818..7bb0d534d99 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Union.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/oxm/schema/model/Union.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 @@ -15,35 +15,35 @@ package org.eclipse.persistence.internal.oxm.schema.model; import java.util.ArrayList; +import java.util.List; public class Union implements SimpleDerivation { - private java.util.List memberTypes; - private java.util.List simpleTypes; + private List memberTypes; + private List simpleTypes; public Union() { } - public void setMemberTypes(java.util.List memberTypes) { + public void setMemberTypes(List memberTypes) { this.memberTypes = memberTypes; } - public java.util.List getMemberTypes() { + public List getMemberTypes() { return memberTypes; } - public void setSimpleTypes(java.util.List simpleTypes) { + public void setSimpleTypes(List simpleTypes) { this.simpleTypes = simpleTypes; } - public java.util.List getSimpleTypes() { + public List getSimpleTypes() { return simpleTypes; } - public java.util.List getAllMemberTypes() { - ArrayList allTypes = new ArrayList(); - allTypes.addAll(getMemberTypes()); + public List getAllMemberTypes() { + List allTypes = new ArrayList<>(getMemberTypes()); for (int i = 0; i < getSimpleTypes().size(); i++) { - SimpleType next = (SimpleType)getSimpleTypes().get(i); + SimpleType next = getSimpleTypes().get(i); if (next.getRestriction() != null) { allTypes.add(next.getRestriction().getBaseType()); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/DatasourceCallQueryMechanism.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/DatasourceCallQueryMechanism.java index 0d23fa449d8..99aacc441a3 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/DatasourceCallQueryMechanism.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/DatasourceCallQueryMechanism.java @@ -37,10 +37,8 @@ import org.eclipse.persistence.internal.helper.DatabaseField; import org.eclipse.persistence.internal.helper.DatabaseTable; import org.eclipse.persistence.internal.helper.Helper; -import org.eclipse.persistence.internal.helper.NonSynchronizedVector; import org.eclipse.persistence.internal.sessions.AbstractRecord; import org.eclipse.persistence.internal.sessions.AbstractSession; -import org.eclipse.persistence.mappings.DatabaseMapping; import org.eclipse.persistence.mappings.DatabaseMapping.WriteType; import org.eclipse.persistence.queries.ConstructorReportItem; import org.eclipse.persistence.queries.DatabaseQuery; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/InterfaceContainerPolicy.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/InterfaceContainerPolicy.java index 8ea0a02c0f7..cb43ae7e7b5 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/InterfaceContainerPolicy.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/InterfaceContainerPolicy.java @@ -108,7 +108,7 @@ public Object cloneFor(Object container) { } Method cloneMethod; - Class javaClass = container.getClass(); + Class javaClass = container.getClass(); if (javaClass == getContainerClass()) { cloneMethod = getCloneMethod(); } else { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sequencing/ClientSessionSequencing.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sequencing/ClientSessionSequencing.java index 0c246757554..3b1fefd34c8 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sequencing/ClientSessionSequencing.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sequencing/ClientSessionSequencing.java @@ -67,7 +67,6 @@ public int whenShouldAcquireValueForAll() { * SequencingServer.getNextValue takes two arguments * the first argument being a session which owns write connection * (either DatabaseSession or ClientSession). - * @param cls */ @Override public Object getNextValue(Class cls) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sequencing/SequencingManager.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sequencing/SequencingManager.java index 7935581df08..6d5451183ca 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sequencing/SequencingManager.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sequencing/SequencingManager.java @@ -719,7 +719,7 @@ public Object getNextValue(Sequence sequence, AbstractSession writeSession) { * The writeSession is always in a transaction, so a transaction is never required. * Table or sequence object with preallocation size 1 still goes through the preallocation state. */ - class NoPreallocation_State extends State { + static class NoPreallocation_State extends State { @Override public Object getNextValue(Sequence sequence, AbstractSession writeSession) { return sequence.getGeneratedValue(null, writeSession); @@ -752,7 +752,6 @@ public void onConnect() { /** * If sequencing is connected initialize the sequences used by descriptors, otherwise connect. - * @param descriptors */ @Override public void onAddDescriptors(Collection descriptors) { @@ -1143,7 +1142,7 @@ public Object getNextValue(AbstractSession writeSession, Class cls) { return state.getNextValue(sequence, writeSession); } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({"unchecked"}) protected void logDebugSequencingConnected(int nAlreadyConnectedSequences) { Vector[] sequenceVectors = (Vector[]) new Vector[NUMBER_OF_STATES]; int size = connectedSequences.size(); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/AbstractRecord.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/AbstractRecord.java index c0a345dbca4..ded5cdb7988 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/AbstractRecord.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/AbstractRecord.java @@ -21,7 +21,6 @@ import org.eclipse.persistence.internal.helper.*; import org.eclipse.persistence.exceptions.*; import org.eclipse.persistence.sessions.DataRecord; -import org.eclipse.persistence.internal.helper.DatabaseField; /** *

diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/AbstractSession.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/AbstractSession.java index e5ba4242cfb..29b01266e5c 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/AbstractSession.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/AbstractSession.java @@ -42,7 +42,6 @@ import java.security.AccessController; import java.util.ArrayList; import java.util.Collection; -import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -1180,8 +1179,8 @@ public InjectionManager createInjectionManager(Object beanManager){ try{ if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){ Class> elim = AccessController.doPrivileged(new PrivilegedClassForName<>(InjectionManager.DEFAULT_CDI_INJECTION_MANAGER, true, getLoader())); - Constructor> constructor = AccessController.doPrivileged(new PrivilegedGetConstructorFor>(elim, new Class[] {String.class}, false)); - return AccessController.doPrivileged(new PrivilegedInvokeConstructor>(constructor, new Object[] {beanManager})); + Constructor> constructor = AccessController.doPrivileged(new PrivilegedGetConstructorFor<>(elim, new Class[]{String.class}, false)); + return AccessController.doPrivileged(new PrivilegedInvokeConstructor<>(constructor, new Object[]{beanManager})); } else { Class> elim = org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(InjectionManager.DEFAULT_CDI_INJECTION_MANAGER, true, getLoader()); Constructor> constructor = PrivilegedAccessHelper.>getConstructorFor(elim, new Class[] {Object.class}, false); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/ArrayRecord.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/ArrayRecord.java index 331da6b13f0..5965eb093c3 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/ArrayRecord.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/ArrayRecord.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 @@ -18,7 +18,6 @@ import java.util.*; import org.eclipse.persistence.internal.helper.*; import org.eclipse.persistence.sessions.DatabaseRecord; -import org.eclipse.persistence.internal.helper.DatabaseField; /** * PERF: Optimized record implementation using arrays instead of Vector. diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/IdentityMapAccessor.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/IdentityMapAccessor.java index 9cc2189ae78..de48c91ca45 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/IdentityMapAccessor.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/IdentityMapAccessor.java @@ -1070,7 +1070,7 @@ public void releaseWriteLock() { */ @Override public Object removeFromIdentityMap(Object object) { - Class theClass = object.getClass(); + Class theClass = object.getClass(); return removeFromIdentityMap(getSession().getId(object), theClass, getSession().getDescriptor(theClass), object); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/ObjectPersistenceRuntimeXMLProject.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/ObjectPersistenceRuntimeXMLProject.java index 4b67faab42c..d1f04b8fb89 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/ObjectPersistenceRuntimeXMLProject.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/ObjectPersistenceRuntimeXMLProject.java @@ -1375,7 +1375,7 @@ public void setAttributeValueInObject(Object object, Object value) { @SuppressWarnings({"unchecked"}) List queryArguments = (List)value; List arguments = new ArrayList<>(queryArguments.size()); - List types = new ArrayList<>(queryArguments.size()); + List> types = new ArrayList<>(queryArguments.size()); List values = new ArrayList<>(queryArguments.size()); for (int index = 0; index < queryArguments.size(); index++) { QueryArgument queryArgument = queryArguments.get(index); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/ObjectPersistenceRuntimeXMLProject_11_1_1.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/ObjectPersistenceRuntimeXMLProject_11_1_1.java index e6f239633e0..6b2f55db15e 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/ObjectPersistenceRuntimeXMLProject_11_1_1.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/ObjectPersistenceRuntimeXMLProject_11_1_1.java @@ -1452,7 +1452,7 @@ public Object getAttributeValueFromObject(Object object) throws DescriptorExcept } @Override - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({"unchecked"}) public void setAttributeValueInObject(Object object, Object value) throws DescriptorException { try { // Get the Class of each entry in the collection diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/SessionsFactory.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/SessionsFactory.java index 68ffb186a9d..0da90470f0b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/SessionsFactory.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/SessionsFactory.java @@ -736,7 +736,7 @@ protected ConnectionPool buildConnectionPoolConfig(ConnectionPoolConfig poolConf /** * INTERNAL: */ - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({"unchecked"}) protected ServerPlatform buildCustomServerPlatformConfig(CustomServerPlatformConfig platformConfig, DatabaseSessionImpl session) { ServerPlatform platform; @@ -1083,7 +1083,7 @@ protected void processJMSTransportManagerConfig(JMSPublishingTransportManagerCon /** * INTERNAL: */ - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({"unchecked"}) protected void buildOc4jJGroupsTransportManagerConfig(Oc4jJGroupsTransportManagerConfig tmConfig, RemoteCommandManager rcm) { TransportManager tm = null; try { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/XMLSessionConfigWriter.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/XMLSessionConfigWriter.java index 5d55af084e0..bc8193cc450 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/XMLSessionConfigWriter.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/sessions/factories/XMLSessionConfigWriter.java @@ -18,6 +18,7 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; +import java.nio.charset.StandardCharsets; import org.eclipse.persistence.exceptions.ValidationException; import org.eclipse.persistence.internal.sessions.factories.model.SessionConfigs; @@ -43,7 +44,7 @@ private XMLSessionConfigWriter() { */ public static void write(SessionConfigs eclipseLinkSessions, String fileName) { //Bug#4305370 Needs to be utf-8 encoded. - try (Writer writer = new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8")) { + try (Writer writer = new OutputStreamWriter(new FileOutputStream(fileName), StandardCharsets.UTF_8)) { write(eclipseLinkSessions, writer); } catch (IOException exception) { throw ValidationException.fileError(exception); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/DirectCollectionMapping.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/DirectCollectionMapping.java index 036750e84c6..0f3a17730d9 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/DirectCollectionMapping.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/DirectCollectionMapping.java @@ -2063,7 +2063,7 @@ protected void mergeAddRemoveChanges(Object valueOfTarget, Object delegateTarget int oldSize = changeRecord.getOldSize(); int newSize = changeRecord.getNewSize(); int delta = newSize - oldSize; - Object newTail[] = null; + Object[] newTail = null; if(delta > 0) { newTail = new Object[delta]; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/OneToOneMapping.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/OneToOneMapping.java index c6f0c8473bc..ee6198605a8 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/OneToOneMapping.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/OneToOneMapping.java @@ -451,7 +451,7 @@ public Object clone() { // DatabaseField overrides equals, so we need to use an IdentifyHashMap for this implementation // to make sure we are using the object references to lookup clone references - AbstractMap fieldToCloneMap = new IdentityHashMap(getTargetToSourceKeyFields().size()); + AbstractMap fieldToCloneMap = new IdentityHashMap<>(getTargetToSourceKeyFields().size()); //clone foreign keys and save the clones in a lookup table for (Enumeration enumtr = getForeignKeyFields().elements(); enumtr.hasMoreElements();) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/converters/ConverterClass.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/converters/ConverterClass.java index ef6a3cb67e7..c0f087de09c 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/converters/ConverterClass.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/converters/ConverterClass.java @@ -126,7 +126,7 @@ private Class getAttributeConverterClass(ClassLoader classLoader) { try { if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { try { - return AccessController.doPrivileged(new PrivilegedClassForName(attributeConverterClassName, true, classLoader)); + return AccessController.doPrivileged(new PrivilegedClassForName<>(attributeConverterClassName, true, classLoader)); } catch (PrivilegedActionException exception) { throw ValidationException.classNotFoundWhileConvertingClassNames(attributeConverterClassName, exception.getException()); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/MediaType.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/MediaType.java index 7b20d0615cd..ad8324d1a3b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/MediaType.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/MediaType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -24,7 +24,7 @@ public enum MediaType implements org.eclipse.persistence.internal.oxm.MediaType private final String mediaType; - private MediaType(String mediaType) { + MediaType(String mediaType) { this.mediaType = mediaType; } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/XMLDescriptor.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/XMLDescriptor.java index 65e695127b1..35b52b7508d 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/XMLDescriptor.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/XMLDescriptor.java @@ -1079,13 +1079,13 @@ protected DatabaseField getTypedField(StringTokenizer stringTokenizer) { xmlField.setNamespaceResolver(namespaceResolver); while(stringTokenizer.hasMoreElements()) { String nextToken = stringTokenizer.nextToken(); - xmlField.setXPath(xPath.toString() + nextToken); + xmlField.setXPath(xPath + nextToken); xmlField.initialize(); DatabaseMapping mapping = objectBuilder.getMappingForField(xmlField); if(null == mapping) { XPathFragment xPathFragment = new XPathFragment(nextToken); if(xPathFragment.getIndexValue() > 0) { - xmlField.setXPath(xPath.toString() + nextToken.substring(0, nextToken.indexOf('['))); + xmlField.setXPath(xPath + nextToken.substring(0, nextToken.indexOf('['))); xmlField.initialize(); mapping = objectBuilder.getMappingForField(xmlField); if(null != mapping) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/XMLMarshaller.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/XMLMarshaller.java index 90b9b473b4d..56c65df4066 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/XMLMarshaller.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/XMLMarshaller.java @@ -147,7 +147,7 @@ public void marshal(Object object, Result result) throws XMLMarshalException { } } }else{ - Class objectClass = object.getClass(); + Class objectClass = object.getClass(); if(result instanceof ExtendedResult){ MarshalRecord writerRecord = ((ExtendedResult)result).createRecord(); if(object instanceof Collection){ @@ -374,7 +374,7 @@ public Document objectToXML(Object object, Node parent, DocumentPreservationPoli } } }else{ - Class objectClass = object.getClass(); + Class objectClass = object.getClass(); session = context.getSession(objectClass); descriptor = getDescriptor(objectClass, session); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLChoiceObjectMapping.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLChoiceObjectMapping.java index 3240233cc3f..b647a133f14 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLChoiceObjectMapping.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLChoiceObjectMapping.java @@ -269,7 +269,7 @@ public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManage @Override public void writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, WriteType writeType) throws DescriptorException { Object value = getAttributeValueFromObject(object); - Class valueClass = value.getClass(); + Class valueClass = value.getClass(); if(valueClass == XMLRoot.class) { //look for a nested mapping based on the Root's QName XMLRoot root = (XMLRoot)value; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLInverseReferenceMapping.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLInverseReferenceMapping.java index 0979d33dd2b..b0c95845b05 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLInverseReferenceMapping.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLInverseReferenceMapping.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 boolean isXMLMapping() { @Override public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); - setFields(new Vector ()); + setFields(new Vector<>()); if(inlineMapping != null){ inlineMapping.initialize(session); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/record/WriterRecord.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/record/WriterRecord.java index 6d940f3f941..45030b1a5d7 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/record/WriterRecord.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/record/WriterRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019 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 @@ -248,7 +248,7 @@ protected void writeValue(String value, boolean isAttribute, StringBuilder write try { StringWriter sw = new StringWriter(); escapeHandler.escape(value.toCharArray(), 0, value.length(), isAttribute, sw); - writer.append(sw.toString()); + writer.append(sw); } catch (IOException e) { throw XMLMarshalException.marshalException(e); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/DB2ZPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/DB2ZPlatform.java index a09f8dda4af..81b89be9a9f 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/DB2ZPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/DB2ZPlatform.java @@ -158,8 +158,8 @@ public String buildProcedureCallString(StoredProcedureCall call, AbstractSession @Override public void registerOutputParameter(CallableStatement statement, String name, int jdbcType) throws SQLException { try { - Class clazz = null; - Method method = null; + Class clazz; + Method method; String methodName = "registerJccOutParameterAtName"; Class[] methodArgs = (Class[]) new Class[] {String.class, int.class}; Object[] parameters = new Object[] {name, jdbcType}; @@ -197,10 +197,9 @@ public void registerOutputParameter(CallableStatement statement, String name, in @Override public void registerOutputParameter(CallableStatement statement, String name, int jdbcType, String typeName) throws SQLException { try { - Class clazz = null; - Method method = null; + Class clazz; + Method method; String methodName = "registerJccOutParameterAtName"; - @SuppressWarnings({"rawtypes"}) Class[] methodArgs = (Class[]) new Class[] {String.class, int.class, String.class}; Object[] parameters = new Object[] {name, jdbcType, typeName}; if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { @@ -401,8 +400,8 @@ else if (parameter instanceof Calendar) { if(methodName != null) { try { - Class clazz = null; - Method method = null; + Class clazz; + Method method; if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { try { ClassLoader cl = AccessController.doPrivileged(new PrivilegedGetContextClassLoader(Thread.currentThread())); @@ -432,11 +431,10 @@ else if (parameter instanceof Calendar) { } @Override - @SuppressWarnings({"rawtypes"}) protected void setNullFromDatabaseField(DatabaseField databaseField, CallableStatement statement, String name) throws SQLException { - String methodName = null; - Class[] methodArgs = null; - Object[] parameters = null; + String methodName; + Class[] methodArgs; + Object[] parameters; if (databaseField instanceof ObjectRelationalDatabaseField) { ObjectRelationalDatabaseField field = (ObjectRelationalDatabaseField)databaseField; methodName = "setJccNullAtName"; @@ -450,8 +448,8 @@ protected void setNullFromDatabaseField(DatabaseField databaseField, CallableSta } try { - Class clazz = null; - Method method = null; + Class clazz; + Method method; if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { try { ClassLoader cl = AccessController.doPrivileged(new PrivilegedGetContextClassLoader(Thread.currentThread())); @@ -480,44 +478,41 @@ protected void setNullFromDatabaseField(DatabaseField databaseField, CallableSta } @Override - @SuppressWarnings({"rawtypes"}) public Object getParameterValueFromDatabaseCall(CallableStatement statement, String name, AbstractSession session) throws SQLException { - String methodName = null; - Class[] methodArgs = null; - Object[] parameters = null; + String methodName; + Class[] methodArgs; + Object[] parameters; methodName = "getJccObjectAtName"; methodArgs = (Class[]) new Class[] {String.class}; parameters = new Object[] {name}; - if(methodName != null) { - try { - Class clazz = null; - Method method = null; - if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { - try { - ClassLoader cl = AccessController.doPrivileged(new PrivilegedGetContextClassLoader(Thread.currentThread())); - clazz = AccessController.doPrivileged(new PrivilegedClassForName<>(DB2_CALLABLESTATEMENT_CLASS, true, cl)); - method = AccessController.doPrivileged(new PrivilegedGetMethod(clazz, methodName, methodArgs, true)); - Object o = statement.unwrap(clazz); - return AccessController.doPrivileged(new PrivilegedMethodInvoker<>(method, o, parameters)); - } catch (PrivilegedActionException ex) { - if (ex.getCause() instanceof ClassNotFoundException) { - throw (ClassNotFoundException) ex.getCause(); - } - throw (RuntimeException) ex.getCause(); - } - } else { - ClassLoader cl = PrivilegedAccessHelper.getContextClassLoader(Thread.currentThread()); - clazz = PrivilegedAccessHelper.getClassForName(DB2_CALLABLESTATEMENT_CLASS, true, cl); - method = PrivilegedAccessHelper.getMethod(clazz, methodName, methodArgs, true); + try { + Class clazz; + Method method; + if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { + try { + ClassLoader cl = AccessController.doPrivileged(new PrivilegedGetContextClassLoader(Thread.currentThread())); + clazz = AccessController.doPrivileged(new PrivilegedClassForName<>(DB2_CALLABLESTATEMENT_CLASS, true, cl)); + method = AccessController.doPrivileged(new PrivilegedGetMethod(clazz, methodName, methodArgs, true)); Object o = statement.unwrap(clazz); - return PrivilegedAccessHelper.invokeMethod(method, o, parameters); + return AccessController.doPrivileged(new PrivilegedMethodInvoker<>(method, o, parameters)); + } catch (PrivilegedActionException ex) { + if (ex.getCause() instanceof ClassNotFoundException) { + throw (ClassNotFoundException) ex.getCause(); + } + throw (RuntimeException) ex.getCause(); } - } catch (ReflectiveOperationException e) { - AbstractSessionLog.getLog().logThrowable(SessionLog.WARNING, null, e); + } else { + ClassLoader cl = PrivilegedAccessHelper.getContextClassLoader(Thread.currentThread()); + clazz = PrivilegedAccessHelper.getClassForName(DB2_CALLABLESTATEMENT_CLASS, true, cl); + method = PrivilegedAccessHelper.getMethod(clazz, methodName, methodArgs, true); + Object o = statement.unwrap(clazz); + return PrivilegedAccessHelper.invokeMethod(method, o, parameters); } + } catch (ReflectiveOperationException e) { + AbstractSessionLog.getLog().logThrowable(SessionLog.WARNING, null, e); } //Didn't work, fall back. This most likely still won't work, but the driver exception from there will be helpful. return super.getParameterValueFromDatabaseCall(statement, name, session); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/DerbyPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/DerbyPlatform.java index db2e86e85a3..59b57575e6f 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/DerbyPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/DerbyPlatform.java @@ -233,8 +233,8 @@ protected String getCreateTempTableSqlBodyForTable(DatabaseTable table) { */ @Override public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, - Collection pkFields, - Collection assignedFields) throws IOException + Collection pkFields, + Collection assignedFields) throws IOException { writer.write("UPDATE "); String tableName = table.getQualifiedNameDelimited(this); @@ -243,14 +243,14 @@ public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable tab String tempTableName = getTempTableForTable(table).getQualifiedNameDelimited(this); boolean isFirst = true; - Iterator itFields = assignedFields.iterator(); + Iterator itFields = assignedFields.iterator(); while(itFields.hasNext()) { if(isFirst) { isFirst = false; } else { writer.write(", "); } - DatabaseField field = (DatabaseField)itFields.next(); + DatabaseField field = itFields.next(); String fieldName = field.getNameDelimited(this); writer.write(fieldName); writer.write(" = (SELECT "); @@ -262,7 +262,7 @@ public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable tab } writer.write(" WHERE EXISTS(SELECT "); - writer.write(((DatabaseField)pkFields.iterator().next()).getNameDelimited(this)); + writer.write(pkFields.iterator().next().getNameDelimited(this)); writer.write(" FROM "); writer.write(tempTableName); writeAutoJoinWhereClause(writer, null, tableName, pkFields, this); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/H2Platform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/H2Platform.java index d8eb4c2b3bc..0626b857ad4 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/H2Platform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/H2Platform.java @@ -174,8 +174,8 @@ protected String getCreateTempTableSqlPrefix() { */ @Override public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, - Collection pkFields, - Collection assignedFields) throws IOException + Collection pkFields, + Collection assignedFields) throws IOException { writer.write("UPDATE "); String tableName = table.getQualifiedNameDelimited(this); @@ -195,7 +195,7 @@ public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable tab writer.write(tempTableName); writeAutoJoinWhereClause(writer, null, tableName, pkFields, this); writer.write(") WHERE EXISTS(SELECT "); - writer.write(((DatabaseField)pkFields.iterator().next()).getNameDelimited(this)); + writer.write(pkFields.iterator().next().getNameDelimited(this)); writer.write(" FROM "); writer.write(tempTableName); writeAutoJoinWhereClause(writer, null, tableName, pkFields, this); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/HSQLPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/HSQLPlatform.java index 18fd1e8f68e..f389ef97dbb 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/HSQLPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/HSQLPlatform.java @@ -270,8 +270,8 @@ protected String getCreateTempTableSqlPrefix() { */ @Override public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, - Collection pkFields, - Collection assignedFields) throws IOException + Collection pkFields, + Collection assignedFields) throws IOException { writer.write("UPDATE "); String tableName = table.getQualifiedNameDelimited(this); @@ -280,14 +280,14 @@ public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable tab String tempTableName = getTempTableForTable(table).getQualifiedNameDelimited(this); boolean isFirst = true; - Iterator itFields = assignedFields.iterator(); + Iterator itFields = assignedFields.iterator(); while(itFields.hasNext()) { if(isFirst) { isFirst = false; } else { writer.write(", "); } - DatabaseField field = (DatabaseField)itFields.next(); + DatabaseField field = itFields.next(); String fieldName = field.getNameDelimited(this); writer.write(fieldName); writer.write(" = (SELECT "); @@ -299,7 +299,7 @@ public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable tab } writer.write(" WHERE EXISTS(SELECT "); - writer.write(((DatabaseField)pkFields.iterator().next()).getNameDelimited(this)); + writer.write(pkFields.iterator().next().getNameDelimited(this)); writer.write(" FROM "); writer.write(tempTableName); writeAutoJoinWhereClause(writer, null, tableName, pkFields, this); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/Informix11Platform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/Informix11Platform.java index c8fccab6714..0092b66358f 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/Informix11Platform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/Informix11Platform.java @@ -392,7 +392,7 @@ protected String getCreateTempTableSqlSuffix() { * bug 402037 */ @Override - public void writeUpdateOriginalFromTempTableSql(final Writer writer, final DatabaseTable table, final Collection pkFields, final Collection assignedFields) throws IOException { + public void writeUpdateOriginalFromTempTableSql(final Writer writer, final DatabaseTable table, final Collection pkFields, final Collection assignedFields) throws IOException { writer.write("UPDATE "); final String tableName = table.getQualifiedNameDelimited(this); writer.write(tableName); @@ -412,7 +412,7 @@ public void writeUpdateOriginalFromTempTableSql(final Writer writer, final Datab writer.write(tempTableName); writeAutoJoinWhereClause(writer, null, tableName, pkFields, this); writer.write(") WHERE EXISTS(SELECT "); - writer.write(((DatabaseField)pkFields.iterator().next()).getNameDelimited(this)); + writer.write(pkFields.iterator().next().getNameDelimited(this)); writer.write(" FROM "); writer.write(tempTableName); writeAutoJoinWhereClause(writer, null, tableName, pkFields, this); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/MySQLPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/MySQLPlatform.java index eac34dc2ccb..1cae3bc200d 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/MySQLPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/MySQLPlatform.java @@ -49,6 +49,7 @@ import org.eclipse.persistence.internal.expressions.FunctionExpression; import org.eclipse.persistence.internal.expressions.SQLSelectStatement; import org.eclipse.persistence.internal.helper.ClassConstants; +import org.eclipse.persistence.internal.helper.DatabaseField; import org.eclipse.persistence.internal.helper.DatabaseTable; import org.eclipse.persistence.internal.helper.Helper; import org.eclipse.persistence.internal.sessions.AbstractRecord; @@ -723,8 +724,8 @@ public String getProcedureEndString() { */ @Override public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, - Collection pkFields, - Collection assignedFields) throws IOException + Collection pkFields, + Collection assignedFields) throws IOException { writer.write("UPDATE "); String tableName = table.getQualifiedNameDelimited(this); @@ -742,8 +743,8 @@ public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable tab */ @Override public void writeDeleteFromTargetTableUsingTempTableSql(Writer writer, DatabaseTable table, DatabaseTable targetTable, - Collection pkFields, - Collection targetPkFields, DatasourcePlatform platform) throws IOException + Collection pkFields, + Collection targetPkFields, DatasourcePlatform platform) throws IOException { writer.write("DELETE FROM "); String targetTableName = targetTable.getQualifiedNameDelimited(this); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/Oracle8Platform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/Oracle8Platform.java index 5b66b59f640..20b3abafdee 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/Oracle8Platform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/Oracle8Platform.java @@ -175,7 +175,6 @@ public Object getCustomModifyValueForCall(Call call, Object value, DatabaseField /** * INTERNAL: Write LOB value - only on Oracle8 and up */ - @SuppressWarnings("deprecation") @Override public void writeLOB(DatabaseField field, Object value, ResultSet resultSet, AbstractSession session) throws SQLException { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/OraclePlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/OraclePlatform.java index e0e81d8717e..3924c148b72 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/OraclePlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/OraclePlatform.java @@ -266,7 +266,7 @@ protected String buildFirstRowsHint(int max){ * Returns null unless the platform supports call with returning */ @Override - public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector returnFields) { + public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector returnFields) { SQLCall call = new SQLCall(); call.setParameters(sqlCall.getParameters()); call.setParameterTypes(sqlCall.getParameterTypes()); @@ -278,7 +278,7 @@ public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector returnFields) writer.write(" RETURNING "); for (int i = 0; i < returnFields.size(); i++) { - DatabaseField field = (DatabaseField)returnFields.elementAt(i); + DatabaseField field = returnFields.elementAt(i); writer.write(field.getNameDelimited(this)); if ((i + 1) < returnFields.size()) { writer.write(", "); @@ -288,7 +288,7 @@ public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector returnFields) writer.write(" INTO "); for (int i = 0; i < returnFields.size(); i++) { - DatabaseField field = (DatabaseField)returnFields.elementAt(i); + DatabaseField field = returnFields.elementAt(i); call.appendOut(writer, field); if ((i + 1) < returnFields.size()) { writer.write(", "); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/PostgreSQLPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/PostgreSQLPlatform.java index 29ffa901dc3..46f0a6c67ce 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/PostgreSQLPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/PostgreSQLPlatform.java @@ -555,16 +555,15 @@ public void printSQLSelectStatement(DatabaseCall call, ExpressionSQLPrinter prin * for updating the original table from the temporary table. Precondition: * supportsTempTables() == true. Precondition: pkFields and assignFields * don't intersect. - * - * @param writer for writing the sql + * @param writer for writing the sql * @param table is original table for which temp table is * created. * @param pkFields - primary key fields for the original - * table. + * table. * @param assignedFields - fields to be assigned a new value. */ @Override - public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, Collection pkFields, Collection assignedFields) throws IOException { + public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, Collection pkFields, Collection assignedFields) throws IOException { writer.write("UPDATE "); String tableName = table.getQualifiedNameDelimited(this); writer.write(tableName); @@ -572,14 +571,14 @@ public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable tab String tempTableName = getTempTableForTable(table).getQualifiedNameDelimited(this); boolean isFirst = true; - Iterator itFields = assignedFields.iterator(); + Iterator itFields = assignedFields.iterator(); while (itFields.hasNext()) { if (isFirst) { isFirst = false; } else { writer.write(", "); } - DatabaseField field = (DatabaseField) itFields.next(); + DatabaseField field = itFields.next(); String fieldName = field.getNameDelimited(this); writer.write(fieldName); writer.write(" = (SELECT "); @@ -591,7 +590,7 @@ public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable tab } writer.write(" WHERE EXISTS(SELECT "); - writer.write(((DatabaseField) pkFields.iterator().next()).getNameDelimited(this)); + writer.write(pkFields.iterator().next().getNameDelimited(this)); writer.write(" FROM "); writer.write(tempTableName); writeAutoJoinWhereClause(writer, null, tableName, pkFields, this); @@ -612,7 +611,7 @@ public boolean canBuildCallWithReturning() { * Uses the returning clause on Postgres. */ @Override - public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector returnFields) { + public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector returnFields) { SQLCall call = new SQLCall(); call.setParameters(sqlCall.getParameters()); call.setParameterTypes(sqlCall.getParameterTypes()); @@ -622,7 +621,7 @@ public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector returnFields) writer.write(sqlCall.getSQLString()); writer.write(" RETURNING "); for (int i = 0; i < returnFields.size(); i++) { - DatabaseField field = (DatabaseField)returnFields.elementAt(i); + DatabaseField field = returnFields.elementAt(i); writer.write(field.getNameDelimited(this)); if ((i + 1) < returnFields.size()) { writer.write(", "); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/SQLServerPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/SQLServerPlatform.java index 4608b894790..df6457875b6 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/SQLServerPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/SQLServerPlatform.java @@ -778,8 +778,8 @@ public DatabaseTable getTempTableForTable(DatabaseTable table) { */ @Override public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, - Collection pkFields, - Collection assignedFields) throws IOException + Collection pkFields, + Collection assignedFields) throws IOException { writer.write("UPDATE "); String tableName = table.getQualifiedNameDelimited(this); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/SybasePlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/SybasePlatform.java index be72280943c..1284ef5a6e9 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/SybasePlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/SybasePlatform.java @@ -48,6 +48,7 @@ import org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition; import org.eclipse.persistence.internal.expressions.RelationExpression; import org.eclipse.persistence.internal.helper.ClassConstants; +import org.eclipse.persistence.internal.helper.DatabaseField; import org.eclipse.persistence.internal.helper.DatabaseTable; import org.eclipse.persistence.internal.helper.Helper; import org.eclipse.persistence.internal.sessions.AbstractSession; @@ -792,8 +793,8 @@ public DatabaseTable getTempTableForTable(DatabaseTable table) { */ @Override public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, - Collection pkFields, - Collection assignedFields) throws IOException + Collection pkFields, + Collection assignedFields) throws IOException { writer.write("UPDATE "); String tableName = table.getQualifiedNameDelimited(this); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/jdbc/JDBCTypes.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/jdbc/JDBCTypes.java index c31258a45ba..024f22c9b8a 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/jdbc/JDBCTypes.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/jdbc/JDBCTypes.java @@ -78,7 +78,6 @@ * @author Mike Norman - michael.norman@oracle.com * @since Oracle TopLink 11.x.x */ -@SuppressWarnings("unchecked") public enum JDBCTypes implements JDBCType { ARRAY_TYPE(ARRAY, "ARRAY"), diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/OraclePLSQLTypes.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/OraclePLSQLTypes.java index d2aff9217b9..64a30d235c3 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/OraclePLSQLTypes.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/OraclePLSQLTypes.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 @@ -36,7 +36,6 @@ * @author Mike Norman - michael.norman@oracle.com * @since Oracle TopLink 11.x.x */ -@SuppressWarnings("unchecked") public enum OraclePLSQLTypes implements SimpleDatabaseType, OraclePLSQLType { BinaryInteger("BINARY_INTEGER"), diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/PLSQLCursor.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/PLSQLCursor.java index bc586c53149..4bd580d537e 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/PLSQLCursor.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/PLSQLCursor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -24,7 +24,6 @@ /** * PUBLIC: describe an Oracle PL/SQL Cursor type */ -@SuppressWarnings("unchecked") public class PLSQLCursor extends ComplexDatabaseType implements OraclePLSQLType, Cloneable { public PLSQLCursor() { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/PLSQLStoredProcedureCall.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/PLSQLStoredProcedureCall.java index 5e8b38e4ee1..ece373a7b53 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/PLSQLStoredProcedureCall.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/PLSQLStoredProcedureCall.java @@ -66,7 +66,6 @@ * This handles conversion of PLSQL Record and Table types into SQL ARRAY (VARRAY) and STRUCT (OBJECT TYPE). * It also handles conversion of flat PLSQL Record types and PLSQL BOOLEAN and other basic types. */ -@SuppressWarnings("unchecked") public class PLSQLStoredProcedureCall extends StoredProcedureCall { // can't use Helper.cr(), Oracle PL/SQL parser only likes Unix-style newlines '\n' @@ -94,7 +93,7 @@ public class PLSQLStoredProcedureCall extends StoredProcedureCall { /** * Map of conversion function routines for converting complex PLSQL types. */ - protected Map typesInfo; + private Map typesInfo; /** * Id used to generate unique local functions. */ @@ -640,8 +639,8 @@ protected void buildDeclareBlock(StringBuilder sb, List arguments * Add the nested function string required for the type and its subtypes. The functions * must be added in inverse order to resolve dependencies. */ - protected void addNestedFunctionsForArgument(List functions, PLSQLargument argument, - DatabaseType databaseType, Set processed) { + protected void addNestedFunctionsForArgument(List functions, PLSQLargument argument, + DatabaseType databaseType, Set processed) { if ((databaseType == null) || !databaseType.isComplexDatabaseType() || databaseType.isJDBCType() @@ -697,14 +696,14 @@ protected void addNestedFunctionsForArgument(List functions, PLSQLargument argum /** * INTERNAL: Generate the nested function to convert the PLSQL type to its compatible SQL type. */ - protected TypeInfo generateNestedFunction(ComplexDatabaseType type) { + private TypeInfo generateNestedFunction(ComplexDatabaseType type) { return generateNestedFunction(type, false); } /** * INTERNAL: Generate the nested function to convert the PLSQL type to its compatible SQL type. */ - protected TypeInfo generateNestedFunction(ComplexDatabaseType type, boolean isNonAssociativeCollection) { + private TypeInfo generateNestedFunction(ComplexDatabaseType type, boolean isNonAssociativeCollection) { TypeInfo info = new TypeInfo(); info.pl2SqlName = PL2SQL_PREFIX + (this.functionId++); info.sql2PlName = SQL2PL_PREFIX + (this.functionId++); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/PLSQLrecord.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/PLSQLrecord.java index 23d2b940760..a7e8a93c78a 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/PLSQLrecord.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/database/oracle/plsql/PLSQLrecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019 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 @@ -41,7 +41,6 @@ * @author Mike Norman - michael.norman@oracle.com * @since Oracle TopLink 11.x.x */ -@SuppressWarnings("unchecked") public class PLSQLrecord extends ComplexDatabaseType implements OraclePLSQLType, Cloneable { protected List fields = new ArrayList<>(); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/JMXServerPlatformBase.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/JMXServerPlatformBase.java index a495c2f51c3..3e780245864 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/JMXServerPlatformBase.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/JMXServerPlatformBase.java @@ -208,12 +208,12 @@ public MBeanServer getMBeanServer() { if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { try { mBeanServerList = AccessController.doPrivileged( - new PrivilegedExceptionAction>() { - @Override - public List run() { - return MBeanServerFactory.findMBeanServer(null); + new PrivilegedExceptionAction<>() { + @Override + public List run() { + return MBeanServerFactory.findMBeanServer(null); + } } - } ); } catch (PrivilegedActionException pae) { getAbstractSession().log(SessionLog.WARNING, SessionLog.SERVER, @@ -322,11 +322,10 @@ public void serverSpecificRegisterMBean() { args[0] = developmentMBean; args[1] = name; try { - @SuppressWarnings({"rawtypes"}) Method getMethod = PrivilegedAccessHelper.getPublicMethod(MBeanServer.class, "registerMBean", new Class[] {Object.class, ObjectName.class}, false); if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { - info = AccessController.doPrivileged(new PrivilegedMethodInvoker(getMethod, mBeanServerRuntime, args)); + info = AccessController.doPrivileged(new PrivilegedMethodInvoker<>(getMethod, mBeanServerRuntime, args)); } else { info = mBeanServerRuntime.registerMBean(developmentMBean, name); } @@ -355,11 +354,10 @@ public void serverSpecificRegisterMBean() { Object[] args = new Object[2]; args[0] = runtimeServicesMBean; args[1] = name; - @SuppressWarnings({"rawtypes"}) Method getMethod = PrivilegedAccessHelper.getPublicMethod(MBeanServer.class, "registerMBean", new Class[] {Object.class, ObjectName.class}, false); if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { - runtimeInstance = AccessController.doPrivileged(new PrivilegedMethodInvoker(getMethod, mBeanServerRuntime, args)); + runtimeInstance = AccessController.doPrivileged(new PrivilegedMethodInvoker<>(getMethod, mBeanServerRuntime, args)); } else { runtimeInstance = mBeanServerRuntime.registerMBean(runtimeServicesMBean, name); } @@ -408,7 +406,6 @@ public void serverSpecificUnregisterMBean() { Object[] args = new Object[1]; args[0] = name; try { - @SuppressWarnings({"rawtypes"}) Method getMethod = PrivilegedAccessHelper.getPublicMethod(MBeanServer.class, "unregisterMBean", new Class[] {ObjectName.class}, false); if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { @@ -437,7 +434,6 @@ public void serverSpecificUnregisterMBean() { Object[] args = new Object[1]; args[0] = name; try { - @SuppressWarnings({"rawtypes"}) Method getMethod = PrivilegedAccessHelper.getPublicMethod(MBeanServer.class, "unregisterMBean", new Class[] {ObjectName.class}, false); if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/NoServerPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/NoServerPlatform.java index acce956300a..04c397d8a52 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/NoServerPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/NoServerPlatform.java @@ -61,7 +61,6 @@ public String getServerNameAndVersion() { * @see #isJTAEnabled() * @see #disableJTA() * @see #initializeExternalTransactionController() - * @return */ @Override public Class getExternalTransactionControllerClass() { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatform.java index 9f9d1d06730..9b3e7e6ee76 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatform.java @@ -104,7 +104,6 @@ public interface ServerPlatform { * @see #isJTAEnabled() * @see #disableJTA() * @see #initializeExternalTransactionController() - * @param newClass */ void setExternalTransactionControllerClass(Class newClass); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatformBase.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatformBase.java index 9b0f576b3b7..3e9e0e543ca 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatformBase.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatformBase.java @@ -264,7 +264,6 @@ public String getModuleName() { * @see #isJTAEnabled() * @see #disableJTA() * @see #initializeExternalTransactionController() - * @param newClass */ @Override public void setExternalTransactionControllerClass(Class newClass) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatformUtils.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatformUtils.java index 44d9f896a02..5c43d5c5064 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatformUtils.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/ServerPlatformUtils.java @@ -44,7 +44,7 @@ * A utility class to interact with ServerPlatforms. */ public final class ServerPlatformUtils { - private static final List PLATFORMS = new ArrayList() {{ + private static final List PLATFORMS = new ArrayList<>() {{ add(new NoServerPlatformDetector()); add(new WebSpherePlatformDetector()); add(new WebLogicPlatformDetector()); @@ -105,7 +105,6 @@ public static String detectServerPlatform(AbstractSession session) { * * @see ServerPlatformBase#ServerPlatformBase(DatabaseSession) */ - @SuppressWarnings({"rawtypes"}) public static ServerPlatform createServerPlatform(DatabaseSession session, String platformClass, ClassLoader loader) { if (platformClass == null) { throw ServerPlatformException.invalidServerPlatformClass(null, null); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/glassfish/GlassfishPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/glassfish/GlassfishPlatform.java index 227fbc24323..657b50c1b1f 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/glassfish/GlassfishPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/glassfish/GlassfishPlatform.java @@ -107,7 +107,7 @@ public java.sql.Connection unwrapConnection(final Connection connection) { Connection unwrappedConnection; if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { - unwrappedConnection = AccessController.doPrivileged(new PrivilegedAction() { + unwrappedConnection = AccessController.doPrivileged(new PrivilegedAction<>() { @Override public Connection run() { return unwrapGlassFishConnectionHelper(connection); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/was/WebSpherePlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/was/WebSpherePlatform.java index 0cc126c5608..8f35aa7b0d1 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/was/WebSpherePlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/was/WebSpherePlatform.java @@ -126,7 +126,6 @@ protected Class getWebsphereConnectionClass() { protected Method getVendorConnectionMethod() { if ((this.vendorConnectionMethod == null) && (!getWebsphereUtilClass().equals(void.class))) { try { - @SuppressWarnings({"rawtypes"}) Class[] args = (Class[]) new Class[1]; args[0] = getWebsphereConnectionClass(); this.vendorConnectionMethod = PrivilegedAccessHelper.getDeclaredMethod(getWebsphereUtilClass(), "getNativeConnection", args); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/was/WebSpherePlatformDetector.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/was/WebSpherePlatformDetector.java index 2cb4f9d2887..0e9f97912a9 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/was/WebSpherePlatformDetector.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/was/WebSpherePlatformDetector.java @@ -49,7 +49,7 @@ public String checkPlatform() { private boolean isLiberty() { if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { - return AccessController.doPrivileged(new PrivilegedAction() { + return AccessController.doPrivileged(new PrivilegedAction<>() { @Override public Boolean run() { return isLibertyInternal(); @@ -62,7 +62,7 @@ public Boolean run() { private boolean isFullProfile() { if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { - return AccessController.doPrivileged(new PrivilegedAction() { + return AccessController.doPrivileged(new PrivilegedAction<>() { @Override public Boolean run() { return isFullProfileInternal(); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/was/WebSphere_7_Platform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/was/WebSphere_7_Platform.java index bc94a111681..bc2fb8a0303 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/was/WebSphere_7_Platform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/was/WebSphere_7_Platform.java @@ -87,7 +87,7 @@ protected SessionLog createSessionLog() { SessionLog log = null; try { if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { - log = AccessController.doPrivileged(new PrivilegedExceptionAction() { + log = AccessController.doPrivileged(new PrivilegedExceptionAction<>() { @Override public SessionLog run() throws Exception { Class cls = PrivilegedAccessHelper.getClassForName(SERVER_LOG_CLASS); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogicPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogicPlatform.java index 5f96c076317..1d9e05f3a38 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogicPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogicPlatform.java @@ -132,7 +132,6 @@ protected Class getWebLogicConnectionClass() { /** * Return the method for the WebLogic JDBC connection wrapper vendorConnection. */ - @SuppressWarnings({"rawtypes"}) protected Method getVendorConnectionMethod() { if ((this.vendorConnectionMethod == null) && (!getWebLogicConnectionClass().equals(void.class))) { try { @@ -166,7 +165,6 @@ public Connection unwrapConnection(Connection connection) { /** * Return the method for the WebLogic connection clearStatementCache method. */ - @SuppressWarnings({"rawtypes"}) protected Method getClearStatementCacheMethod() { if ((this.clearStatementCacheMethod == null) && (!getWebLogicConnectionClass().equals(void.class))) { try { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogicPlatformDetector.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogicPlatformDetector.java index a9e1b4bc9b8..a6ee63155e9 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogicPlatformDetector.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogicPlatformDetector.java @@ -37,7 +37,7 @@ public String checkPlatform() { String platform = null; String serverNameAndVersion; if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { - serverNameAndVersion = AccessController.doPrivileged(new PrivilegedAction() { + serverNameAndVersion = AccessController.doPrivileged(new PrivilegedAction<>() { @Override public String run() { return getServerNameAndVersionInternal(); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogic_10_Platform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogic_10_Platform.java index 72b40daae23..f890f134be8 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogic_10_Platform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogic_10_Platform.java @@ -316,7 +316,6 @@ private String getModuleOrApplicationName(String getMethodName) { try { // perform a reflective public java.lang.String // weblogic.work.ExecuteThreadRuntime. - @SuppressWarnings({"rawtypes"}) Method getMethod = PrivilegedAccessHelper.getPublicMethod(executeThread.getClass(), getMethodName, new Class[] {}, false); if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { classLoaderOrString = AccessController.doPrivileged(new PrivilegedMethodInvoker<>(getMethod, executeThread, null)); @@ -400,7 +399,6 @@ private Object getExecuteThreadFromMBean() { * so use this if available. */ @Override - @SuppressWarnings({"rawtypes"}) protected Method getVendorConnectionMethod() { if ((this.vendorConnectionMethod == null) && (!getWebLogicConnectionClass().equals(void.class))) { try { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogic_12_Platform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogic_12_Platform.java index e0bffcc37ad..45548b9000b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogic_12_Platform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/server/wls/WebLogic_12_Platform.java @@ -67,7 +67,7 @@ private static final class ContextHelper { static { if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { - cicManagerClass = AccessController.doPrivileged(new PrivilegedAction>() { + cicManagerClass = AccessController.doPrivileged(new PrivilegedAction<>() { @Override public Class run() { return getCicManagerClass(CIC_MANAGER_RESOURCE_NAME, CIC_MANAGER_CLASS_NAME); @@ -104,7 +104,6 @@ public Void run() { } } - @SuppressWarnings({"rawtypes"}) private void initialize(final Class managerClass, final String contextClassName) { try { // Get component invocation manager @@ -160,7 +159,7 @@ String getPartitionName() { private String getStringFromMethod(final Method methodToCall) { try { if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { - return AccessController.doPrivileged(new PrivilegedAction() { + return AccessController.doPrivileged(new PrivilegedAction<>() { @Override public String run() { try { @@ -189,7 +188,7 @@ public String run() { boolean isGlobalRuntime() { try { if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { - return AccessController.doPrivileged(new PrivilegedAction() { + return AccessController.doPrivileged(new PrivilegedAction<>() { @Override public Boolean run() { try { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/xml/jaxp/JAXPPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/xml/jaxp/JAXPPlatform.java index f54aa3469ba..65dc8c892c0 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/xml/jaxp/JAXPPlatform.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/platform/xml/jaxp/JAXPPlatform.java @@ -260,7 +260,7 @@ public boolean validate(Element elem, org.eclipse.persistence.oxm.XMLDescriptor } @Override public void namespaceQualifyFragment(Element next) { - namespaceQualifyFragment(next, new ArrayList()); + namespaceQualifyFragment(next, new ArrayList<>()); } //pass list of prefixes declared and encountered diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/AttributeGroup.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/AttributeGroup.java index f53b24c0a25..6a33f393956 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/AttributeGroup.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/AttributeGroup.java @@ -151,7 +151,7 @@ public FetchGroup toFetchGroup() { if (isFetchGroup()) { return (FetchGroup) this; } - return toFetchGroup(new HashMap()); + return toFetchGroup(new HashMap<>()); } /** @@ -273,7 +273,7 @@ public LoadGroup toLoadGroup() { if (this.isLoadGroup()) { return (LoadGroup) this; } - return toLoadGroup(new HashMap(), false); + return toLoadGroup(new HashMap<>(), false); } public LoadGroup toLoadGroup(Map cloneMap, boolean loadOnly){ diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/BatchFetchPolicy.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/BatchFetchPolicy.java index 5f9eb0e8064..ba81f2483f6 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/BatchFetchPolicy.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/BatchFetchPolicy.java @@ -57,8 +57,8 @@ public BatchFetchPolicy() { public BatchFetchPolicy(BatchFetchType type) { this.type = type; - this.dataResults = new HashMap>(); - this.dataResults.put(this, new ArrayList()); + this.dataResults = new HashMap<>(); + this.dataResults.put(this, new ArrayList<>()); } @Override diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/DatabaseQuery.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/DatabaseQuery.java index 4ae07cc5df3..48cc4d0cb06 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/DatabaseQuery.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/DatabaseQuery.java @@ -108,7 +108,7 @@ public abstract class DatabaseQuery implements Cloneable, Serializable { protected List argumentValues; /** Needed to differentiate queries with the same name. */ - protected List argumentTypes; + protected List> argumentTypes; /** Used to build a list of argumentTypes by name pre-initialization */ protected List argumentTypeNames; @@ -707,7 +707,7 @@ public Object clone() { if (cloneQuery.properties.isEmpty()) { cloneQuery.properties = null; } else { - cloneQuery.properties = new HashMap(this.properties); + cloneQuery.properties = new HashMap<>(this.properties); } } @@ -968,7 +968,7 @@ public List getArgumentParameterTypes(){ * INTERNAL: Return the argumentTypes for use with the pre-defined query * option */ - public List getArgumentTypes() { + public List> getArgumentTypes() { if ((this.argumentTypes == null) || (this.argumentTypes.isEmpty() && (this.argumentTypeNames != null) && !this.argumentTypeNames.isEmpty())) { this.argumentTypes = new ArrayList<>(); // Bug 3256198 - lazily initialize the argument types from their @@ -999,12 +999,12 @@ public List getArgumentTypeNames() { /** * INTERNAL: Set the argumentTypes for use with the pre-defined query option */ - public void setArgumentTypes(List argumentTypes) { + public void setArgumentTypes(List> argumentTypes) { this.argumentTypes = argumentTypes; // bug 3256198 - ensure the list of type names matches the argument // types. getArgumentTypeNames().clear(); - for (Class type : argumentTypes) { + for (Class type : argumentTypes) { this.argumentTypeNames.add(type.getName()); } } @@ -1021,7 +1021,7 @@ public void setArgumentTypeNames(List argumentTypeNames) { * Maintain the argumentTypes as well. */ public void setArguments(List arguments) { - List types = new ArrayList<>(arguments.size()); + List> types = new ArrayList<>(arguments.size()); List typeNames = new ArrayList<>(arguments.size()); List typeFields = new ArrayList<>(arguments.size()); int size = arguments.size(); @@ -1189,7 +1189,7 @@ public char getParameterDelimiterChar() { public Map getProperties() { if (this.properties == null) { // Lazy initialize to conserve space and allocation time. - this.properties = new HashMap(); + this.properties = new HashMap<>(); } return this.properties; } @@ -1341,13 +1341,13 @@ public String getSensorName(String operationName, String sessionName) { if (operationName == null) { return getQueryNounName(sessionName); } - - Hashtable sensorNames = (Hashtable)getProperty("DMSSensorNames"); + @SuppressWarnings({"unchecked"}) + Hashtable sensorNames = (Hashtable) getProperty("DMSSensorNames"); if (sensorNames == null) { - sensorNames = new Hashtable(); + sensorNames = new Hashtable<>(); setProperty("DMSSensorNames", sensorNames); } - Object sensorName = sensorNames.get(operationName); + String sensorName = sensorNames.get(operationName); if (sensorName == null) { StringBuilder buffer = new StringBuilder(getQueryNounName(sessionName)); buffer.append("_"); @@ -1355,7 +1355,7 @@ public String getSensorName(String operationName, String sessionName) { sensorName = buffer.toString(); sensorNames.put(operationName, sensorName); } - return (String)sensorName; + return sensorName; } /** @@ -2018,8 +2018,8 @@ public void retrieveBypassCache() { */ public List buildArgumentFields() { List arguments = getArguments(); - List argumentTypes = getArgumentTypes(); - List argumentFields = new ArrayList(arguments.size()); + List> argumentTypes = getArgumentTypes(); + List argumentFields = new ArrayList<>(arguments.size()); int size = arguments.size(); for (int index = 0; index < size; index++) { DatabaseField argumentField = new DatabaseField(arguments.get(index)); @@ -2072,7 +2072,7 @@ public void setAccessor(Accessor accessor) { this.accessors = null; return; } - List accessors = new ArrayList(1); + List accessors = new ArrayList<>(1); accessors.add(accessor); this.accessors = accessors; } @@ -2733,6 +2733,7 @@ public void setDoNotRedirect(boolean doNotRedirect) { * INTERNAL: * Return temporary map of batched objects. */ + @SuppressWarnings({"unchecked"}) public Map getBatchObjects() { return (Map)getProperty(BATCH_FETCH_PROPERTY); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/DoesExistQuery.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/DoesExistQuery.java index 036eab0768c..b6a6625b0eb 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/DoesExistQuery.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/DoesExistQuery.java @@ -163,7 +163,7 @@ public Object checkEarlyReturn(Object object, Object primaryKey, AbstractSession } CacheKey cacheKey; - Class objectClass = object.getClass(); + Class objectClass = object.getClass(); AbstractSession tempSession = session; if (tempSession.isUnitOfWork()){ cacheKey = tempSession.getIdentityMapAccessorInstance().getCacheKeyForObjectForLock(primaryKey, objectClass, descriptor); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/FetchGroup.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/FetchGroup.java index a73402595df..f2801c91935 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/FetchGroup.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/FetchGroup.java @@ -293,7 +293,7 @@ public boolean isEntityFetchGroup() { * LoadGroup created with all member groups with shouldLoad set to false dropped. */ public LoadGroup toLoadGroupLoadOnly() { - return this.toLoadGroup(new HashMap(), true); + return this.toLoadGroup(new HashMap<>(), true); } @Override 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 447e6c28a8c..e513d53dbda 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 @@ -17,9 +17,6 @@ import org.eclipse.persistence.internal.helper.*; import org.eclipse.persistence.internal.sessions.*; import org.eclipse.persistence.exceptions.*; -import org.eclipse.persistence.internal.sessions.AbstractRecord; -import org.eclipse.persistence.internal.sessions.UnitOfWorkImpl; -import org.eclipse.persistence.internal.sessions.AbstractSession; import org.eclipse.persistence.descriptors.ClassDescriptor; /** diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ObjectLevelReadQuery.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ObjectLevelReadQuery.java index 7e2033b884a..5508950fabe 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ObjectLevelReadQuery.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ObjectLevelReadQuery.java @@ -3488,7 +3488,7 @@ public String toString() { if(this.descriptor != null && this.descriptor.hasFetchGroupManager()) { FetchGroup defaultFetchGroup = descriptor.getFetchGroupManager().getDefaultFetchGroup(); if(defaultFetchGroup != null) { - str += '\n' + "Default " + defaultFetchGroup.toString(); + str += '\n' + "Default " + defaultFetchGroup; } } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ReadAllQuery.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ReadAllQuery.java index 169c655d76f..874226c0d06 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ReadAllQuery.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ReadAllQuery.java @@ -84,7 +84,7 @@ public class ReadAllQuery extends ObjectLevelReadQuery { * Specifies the direction in which the hierarchy is traversed in a * hierarchical query. */ - public static enum Direction { + public enum Direction { /** * Hierarchy will be traversed from parent to child - PRIOR keyword is * generated on the left side of the equation diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ReportQueryResult.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ReportQueryResult.java index 232a3174662..7c0f79a7126 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ReportQueryResult.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/ReportQueryResult.java @@ -113,7 +113,7 @@ protected void buildResult(ReportQuery query, AbstractRecord row, Vector toManyD // For bug 3115576 this is only used for EXISTS sub-selects so no result is needed. } - List results = new ArrayList(); + List results = new ArrayList<>(); for(ReportItem item: query.getItems()) { if (item.isConstructorItem()) { Object result = processConstructorItem(query, row, toManyData, (ConstructorReportItem) item); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/SQLCall.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/SQLCall.java index e649cb81c93..252fd6cd034 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/SQLCall.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/queries/SQLCall.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 @@ -82,11 +82,6 @@ protected void afterTranslateCustomQuery(List updatedParameters, List u } ((Object[])parameter)[1] = outField; } - } else if ((parameterType == IN) && (parameter instanceof DatabaseField)){ - DatabaseField field = afterTranslateCustomQueryUpdateParameter((DatabaseField)parameter, i, parameterType, updatedParameters, updatedParameterTypes); - if (field != null) { - this.parameters.set(i, field); - } } } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sequencing/DefaultSequence.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sequencing/DefaultSequence.java index 7670679aebe..34d42528b2b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sequencing/DefaultSequence.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sequencing/DefaultSequence.java @@ -171,7 +171,6 @@ public Object getGeneratedValue(Accessor accessor, AbstractSession writeSession, * @param writeSession Session is a Session used for writing (either ClientSession or DatabaseSession); * @param seqName String is sequencing number field name * @param size int number of values to preallocate (output Vector size). - * @return */ @Override public Vector getGeneratedVector(Accessor accessor, AbstractSession writeSession, String seqName, int size) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/factories/XMLProjectReader.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/factories/XMLProjectReader.java index 319e434f280..3ee31a50e04 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/factories/XMLProjectReader.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/factories/XMLProjectReader.java @@ -26,6 +26,8 @@ import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.net.URL; +import java.nio.charset.StandardCharsets; + import org.w3c.dom.Document; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; @@ -234,12 +236,8 @@ public static Project read(String fileOrResourceName, ClassLoader classLoader) { InputStreamReader reader = null; try { - try { - // Bug2631348 Only UTF-8 is supported - reader = new InputStreamReader(fileStream, "UTF-8"); - } catch (UnsupportedEncodingException exception) { - throw ValidationException.fatalErrorOccurred(exception); - } + // Bug2631348 Only UTF-8 is supported + reader = new InputStreamReader(fileStream, StandardCharsets.UTF_8); Project project = read(reader, classLoader); return project; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/factories/XMLProjectWriter.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/factories/XMLProjectWriter.java index 21d25a6ac65..a9999e4d3c0 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/factories/XMLProjectWriter.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/factories/XMLProjectWriter.java @@ -15,6 +15,8 @@ package org.eclipse.persistence.sessions.factories; import java.io.*; +import java.nio.charset.StandardCharsets; + import org.eclipse.persistence.exceptions.*; import org.eclipse.persistence.internal.sessions.factories.MissingDescriptorListener; import org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject; @@ -49,7 +51,7 @@ public static void write(Project project, String fileName) { Writer writer; try { FileOutputStream stream = new FileOutputStream(fileName); - writer = new OutputStreamWriter(stream, "UTF-8"); + writer = new OutputStreamWriter(stream, StandardCharsets.UTF_8); write(project, writer); writer.close(); } catch (IOException exception) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/interceptors/CacheInterceptor.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/interceptors/CacheInterceptor.java index efdcef5bd9a..82f35ce75b6 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/interceptors/CacheInterceptor.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/interceptors/CacheInterceptor.java @@ -22,7 +22,6 @@ import java.util.Map; import org.eclipse.persistence.descriptors.ClassDescriptor; -import org.eclipse.persistence.exceptions.QueryException; import org.eclipse.persistence.indirection.ValueHolderInterface; import org.eclipse.persistence.internal.helper.Helper; import org.eclipse.persistence.internal.identitymaps.CacheKey; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/remote/rmi/RMIServerSessionManagerDispatcher.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/remote/rmi/RMIServerSessionManagerDispatcher.java index 6128fcf61f8..7f2561a82fd 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/remote/rmi/RMIServerSessionManagerDispatcher.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/remote/rmi/RMIServerSessionManagerDispatcher.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 @@ -39,7 +39,7 @@ public RMIRemoteSessionController createRemoteSessionController() { controller = new RMIRemoteSessionControllerDispatcher((getSession())); } } catch (RemoteException exception) { - System.out.println("Error in invocation " + exception.toString()); + System.out.println("Error in invocation " + exception); } return controller; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/server/ClientSession.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/server/ClientSession.java index f21979809da..b518278fea2 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/server/ClientSession.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/sessions/server/ClientSession.java @@ -38,7 +38,6 @@ import org.eclipse.persistence.internal.sessions.*; import org.eclipse.persistence.sessions.DatabaseLogin; import org.eclipse.persistence.sessions.SessionProfiler; -import org.eclipse.persistence.internal.sessions.AbstractSession; /** * Purpose: Acts as a client to the server session. diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/PackageRenamer.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/PackageRenamer.java index 6f8b881e932..5ba09b8f3a6 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/PackageRenamer.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/PackageRenamer.java @@ -87,7 +87,7 @@ public class PackageRenamer { static { // bug 2756643 CR = PrivilegedAccessHelper.shouldUsePrivilegedAccess() ? - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction<>() { @Override public String run() { return System.getProperty("line.separator"); @@ -262,10 +262,10 @@ protected void cleanup() { public void createDestinationDirectory(File aDirectory) { if (!aDirectory.exists()) { if (!aDirectory.mkdirs()) { - throw new PackageRenamerException("Error while creating directory:" + CR + " '" + aDirectory.toString() + "'"); + throw new PackageRenamerException("Error while creating directory:" + CR + " '" + aDirectory + "'"); } } else { - throw new PackageRenamerException("Error directory: '" + aDirectory.toString() + "' already exists but shouldn't."); + throw new PackageRenamerException("Error directory: '" + aDirectory + "' already exists but shouldn't."); } } @@ -304,7 +304,7 @@ public File existingDirectoryFromPrompt() { public static String getDefaultPropertiesFileName() { String currentDirectory = PrivilegedAccessHelper.shouldUsePrivilegedAccess() ? - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction<>() { @Override public String run() { return System.getProperty("user.dir"); @@ -537,7 +537,7 @@ public void runSearchAndReplacePackageName(java.io.File sourceFile) { try { fis = new FileInputStream(new java.io.File(sourceFileName)); byte[] buf = new byte[BUFSIZ]; - StringBuffer strBuf = new StringBuffer((int)new java.io.File(sourceFileName).length()); + StringBuilder strBuf = new StringBuilder((int)new java.io.File(sourceFileName).length()); int i = 0; while ((i = fis.read(buf)) != -1) { if (bufferContainsNullChar(buf, i)) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/profiler/FetchGroupMonitor.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/profiler/FetchGroupMonitor.java index ca1830e454a..2fd53fb51b9 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/profiler/FetchGroupMonitor.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/profiler/FetchGroupMonitor.java @@ -33,7 +33,7 @@ */ public class FetchGroupMonitor { - public static Hashtable, Set> fetchedAttributes = new Hashtable, Set>(); + public static Hashtable, Set> fetchedAttributes = new Hashtable<>(); public static Boolean shouldMonitor; public static boolean shouldMonitor() { @@ -54,7 +54,7 @@ public static void recordFetchedAttribute(Class domainClass, String attribute synchronized (fetchedAttributes) { Set classesFetchedAttributes = fetchedAttributes.get(domainClass); if (classesFetchedAttributes == null) { - classesFetchedAttributes = new HashSet(); + classesFetchedAttributes = new HashSet<>(); fetchedAttributes.put(domainClass, classesFetchedAttributes); } if (!classesFetchedAttributes.contains(attributeName)) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/profiler/PerformanceProfiler.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/profiler/PerformanceProfiler.java index a376bdf5d99..79d131fd8c9 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/profiler/PerformanceProfiler.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/profiler/PerformanceProfiler.java @@ -396,7 +396,7 @@ public Object profileExecutionOfQuery(DatabaseQuery query, DataRecord row, Abstr try { if (shouldLogProfile()) { writeNestingTabs(writer); - writer.write(ToStringLocalization.buildMessage("begin_profile_of", null) + "{" + query.toString() + Helper.cr()); + writer.write(ToStringLocalization.buildMessage("begin_profile_of", null) + "{" + query + Helper.cr()); writer.flush(); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/profiler/QueryMonitor.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/profiler/QueryMonitor.java index f0736c54245..67f4dfed56b 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/profiler/QueryMonitor.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/profiler/QueryMonitor.java @@ -84,7 +84,7 @@ public static void checkDumpTime() { writer.write(misses.toString()); writer.write("\n"); } - System.out.println(writer.toString()); + System.out.println(writer); } } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/StoredProcedureDefinition.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/StoredProcedureDefinition.java index 95ce7f6151c..6f00c10b783 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/StoredProcedureDefinition.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/StoredProcedureDefinition.java @@ -18,7 +18,6 @@ import java.io.IOException; import java.io.Writer; -import java.util.Enumeration; import java.util.List; import java.util.Vector; diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/StoredProcedureGenerator.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/StoredProcedureGenerator.java index fe1332997bf..3c7e5b5a220 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/StoredProcedureGenerator.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/StoredProcedureGenerator.java @@ -32,7 +32,6 @@ import org.eclipse.persistence.internal.expressions.ParameterExpression; import org.eclipse.persistence.internal.helper.DatabaseField; import org.eclipse.persistence.internal.helper.Helper; -import org.eclipse.persistence.internal.oxm.mappings.Field; import org.eclipse.persistence.internal.queries.CallQueryMechanism; import org.eclipse.persistence.internal.sessions.AbstractRecord; import org.eclipse.persistence.internal.sessions.AbstractSession; @@ -156,7 +155,7 @@ public void generateAmendmentClass(Writer outputWriter, String packageName, Stri String methodComment = "/**\n * EclipseLink generated method. \n * WARNING: This code was generated by an automated tool.\n * Any changes will be lost when the code is re-generated\n */"; ClassDescriptor descriptor; List storedProcedureVector; - Hashtable mappingHashtable; + Hashtable> mappingHashtable; StoredProcedureDefinition definition; List storedProcedureDefinitionArguments; Iterator argumentEnum; @@ -282,9 +281,9 @@ public void generateAmendmentClass(Writer outputWriter, String packageName, Stri //read all outputWriter.write("\tReadAllQuery mappingQuery; \n"); outputWriter.write("\tDeleteAllQuery deleteMappingQuery; \n"); - for (Enumeration e = mappingHashtable.keys(); e.hasMoreElements();) { - String mappingName = (String)e.nextElement(); - definition = (StoredProcedureDefinition)((Hashtable)mappingHashtable.get(mappingName)).get("1MREAD"); + for (Enumeration e = mappingHashtable.keys(); e.hasMoreElements();) { + String mappingName = e.nextElement(); + definition = mappingHashtable.get(mappingName).get("1MREAD"); if (definition != null) { outputWriter.write("\n\t//MAPPING READALL QUERY FOR " + mappingName + "\n"); outputWriter.write("\tmappingQuery= new ReadAllQuery();\n\tcall = new StoredProcedureCall();\n"); @@ -305,7 +304,7 @@ public void generateAmendmentClass(Writer outputWriter, String packageName, Stri } //DeleteAll Query - definition = (StoredProcedureDefinition)((Hashtable)mappingHashtable.get(mappingName)).get("1MDALL"); + definition = mappingHashtable.get(mappingName).get("1MDALL"); if (definition != null) { outputWriter.write("\n\t//MAPPING DELETEALL QUERY FOR " + mappingName + "\n"); outputWriter.write("\tdeleteMappingQuery= new DeleteAllQuery();\n\tcall = new StoredProcedureCall();\n"); diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/TableCreator.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/TableCreator.java index 1d28b270022..a29aa031063 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/TableCreator.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/TableCreator.java @@ -24,7 +24,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.Vector; import org.eclipse.persistence.exceptions.DatabaseException; import org.eclipse.persistence.internal.helper.DatabaseField; @@ -58,7 +57,7 @@ public class TableCreator { protected boolean ignoreDatabaseException; //if true, DDL generation will continue even if exceptions occur public TableCreator() { - this(new ArrayList()); + this(new ArrayList<>()); } public TableCreator(List tableDefinitions) { diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/TableDefinition.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/TableDefinition.java index 9252c49870a..b1c4cfaea2c 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/TableDefinition.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/TableDefinition.java @@ -791,7 +791,7 @@ protected String buildIndexName(String tableName, String key, String indexPrefix public Object clone() { TableDefinition clone = (TableDefinition)super.clone(); if (fields != null) { - clone.setFields(new ArrayList(fields.size())); + clone.setFields(new ArrayList<>(fields.size())); for (FieldDefinition fieldDef : getFields()) { clone.addField((FieldDefinition)fieldDef.clone()); } diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/transaction/jotm/JotmTransactionController.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/transaction/jotm/JotmTransactionController.java index 5d025d427cd..4474e68e06e 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/transaction/jotm/JotmTransactionController.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/transaction/jotm/JotmTransactionController.java @@ -57,7 +57,7 @@ protected TransactionManager acquireTransactionManager() throws Exception { Class clazz = AccessController.doPrivileged(new PrivilegedClassForName<>(TX_CURRENT_FACTORY_CLASS)); Method method = AccessController.doPrivileged(new PrivilegedGetMethod(clazz, TX_CURRENT_FACTORY_METHOD, null, false)); Method txMethod = AccessController.doPrivileged(new PrivilegedGetMethod(clazz, TX_MANAGER_FACTORY_METHOD, null, false)); - TransactionManager current = AccessController.doPrivileged(new PrivilegedMethodInvoker(method, null, null)); + TransactionManager current = AccessController.doPrivileged(new PrivilegedMethodInvoker<>(method, null, null)); return AccessController.doPrivileged(new PrivilegedMethodInvoker<>(txMethod, current, null)); }catch (PrivilegedActionException ex){ if (ex.getCause() instanceof ClassNotFoundException){ diff --git a/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/Oracle12Platform.java b/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/Oracle12Platform.java index 2c70171e9e9..df05a31373e 100644 --- a/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/Oracle12Platform.java +++ b/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/Oracle12Platform.java @@ -29,7 +29,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.eclipse.persistence.descriptors.ClassDescriptor; -import org.eclipse.persistence.exceptions.ConversionException; import org.eclipse.persistence.exceptions.ValidationException; import org.eclipse.persistence.internal.helper.ClassConstants; import org.eclipse.persistence.internal.helper.DatabaseField; @@ -167,9 +166,9 @@ public void printFieldIdentityClause(final Writer writer) throws ValidationExcep * @return Struct */ @Override - public Struct createStruct(String structTypeName, Object[] attributes, AbstractRecord row, Vector orderedFields, AbstractSession session, Connection connection) throws SQLException { + public Struct createStruct(String structTypeName, Object[] attributes, AbstractRecord row, Vector orderedFields, AbstractSession session, Connection connection) throws SQLException { for (int index = 0; index < orderedFields.size(); index++) { - DatabaseField field = (DatabaseField)orderedFields.elementAt(index); + DatabaseField field = orderedFields.elementAt(index); if (row.getField(field) != null && row.getField(field).getTypeName() != null) { if (ClassConstants.BLOB.getTypeName().equals(row.getField(field).getTypeName())) { Blob blob = connection.createBlob(); diff --git a/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/converters/JGeometryConverter.java b/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/converters/JGeometryConverter.java index d90fa44f2cf..e127b117339 100644 --- a/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/converters/JGeometryConverter.java +++ b/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/converters/JGeometryConverter.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 @@ -32,7 +32,7 @@ */ public class JGeometryConverter implements StructConverter { private final static String JGEOMETRY_DB_TYPE = "MDSYS.SDO_GEOMETRY"; - private final Class JGEOMETRY_CLASS; + private final Class JGEOMETRY_CLASS; private final MethodHandle loadJSMethod; private final MethodHandle storeJSMethod; diff --git a/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/ucp/GridLinkDataPartitioningCallback.java b/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/ucp/GridLinkDataPartitioningCallback.java index b75999eab05..9db8be0d004 100644 --- a/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/ucp/GridLinkDataPartitioningCallback.java +++ b/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/ucp/GridLinkDataPartitioningCallback.java @@ -33,7 +33,7 @@ */ public class GridLinkDataPartitioningCallback extends UCPDataPartitioningCallback { /** The id is stored in a static thread local. */ - protected static ThreadLocal partitionId = new ThreadLocal(); + protected static ThreadLocal partitionId = new ThreadLocal<>(); public static boolean isRegistered = false; @@ -68,7 +68,7 @@ public static synchronized void register(Session session) { Object instance = PrivilegedAccessHelper.invokeMethod(getInstance, null, null); Method getDataSourceService = PrivilegedAccessHelper.getMethod(instance.getClass(), "getDataSourceService", null, false); Object service = PrivilegedAccessHelper.invokeMethod(getDataSourceService, instance, null); - Class[] argumentTypes = new Class[] {DataBasedConnectionAffinityCallback.class}; + Class[] argumentTypes = new Class[] {DataBasedConnectionAffinityCallback.class}; Method registerDataAffinityCallback = PrivilegedAccessHelper.getMethod(service.getClass(), "registerDataAffinityCallback", argumentTypes, false); Object[] arguments = new Object[] {new GridLinkDataPartitioningCallback()}; PrivilegedAccessHelper.invokeMethod(registerDataAffinityCallback, service, arguments); @@ -88,7 +88,7 @@ public void setPartitionId(int id) { @Override public int getPartitionId() { - Integer id = (Integer)partitionId.get(); + Integer id = partitionId.get(); if (id == null) { return 0; } diff --git a/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/ucp/UCPDataPartitioningCallback.java b/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/ucp/UCPDataPartitioningCallback.java index 4c55cdc5948..f73c60f01fd 100644 --- a/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/ucp/UCPDataPartitioningCallback.java +++ b/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/platform/database/oracle/ucp/UCPDataPartitioningCallback.java @@ -36,7 +36,7 @@ */ public class UCPDataPartitioningCallback implements DataPartitioningCallback, DataBasedConnectionAffinityCallback { /** The id is stored in a thread local. */ - protected ThreadLocal partitionId = new ThreadLocal(); + protected ThreadLocal partitionId = new ThreadLocal<>(); /** * Default constructor. @@ -63,7 +63,7 @@ public void setPartitionId(int id) { @Override public int getPartitionId() { - Integer id = (Integer)this.partitionId.get(); + Integer id = this.partitionId.get(); if (id == null) { return 0; } diff --git a/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/tools/profiler/oracle/DMSPerformanceProfiler.java b/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/tools/profiler/oracle/DMSPerformanceProfiler.java index cbad6f94d16..cd3cf41dbee 100644 --- a/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/tools/profiler/oracle/DMSPerformanceProfiler.java +++ b/foundation/org.eclipse.persistence.oracle/src/main/java/org/eclipse/persistence/tools/profiler/oracle/DMSPerformanceProfiler.java @@ -84,7 +84,7 @@ public class DMSPerformanceProfiler implements Serializable, Cloneable, SessionP protected Map normalWeightNouns; protected Map heavyWeightNouns; protected Map allWeightNouns; - protected ThreadLocal operationStartTokenThreadLocal; + protected ThreadLocal> operationStartTokenThreadLocal; protected static boolean isDMSSpyInitialized; protected int weight; @@ -104,15 +104,15 @@ public DMSPerformanceProfiler() { */ public DMSPerformanceProfiler(Session session) { this.session = (AbstractSession)session; - this.normalWeightNouns = new Hashtable(1); - this.heavyWeightNouns = new Hashtable(5); - this.allWeightNouns = new Hashtable(1); - this.normalWeightSensors = new Hashtable(4); - this.heavyWeightSensors = new Hashtable(); - this.allWeightSensors = new Hashtable(22); - this.normalAndHeavyWeightSensors = new Hashtable(); - this.normalHeavyAndAllWeightSensors = new Hashtable(); - this.operationStartTokenThreadLocal = new ThreadLocal(); + this.normalWeightNouns = new Hashtable<>(1); + this.heavyWeightNouns = new Hashtable<>(5); + this.allWeightNouns = new Hashtable<>(1); + this.normalWeightSensors = new Hashtable<>(4); + this.heavyWeightSensors = new Hashtable<>(); + this.allWeightSensors = new Hashtable<>(22); + this.normalAndHeavyWeightSensors = new Hashtable<>(); + this.normalHeavyAndAllWeightSensors = new Hashtable<>(); + this.operationStartTokenThreadLocal = new ThreadLocal<>(); this.weight = DMSConsole.getSensorWeight(); if (!isDMSSpyInitialized) { isDMSSpyInitialized = true; @@ -269,7 +269,7 @@ public void endOperationProfile(String operationName) { } Sensor phaseEvent = getSensorByName(operationName); if (phaseEvent != null) { - Long startTime = (Long)getPhaseEventStartToken().get(operationName); + Long startTime = getPhaseEventStartToken().get(operationName); ((PhaseEvent)phaseEvent).stop(startTime); } } @@ -293,9 +293,9 @@ public void endOperationProfile(String operationName, DatabaseQuery query, int w if (phaseEvent != null) { Long startTime; if (query != null) { - startTime = (Long)getPhaseEventStartToken().get(query.getSensorName(operationName, getSessionName())); + startTime = getPhaseEventStartToken().get(query.getSensorName(operationName, getSessionName())); } else { - startTime = (Long)getPhaseEventStartToken().get(operationName); + startTime = getPhaseEventStartToken().get(operationName); } ((PhaseEvent)phaseEvent).stop(startTime); } @@ -390,7 +390,7 @@ protected Noun getNounByType(String type, Noun parentNoun, int weight) { return null; } Noun noun = null; - Map map = null; + Map map = null; if (weight == DMSConsole.NORMAL) { map = getNormalWeightNouns(); } else if (weight == DMSConsole.HEAVY) { @@ -399,7 +399,7 @@ protected Noun getNounByType(String type, Noun parentNoun, int weight) { map = getAllWeightNouns(); } if (map != null) { - noun = (Noun)map.get(type); + noun = map.get(type); if (noun == null) { if (parentNoun != null) { noun = Noun.create(parentNoun, type, type); @@ -644,7 +644,7 @@ protected void initSpy() { * Destroy sensors based on dms weight when user changes the weight at runtime. */ protected void destroySensorsByWeight(int weight) { - Iterator iterator = null; + Iterator iterator = null; if (weight == DMSConsole.HEAVY) { iterator = getHeavyWeightSensors().values().iterator(); } else if (weight == DMSConsole.ALL) { @@ -652,7 +652,7 @@ protected void destroySensorsByWeight(int weight) { } if (iterator != null) { while (iterator.hasNext()) { - ((Sensor)iterator.next()).destroy(); + iterator.next().destroy(); } } } @@ -692,11 +692,11 @@ protected void destroyNounsByWeight(int weight) { } } - protected HashMap getPhaseEventStartToken() { + protected Map getPhaseEventStartToken() { if (getOperationStartTokenThreadLocal().get() == null) { - getOperationStartTokenThreadLocal().set(new HashMap()); + getOperationStartTokenThreadLocal().set(new HashMap<>()); } - return (HashMap)getOperationStartTokenThreadLocal().get(); + return getOperationStartTokenThreadLocal().get(); } protected Map getNormalWeightSensors() { @@ -731,7 +731,7 @@ protected Map getAllWeightNouns() { return allWeightNouns; } - protected ThreadLocal getOperationStartTokenThreadLocal() { + protected ThreadLocal> getOperationStartTokenThreadLocal() { return operationStartTokenThreadLocal; } diff --git a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/inherited/Consumable.java b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/inherited/Consumable.java index 0b51b18de8c..11ca06c07e5 100644 --- a/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/inherited/Consumable.java +++ b/jpa/eclipselink.jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/inherited/Consumable.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 @@ -22,7 +22,6 @@ * This class was added as a test for bug 411560 * @author tware * - * @param */ @MappedSuperclass diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/CMP3Policy.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/CMP3Policy.java index bb3feb6a580..b00b5e1fc9a 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/CMP3Policy.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/CMP3Policy.java @@ -88,9 +88,6 @@ public CMP3Policy() { /** * INTERNAL: * Add the read only mappings for the given field to the allMappings list. - * @param aDescriptor - * @param field - * @param allMappings */ protected void addWritableMapping(ClassDescriptor aDescriptor, DatabaseField field, List allMappings) { DatabaseMapping writableMapping = aDescriptor.getObjectBuilder().getMappingForField(field); @@ -106,9 +103,6 @@ protected void addWritableMapping(ClassDescriptor aDescriptor, DatabaseField fie /** * INTERNAL: * Add the writable mapping for the given field to the allMappings list. - * @param aDescriptor - * @param field - * @param allMappings */ protected void addReadOnlyMappings(ClassDescriptor aDescriptor, DatabaseField field, List allMappings) { List readOnlyMappings = aDescriptor.getObjectBuilder().getReadOnlyMappingsForField(field); @@ -135,7 +129,6 @@ public CMP3Policy clone() { * Convert all the class-name-based settings in this object to actual class-based * settings. This method is used when converting a project that has been built * with class names to a project with classes. - * @param classLoader */ @Override public void convertClassNamesToClasses(ClassLoader classLoader){ @@ -279,10 +272,7 @@ public Object createPrimaryKeyFromId(Object key, AbstractSession session) { /** * INTERNAL: - * @param cls - * @param fieldName * @return the field from the class with name equal to fieldName. - * @throws NoSuchFieldException */ protected Field getField(Class cls, String fieldName) throws NoSuchFieldException { Field keyField = null; diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/CacheImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/CacheImpl.java index 2c02cc226fa..cfe96d71aa8 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/CacheImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/CacheImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -46,7 +46,6 @@ public class CacheImpl implements JpaCache { private EntityManagerFactoryDelegate emf; /** - * @param emf */ public CacheImpl(EntityManagerFactoryDelegate emf) { this.emf = emf; @@ -87,8 +86,6 @@ public boolean contains(Class cls, Object id) { * passed in class parameter and invalidates only entities found in the cache. * If the class is not an Entity or MappedSuperclass (such as an Embeddable or plain java class) * - nothing will be evicted - * @param possibleSuperclass - * @param id */ private void evictAssignableEntitySuperclass(Class possibleSuperclass, Object id) { // just remove the parent entity @@ -444,7 +441,6 @@ public void evict(Object object, boolean invalidateInCluster) { /** * INTERNAL: * Return the EntityManagerFactory associated with this CacheImpl. - * @return */ protected EntityManagerFactoryDelegate getEntityManagerFactory() { return this.emf; @@ -453,7 +449,6 @@ protected EntityManagerFactoryDelegate getEntityManagerFactory() { /** * INTERNAL: * Return the Session associated with the EntityManagerFactory. - * @return */ protected Session getSession() { return getEntityManagerFactory().getDatabaseSession(); @@ -462,7 +457,6 @@ protected Session getSession() { /** * INTERNAL: * Return the IdentityMapAccessor associated with the session on the EntityManagerFactory on this CacheImpl. - * @return */ protected IdentityMapAccessor getAccessor() { return getSession().getIdentityMapAccessor(); 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 9da5cb97411..51bf293d242 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 @@ -109,7 +109,6 @@ public EJBQueryImpl(String queryDescription, EntityManagerImpl entityManager, bo /** * Build a DatabaseQuery from an jpql string. * - * @param jpql * @param session * the session to get the descriptors for this query for. * @return a DatabaseQuery representing the given jpql. @@ -270,8 +269,6 @@ public static DatabaseQuery buildSQLDatabaseQuery(String sqlResultSetMappingName * Set an implementation-specific hint. If the hint name is not recognized, * it is silently ignored. * - * @param hintName - * @param value * @return the same query instance * @throws IllegalArgumentException * if the second argument is not valid for the implementation @@ -291,7 +288,6 @@ public TypedQuery setHint(String hintName, Object value) { /** * Set the lock mode type to be used for the query execution. * - * @param lockMode * @throws IllegalStateException * if not a Java Persistence query language SELECT query */ @@ -419,7 +415,6 @@ public EJBQueryImpl setFirstResult(int startPosition) { /** * Set the flush mode type to be used for the query execution. * - * @param flushMode */ @Override public EJBQueryImpl setFlushMode(FlushModeType flushMode) { @@ -429,7 +424,6 @@ public EJBQueryImpl setFlushMode(FlushModeType flushMode) { /** * Set the maximum number of results to retrieve. * - * @param maxResult * @return the same query instance */ @Override @@ -440,9 +434,6 @@ public EJBQueryImpl setMaxResults(int maxResult) { /** * Bind an instance of java.util.Calendar to a positional parameter. * - * @param position - * @param value - * @param temporalType * @return the same query instance */ @Override @@ -454,9 +445,6 @@ public TypedQuery setParameter(int position, Calendar value, TemporalType tempor /** * Bind an instance of java.util.Date to a positional parameter. * - * @param position - * @param value - * @param temporalType * @return the same query instance */ @Override @@ -468,8 +456,6 @@ public TypedQuery setParameter(int position, Date value, TemporalType temporalTy /** * Bind an argument to a positional parameter. * - * @param position - * @param value * @return the same query instance */ @Override @@ -487,9 +473,6 @@ public TypedQuery setParameter(int position, Object value) { /** * Bind an instance of java.util.Calendar to a Parameter object. * - * @param param - * @param value - * @param temporalType * @return the same query instance * @throws IllegalArgumentException * if position does not correspond to a parameter of the query @@ -516,8 +499,6 @@ public TypedQuery setParameter(Parameter param, Calendar value, Tempor * * @param param * object - * @param value - * @param temporalType * @return the same query instance * @throws IllegalArgumentException * if position does not correspond to a parameter of the query @@ -569,9 +550,6 @@ public TypedQuery setParameter(Parameter param, T value) { /** * Bind an instance of java.util.Calendar to a named parameter. * - * @param name - * @param value - * @param temporalType * @return the same query instance */ @Override @@ -583,9 +561,6 @@ public TypedQuery setParameter(String name, Calendar value, TemporalType tempora /** * Bind an instance of java.util.Date to a named parameter. * - * @param name - * @param value - * @param temporalType * @return the same query instance */ @Override @@ -599,7 +574,6 @@ public TypedQuery setParameter(String name, Date value, TemporalType temporalTyp * * @param name * the parameter name - * @param value * @return the same query instance */ @Override diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerFactoryDelegate.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerFactoryDelegate.java index 36aa485fda2..c6b70b5d10d 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerFactoryDelegate.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerFactoryDelegate.java @@ -1,6 +1,6 @@ /* * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 1998, 2019 IBM Corporation. All rights reserved. + * Copyright (c) 1998, 2021 IBM Corporation. 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 @@ -156,7 +156,6 @@ public class EntityManagerFactoryDelegate implements EntityManagerFactory, Persi * Will return an instance of the Factory. Should only be called by * EclipseLink. * - * @param databaseSession */ public EntityManagerFactoryDelegate(AbstractSession databaseSession, JpaEntityManagerFactory owner) { this.session = databaseSession; @@ -239,7 +238,6 @@ public AbstractSession getAbstractSession() { /** * INTERNAL: * Return the EntityManagerSetupImpl associated with this factory - * @return */ public EntityManagerSetupImpl getSetupImpl(){ return setupImpl; @@ -353,7 +351,6 @@ protected EntityManagerImpl createEntityManagerImpl(Map properties, Synchronizat * This method will return a version of EntityManagerFactory that is * based on the available metadata at the time it is called. Future calls * to refresh will not affect that metadata on this EntityManagerFactory. - * @return */ @Override public EntityManagerFactoryDelegate unwrap(){ @@ -459,7 +456,6 @@ protected void processProperties(Map properties) { * EntityMangers will continue to function with the old metadata, but new factories will use the new metadata. * * This call will throw an exception when called on EntityManagerFactoryImplDelegate - * @param properties */ @Override public void refreshMetadata(Map properties){ @@ -683,7 +679,6 @@ public Metamodel getMetamodel() { /** * INTERNAL: * Get the EntityManagerFactoryImpl that created this - * @return */ public JpaEntityManagerFactory getOwner() { return owner; @@ -694,7 +689,6 @@ public JpaEntityManagerFactory getOwner() { * possible case that we want to regenerate it. This function is outside of * the JPA 2.0 specification. * - * @param aMetamodel * @since Java Persistence 2.0 */ public void setMetamodel(Metamodel aMetamodel) { @@ -749,7 +743,6 @@ public boolean isLoaded(Object entity) { * available until after the database insert has occurred. Returns null if * the entity does not yet have an id * - * @param entity * @return id of the entity * @throws IllegalArgumentException * if the entity is found not to be an entity. diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerFactoryImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerFactoryImpl.java index 65b39c221fb..1ba99bf17f8 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerFactoryImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerFactoryImpl.java @@ -81,7 +81,6 @@ public class EntityManagerFactoryImpl implements EntityManagerFactory, Persisten * available until after the database insert has occurred. Returns null if * the entity does not yet have an id * - * @param entity * @return id of the entity * @throws IllegalArgumentException * if the entity is found not to be an entity. @@ -166,10 +165,6 @@ public static Boolean isLoaded(Object entity, String attributeName, AbstractSess * ForeignReferenceMappings to see if has been instantiated and otherwise * check the fetch group. * - * @param entity - * @param attributeName - * @param mapping - * @return */ public static boolean isLoaded(Object entity, String attributeName, DatabaseMapping mapping) { if (mapping.isForeignReferenceMapping()) { @@ -191,7 +186,6 @@ public static boolean isLoaded(Object entity, String attributeName, DatabaseMapp * Will return an instance of the Factory. Should only be called by * EclipseLink. * - * @param serverSession */ public EntityManagerFactoryImpl(AbstractSession serverSession) { delegate = new EntityManagerFactoryDelegate(serverSession, this); @@ -215,7 +209,6 @@ public EntityManagerFactoryImpl(String persistenceUnitName, Map * Re-bootstrap this factory. This method will rebuild the EntityManagerFactory. It should be used * in conjunction with a MetadataSource to allow mappings to be changed in a running system. All existing * EntityMangers will continue to function with the old metadata, but new factories will use the new metadata. - * @param properties */ @Override public void refreshMetadata(Map properties){ @@ -355,7 +348,6 @@ protected EntityManagerImpl createEntityManagerImpl(Map properties, Synchronizat * This method will return a version of EntityManagerFactory that is * based on the available metadata at the time it is called. Future calls * to refresh will not affect that metadata on this EntityManagerFactory. - * @return */ @Override public EntityManagerFactoryDelegate unwrap(){ @@ -570,7 +562,6 @@ public Metamodel getMetamodel() { * possible case that we want to regenerate it. This function is outside of * the JPA 2.0 specification. * - * @param aMetamodel * @since Java Persistence 2.0 */ public void setMetamodel(Metamodel aMetamodel) { @@ -616,7 +607,6 @@ public boolean isLoaded(Object entity) { * available until after the database insert has occurred. Returns null if * the entity does not yet have an id * - * @param entity * @return id of the entity * @throws IllegalStateException * if the entity is found not to be an entity. diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerFactoryProvider.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerFactoryProvider.java index 21a9f30545c..517c6e261ff 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerFactoryProvider.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerFactoryProvider.java @@ -97,8 +97,6 @@ public EntityManagerFactoryProvider() { /** * Add an EntityManagerSetupImpl to the cached list * These are used to ensure all persistence units that are the same get the same underlying session - * @param name - * @param setup */ public static void addEntityManagerSetupImpl(String name, EntityManagerSetupImpl setup){ synchronized (EntityManagerFactoryProvider.emSetupImpls) { @@ -111,7 +109,6 @@ public static void addEntityManagerSetupImpl(String name, EntityManagerSetupImpl /** * Calls the appropriate create,replace or alter SchemaManager api. - * @param mgr * @param ddlType - ddl operation to be performed */ protected static void generateDefaultTables(SchemaManager mgr, TableCreationType ddlType) { @@ -142,10 +139,6 @@ public static String getConfigPropertyAsString(final String propertyKey, final M /** * Check the provided map for an object with the given key. If that object is not available, check the * System properties. If it is not available from either location, return the default value. - * @param propertyKey - * @param overrides - * @param defaultValue - * @return */ public static String getConfigPropertyAsString(String propertyKey, Map overrides, String defaultValue){ String value = getConfigPropertyAsString(propertyKey, overrides); @@ -230,7 +223,6 @@ protected static Object getConfigProperty(String propertyKey, Map overrides, Obj /** * Return the setup class for a given entity manager name - * @param emName */ public static EntityManagerSetupImpl getEntityManagerSetupImpl(String emName) { synchronized (EntityManagerFactoryProvider.emSetupImpls){ @@ -274,8 +266,6 @@ protected static void login(DatabaseSessionImpl session, Map properties, boolean /** * Merge the properties from the source object into the target object. If the property * exists in both objects, use the one from the target - * @param target - * @param source * @return the target object */ public static Map mergeMaps(Map target, Map source){ @@ -292,8 +282,6 @@ public static Map mergeMaps(Map target, Map source){ /** * Copies source into target, removes from target all keysToBeRemoved. - * @param source - * @param keysToBeRemoved * @return the target object */ public static Map removeSpecifiedProperties(Map source, Collection keysToBeRemoved){ @@ -310,8 +298,6 @@ public static Map removeSpecifiedProperties(Map source, Colle /** * target contains the entries from source with keysToBeKept. - * @param source - * @param keysToBeKept * @return the target object */ public static Map keepSpecifiedProperties(Map source, Collection keysToBeKept){ @@ -333,8 +319,6 @@ public static Map keepSpecifiedProperties(Map source, Collect * target is a array of two Maps * the first one contains specified properties; * the second all the rest. - * @param source - * @param keysToBeKept * @return the target object */ public static Map[] splitSpecifiedProperties(Map source, Collection keysToBeKept){ @@ -362,7 +346,6 @@ public static Map[] splitSpecifiedProperties(Map source, Coll * Target's size equals keys' size + 1: * all the source's Map.Entries not found in any of keys Collections * go into the last target's map. - * @param source * @param keys is array of Maps of size n * @return the target object is array of Maps of size n+1 */ @@ -394,8 +377,6 @@ public static Map[] splitProperties(Map source, Collection /** * This is a TEMPORARY method that will be removed. * DON'T USE THIS METHOD - for internal use only. - * @param m - * @param session */ protected static void translateOldProperties(Map m, AbstractSession session) { for(int i=0; i < oldPropertyNames.length; i++) { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerImpl.java index 48acbcaf5ff..8e4347a7700 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/EntityManagerImpl.java @@ -431,7 +431,6 @@ protected Set getOpenQueriesSet() { * manager will be added here. On rollback or commit any left over open * queries should be closed. * - * @param query */ public void addOpenQuery(QueryImpl query) { getOpenQueriesMap().put(query, query); @@ -586,7 +585,6 @@ public void removeExtendedPersistenceContext() { * object if it is new. The instance of the entity provided will become * managed. * - * @param entity * @throws IllegalArgumentException * if the given Object is not an entity. */ @@ -615,7 +613,6 @@ public void persist(Object entity) { * Merge the state of the given entity into the current persistence context, * using the unqualified class name as the entity name. * - * @param entity * @return the instance that the state was merged to */ @Override @@ -633,7 +630,6 @@ public T merge(T entity) { * Merge the state of the given entity into the current persistence context, * using the unqualified class name as the entity name. * - * @param entity * @return the instance that the state was merged to * @throws IllegalArgumentException * if given Object is not an entity or is a removed entity @@ -655,7 +651,6 @@ protected Object mergeInternal(Object entity) { /** * Remove the instance. * - * @param entity * @throws IllegalArgumentException * if Object passed in is not an entity */ @@ -703,8 +698,6 @@ public T find(Class entityClass, Object primaryKey) { * vendor-specific property or hint is not recognized, it is silently * ignored. * - * @param entityClass - * @param primaryKey * @param properties * standard and vendor-specific properties * @return the found entity instance or null if the entity does not exist @@ -735,9 +728,6 @@ public T find(Class entityClass, Object primaryKey, Map p * thrown if the database locking failure causes only statement-level * rollback * - * @param entityClass - * @param primaryKey - * @param lockMode * @return the found entity instance or null if the entity does not exist * @throws IllegalArgumentException * if the first argument does not denote an entity type or the @@ -780,9 +770,6 @@ public T find(Class entityClass, Object primaryKey, LockModeType lockMode * timeout hint. Depending on the database in use and the locking mechanisms * used by the provider, the hint may or may not be observed. * - * @param entityClass - * @param primaryKey - * @param lockMode * @param properties * standard and vendor-specific properties and hints * @return the found entity instance or null if the entity does not exist @@ -1048,7 +1035,6 @@ public void refresh(Object entity) { * vendor-specific property or hint is not recognized, it is silently * ignored. * - * @param entity * @param properties * standard and vendor-specific properties * @throws IllegalArgumentException @@ -1076,8 +1062,6 @@ public void refresh(Object entity, Map properties) { * LockTimeoutException will be thrown if the database locking failure * causes only statement-level rollback. * - * @param entity - * @param lockMode * @throws IllegalArgumentException * if the instance is not an entity or the entity is not managed * @throws TransactionRequiredException @@ -1111,8 +1095,6 @@ public void refresh(Object entity, LockModeType lockMode) { * in use and the locking mechanisms used by the provider, the hint may or * may not be observed. * - * @param entity - * @param lockMode * @param properties * standard and vendor-specific properties and hints * @throws IllegalArgumentException @@ -1170,8 +1152,6 @@ public void refresh(Object entity, LockModeType lockMode, Map pr /** * Check if the instance belongs to the current persistence context. * - * @param entity - * @return * @throws IllegalArgumentException * if given Object is not an entity */ @@ -1451,8 +1431,6 @@ public jakarta.persistence.EntityTransaction getTransaction() { * if it is not found then search for it from EntityManagerFactory * properties. * - * @param name - * @return */ public Object getProperty(String name) { Object propertyValue = null; @@ -1508,8 +1486,6 @@ protected ReadObjectQuery getReadObjectQuery(Object entity, Map properties) { * unless it was accessed by the application while the entity manager was * open. * - * @param entityClass - * @param primaryKey * @return the found entity instance. * @throws IllegalArgumentException * if the first argument does not denote an entity type or the @@ -1974,8 +1950,6 @@ public boolean isOpen() { * Set the lock mode for an entity object contained in the persistence * context. * - * @param entity - * @param lockMode * @throws PersistenceException * if an unsupported lock call is made * @throws IllegalArgumentException @@ -1992,8 +1966,6 @@ public void lock(Object entity, LockModeType lockMode) { * Set the lock mode for an entity object contained in the persistence * context. * - * @param entity - * @param lockMode * @throws PersistenceException * if an unsupported lock call is made * @throws IllegalArgumentException @@ -2287,7 +2259,6 @@ protected void setEntityTransactionWrapper() { * Set the flush mode that applies to all objects contained in the * persistence context. * - * @param flushMode */ @Override public void setFlushMode(FlushModeType flushMode) { @@ -2679,7 +2650,6 @@ protected static Boolean isPropertyValueToBeUpdated(String oldValue, String newV * database. Entities which previously referenced the detached entity will * continue to reference it. * - * @param entity * @throws IllegalArgumentException * if the instance is not an entity * @@ -2992,7 +2962,6 @@ public T unwrap(Class cls) { * or have a common inheritance hierarchy mapped root class. * The AttributeGroup should correspond to the entity type. * - * @param entityOrEntities */ @Override public void load(Object entityOrEntities, AttributeGroup group) { @@ -3006,7 +2975,6 @@ public void load(Object entityOrEntities, AttributeGroup group) { * or have a common inheritance hierarchy mapped root class. * The AttributeGroup should correspond to the entity type. * - * @param entityOrEntities */ @Override public Object copy(Object entityOrEntities, AttributeGroup group) { 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 619fced4dda..d7390fdce32 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 @@ -875,11 +875,6 @@ public Object handleException(RuntimeException exception) { * This method is used to resolve Descriptor Customizers that might have been stored in the project * for JPA project caching. * - * @param realClassLoader - * @throws ClassNotFoundException - * @throws PrivilegedActionException - * @throws IllegalAccessException - * @throws InstantiationException */ private void processDescriptorsFromCachedProject(ClassLoader realClassLoader) throws ClassNotFoundException, PrivilegedActionException, IllegalAccessException, InstantiationException { for (ClassDescriptor descriptor: session.getProject().getDescriptors().values()) { @@ -1404,8 +1399,6 @@ private static Class findClassForPropertyInternal(String clsName, String propNam * Internal: * Returns a list of StructConverter instances from a list of StructConverter names stored within the project. * - * @param realClassLoader - * @return */ protected List getStructConverters(ClassLoader realClassLoader) { List structConverters = new ArrayList(); @@ -4120,7 +4113,6 @@ protected void initializeCanonicalMetamodel(Metamodel model) { * Convenience function to allow us to reset the Metamodel * in the possible case that we want to regenerate it. * This function is outside of the JPA 2.0 specification. - * @param aMetamodel * @since Java Persistence 2.0 */ public void setMetamodel(Metamodel aMetamodel) { @@ -4261,7 +4253,6 @@ public void preInitializeMetamodel(){ * for a canonical metamodel class and initialize each attribute in it with a proxy that can cause the * rest of the metamodel population. Attributes are found reflectively rather than through the metamodel * to avoid having to further initialize the metamodel. - * @param factory */ public void preInitializeCanonicalMetamodel(EntityManagerFactoryImpl factory){ // 338837: verify that the collection is not empty - this would mean entities did not make it into the search path @@ -4471,8 +4462,6 @@ public static void throwPersistenceUnitNameAlreadyInUseException(String puName, * * This call will mean any users of this EntityManagerSetupImpl will get the new version the next time * they look it up (for instance and EntityManager creation time) - * @param properties - * @return */ public EntityManagerSetupImpl refreshMetadata(Map properties){ String sessionName = getSessionName(); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/JPAQuery.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/JPAQuery.java index e9765aa876d..d813ccdb1f0 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/JPAQuery.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/JPAQuery.java @@ -64,10 +64,6 @@ public JPAQuery(String jpqlString) { /** * JPQL - * @param name - * @param jpqlString - * @param lockMode - * @param hints */ public JPAQuery(String name, String jpqlString, String lockMode, Map hints) { this.name = name; 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 5f98650aa50..49cfb4a92c2 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 @@ -635,7 +635,6 @@ public int getFirstResult() { /** * Set the flush mode type to be used for the query execution. * - * @param flushMode */ public QueryImpl setFlushMode(FlushModeType flushMode) { try { @@ -720,8 +719,6 @@ protected static DatabaseQuery applyHints(Map hints, DatabaseQue /** * Return the identifier of this parameter. This will be the name if it is set, else it will be the position - * @param param - * @return */ public static String getParameterId(Parameter param){ Integer id= param.getPosition(); @@ -782,7 +779,6 @@ protected void setHintInternal(String hintName, Object value) { /** * Set the lock mode type to be used for the query execution. * - * @param lockMode * @throws IllegalStateException * if not a Java Persistence query language SELECT query */ @@ -838,7 +834,6 @@ protected Object convertTemporalType(Object value, TemporalType type) { /** * Set the maximum number of results to retrieve. * - * @param maxResult * @return the same query instance */ public QueryImpl setMaxResults(int maxResult) { @@ -875,7 +870,6 @@ public int getMaxResultsInternal() { /** * Set the maximum number of results to retrieve. * - * @param maxResult */ public void setMaxResultsInternal(int maxResult) { if (maxResult < 0) { @@ -913,8 +907,6 @@ protected void propagateResultProperties() { /** * Bind an argument to a positional parameter. * - * @param position - * @param value */ protected void setParameterInternal(int position, Object value) { setParameterInternal(String.valueOf(position), value, true); @@ -1094,7 +1086,6 @@ public T getParameterValue(Parameter param) { /** * Return the value bound to the named parameter. * - * @param name * @return parameter value * @throws IllegalStateException * if the parameter has not been been bound @@ -1116,7 +1107,6 @@ public Object getParameterValue(String name) { /** * Return the value bound to the positional parameter. * - * @param position * @return parameter value * @throws IllegalStateException * if the parameter has not been been bound diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/StoredProcedureQueryImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/StoredProcedureQueryImpl.java index 2a2896644c7..f238213e87b 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/StoredProcedureQueryImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/StoredProcedureQueryImpl.java @@ -896,7 +896,6 @@ public StoredProcedureQuery setHint(String hintName, Object value) { /** * Set the lock mode type to be used for the query execution. * - * @param lockMode * @throws IllegalStateException * if not a Java Persistence query language SELECT query */ @@ -908,7 +907,6 @@ public StoredProcedureQueryImpl setLockMode(LockModeType lockMode) { /** * Set the maximum number of results to retrieve. * - * @param maxResult * @return the same query instance */ @Override @@ -919,9 +917,6 @@ public StoredProcedureQueryImpl setMaxResults(int maxResult) { /** * Bind an instance of java.util.Calendar to a positional parameter. * - * @param position - * @param value - * @param temporalType * @return the same query instance * @throws IllegalArgumentException if position does not correspond to a * positional parameter of the query or if the value argument is of @@ -936,9 +931,6 @@ public StoredProcedureQuery setParameter(int position, Calendar value, TemporalT /** * Bind an instance of java.util.Date to a positional parameter. * - * @param position - * @param value - * @param temporalType * @return the same query instance * @throws IllegalArgumentException if position does not correspond to a * positional parameter of the query or if the value argument is of @@ -953,8 +945,6 @@ public StoredProcedureQuery setParameter(int position, Date value, TemporalType /** * Bind an argument to a positional parameter. * - * @param position - * @param value * @return the same query instance * @throws IllegalArgumentException if position does not correspond to a * positional parameter of the query or if the argument is of incorrect type @@ -974,9 +964,6 @@ public StoredProcedureQuery setParameter(int position, Object value) { /** * Bind an instance of java.util.Calendar to a Parameter object. * - * @param param - * @param value - * @param temporalType * @return the same query instance * @throws IllegalArgumentException if the parameter does not correspond to * a parameter of the query @@ -1001,9 +988,6 @@ public StoredProcedureQuery setParameter(Parameter param, Calendar val /** * Bind an instance of java.util.Date to a Parameter object. * - * @param param - * @param value - * @param temporalType * @return the same query instance * @throws IllegalArgumentException if the parameter does not correspond to * a parameter of the query @@ -1028,8 +1012,6 @@ public StoredProcedureQuery setParameter(Parameter param, Date value, Temp /** * Bind the value of a Parameter object. * - * @param param - * @param value * @return the same query instance * @throws IllegalArgumentException if the parameter does not correspond to * a parameter of the query @@ -1054,9 +1036,6 @@ public StoredProcedureQuery setParameter(Parameter param, T value) { /** * Bind an instance of java.util.Calendar to a named parameter. * - * @param name - * @param value - * @param temporalType * @return the same query instance * @throws IllegalArgumentException if the parameter name does not * correspond to a parameter of the query or if the value argument is of @@ -1071,9 +1050,6 @@ public StoredProcedureQuery setParameter(String name, Calendar value, TemporalTy /** * Bind an instance of java.util.Date to a named parameter. * - * @param name - * @param value - * @param temporalType * @return the same query instance * @throws IllegalArgumentException if the parameter name does not * correspond to a parameter of the query or if the value argument is of @@ -1088,8 +1064,6 @@ public StoredProcedureQuery setParameter(String name, Date value, TemporalType t /** * Bind an argument to a named parameter. * - * @param name - * @param value * @return the same query instance * @throws IllegalArgumentException if the parameter name does not * correspond to a parameter of the query or if the argument is of incorrect diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/ArchiveFactoryImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/ArchiveFactoryImpl.java index 31071f58144..c9db329d032 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/ArchiveFactoryImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/ArchiveFactoryImpl.java @@ -132,7 +132,6 @@ public Archive createArchive(URL rootUrl, String descriptorLocation, Map propert * This method is called for a URL which has neither jar nor file protocol. * This attempts to find out if we can treat it as a URL from which a JAR * format InputStream can be obtained. - * @param url */ protected boolean isJarInputStream(URL url) throws IOException { InputStream in = null; diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/BeanValidationInitializationHelper.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/BeanValidationInitializationHelper.java index 58c37057aa1..64643ec6527 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/BeanValidationInitializationHelper.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/BeanValidationInitializationHelper.java @@ -120,8 +120,6 @@ private Class[] translateValidationGroups(String validationGroups, ClassLoader a * @param className Fully qualified class name * @param classLoader ClassLoader to be used for loading the class * @return Loaded Class - * @throws java.security.PrivilegedActionException - * @throws ClassNotFoundException */ private Class loadClass(String className, ClassLoader classLoader) throws PrivilegedActionException, ClassNotFoundException { Class loadedClass = null; diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/JPAInitializer.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/JPAInitializer.java index 1729c2441aa..e5671e6c19a 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/JPAInitializer.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/JPAInitializer.java @@ -194,8 +194,6 @@ protected SEPersistenceUnitInfo findPersistenceUnitInfoInArchive(String puName, /** * Returns whether the given persistence provider class is supported by this implementation - * @param providerClassName - * @return */ public boolean isPersistenceProviderSupported(String providerClassName){ return (providerClassName == null) || providerClassName.equals("") || providerClassName.equals(EntityManagerFactoryProvider.class.getName()) || providerClassName.equals(PersistenceProvider.class.getName()); @@ -224,8 +222,6 @@ protected Set loadEntityClasses(Collection entityNames, ClassLoader classLoader) /** * Register a transformer. This method should be overridden to provide the appropriate transformer * registration for the environment - * @param transformer - * @param persistenceUnitInfo */ public abstract void registerTransformer(final ClassTransformer transformer, PersistenceUnitInfo persistenceUnitInfo, Map properties); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/JavaSECMPInitializer.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/JavaSECMPInitializer.java index 2b0407b68e4..51696f5f92f 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/JavaSECMPInitializer.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/JavaSECMPInitializer.java @@ -242,8 +242,6 @@ public static void initializeFromMain() { /** * Register a transformer. In this case, we use the instrumentation to add a transformer for the * JavaSE environment - * @param transformer - * @param persistenceUnitInfo */ @Override public void registerTransformer(final ClassTransformer transformer, PersistenceUnitInfo persistenceUnitInfo, Map properties){ diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/PersistenceUnitProcessor.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/PersistenceUnitProcessor.java index dc6b7b530d9..ae8cdf818f6 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/PersistenceUnitProcessor.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/PersistenceUnitProcessor.java @@ -171,7 +171,6 @@ public static Collection buildEntityList(MetadataProcessor proces * {@code descriptorLocation} via {@code Classloader.getResource(String)}). * @param descriptorLocation - the name of the resource. * @return The URL of the PU root containing the resource. - * @throws IOException * @throws ValidationException if the resolved root doesn't conform to the * JPA specification (8.2) */ @@ -720,8 +719,6 @@ public static void setArchiveFactory(ArchiveFactory factory){ /** * Build the unique persistence name by concatenating the decoded URL with the persistence unit name. * A decoded URL is required while persisting on a multi-bytes OS. - * @param url - * @param puName * @return String */ public static String buildPersistenceUnitName(URL url, String puName){ diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/xml/parser/XPathEngine.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/xml/parser/XPathEngine.java index 135cd700ad0..2e8c1899354 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/xml/parser/XPathEngine.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/deployment/xml/parser/XPathEngine.java @@ -51,7 +51,6 @@ public static XPathEngine getInstance() { * * @param contextNode the node relative to which the XPath statement will be executed * @return the first node located matching the XPath statement - * @throws XMLPlatformException */ public Node selectSingleNode(Node contextNode, String[] xPathFragments) { if (contextNode == null) { @@ -75,7 +74,6 @@ private Node selectSingleNode(Node contextNode, String[] xPathFragments, int ind * * @param contextNode the node relative to which the XPath statement will be executed * @return a list of nodes matching the XPath statement - * @throws XMLPlatformException */ public NodeList selectNodes(Node contextNode, String[] xPathFragments) { if (contextNode == null) { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/MetadataProject.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/MetadataProject.java index 5a69cefb8ca..60c6700a0b9 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/MetadataProject.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/MetadataProject.java @@ -1283,7 +1283,6 @@ public ComplexTypeMetadata getComplexTypeMetadata(String name) { /** * INTERNAL: * Return the core API Project associated with this MetadataProject. - * @return * @since EclipseLink 1.2 for the JPA 2.0 Reference Implementation */ public Project getProject() { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/MetadataAccessor.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/MetadataAccessor.java index 82d292c7b8d..f30dd214eb3 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/MetadataAccessor.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/MetadataAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019 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 @@ -707,7 +707,6 @@ public boolean isAnnotationPresent(Class annotation) { /** * Subclasses must handle this flag. - * @return */ public abstract boolean isProcessed(); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/mappings/ElementCollectionAccessor.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/mappings/ElementCollectionAccessor.java index 3a5c7038a03..62e862e2860 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/mappings/ElementCollectionAccessor.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/mappings/ElementCollectionAccessor.java @@ -497,7 +497,6 @@ protected ColumnMetadata getColumn(String loggingCtx) { * INTERNAL: * Return the default table to hold the foreign key of a MapKey when * and Entity is used as the MapKey - * @return */ @Override protected DatabaseTable getDefaultTableForEntityMapKey(){ diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/mappings/ManyToManyAccessor.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/mappings/ManyToManyAccessor.java index ed97c0d547b..311298f520c 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/mappings/ManyToManyAccessor.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/accessors/mappings/ManyToManyAccessor.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 @@ -98,7 +98,6 @@ public int hashCode() { * INTERNAL: * Return the default table to hold the foreign key of a MapKey when * and Entity is used as the MapKey - * @return */ @Override protected DatabaseTable getDefaultTableForEntityMapKey(){ diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/listeners/JPAEntityListenerHolder.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/listeners/JPAEntityListenerHolder.java index 9f4c3076445..d9dd77d49f5 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/listeners/JPAEntityListenerHolder.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/listeners/JPAEntityListenerHolder.java @@ -175,8 +175,6 @@ public void addEventMethod(String event, Method method) { * INTERNAL: * This returns a hashtable of methods which are used in a JPA EntityListener instance, built from * the MethodSerialImpl representation since Methods are not serializable - * @param loader - * @return */ public Map> convertToMethods(ClassLoader loader) { Map> table = new ConcurrentHashMap<>(); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/queries/OracleArrayTypeMetadata.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/queries/OracleArrayTypeMetadata.java index f9e788417f5..edb53d41056 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/queries/OracleArrayTypeMetadata.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/queries/OracleArrayTypeMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -102,7 +102,6 @@ public void setNestedType(String nestedType) { /** * Indicates an instance of OracleArrayTypeMetadata. - * @return */ @Override public boolean isOracleArrayTypeMetadata() { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/queries/OracleComplexTypeMetadata.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/queries/OracleComplexTypeMetadata.java index 5ca85f03f3b..ff32d1b2116 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/queries/OracleComplexTypeMetadata.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/queries/OracleComplexTypeMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -110,7 +110,6 @@ public boolean isOracleComplexTypeMetadata() { /** * Indicates an instance of OracleArrayTypeMetadata. - * @return */ public boolean isOracleArrayTypeMetadata() { return false; @@ -118,7 +117,6 @@ public boolean isOracleArrayTypeMetadata() { /** * Indicates an instance of OracleObjectTypeMetadata. - * @return */ public boolean isOracleObjectTypeMetadata() { return false; diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/queries/OracleObjectTypeMetadata.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/queries/OracleObjectTypeMetadata.java index cb5fef9406a..8acf21a04eb 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/queries/OracleObjectTypeMetadata.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/queries/OracleObjectTypeMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -130,7 +130,6 @@ public void setFields(List fields) { /** * Indicates an instance of OracleObjectTypeMetadata. - * @return */ @Override public boolean isOracleObjectTypeMetadata() { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/xml/XMLEntityMappingsReader.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/xml/XMLEntityMappingsReader.java index 5c51c9502cc..d235ecb2f12 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/xml/XMLEntityMappingsReader.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metadata/xml/XMLEntityMappingsReader.java @@ -325,7 +325,6 @@ public static void clear() { * eclipselink.orm.validate.schema is set to true or false.
* The default value is false. * @param properties - PersistenceUnitInfo properties on the project - * @return */ private static boolean isORMSchemaValidationPerformed(Map properties) { // Get property from persistence.xml (we are not yet parsing sessions.xml) @@ -391,11 +390,7 @@ protected static XMLEntityMappings read(String mappingFile, Reader reader1, Read /** * INTERNAL: - * @param url - * @param classLoader * @param properties - PersistenceUnitInfo properties on the project - * @return - * @throws IOException */ public static XMLEntityMappings read(URL url, ClassLoader classLoader, Properties properties) throws IOException { InputStreamReader reader1 = null; @@ -430,8 +425,6 @@ public static XMLEntityMappings read(URL url, ClassLoader classLoader, Propertie * will get the schema from the same classloader that loaded this class and * hence works for the case where the schema is shipped as part of EclipseLink * - * @param unmarshaller - * @param schema */ private static void useLocalSchemaForUnmarshaller(XMLUnmarshaller unmarshaller, Schema schema) { try { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/AttributeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/AttributeImpl.java index e0bf03a3a86..a5f0b41afc6 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/AttributeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/AttributeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -77,8 +77,6 @@ public abstract class AttributeImpl implements Attribute, Serializab /** * INTERNAL: * - * @param managedType - * @param mapping */ protected AttributeImpl(ManagedTypeImpl managedType, DatabaseMapping mapping) { this.mapping = mapping; @@ -100,7 +98,6 @@ public ManagedType getDeclaringType() { /** * INTERNAL: * Return the Descriptor associated with this attribute - * @return */ protected ClassDescriptor getDescriptor() { return getManagedTypeImpl().getDescriptor(); @@ -200,7 +197,6 @@ public Member getJavaMember() { * INTERNAL: * Return the managed type representing the type in which the member was * declared. - * @return */ public ManagedTypeImpl getManagedTypeImpl() { return this.managedType; @@ -209,7 +205,6 @@ public ManagedTypeImpl getManagedTypeImpl() { /** * INTERNAL: * Return the databaseMapping that represents the type - * @return */ public DatabaseMapping getMapping() { return this.mapping; @@ -311,7 +306,6 @@ public boolean isCollection() { /** * INTERNAL: * Return whether the attribute is plural or singular - * @return */ public abstract boolean isPlural(); } diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/BasicTypeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/BasicTypeImpl.java index 1c511620eea..a634fcbd293 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/BasicTypeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/BasicTypeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 PersistenceType getPersistenceType() { /** * INTERNAL: * Return whether this type is an Entity (true) or MappedSuperclass (false) or Embeddable (false) - * @return */ @Override public boolean isEntity() { @@ -67,7 +66,6 @@ public boolean isEntity() { * INTERNAL: * Return whether this type is identifiable. * This would be EntityType and MappedSuperclassType - * @return */ @Override protected boolean isIdentifiableType() { @@ -78,7 +76,6 @@ protected boolean isIdentifiableType() { * INTERNAL: * Return whether this type is identifiable. * This would be EmbeddableType as well as EntityType and MappedSuperclassType - * @return */ @Override protected boolean isManagedType() { @@ -88,7 +85,6 @@ protected boolean isManagedType() { /** * INTERNAL: * Return whether this type is an MappedSuperclass (true) or Entity (false) or Embeddable (false) - * @return */ @Override public boolean isMappedSuperclass() { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/CollectionAttributeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/CollectionAttributeImpl.java index 588f1d9e38f..b6b7db61119 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/CollectionAttributeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/CollectionAttributeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -50,8 +50,6 @@ public class CollectionAttributeImpl extends PluralAttributeImpl managedType, CollectionMapping mapping) { this(managedType, mapping, false); @@ -60,9 +58,6 @@ protected CollectionAttributeImpl(ManagedTypeImpl managedType, CollectionMapp /** * INTERNAL: * Construct an instance of Collection for the managed type managedType - * @param managedType - * @param mapping - * @param validationEnabled */ protected CollectionAttributeImpl(ManagedTypeImpl managedType, CollectionMapping mapping, boolean validationEnabled) { super(managedType, mapping, validationEnabled); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/EmbeddableTypeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/EmbeddableTypeImpl.java index d9f72a67d13..bbc436e3fef 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/EmbeddableTypeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/EmbeddableTypeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -57,7 +57,6 @@ public PersistenceType getPersistenceType() { /** * INTERNAL: * Return whether this type is an Entity (true) or MappedSuperclass (false) or Embeddable (false) - * @return */ @Override public boolean isEntity() { @@ -67,7 +66,6 @@ public boolean isEntity() { /** * INTERNAL: * Return whether this type is an MappedSuperclass (true) or Entity (false) or Embeddable (false) - * @return */ @Override public boolean isMappedSuperclass() { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/EntityTypeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/EntityTypeImpl.java index 6d4bb51f3e6..5b1339b40af 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/EntityTypeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/EntityTypeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -99,7 +99,6 @@ public Type.PersistenceType getPersistenceType() { /** * INTERNAL: * Return whether this type is an Entity (true) or MappedSuperclass (false) or Embeddable (false) - * @return */ @Override public boolean isEntity() { @@ -109,7 +108,6 @@ public boolean isEntity() { /** * INTERNAL: * Return whether this type is an MappedSuperclass (true) or Entity (false) or Embeddable (false) - * @return */ @Override public boolean isMappedSuperclass() { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/IdentifiableTypeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/IdentifiableTypeImpl.java index 29a95bedc94..0e779ca3dc6 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/IdentifiableTypeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/IdentifiableTypeImpl.java @@ -300,8 +300,6 @@ public SingularAttribute getVersion(Class type) { * INTERNAL: * Return the version attribute on this type. * If no version attribute exists - return null. - * @param - * @return */ private SingularAttribute getVersion() { if(hasVersionAttribute()) { @@ -387,7 +385,6 @@ public boolean hasVersionAttribute() { * INTERNAL: * Return whether this type is identifiable. * This would be EntityType and MappedSuperclassType - * @return */ @Override protected boolean isIdentifiableType() { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/ListAttributeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/ListAttributeImpl.java index 2190e6c0ef1..686d353623e 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/ListAttributeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/ListAttributeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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,8 +49,6 @@ public class ListAttributeImpl extends PluralAttributeImpl, V> /** * INTERNAL: - * @param managedType - * @param mapping */ protected ListAttributeImpl(ManagedTypeImpl managedType, CollectionMapping mapping) { super(managedType, mapping, false); @@ -58,9 +56,6 @@ protected ListAttributeImpl(ManagedTypeImpl managedType, CollectionMapping ma /** * - * @param managedType - * @param mapping - * @param validationEnabled */ protected ListAttributeImpl(ManagedTypeImpl managedType, CollectionMapping mapping, boolean validationEnabled) { super(managedType, mapping, validationEnabled); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/ManagedTypeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/ManagedTypeImpl.java index 9414514d37f..2453cfe2d99 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/ManagedTypeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/ManagedTypeImpl.java @@ -416,9 +416,6 @@ public CollectionAttribute getDeclaredCollection(String name, Class /** * INTERNAL: * Return an instance of a ManagedType based on the RelationalDescriptor parameter - * @param metamodel - * @param descriptor - * @return */ protected static ManagedTypeImpl create(MetamodelImpl metamodel, ClassDescriptor descriptor) { // Get the ManagedType property on the descriptor if it exists @@ -659,7 +656,6 @@ public SingularAttribute getDeclaredSingularAttribute(String name, Cla /** * INTERNAL: * Return the RelationalDescriptor associated with this ManagedType - * @return */ public ClassDescriptor getDescriptor() { return this.descriptor; @@ -833,7 +829,6 @@ public MapAttribute getMap(String name, Class keyType /** * INTERNAL: * Return the Map of AttributeImpl members keyed by String. - * @return */ protected java.util.Map> getMembers() { return this.members; @@ -842,7 +837,6 @@ public MapAttribute getMap(String name, Class keyType /** * INTERNAL: * Return the Metamodel that this ManagedType is associated with. - * @return */ protected MetamodelImpl getMetamodel() { return this.metamodel; @@ -924,7 +918,6 @@ public SetAttribute getSet(String name, Class elementType) * * @param targetPrimitiveOrWrapperClass (the type we are verifying against) * @param actualPrimitiveOrWrapperClass (the type that may be the autoboxed or primitive equal - * @return */ private boolean isAutoboxedType(Class targetPrimitiveOrWrapperClass, Class actualPrimitiveOrWrapperClass) { BasicTypeHelperImpl typeHelper = BasicTypeHelperImpl.getInstance(); @@ -1112,9 +1105,6 @@ private boolean isAttributeDeclaredOnlyInLeafType(String attributeName, Attribut * INTERNAL: * Handle the case where we were unable to determine the element type of the plural attribute. * Normally this function is never required and should have a code coverage of 0%. - * @param managedType - * @param collectionMapping - * @param validation */ private AttributeImpl initializePluralAttributeTypeNotFound(ManagedTypeImpl managedType, CollectionMapping collectionMapping, boolean validation) { // default to List @@ -1344,8 +1334,6 @@ protected void initialize() { // Future: Check all is*Policy() calls * INTERNAL: * Get the elementType directly from the class using a reflective method call * directly on the containing java class associated with this managedType. - * @param mapping - * @return */ protected Class getTypeClassFromAttributeOrMethodLevelAccessor(DatabaseMapping mapping) { /** @@ -1453,7 +1441,6 @@ protected Class getTypeClassFromAttributeOrMethodLevelAccessor(DatabaseMapping m * INTERNAL: * Return whether this type is identifiable. * This would be EntityType and MappedSuperclassType - * @return */ @Override protected boolean isIdentifiableType() { @@ -1464,7 +1451,6 @@ protected boolean isIdentifiableType() { * INTERNAL: * Return whether this type is identifiable. * This would be EmbeddableType as well as EntityType and MappedSuperclassType - * @return */ @Override protected boolean isManagedType() { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/MapAttributeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/MapAttributeImpl.java index c123211e6ed..3f0af238e01 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/MapAttributeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/MapAttributeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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,8 +69,6 @@ public class MapAttributeImpl extends PluralAttributeImpl, /** * INTERNAL: - * @param managedType - * @param mapping */ protected MapAttributeImpl(ManagedTypeImpl managedType, CollectionMapping mapping) { this(managedType, mapping, false); @@ -208,7 +206,6 @@ Use AttributeClassification (since keyMapping.attributeAccessor.attributeClass = * INTERNAL: * Default to the PK of the owning descriptor when no MapKey or MapKey:name attribute is specified. * Prerequisites: policy on the mapping is of type MappedKeyMapPolicy - * @return */ private Class getOwningPKTypeWhenMapKeyAnnotationMissingOrDefaulted(MappedKeyMapContainerPolicy policy) { Class javaClass = null;; diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/MappedSuperclassTypeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/MappedSuperclassTypeImpl.java index 0e86b691ecd..85be82151aa 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/MappedSuperclassTypeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/MappedSuperclassTypeImpl.java @@ -68,7 +68,6 @@ protected MappedSuperclassTypeImpl(MetamodelImpl metamodel, ClassDescriptor rela /** * INTERNAL: * Add an inheriting subclass to the map of Identifiable types that inherit from this mappedSuperclass. - * @param identifiableType */ protected void addInheritingType(IdentifiableTypeImpl identifiableType) { // The Map will always be instantiated in the constructor @@ -78,9 +77,6 @@ protected void addInheritingType(IdentifiableTypeImpl identifiableType) { /** * INTERNAL: * Return an instance of a MappedSuperclassType based on the RelationalDescriptor. - * @param metamodel - * @param relationalDescriptor - * @return */ protected static MappedSuperclassTypeImpl create(MetamodelImpl metamodel, ClassDescriptor relationalDescriptor) { MappedSuperclassTypeImpl mappedSuperclassTypeImpl = new MappedSuperclassTypeImpl(metamodel, relationalDescriptor); @@ -91,8 +87,6 @@ protected static MappedSuperclassTypeImpl create(MetamodelImpl metamodel, Cla * INTERNAL: * MappedSuperclasses need special handling to get their type from an inheriting subclass. * This function determines the type for an attribute by returning the same inherited attribute from a subclass - * @param name - * @return */ public AttributeImpl getMemberFromInheritingType(String name) { AttributeImpl inheritedAttribute = null; @@ -139,7 +133,6 @@ protected void initialize(){ /** * INTERNAL: * Return whether this type is an Entity (true) or MappedSuperclass (false) or Embeddable (false) - * @return */ @Override public boolean isEntity() { @@ -149,7 +142,6 @@ public boolean isEntity() { /** * INTERNAL: * Return whether this type is an MappedSuperclass (true) or Entity (false) or Embeddable (false) - * @return */ @Override public boolean isMappedSuperclass() { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/MetamodelImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/MetamodelImpl.java index f5f87136e60..a19199c14bf 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/MetamodelImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/MetamodelImpl.java @@ -127,7 +127,6 @@ public MetamodelImpl(EntityManagerFactory emf) { /** * INTERNAL: - * @param emSetupImpl */ public MetamodelImpl(EntityManagerSetupImpl emSetupImpl) { // Create a new Metamodel using the EclipseLink session on the EM @@ -160,10 +159,6 @@ public EmbeddableType embeddable(Class clazz) { * This may occur on certain configurations of Spring or on Java EE 6 Web Profile implementations that are not in compliance * with the specification. * See http://bugs.eclipse.org/338837 - * @param aType - * @param clazz - * @param metamodelType - * @param metamodelTypeName */ private void entityEmbeddableManagedTypeNotFound(Map typeMap, Object aType, Class clazz, String metamodelType, String metamodelTypeName) { // 338837: verify that the collection is not empty - this would mean entities did not make it into the search path @@ -207,7 +202,6 @@ public EntityType entity(Class clazz) { /** * INTERNAL: * Return a List of all attributes for all ManagedTypes. - * @return */ public List getAllManagedTypeAttributes() { List attributeList = new ArrayList(); @@ -254,7 +248,6 @@ public Set> getManagedTypes() { /** * INTERNAL: * Return the Set of MappedSuperclassType objects - * @return */ public Set> getMappedSuperclasses() { return new LinkedHashSet>(this.mappedSuperclasses); @@ -264,7 +257,6 @@ public Set> getMappedSuperclasses() { * INTERNAL: * Return the core API Project associated with the DatabaseSession * that is associated with this Metamodel - * @return */ public Project getProject() { return this.getSession().getProject(); @@ -272,7 +264,6 @@ public Project getProject() { /** * INTERNAL: * Return the DatabaseSession associated with this Metamodel - * @return */ protected AbstractSession getSession() { return this.session; @@ -283,9 +274,6 @@ protected AbstractSession getSession() { * This function is a wrapper around a Map.put(K,V)
* We return a boolean that is unused but provides a way to add a * breakpoint for the false condition. - * @param javaClassKey - * @param typeValue - * @return */ private boolean putType(String javaClassKey, TypeImpl typeValue) { boolean isValid = true; @@ -304,8 +292,6 @@ private boolean putType(String javaClassKey, TypeImpl typeValue) { * If a type does not yet exist - one will be created and added to the Metamodel - this usually only for Basic types.

* This function will handle all Metamodel defined and core java classes. * - * @param javaClass - * @return */ public TypeImpl getType(Class javaClass) { // Return an existing matching type on the metamodel keyed on class name @@ -332,7 +318,6 @@ public TypeImpl getType(Class javaClass) { * INTERNAL: * Return the Map of types on this metamodel. * This includes all Entity, MappedSuperclass, Embeddable and Basic types - * @return */ public Map> getTypes() { return types; @@ -342,8 +327,6 @@ public Map> getTypes() { * INTERNAL: * Return whether there is a descriptor that is keyed by the supplied class name.

* Referenced by ManagedTypeImpl.create() - * @param qualifiedClassNameKeyString - * @return */ protected boolean hasMappedSuperclass(String qualifiedClassNameKeyString) { /** diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/PluralAttributeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/PluralAttributeImpl.java index 9db85dc6295..7e3248b6656 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/PluralAttributeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/PluralAttributeImpl.java @@ -61,9 +61,6 @@ public abstract class PluralAttributeImpl extends AttributeImpl i /** * INTERNAL: * Create an Attribute instance with a passed in validation flag (usually set to true only during Metamodel initialization) - * @param managedType - * @param mapping - * @param validationEnabled */ protected PluralAttributeImpl(ManagedTypeImpl managedType, CollectionMapping mapping, boolean validationEnabled) { super(managedType, mapping); @@ -157,7 +154,6 @@ public BindableType getBindableType() { /** * INTERNAL: * Return the mapping associated with this PluralAttribute. - * @return */ public CollectionMapping getCollectionMapping() { return (CollectionMapping) getMapping(); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/SetAttributeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/SetAttributeImpl.java index 15c7365f182..7120f0d6571 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/SetAttributeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/SetAttributeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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,8 +49,6 @@ public class SetAttributeImpl extends PluralAttributeImpl, V> im /** * INTERNAL: - * @param managedType - * @param mapping */ protected SetAttributeImpl(ManagedTypeImpl managedType, CollectionMapping mapping) { super(managedType, mapping, false); @@ -58,9 +56,6 @@ protected SetAttributeImpl(ManagedTypeImpl managedType, CollectionMapping map /** * INTERNAL: - * @param managedType - * @param mapping - * @param validationEnabled */ protected SetAttributeImpl(ManagedTypeImpl managedType, CollectionMapping mapping, boolean validationEnabled) { super(managedType, mapping, validationEnabled); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/SingularAttributeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/SingularAttributeImpl.java index fb69f0590a8..be6e9a7b7fc 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/SingularAttributeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/SingularAttributeImpl.java @@ -63,8 +63,6 @@ public class SingularAttributeImpl extends AttributeImpl implements /** * Create an instance of the Attribute - * @param managedType - * @param mapping */ protected SingularAttributeImpl(ManagedTypeImpl managedType, DatabaseMapping mapping) { this(managedType, mapping, false); @@ -72,9 +70,6 @@ protected SingularAttributeImpl(ManagedTypeImpl managedType, DatabaseMapping /** * INTERNAL: * Create an Attribute instance with a passed in validation flag (usually set to true only during Metamodel initialization) - * @param managedType - * @param mapping - * @param validationEnabled */ protected SingularAttributeImpl(ManagedTypeImpl managedType, DatabaseMapping mapping, boolean validationEnabled) { super(managedType, mapping); @@ -175,7 +170,6 @@ public boolean isOptional() { /** * INTERNAL: * Return whether the attribute is plural or singular - * @return */ @Override public boolean isPlural() { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/TypeImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/TypeImpl.java index add57cbbb1e..518268f2bcf 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/TypeImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/metamodel/TypeImpl.java @@ -115,7 +115,6 @@ public String getJavaTypeName(){ /** * INTERNAL: * Return whether this type is an Entity (true) or MappedSuperclass (false) or Embeddable (false) - * @return */ public abstract boolean isEntity(); @@ -123,7 +122,6 @@ public String getJavaTypeName(){ * INTERNAL: * Return whether this type is identifiable. * This would be EntityType and MappedSuperclassType - * @return */ protected abstract boolean isIdentifiableType(); @@ -131,14 +129,12 @@ public String getJavaTypeName(){ * INTERNAL: * Return whether this type is identifiable. * This would be EmbeddableType as well as EntityType and MappedSuperclassType - * @return */ protected abstract boolean isManagedType(); /** * INTERNAL: * Return whether this type is an MappedSuperclass (true) or Entity (false) or Embeddable (false) - * @return */ public abstract boolean isMappedSuperclass(); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/CriteriaBuilderImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/CriteriaBuilderImpl.java index 79f59b46345..7a1decb5bce 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/CriteriaBuilderImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/CriteriaBuilderImpl.java @@ -321,7 +321,6 @@ public Predicate exists(Subquery subquery){ * Create a predicate corresponding to an all expression over the subquery * results. * - * @param subquery * @return all expression */ @Override @@ -333,7 +332,6 @@ public Expression all(Subquery subquery){ * Create a predicate corresponding to a some expression over the subquery * results. This is equivalent to an any expression. * - * @param subquery * @return all expression */ @Override @@ -345,7 +343,6 @@ public Expression some(Subquery subquery){ * Create a predicate corresponding to an any expression over the subquery * results. This is equivalent to a some expression. * - * @param subquery * @return any expression */ @Override @@ -1414,7 +1411,6 @@ public Expression toString(Expression character){ /** * Create an expression literal. * - * @param value * @return expression literal */ @Override @@ -1439,7 +1435,6 @@ public Expression nullLiteral(Class resultClass){ /** * Create an expression literal but without null validation. * - * @param value * @return expression literal */ protected Expression internalLiteral(T value){ @@ -1464,7 +1459,6 @@ public ParameterExpression parameter(Class paramClass){ * * @param paramClass * parameter class - * @param name * @return parameter */ @Override @@ -1507,7 +1501,6 @@ public > Predicate isNotEmpty(Expression collection){ /** * Create an expression that tests the size of a collection. * - * @param collection * @return size expression */ @Override @@ -1604,7 +1597,6 @@ public > Predicate isNotMember(Expression elem, Ex /** * Create an expression that returns the values of a map. * - * @param map * @return collection expression */ @Override @@ -1615,7 +1607,6 @@ public > Expression> values(M map){ /** * Create an expression that returns the keys of a map. * - * @param map * @return set expression */ @Override diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/CriteriaQueryImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/CriteriaQueryImpl.java index df2fa384d22..36ee56f7e02 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/CriteriaQueryImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/CriteriaQueryImpl.java @@ -394,9 +394,6 @@ public CriteriaQuery orderBy(List o) { * * Also sets the query result to ResultType.CONSTRUCTOR * - * @param class1 - * @param selections - * @throws IllegalArgumentException */ public void populateAndSetConstructorSelection(ConstructorSelectionImpl constructorSelection, Class class1, Selection... selections) throws IllegalArgumentException{ Class[] constructorArgs = new Class[selections.length]; diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/ExpressionImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/ExpressionImpl.java index a0fbb4773a1..a75a6a0aa8f 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/ExpressionImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/ExpressionImpl.java @@ -86,7 +86,6 @@ public Predicate in(Object... values) { /** * Apply a predicate to test whether the expression is a member * of the argument list. - * @param values * @return predicate testing for membership */ @Override diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/ParameterExpressionImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/ParameterExpressionImpl.java index ed619040a76..aadb30cb637 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/ParameterExpressionImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/ParameterExpressionImpl.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 @@ -62,7 +62,6 @@ public String getName(){ /** * Returns the name used by EclipseLink when a name has not been assigned by the user. - * @return */ public String getInternalName(){ return this.internalName; diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/SubQueryImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/SubQueryImpl.java index bd8c8f15d4a..2a5a08f387f 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/SubQueryImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/querydef/SubQueryImpl.java @@ -484,7 +484,6 @@ public Predicate in(Object... values) { /** * Apply a predicate to test whether the expression is a member * of the argument list. - * @param values * @return predicate testing for membership */ @Override diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/transaction/EntityTransactionImpl.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/transaction/EntityTransactionImpl.java index bdf10affd95..a7d8468f916 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/transaction/EntityTransactionImpl.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/transaction/EntityTransactionImpl.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,6 @@ public EntityTransactionImpl(EntityTransactionWrapper wrapper) { * manager will be added here. On rollback or commit any left over open * queries should be closed. * - * @param query */ public void addOpenQuery(QueryImpl query) { if (openQueriesMap == null) { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/AbstractStaticWeaveOutputHandler.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/AbstractStaticWeaveOutputHandler.java index f7a9c7021ef..83451d10944 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/AbstractStaticWeaveOutputHandler.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/AbstractStaticWeaveOutputHandler.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 @@ -29,31 +29,22 @@ public abstract class AbstractStaticWeaveOutputHandler{ /** * create directory into target directory, or insert directory entry into outputstream. - * @param dirPath - * @throws IOException */ abstract public void addDirEntry(String dirPath)throws IOException; /** * Write entry bytes into target, this is usually called if class has been tranformed - * @param targetEntry - * @param entryBytes - * @throws IOException */ abstract public void addEntry(JarEntry targetEntry,byte[] entryBytes)throws IOException; /** * Write entry into target, this method usually copy original class into target. - * @param jis - * @param entry - * @throws IOException */ abstract public void addEntry(InputStream jis,JarEntry entry) throws IOException,URISyntaxException; /** * Close the output stream. - * @throws IOException */ public void closeOutputStream() throws IOException { if(outputStreamHolder!=null){ @@ -63,7 +54,6 @@ public void closeOutputStream() throws IOException { /** * Get the ouput stream instance. - * @return */ public JarOutputStream getOutputStream(){ return this.outputStreamHolder; diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/ClassDetails.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/ClassDetails.java index cb3d2704796..568db7e8ed4 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/ClassDetails.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/ClassDetails.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 @@ -178,8 +178,6 @@ public boolean getImplementsCloneMethod(){ * INTERNAL: * Search the list of virtualAccessMethods for a VirtualAttributeMethodInfo with the given * getMethodName. Return the VirtualAttributeMethodInfo if there is one, else return null - * @param getMethodName - * @return */ public VirtualAttributeMethodInfo getInfoForVirtualGetMethod(String getMethodName){ Iterator i = virtualAccessMethods.iterator(); @@ -196,8 +194,6 @@ public VirtualAttributeMethodInfo getInfoForVirtualGetMethod(String getMethodNam * INTERNAL: * Search the list of virtualAccessMethods for a VirtualAttributeMethodInfo with the given * setMethodName. Return the VirtualAttributeMethodInfo if there is one, else return null - * @param setMethodName - * @return */ public VirtualAttributeMethodInfo getInfoForVirtualSetMethod(String setMethodName){ Iterator i = virtualAccessMethods.iterator(); @@ -218,7 +214,6 @@ public void setImplementsCloneMethod(boolean implementsCloneMethod){ * Return the name of the most direct superclass that has a direct implementation of * a clone method. * If there is not one, return null - * @return */ public String getNameOfSuperclassImplementingCloneMethod(){ if (superClassDetails == null){ @@ -317,8 +312,6 @@ public boolean canWeaveConstructorOptimization(){ * * Assume java.lang.Object is in the hierarchy * - * @param className - * @return */ public boolean isInMetadataHierarchy(String className){ if (className.equals(Object.class.getName().replace('.', '/'))){ @@ -340,8 +333,6 @@ public boolean isInMetadataHierarchy(String className){ * * Assume java.lang.Object is in the hierarchy * - * @param className - * @return */ public boolean isInSuperclassHierarchy(String className){ if (className.equals(Object.class.getName().replace('.', '/'))){ diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/StaticWeaveDirectoryOutputHandler.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/StaticWeaveDirectoryOutputHandler.java index 4f57f217054..1dc64bd9b13 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/StaticWeaveDirectoryOutputHandler.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/StaticWeaveDirectoryOutputHandler.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 @@ -38,8 +38,6 @@ public class StaticWeaveDirectoryOutputHandler extends AbstractStaticWeaveOutput /** * Construct an instance of StaticWeaveDirectoryOutputHandler. - * @param source - * @param target */ public StaticWeaveDirectoryOutputHandler(URL source,URL target){ this.source=source; @@ -47,8 +45,6 @@ public StaticWeaveDirectoryOutputHandler(URL source,URL target){ } /** * create directory into target directory. - * @param dirPath - * @throws IOException */ @Override public void addDirEntry(String dirPath)throws IOException { @@ -63,9 +59,6 @@ public void addDirEntry(String dirPath)throws IOException { /** * Write entry bytes into target, this method is usually invoked if class has been tranformed - * @param targetEntry - * @param entryBytes - * @throws IOException */ @Override public void addEntry(JarEntry targetEntry,byte[] entryBytes)throws IOException{ @@ -87,9 +80,6 @@ public void addEntry(JarEntry targetEntry,byte[] entryBytes)throws IOException{ /** * Write entry into target, this method usually copy original class into target. - * @param jis - * @param entry - * @throws IOException */ @Override public void addEntry(InputStream jis,JarEntry entry) throws IOException,URISyntaxException { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/StaticWeaveJAROutputHandler.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/StaticWeaveJAROutputHandler.java index ae993e3b388..a675c5d4800 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/StaticWeaveJAROutputHandler.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/internal/jpa/weaving/StaticWeaveJAROutputHandler.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 @@ -28,7 +28,6 @@ public class StaticWeaveJAROutputHandler extends AbstractStaticWeaveOutputHandle /** * Construct an instance of StaticWeaveJAROutputHandler - * @param outputStreamHolder */ public StaticWeaveJAROutputHandler(JarOutputStream outputStreamHolder){ super.outputStreamHolder=outputStreamHolder; @@ -36,8 +35,6 @@ public StaticWeaveJAROutputHandler(JarOutputStream outputStreamHolder){ /** * Add directory entry into outputstream. - * @param dirPath - * @throws IOException */ @Override public void addDirEntry(String dirPath)throws IOException { @@ -47,9 +44,6 @@ public void addDirEntry(String dirPath)throws IOException { /** * Write entry bytes into target, this method is usually called if class has been tranformed - * @param targetEntry - * @param entryBytes - * @throws IOException */ @Override public void addEntry(JarEntry targetEntry,byte[] entryBytes)throws IOException{ @@ -62,9 +56,6 @@ public void addEntry(JarEntry targetEntry,byte[] entryBytes)throws IOException{ /** * Write entry into target, this method usually copy original class into target. - * @param jis - * @param entry - * @throws IOException */ @Override public void addEntry(InputStream jis,JarEntry entry) throws IOException,URISyntaxException { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/ArchiveFactory.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/ArchiveFactory.java index d44b2ef525b..26f9fa80bc5 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/ArchiveFactory.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/ArchiveFactory.java @@ -33,8 +33,6 @@ public interface ArchiveFactory { /** * Return an instance of an implementer of Archive that can process the URL provided * - * @throws URISyntaxException - * @throws IOException */ Archive createArchive(URL rootUrl, Map properties) throws URISyntaxException, IOException; @@ -43,8 +41,6 @@ public interface ArchiveFactory { * This instance will allow access to the persistence descriptor associated with * this archive through the getDescriptorStream() method * - * @throws URISyntaxException - * @throws IOException */ Archive createArchive(URL rootUrl, String descriptorLocation, Map properties) throws URISyntaxException, IOException; } diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/JpaEntityManagerFactory.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/JpaEntityManagerFactory.java index a70e56750fd..4969912a4f1 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/JpaEntityManagerFactory.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/JpaEntityManagerFactory.java @@ -58,7 +58,6 @@ public interface JpaEntityManagerFactory extends EntityManagerFactory, AutoClose * This method will return a version of EntityManagerFactory that is * based on the available metadata at the time it is called. Future calls * to refresh will not affect that metadata on this EntityManagerFactory. - * @return */ EntityManagerFactoryDelegate unwrap(); @@ -66,7 +65,6 @@ public interface JpaEntityManagerFactory extends EntityManagerFactory, AutoClose * As this EntityManagerFactory to refresh itself. This will cause the * underlying EntityManagerFactory implementation to be dropped and a new one * to be bootstrapped. Existing EntityManagers will continue to use the old implementation - * @param properties */ void refreshMetadata(Map properties); diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/PersistenceProvider.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/PersistenceProvider.java index 0e0d4e2df1b..2b9ea20d76b 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/PersistenceProvider.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/PersistenceProvider.java @@ -268,9 +268,6 @@ public boolean generateSchema(String persistenceUnitName, Map properties) { * Return JPAInitializer corresponding to the passed classLoader. * Note: This is written as an instance method rather than a static to allow * it to be overridden - * @param emName - * @param m - * @return */ public JPAInitializer getInitializer(String emName, Map m){ ClassLoader classLoader = getClassLoader(emName, m); @@ -425,7 +422,6 @@ public ProviderUtil getProviderUtil(){ * a reference to an attribute value, as this could trigger the * loading of entity state if the entity has been provided by a * different provider. - * @param entity * @param attributeName name of attribute whose load status is * to be determined * @return load status of the attribute @@ -455,7 +451,6 @@ public LoadState isLoadedWithoutReference(Object entity, String attributeName){ * attribute state will have already been determined by * isLoadedWithoutReference. ) * - * @param entity * @param attributeName name of attribute whose load status is * to be determined * @return load status of the attribute @@ -512,7 +507,6 @@ public LoadState isLoaded(Object entity){ * If a classloader is not found in the properties map then * use the current thread classloader. * - * @param properties * @return ClassLoader */ public ClassLoader getClassLoader(String emName, Map properties) { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/metadata/XMLMetadataSource.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/metadata/XMLMetadataSource.java index 571ebf2f96b..b6b949374d0 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/metadata/XMLMetadataSource.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/jpa/metadata/XMLMetadataSource.java @@ -55,8 +55,6 @@ public XMLMetadataSource() { * resource from the classloader. * It will throw a ValidationException if no reader can be returned. * - * @param properties - * @param classLoader * @param log - SessionLog used for status messages. * @return Reader - a InputStreamReader with data in the form of an EclipseLink-orm.xml * diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/tools/weaving/jpa/StaticWeaveAntTask.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/tools/weaving/jpa/StaticWeaveAntTask.java index 877ab0a8ffb..cc33c0da432 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/tools/weaving/jpa/StaticWeaveAntTask.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/tools/weaving/jpa/StaticWeaveAntTask.java @@ -185,7 +185,6 @@ public void execute() { /** * Verify the value of attributes. - * @throws BuildException */ private void verifyOptions() throws BuildException { if (source==null) { diff --git a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/tools/weaving/jpa/StaticWeaveProcessor.java b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/tools/weaving/jpa/StaticWeaveProcessor.java index 168a263e4ea..55861e1b9c0 100644 --- a/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/tools/weaving/jpa/StaticWeaveProcessor.java +++ b/jpa/org.eclipse.persistence.jpa/src/main/java/org/eclipse/persistence/tools/weaving/jpa/StaticWeaveProcessor.java @@ -65,7 +65,6 @@ public class StaticWeaveProcessor { * Constructs an instance of StaticWeaveProcessor * @param source the name of the location to be weaved * @param target the name of the location to be weaved to - * @throws MalformedURLException */ public StaticWeaveProcessor(String source, String target)throws MalformedURLException{ if (source != null) { @@ -80,7 +79,6 @@ public StaticWeaveProcessor(String source, String target)throws MalformedURLExce * Constructs an instance of StaticWeaveProcessor * @param source the File object of the source to be weaved * @param target the File object of the target to be weaved to - * @throws MalformedURLException */ public StaticWeaveProcessor(File source, File target)throws MalformedURLException { this.source=source.toURL(); @@ -147,7 +145,6 @@ public String getPersistenceXMLLocation() { /** * Set a specific location to look for persistence.xml * by default we will look in META-INF/persistence.xml - * @param persistenceXMLLocation */ public void setPersistenceXMLLocation(String persistenceXMLLocation) { this.persistenceXMLLocation = persistenceXMLLocation; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/JAXBSchemaOutputResolver.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/JAXBSchemaOutputResolver.java index 8214293ec06..955637d9440 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/JAXBSchemaOutputResolver.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/JAXBSchemaOutputResolver.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 @@ -33,7 +33,6 @@ public class JAXBSchemaOutputResolver implements SchemaModelOutputResolver { * This constructor sets the underlying SchemaOutputResolver to be used * during createOutput operation. * - * @param outputResolver */ public JAXBSchemaOutputResolver(SchemaOutputResolver outputResolver) { this.outputResolver = outputResolver; @@ -43,10 +42,7 @@ public JAXBSchemaOutputResolver(SchemaOutputResolver outputResolver) { * Determines the location where a given schema file (of the given namespace URI) * will be generated, and return it as a Result object. * - * @param namespaceURI - * @param suggestedFileName * @return schema file as a Result object - * @throws java.io.IOException */ @Override public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/JAXBSetMethodAttributeAccessor.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/JAXBSetMethodAttributeAccessor.java index 8647016835a..05ead1418e9 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/JAXBSetMethodAttributeAccessor.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/JAXBSetMethodAttributeAccessor.java @@ -45,8 +45,6 @@ public class JAXBSetMethodAttributeAccessor extends MethodAttributeAccessor { * well as the classloader that will be used to load the associated class * during initialization. * - * @param parameterTypeAsString - * @param loader */ public JAXBSetMethodAttributeAccessor(String parameterTypeAsString, ClassLoader loader) { this.parameterTypeAsString = parameterTypeAsString; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/SessionEventListener.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/SessionEventListener.java index 880eeade82d..dd29e1ec1d2 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/SessionEventListener.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/SessionEventListener.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,6 @@ public void preLogin(SessionEvent event) { * Indicates if each descriptor's instantiation policy should be validated * during initialization. * - * @param value * @see InstantiationPolicy * @see org.eclipse.persistence.oxm.XMLDescriptor */ diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/XMLJavaTypeConverter.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/XMLJavaTypeConverter.java index 2eb1aa2152b..b02d422affc 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/XMLJavaTypeConverter.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/XMLJavaTypeConverter.java @@ -70,7 +70,6 @@ public XMLJavaTypeConverter() { * This constructor takes the XmlAdapter class to be used with this * converter. * - * @param xmlAdapterClass */ public XMLJavaTypeConverter(Class xmlAdapterClass) { setXmlAdapterClass(xmlAdapterClass); @@ -80,7 +79,6 @@ public XMLJavaTypeConverter(Class xmlAdapterClass) { * This constructor takes an adapter class name. The adapter * class will be loaded during initialization. * - * @param xmlAdapterClassName */ public XMLJavaTypeConverter(String xmlAdapterClassName) { this.xmlAdapterClassName = xmlAdapterClassName; @@ -93,8 +91,6 @@ public XMLJavaTypeConverter(String xmlAdapterClassName) { * the schema type, then from that type to the bound type. The opposite * will occur during marshal. * - * @param xmlAdapterClass - * @param schemaType */ public XMLJavaTypeConverter(Class xmlAdapterClass, QName schemaType) { setSchemaType(schemaType); @@ -108,8 +104,6 @@ public XMLJavaTypeConverter(Class xmlAdapterClass, QName schemaType) { * type will be converted to the schema type, then from that type to the * bound type. The opposite will occur during marshal. * - * @param xmlAdapterClassName - * @param schemaType */ public XMLJavaTypeConverter(String xmlAdapterClassName, QName schemaType) { setSchemaType(schemaType); @@ -231,8 +225,6 @@ public String getXmlAdapterClassName() { * either create an instance of the XmlAdapter, or if an instance is set * on the marshaller, use it. * - * @param mapping - * @param session */ @Override public void initialize(DatabaseMapping mapping, Session session) { @@ -322,7 +314,6 @@ public void setSchemaType(QName qname) { /** * Set the XmlAdapter class to be used with this converter. * - * @param xmlAdapterClass */ public void setXmlAdapterClass(Class xmlAdapterClass) { this.xmlAdapterClass = xmlAdapterClass; @@ -331,7 +322,6 @@ public void setXmlAdapterClass(Class xmlAdapterClass) { /** * Set the XmlAdapter class to be used with this converter. * - * @param xmlAdapterClassName */ public void setXmlAdapterClassName(String xmlAdapterClassName) { this.xmlAdapterClassName = xmlAdapterClassName; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/json/schema/JsonSchemaGenerator.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/json/schema/JsonSchemaGenerator.java index dca1c3f30c6..8b8e83b7951 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/json/schema/JsonSchemaGenerator.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/internal/jaxb/json/schema/JsonSchemaGenerator.java @@ -307,8 +307,6 @@ private boolean hasAnyMappings(XMLDescriptor descriptor) { * simple type (a single direct mapping with xpath of text) then the name of the simple type is returned. * Otherwise null is returned. * - * @param properties - * @param descriptor * @return null for a complex type, the simple type name for a simple type. */ private JsonType populateProperties(Map properties, XMLDescriptor descriptor) { diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/IDResolver.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/IDResolver.java index 38da35bd540..2bda33f6d2e 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/IDResolver.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/IDResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -44,7 +44,6 @@ public abstract class IDResolver extends org.eclipse.persistence.oxm.IDResolver * * @param eventHandler Any errors encountered during the unmarshal process should be reported to this handler. * - * @throws SAXException */ public void startDocument(ValidationEventHandler eventHandler) throws SAXException {} diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBBeanValidator.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBBeanValidator.java index b918eb44dce..10d633be4a3 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBBeanValidator.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBBeanValidator.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 @@ -265,7 +265,6 @@ private boolean isConstrainedObject(Object value) { * * @param value Object to be validated. * @param groups Target groups as per BV spec. If null {@link #DEFAULT_GROUP_ARRAY} is used. - * @throws BeanValidationException {@link BeanValidationException#constraintViolation} */ void validate(Object value, Class... groups) throws BeanValidationException { Class[] grp = groups; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBContext.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBContext.java index a965cb45f7a..89eaca7de33 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBContext.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBContext.java @@ -301,7 +301,6 @@ void postInitialize() { * not affect instances of Binder. To get the new metadata you must create * a new instance of Binder after the refresh metadata call has been made. * - * @throws jakarta.xml.bind.JAXBException */ public void refreshMetadata() throws jakarta.xml.bind.JAXBException { JAXBContextState newState = newContextState(); @@ -784,7 +783,6 @@ protected JAXBElement createJAXBElement(QName qname, Class theClass, Object valu /** * Returns true if any Object in this context contains a property annotated with an XmlAttachmentRef * annotation. - * @return */ public boolean hasSwaRef() { return contextState.getGenerator().getAnnotationsProcessor().hasSwaRef(); @@ -1606,7 +1604,7 @@ public JAXBMarshaller createMarshaller(JAXBContext jaxbContext) throws jakarta.x // initialize each callback in the map ClassLoader classLoader = getXMLContext().getSession(0).getDatasourcePlatform().getConversionManager().getLoader(); for (Object o : generator.getMarshalCallbacks().keySet()) { - MarshalCallback cb = (MarshalCallback) generator.getMarshalCallbacks().get(o); + MarshalCallback cb = generator.getMarshalCallbacks().get(o); cb.initialize(classLoader); } marshaller.setMarshalCallbacks(generator.getMarshalCallbacks()); @@ -1641,7 +1639,7 @@ public JAXBUnmarshaller createUnmarshaller(JAXBContext jaxbContext) throws jakar // initialize each callback in the map ClassLoader classLoader = getXMLContext().getSession(0).getDatasourcePlatform().getConversionManager().getLoader(); for (Object o : generator.getUnmarshalCallbacks().keySet()) { - UnmarshalCallback cb = (UnmarshalCallback) generator.getUnmarshalCallbacks().get(o); + UnmarshalCallback cb = generator.getUnmarshalCallbacks().get(o); cb.initialize(classLoader); } unmarshaller.setUnmarshalCallbacks(generator.getUnmarshalCallbacks()); diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBContextFactory.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBContextFactory.java index a03771b779e..ccfcbcfe0ed 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBContextFactory.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBContextFactory.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 @@ -277,8 +277,6 @@ public static Map getXmlBindingsFromProperties(Map properti * * @param originalBindings Map of bindings to be updated * @param bindingHandle handle to bindings file - * @param classLoader - * @return */ private static Map> processBindingFile(Map> originalBindings, Object bindingHandle, ClassLoader classLoader, Map properties) { XmlBindings binding = getXmlBindings(bindingHandle, classLoader, properties); diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBErrorHandler.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBErrorHandler.java index d7e52c9bae8..65d45419dc0 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBErrorHandler.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBErrorHandler.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 @@ -37,7 +37,6 @@ public class JAXBErrorHandler implements ErrorHandler { /** * Create a new JAXBErrorHandler with the specified ValidationEventHandler - * @param validationEventHandler */ public JAXBErrorHandler(ValidationEventHandler validationEventHandler) { super(); diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBHelper.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBHelper.java index 292ee9a9578..7690cdd0ab2 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBHelper.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBHelper.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 @@ -38,9 +38,6 @@ public class JAXBHelper { * an instance of {@link org.eclipse.persistence.jaxb.JAXBContext}. If not, an exception will be * thrown. * - * @param jaxbContext - * @return - * @throws IllegalArgumentException */ public static JAXBContext getJAXBContext(jakarta.xml.bind.JAXBContext jaxbContext) throws IllegalArgumentException { try { @@ -56,9 +53,6 @@ public static JAXBContext getJAXBContext(jakarta.xml.bind.JAXBContext jaxbContex * be an instance of {@link org.eclipse.persistence.jaxb.JAXBUnmarshaller}. If not, an exception * will be thrown. * - * @param jaxbUnmarshaller - * @return - * @throws IllegalArgumentException */ public static JAXBUnmarshaller getUnmarshaller(jakarta.xml.bind.Unmarshaller jaxbUnmarshaller) throws IllegalArgumentException { try { @@ -74,9 +68,6 @@ public static JAXBUnmarshaller getUnmarshaller(jakarta.xml.bind.Unmarshaller jax * instance of {@link org.eclipse.persistence.jaxb.JAXBMarshaller}. If not, an exception will be * thrown. * - * @param jaxbMarshaller - * @return - * @throws IllegalArgumentException */ public static JAXBMarshaller getMarshaller(jakarta.xml.bind.Marshaller jaxbMarshaller) throws IllegalArgumentException { try { @@ -92,9 +83,6 @@ public static JAXBMarshaller getMarshaller(jakarta.xml.bind.Marshaller jaxbMarsh * instance of {@link org.eclipse.persistence.jaxb.JAXBBinder}. If not, an exception will be * thrown. * - * @param jaxbBinder - * @return - * @throws IllegalArgumentException */ public static JAXBBinder getBinder(jakarta.xml.bind.Binder jaxbBinder) throws IllegalArgumentException { try { @@ -111,13 +99,8 @@ public static JAXBBinder getBinder(jakarta.xml.bind.Binder jaxbBinder) throws Il * EclipseLink JAXBContext, and clazz is one of org.eclipse.persistence.jaxb.JAXBContext or * org.eclipse.persistence.oxm.XMLContext. * - * @param - * @param jaxbContext - * @param clazz - * @return * @see org.eclipse.persistence.jaxb.JAXBContext * @see org.eclipse.persistence.oxm.XMLContext - * @throws IllegalArgumentException */ public static T unwrap(jakarta.xml.bind.JAXBContext jaxbContext, Class clazz) throws IllegalArgumentException { try { @@ -142,13 +125,8 @@ public static T unwrap(jakarta.xml.bind.JAXBContext jaxbContext, Class cl * instance of EclipseLink JAXBUnmarshaller, and clazz is one of * org.eclipse.persistence.jaxb.JAXBUnmarshaller or org.eclipse.persistence.oxm.XMLUnmarshaller. * - * @param - * @param jaxbUnmarshaller - * @param clazz - * @return * @see org.eclipse.persistence.jaxb.JAXBUnmarshaller * @see org.eclipse.persistence.oxm.XMLUnmarshaller - * @throws IllegalArgumentException */ public static T unwrap(jakarta.xml.bind.Unmarshaller jaxbUnmarshaller, Class clazz) throws IllegalArgumentException { try { @@ -173,13 +151,8 @@ public static T unwrap(jakarta.xml.bind.Unmarshaller jaxbUnmarshaller, Class * of EclipseLink JAXBMarshaller, and clazz is one of * org.eclipse.persistence.jaxb.JAXBMarshaller or org.eclipse.persistence.oxm.XMLMarshaller. * - * @param - * @param jaxbMarshaller - * @param clazz - * @return * @see org.eclipse.persistence.jaxb.JAXBMarshaller * @see org.eclipse.persistence.oxm.XMLMarshaller - * @throws IllegalArgumentException */ public static T unwrap(jakarta.xml.bind.Marshaller jaxbMarshaller, Class clazz) throws IllegalArgumentException { try { @@ -204,13 +177,8 @@ public static T unwrap(jakarta.xml.bind.Marshaller jaxbMarshaller, Class * EclipseLink JAXBBinderr, and clazz is one of org.eclipse.persistence.jaxb.JAXBinder or * org.eclipse.persistence.oxm.XMLBinder. * - * @param - * @param jaxbBinder - * @param clazz - * @return * @see org.eclipse.persistence.jaxb.JAXBBinder * @see org.eclipse.persistence.oxm.XMLBinder - * @throws IllegalArgumentException */ public static T unwrap(jakarta.xml.bind.Binder jaxbBinder, Class clazz) throws IllegalArgumentException { try { diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBMarshaller.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBMarshaller.java index 1a8faf92adf..8e81fbbeebb 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBMarshaller.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBMarshaller.java @@ -159,8 +159,6 @@ public JAXBMarshaller(XMLMarshaller newXMLMarshaller, JAXBContext jaxbContext) { * while the marshal operation is performed by TopLink OXM. This will avoid * adding any runtime dependencies to TopLink. * - * @param elt - * @return */ private Root createXMLRootFromJAXBElement(JAXBElement elt) { // create an XMLRoot to hand into the marshaller diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBUnmarshaller.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBUnmarshaller.java index c590ceedb99..8351fe12cb7 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBUnmarshaller.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBUnmarshaller.java @@ -258,8 +258,6 @@ private JAXBElement validateAndBuildJAXBElement(Object obj, Class declaredClass) * using the object's descriptor default root element - any * prefix will be resolved, and a QName created. * - * @param obj - * @return */ private JAXBElement buildJAXBElementFromObject(Object obj, Class declaredClass) { // if an XMLRoot was returned, the root element != the default root diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBValidator.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBValidator.java index b0b2aa48930..a3bee28baa1 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBValidator.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBValidator.java @@ -33,7 +33,6 @@ public class JAXBValidator /*implements Validator*/ { * DefaultValidationEventHandlervalidation instance, and sets the * XMLMarshaller instance to the one provided. * - * @param newValidator */ public JAXBValidator(XMLValidator newValidator) { super(); @@ -46,7 +45,6 @@ public JAXBValidator(XMLValidator newValidator) { * * @param rootObject - the root object to be validated * @return true if a valid root object, false otherwise - * @throws JAXBException */ public boolean validateRoot(Object rootObject) throws JAXBException { if (rootObject == null) { @@ -65,7 +63,6 @@ public boolean validateRoot(Object rootObject) throws JAXBException { * * @param object - the object to be validated * @return true if a valid object, false otherwise - * @throws JAXBException */ public boolean validate(Object object) throws JAXBException { if (object == null) { diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/TypeMappingInfo.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/TypeMappingInfo.java index 5c158fb446a..bd90fa28a42 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/TypeMappingInfo.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/TypeMappingInfo.java @@ -63,7 +63,6 @@ public void setElementScope(ElementScope scope) { /** * Return if the global element will be marked as nillable - * @return */ public boolean isNillable() { return nillable; @@ -71,7 +70,6 @@ public boolean isNillable() { /** * Set if the global element should be marked as nillable - * @param nillable */ public void setNillable(boolean nillable) { this.nillable = nillable; 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 484f163d4d9..6fd7c97b487 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 @@ -1674,7 +1674,7 @@ private void processXmlElement(Property property, TypeInfo info) { JavaClass newType =helper.getJavaClass(element.type()); if(!originalType.getName().equals(newType.getName())){ property.setTyped(true); - property.setSchemaType((QName) helper.getXMLToJavaTypeMap().get(newType.getName())); + property.setSchemaType(helper.getXMLToJavaTypeMap().get(newType.getName())); } property.setType(newType); } @@ -1930,7 +1930,7 @@ public ArrayList getFieldPropertiesForClass(JavaClass cls, TypeInfo in return properties; } - for (JavaField javaField : (Iterable) cls.getDeclaredFields()) { + for (JavaField javaField : cls.getDeclaredFields()) { Property property = null; int modifiers = javaField.getModifiers(); @@ -3331,7 +3331,7 @@ public void addEnumTypeInfo(JavaClass javaClass, EnumTypeInfo info) { } info.setRestrictionBase(restrictionBase); - for (JavaField field : (Iterable) javaClass.getDeclaredFields()) { + for (JavaField field : javaClass.getDeclaredFields()) { if (field.isEnumConstant()) { Object enumValue = field.getName(); if (helper.isAnnotationPresent(field, XmlEnumValue.class)) { @@ -3365,7 +3365,7 @@ public QName getSchemaTypeOrNullFor(JavaClass javaClass) { // check user defined types first QName schemaType = userDefinedSchemaTypes.get(javaClass.getQualifiedName()); if (schemaType == null) { - schemaType = (QName) helper.getXMLToJavaTypeMap().get(javaClass.getRawName()); + schemaType = helper.getXMLToJavaTypeMap().get(javaClass.getRawName()); } return schemaType; } @@ -4358,7 +4358,7 @@ private Class generateArrayValue(JavaClass arrayClass, JavaClass componentClass, } if (componentClass.isPrimitive() || helper.isBuiltInJavaType(componentClass)) { - qName = (QName) helper.getXMLToJavaTypeMap().get(componentClass.getQualifiedName()); + qName = helper.getXMLToJavaTypeMap().get(componentClass.getQualifiedName()); if(null != qName) { packageName = ARRAY_PACKAGE_NAME; qualifiedClassName = ARRAY_PACKAGE_NAME + DOT_CHR + qName.getLocalPart() + ARRAY_CLASS_NAME_SUFFIX; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/CompilerHelper.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/CompilerHelper.java index e7fcb907bf5..350f270f856 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/CompilerHelper.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/CompilerHelper.java @@ -314,9 +314,6 @@ private static Type getActualArgumentType(Type argument){ * unmarshal the Element. This assumes that the Element represents an * xml-element to be unmarshalled. * - * @param xmlElementNode - * @param classLoader - * @return */ static org.eclipse.persistence.jaxb.xmlmodel.XmlElement getXmlElement(org.w3c.dom.Element xmlElementNode, ClassLoader classLoader) { try { diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/ElementDeclaration.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/ElementDeclaration.java index 72ee9d90ddb..7436c29474a 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/ElementDeclaration.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/ElementDeclaration.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 @@ -151,7 +151,6 @@ public void setIsXmlRootElement(boolean isXmlRoot) { } /** * Return if the global element will be marked as nillable - * @return */ public boolean isNillable() { return nillable; @@ -159,7 +158,6 @@ public boolean isNillable() { /** * Set if the global element should be marked as nillable - * @param nillable */ public void setNillable(boolean nillable) { this.nillable = nillable; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/EnumTypeInfo.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/EnumTypeInfo.java index b671469978a..5a8dc1809b4 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/EnumTypeInfo.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/EnumTypeInfo.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 @@ -43,8 +43,8 @@ public class EnumTypeInfo extends TypeInfo { public EnumTypeInfo(Helper helper, JavaClass javaClass) { super(helper, javaClass); - m_fieldNames = new ArrayList(); - m_xmlEnumValues = new ArrayList(); + m_fieldNames = new ArrayList<>(); + m_xmlEnumValues = new ArrayList<>(); } @Override @@ -71,8 +71,6 @@ public void setRestrictionBase(QName restrictionBase) { /** * Add a Java field name to XmlEnumValue pair. * - * @param fieldName - * @param xmlEnumValue */ public void addJavaFieldToXmlEnumValuePair(String fieldName, Object xmlEnumValue) { m_fieldNames.add(fieldName); @@ -85,9 +83,6 @@ public void addJavaFieldToXmlEnumValuePair(String fieldName, Object xmlEnumValue * 'override' will typically be used when performing overrides via XML metadata * in XmlProcessor. * - * @param override - * @param fieldName - * @param xmlEnumValue */ public void addJavaFieldToXmlEnumValuePair(boolean override, String fieldName, Object xmlEnumValue) { if (!override) { @@ -117,8 +112,6 @@ public List getXmlEnumValues() { * Return the index in the fieldNames List for a given Java field * name, or -1 if it doesn't exist. * - * @param fieldName - * @return */ private int getIndexForJavaField(String fieldName) { for (int i=0; i xmlBindings, ClassLoader cLoader, String defaultTargetNamespace, boolean enableXmlAccessorFactory) { helper = new Helper(jModelInput.getJavaModel()); @@ -124,7 +118,6 @@ public Generator(JavaModelInput jModelInput, Map xmlBinding * instance's JavaModel and a map of javaclasses that were generated from Type objects. * Annotations are processed here as well. * - * @param jModelInput */ public Generator(JavaModelInput jModelInput, TypeMappingInfo[] typeMappingInfos, JavaClass[] javaClasses, Map typeToTypeMappingInfo, String defaultTargetNamespace) { helper = new Helper(jModelInput.getJavaModel()); @@ -144,14 +137,7 @@ public Generator(JavaModelInput jModelInput, TypeMappingInfo[] typeMappingInfos, * If xmlBindings is null or empty, AnnotationsProcessor will be used to process * annotations as per usual. * - * @param jModelInput - * @param defaultTargetNamespace - * @param enableXmlAccessorFactory - * @param javaClasses - * @param typeMappingInfos - * @param typeToTypeMappingInfo * @param xmlBindings map of XmlBindings keyed on package name - * @param cLoader */ public Generator(JavaModelInput jModelInput, TypeMappingInfo[] typeMappingInfos, JavaClass[] javaClasses, Map typeToTypeMappingInfo, Map xmlBindings, ClassLoader cLoader, String defaultTargetNamespace, boolean enableXmlAccessorFactory) { helper = new Helper(jModelInput.getJavaModel()); @@ -238,7 +224,7 @@ public Map generateSchemaFiles(SchemaOutputResolver outp java.util.Collection schemas = schemaGenerator.getAllSchemas(); // make sure that schemas will be passed to the output in specified order if (schemas instanceof List) { - ((List)schemas).sort(new SchemaCompareByNamespace()); + ((List)schemas).sort(new SchemaCompareByNamespace()); } for(Schema schema : schemas) { try { @@ -267,8 +253,6 @@ public Map generateSchemaFiles(SchemaOutputResolver outp * It is assumed that the map of QName-Type entries contains Type instances that are either a Class or * a ParameterizedType. * - * @param additionalGlobalElements - * @param annotationsProcessor */ private void processAdditionalElements(Map additionalGlobalElements, AnnotationsProcessor annotationsProcessor) { if (additionalGlobalElements != null) { @@ -288,7 +272,7 @@ private void processAdditionalElements(Map additionalGlobalElements } JavaClass jClass = null; if (type instanceof Class) { - Class tClass = (Class) type; + Class tClass = (Class) type; jClass = helper.getJavaClass(tClass); } // if no type is available don't do anything @@ -300,11 +284,11 @@ private void processAdditionalElements(Map additionalGlobalElements } } - public Map getUnmarshalCallbacks() { + public Map getUnmarshalCallbacks() { return annotationsProcessor.getUnmarshalCallbacks(); } - public Map getMarshalCallbacks() { + public Map getMarshalCallbacks() { return annotationsProcessor.getMarshalCallbacks(); } diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/JAXBMetadataLogger.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/JAXBMetadataLogger.java index f2cdf1ea3cf..53c0176c2c0 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/JAXBMetadataLogger.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/JAXBMetadataLogger.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 @@ -38,7 +38,6 @@ public JAXBMetadataLogger() { /** * Create a new JAXBMetadataLogger and set the logLevel. * - * @param logLevel * @see SessionLog */ public JAXBMetadataLogger(int logLevel) { @@ -71,7 +70,6 @@ public void logWarning(String message, Object[] args) { * Logs a Severe message to the SessionLog. Typically called when EclipseLink is not in a state * to continue * - * @param throwable * @see SessionLog */ public void logException(Throwable throwable) { diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/MappingsGenerator.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/MappingsGenerator.java index 7b32eb8c16f..974d92f3fb0 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/MappingsGenerator.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/MappingsGenerator.java @@ -52,7 +52,6 @@ import org.eclipse.persistence.core.queries.CoreAttributeGroup; import org.eclipse.persistence.core.sessions.CoreProject; import org.eclipse.persistence.descriptors.ClassDescriptor; -import org.eclipse.persistence.descriptors.InheritancePolicy; import org.eclipse.persistence.dynamic.DynamicClassLoader; import org.eclipse.persistence.exceptions.DescriptorException; import org.eclipse.persistence.exceptions.JAXBException; @@ -60,10 +59,8 @@ import org.eclipse.persistence.internal.descriptors.InstanceVariableAttributeAccessor; import org.eclipse.persistence.internal.descriptors.InstantiationPolicy; import org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor; -import org.eclipse.persistence.internal.descriptors.ObjectBuilder; import org.eclipse.persistence.internal.descriptors.VirtualAttributeAccessor; import org.eclipse.persistence.internal.helper.DatabaseField; -import org.eclipse.persistence.internal.helper.DatabaseTable; import org.eclipse.persistence.internal.jaxb.AccessorFactoryWrapper; import org.eclipse.persistence.internal.jaxb.CustomAccessorAttributeAccessor; import org.eclipse.persistence.internal.jaxb.DefaultElementConverter; @@ -280,17 +277,13 @@ public CoreProject generateProject(List typeInfoClasses, Map customizerClass = PrivilegedAccessHelper.getClassForName(customizerClassName, true, helper.getClassLoader()); - DescriptorCustomizer descriptorCustomizer = (DescriptorCustomizer) PrivilegedAccessHelper.newInstanceFromClass(customizerClass); + Class customizerClass = PrivilegedAccessHelper.getClassForName(customizerClassName, true, helper.getClassLoader()); + DescriptorCustomizer descriptorCustomizer = PrivilegedAccessHelper.newInstanceFromClass(customizerClass); descriptorCustomizer.customize((XMLDescriptor)tInfo.getDescriptor()); - } catch (IllegalAccessException iae) { - throw JAXBException.couldNotCreateCustomizerInstance(iae, customizerClassName); - } catch (InstantiationException ie) { - throw JAXBException.couldNotCreateCustomizerInstance(ie, customizerClassName); } catch (ClassCastException cce) { throw JAXBException.invalidCustomizerClass(cce, customizerClassName); - } catch (ClassNotFoundException cnfe) { - throw JAXBException.couldNotCreateCustomizerInstance(cnfe, customizerClassName); + } catch (ReflectiveOperationException roe) { + throw JAXBException.couldNotCreateCustomizerInstance(roe, customizerClassName); } } } @@ -660,9 +653,6 @@ private void setSchemaContext(Descriptor desc, TypeInfo info) { /** * Generate a mapping for a given Property. * - * @param property - * @param descriptor - * @param namespaceInfo * @return newly created mapping */ public Mapping generateMapping(Property property, Descriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo) { @@ -1072,10 +1062,6 @@ private InverseReferenceMapping generateInverseReferenceMapping(Property propert /** * Generate an XMLTransformationMapping based on a given Property. * - * @param property - * @param descriptor - * @param namespace - * @return */ public TransformationMapping generateTransformationMapping(Property property, Descriptor descriptor, NamespaceInfo namespace) { TransformationMapping mapping = new XMLTransformationMapping(); @@ -1177,9 +1163,7 @@ public ChoiceObjectMapping generateChoiceMapping(Property property, Descriptor d } mapping.addChoiceElement(xpath, type.getQualifiedName()); if(!originalType.getQualifiedName().equals(type.getQualifiedName())) { - if(mapping.getClassNameToFieldMappings().get(originalType.getQualifiedName()) == null) { - mapping.getClassNameToFieldMappings().put(originalType.getQualifiedName(), xpath); - } + mapping.getClassNameToFieldMappings().putIfAbsent(originalType.getQualifiedName(), xpath); mapping.addConverter(xpath, converter); } XMLMapping nestedMapping = mapping.getChoiceElementMappings().get(xpath); @@ -1283,9 +1267,7 @@ public ChoiceCollectionMapping generateChoiceCollectionMapping(Property property xmlField = xpath; mapping.addChoiceElement(xpath.getName(), type.getQualifiedName()); if(!originalType.getQualifiedName().equals(type.getQualifiedName())) { - if(mapping.getClassNameToFieldMappings().get(originalType.getQualifiedName()) == null) { - mapping.getClassNameToFieldMappings().put(originalType.getQualifiedName(), xpath); - } + mapping.getClassNameToFieldMappings().putIfAbsent(originalType.getQualifiedName(), xpath); mapping.addConverter(xpath, converter); } @@ -1948,9 +1930,6 @@ protected boolean areEquals(JavaClass src, Class tgt) { * the raw name of the JavaClass compared to the canonical * name of the Class. * - * @param src - * @param tgtCanonicalName - * @return */ protected boolean areEquals(JavaClass src, String tgtCanonicalName) { if (src == null || tgtCanonicalName == null) { @@ -2181,7 +2160,7 @@ private Mapping generateMappingForType(JavaClass theType, String attributeName){ QName schemaType = userDefinedSchemaTypes.get(theType.getQualifiedName()); if (schemaType == null) { - schemaType = (QName) helper.getXMLToJavaTypeMap().get(theType); + schemaType = helper.getXMLToJavaTypeMap().get(theType); } ((Field) mapping.getField()).setSchemaType(schemaType); if(info != null && info.isEnumerationType()) { @@ -2379,7 +2358,7 @@ public String getPrefixForNamespace(String URI, NamespaceResolver namespaceResol public String getPrefixForNamespace(String URI, NamespaceResolver namespaceResolver, boolean addPrefixToNR) { String defaultNS = namespaceResolver.getDefaultNamespaceURI(); - if(defaultNS != null && URI.equals(defaultNS)){ + if(URI.equals(defaultNS)){ return null; } String prefix = namespaceResolver.resolveNamespaceURI(URI); @@ -2426,7 +2405,6 @@ public String getPrefixForNamespace(String URI, NamespaceResolver namespaceResol * generateMappings() that determines when to copy down inherited * methods from the parent class will need to be changed as well. * - * @param jClass */ private void setupInheritance(JavaClass jClass) { TypeInfo tInfo = typeInfo.get(jClass.getName()); @@ -2566,9 +2544,6 @@ public void generateMappings() { /** * Generate mappings for a given TypeInfo. * - * @param info - * @param descriptor - * @param namespaceInfo */ public void generateMappings(TypeInfo info, Descriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo) { if(info.isAnonymousComplexType()) { @@ -2659,10 +2634,6 @@ private void generateInheritedMappingsForAnonymousType(TypeInfo info, Descriptor /** * Create an XMLCollectionReferenceMapping and add it to the descriptor. * - * @param property - * @param descriptor - * @param namespaceInfo - * @param referenceClass */ public CollectionReferenceMapping generateXMLCollectionReferenceMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, JavaClass referenceClass) { CollectionReferenceMapping mapping = new XMLCollectionReferenceMapping(); @@ -2745,10 +2716,6 @@ public CollectionReferenceMapping generateXMLCollectionReferenceMapping(Property /** * Create an XMLObjectReferenceMapping and add it to the descriptor. * - * @param property - * @param descriptor - * @param namespaceInfo - * @param referenceClass */ public ObjectReferenceMapping generateXMLObjectReferenceMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, JavaClass referenceClass) { ObjectReferenceMapping mapping = new XMLObjectReferenceMapping(); @@ -2932,7 +2899,7 @@ public Field getXPathForField(Property property, NamespaceInfo namespaceInfo, bo if (schemaType == null) { String propertyActualTypeRawName = property.getActualType().getRawName(); if(QName.class.getCanonicalName().equals(propertyActualTypeRawName)) { - schemaType = (QName) helper.getXMLToJavaTypeMap().get(propertyActualTypeRawName); + schemaType = helper.getXMLToJavaTypeMap().get(propertyActualTypeRawName); } } if(schemaType !=null && !schemaType.equals (Constants.NORMALIZEDSTRING_QNAME)){ @@ -3404,10 +3371,8 @@ private AbstractNullPolicy getWrapperNullPolicyFromProperty(Property property) { /** * Convenience method which returns an AbstractNullPolicy built from an XmlAbstractNullPolicy. * - * @param property * @param nsr if 'NullRepresentedByXsiNil' is true, this is the resolver * that we will add the schema instance prefix/uri pair to - * @return * @see org.eclipse.persistence.oxm.mappings.nullpolicy.AbstractNullPolicy * @see org.eclipse.persistence.jaxb.xmlmodel.XmlAbstractNullPolicy */ diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/MarshalCallback.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/MarshalCallback.java index 308f510f5bf..3e5da2e0103 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/MarshalCallback.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/MarshalCallback.java @@ -62,7 +62,6 @@ public Class getDomainClass() { } /** - * @param loader */ public void initialize(ClassLoader loader) { try { @@ -148,7 +147,6 @@ public void setHasBeforeMarshalCallback() { * Should use setDomainClassName - the init method will overwrite * the set value with Class.forName(domainClassName). * - * @param clazz */ public void setDomainClass(Class clazz) { domainClass = clazz; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/Property.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/Property.java index 7ca65dc0898..8f5c098bae1 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/Property.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/Property.java @@ -206,7 +206,7 @@ public void setAdapterClass(JavaClass adapterCls) { ArrayList marshalMethods = new ArrayList(); // Look for marshal method - for (JavaMethod method : (Collection) adapterCls.getMethods()) { + for (JavaMethod method : adapterCls.getMethods()) { if (!method.isBridge() && method.getName().equals(MARSHAL_METHOD_NAME)) { final JavaClass[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length != 1) diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/SchemaGenerator.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/SchemaGenerator.java index d9128c58aba..78164fedf6b 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/SchemaGenerator.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/SchemaGenerator.java @@ -151,7 +151,7 @@ public void generateSchema(List typeInfoClasses, Map(typeInfo.size()); + this.schemaTypeInfo = new HashMap<>(typeInfo.size()); this.arrayClassesToGeneratedClasses = arrayClassesToGeneratedClasses; //sort input classes before schema name (like schema1.xsd, schema2.xsd....) is generated and assigned @@ -548,8 +548,6 @@ public void addToSchemaType(TypeInfo ownerTypeInfo, java.util.List pro /** * Return the schema type (as QName) based on a given JavaClass. * - * @param javaClass - * @return */ public QName getSchemaTypeFor(JavaClass javaClass) { String className; @@ -566,7 +564,7 @@ public QName getSchemaTypeFor(JavaClass javaClass) { // check user defined types first QName schemaType = userDefinedSchemaTypes.get(className); if (schemaType == null) { - schemaType = (QName) helper.getXMLToJavaTypeMap().get(javaClass.getRawName()); + schemaType = helper.getXMLToJavaTypeMap().get(javaClass.getRawName()); } if (schemaType == null) { TypeInfo targetInfo = this.typeInfo.get(className); @@ -644,8 +642,6 @@ public Property getXmlValueFieldForSimpleContent(TypeInfo info) { /** * Indicates if a given Property is a collection type. * - * @param field - * @return */ public boolean isCollectionType(Property field) { JavaClass type = field.getType(); @@ -662,13 +658,11 @@ private Schema getSchemaForNamespace(String namespace) { * Return the Schema for a given namespace. If no schema exists for the * given namespace, one will be created. * - * @param namespace - * @return */ private Schema getSchemaForNamespace(String namespace, String packageName) { if (schemaForNamespace == null) { - schemaForNamespace = new HashMap(); - allSchemas = new ArrayList(); + schemaForNamespace = new HashMap<>(); + allSchemas = new ArrayList<>(); } Schema schema = schemaForNamespace.get(namespace); if (schema == null && !javax.xml.XMLConstants.XML_NS_URI.equals(namespace)) { @@ -680,9 +674,9 @@ private Schema getSchemaForNamespace(String namespace, String packageName) { if (namespaceInfo.getLocation() != null && !namespaceInfo.getLocation().equals(GENERATE)) { return null; } - java.util.Vector namespaces = namespaceInfo.getNamespaceResolver().getNamespaces(); + java.util.Vector namespaces = namespaceInfo.getNamespaceResolver().getNamespaces(); for (int i = 0; i < namespaces.size(); i++) { - Namespace nextNamespace = (Namespace) namespaces.get(i); + Namespace nextNamespace = namespaces.get(i); schema.getNamespaceResolver().put(nextNamespace.getPrefix(), nextNamespace.getNamespaceURI()); } } @@ -731,7 +725,7 @@ private Schema getSchemaForNamespace(String namespace, String packageName) { public Collection getAllSchemas() { if (allSchemas == null) { - allSchemas = new ArrayList(); + allSchemas = new ArrayList<>(); } return allSchemas; } @@ -767,9 +761,9 @@ public String getPrefixForNamespace(Schema schema, String URI) { addImportIfRequired(schema, referencedSchema, URI); NamespaceResolver namespaceResolver = schema.getNamespaceResolver(); - Enumeration keys = namespaceResolver.getPrefixes(); + Enumeration keys = namespaceResolver.getPrefixes(); while (keys.hasMoreElements()) { - String next = (String) keys.nextElement(); + String next = keys.nextElement(); String nextUri = namespaceResolver.resolveNamespacePrefix(next); if (nextUri.equals(URI)) { return next; @@ -782,9 +776,6 @@ public String getPrefixForNamespace(Schema schema, String URI) { * Attempt to resolve the given URI to a prefix. If this is unsuccessful, one * will be generated and added to the resolver. * - * @param URI - * @param schema - * @return */ public String getOrGeneratePrefixForNamespace(String URI, Schema schema) { String prefix = schema.getNamespaceResolver().resolveNamespaceURI(URI); @@ -828,7 +819,7 @@ public void addGlobalElements(Map additionalElements) JavaClass javaClass = nextElement.getJavaType(); //First check for built in type - QName schemaType = (QName) helper.getXMLToJavaTypeMap().get(javaClass.getRawName()); + QName schemaType = helper.getXMLToJavaTypeMap().get(javaClass.getRawName()); if (schemaType != null) { element.setType(Constants.SCHEMA_PREFIX + COLON + schemaType.getLocalPart()); } else if (areEquals(javaClass, JAVAX_ACTIVATION_DATAHANDLER) || areEquals(javaClass, byte[].class) || areEquals(javaClass, Byte[].class) || areEquals(javaClass, Image.class) || areEquals(javaClass, Source.class) || areEquals(javaClass, JAVAX_MAIL_INTERNET_MIMEMULTIPART)) { @@ -926,16 +917,15 @@ public void addGlobalElements(Map additionalElements) * Return the Map of SchemaTypeInfo instances. The Map is keyed on JavaClass * qualified name. * - * @return */ public Map getSchemaTypeInfo() { return this.schemaTypeInfo; } private boolean importExists(Schema schema, String importNsURI, String schemaLocation) { - java.util.List imports = schema.getImports(); + java.util.List imports = schema.getImports(); for (int i = 0; i < imports.size(); i++) { - Import nextImport = (Import) imports.get(i); + Import nextImport = imports.get(i); if (nextImport.getSchemaLocation() != null && nextImport.getSchemaLocation().equals(schemaLocation)) { if ("".equals(importNsURI)) { if (nextImport.getNamespace() == null) { @@ -1015,9 +1005,6 @@ private boolean addImportIfRequired(Schema sourceSchema, Schema importSchema, St * the raw name of the JavaClass compared to the canonical * name of the Class. * - * @param src - * @param tgtCanonicalName - * @return */ protected boolean areEquals(JavaClass src, String tgtCanonicalName) { if (src == null || tgtCanonicalName == null) { @@ -1031,9 +1018,6 @@ protected boolean areEquals(JavaClass src, String tgtCanonicalName) { * the raw name of the JavaClass compared to the canonical * name of the Class. * - * @param src - * @param tgt - * @return */ protected boolean areEquals(JavaClass src, Class tgt) { if (src == null || tgt == null) { @@ -1045,10 +1029,6 @@ protected boolean areEquals(JavaClass src, Class tgt) { /** * Return the type name for a given Property. * - * @param next - * @param javaType - * @param theSchema - * @return */ private String getTypeName(Property next, JavaClass javaType, Schema theSchema){ QName schemaType = next.getSchemaType(); @@ -1067,9 +1047,6 @@ private String getTypeName(Property next, JavaClass javaType, Schema theSchema){ /** * Return the qualified (if necessary) type name for a given Property. * - * @param prop - * @param schema - * @return */ private String getQualifiedTypeName(Property prop, Schema schema) { JavaClass javaType = prop.getActualType(); @@ -1097,11 +1074,6 @@ private String getQualifiedTypeName(Property prop, Schema schema) { * returning - this is necessary due to the fact that an Any will be added to the sequence * in place of the last path element by the calling method. * - * @param frag - * @param xpr - * @param isChoice - * @param next - * @return */ private AddToSchemaResult buildSchemaComponentsForXPath(XPathFragment frag, AddToSchemaResult xpr, boolean isChoice, Property next) { boolean isAny = next.isAny() || next.isAnyAttribute(); @@ -1195,7 +1167,7 @@ private AddToSchemaResult buildSchemaComponentsForXPath(XPathFragment frag, AddT // if fragSchema is null, just generate the ref if(fragSchema != null) { Attribute globalAttribute = null; - globalAttribute = (Attribute) fragSchema.getTopLevelAttributes().get(frag.getLocalName()); + globalAttribute = fragSchema.getTopLevelAttributes().get(frag.getLocalName()); if (globalAttribute == null) { globalAttribute = createGlobalAttribute(frag, workingSchema, fragSchema, next); } @@ -1233,7 +1205,7 @@ private AddToSchemaResult buildSchemaComponentsForXPath(XPathFragment frag, AddT if ((fragSchema.isElementFormDefault() && !fragUri.equals(targetNS)) || (!fragSchema.isElementFormDefault() && fragUri.length() > 0)) { // must generate a global element and create a reference to it // if the global element exists, use it; otherwise create a new one - globalElement = (Element) fragSchema.getTopLevelElements().get(frag.getLocalName()); + globalElement = fragSchema.getTopLevelElements().get(frag.getLocalName()); if (globalElement == null) { globalElement = createGlobalElement(frag, workingSchema, fragSchema, isChoice, isUnbounded, next, (lastFrag && !isAny)); } @@ -1337,20 +1309,19 @@ private AddToSchemaResult buildSchemaComponentsForXPath(XPathFragment frag, AddT * @param elementName the non-null element name to look for * @param refString if the element is a ref, this will be the prefix qualified element name * @param particle the sequence/choice/all to search for an existing element - * @return */ protected Element elementExistsInParticle(String elementName, String refString, TypeDefParticle particle) { if (particle == null || particle.getElements() == null || particle.getElements().size() == 0) { return null; } - java.util.List existingElements = particle.getElements(); + java.util.List existingElements = particle.getElements(); if (existingElements != null) { - Iterator elementIt = existingElements.iterator(); + Iterator elementIt = existingElements.iterator(); while (elementIt.hasNext()) { Element element; // could be other components in the list, like Any, but we only care about Element try { - element = (Element) elementIt.next(); + element = elementIt.next(); } catch (ClassCastException cce) { continue; } @@ -1383,11 +1354,6 @@ else if (element.getRef() != null && element.getRef().equals(refString)) { * will typically be called when processing an XPath and a prefixed path * element is encountered tha requires an attribute ref. * - * @param frag - * @param workingSchema - * @param fragSchema - * @param prop - * @return */ public Attribute createGlobalAttribute(XPathFragment frag, Schema workingSchema, Schema fragSchema, Property prop) { Attribute gAttribute = new Attribute(); @@ -1410,7 +1376,6 @@ public Attribute createGlobalAttribute(XPathFragment frag, Schema workingSchema, * @param isUnbounded maxOccurs setting for choice * @param prop property which owns the xml-path * @param shouldSetType if this is the last fragment in the xml-path and not an 'any', we should set the type - * @return */ public Element createGlobalElement(XPathFragment frag, Schema workingSchema, Schema fragSchema, boolean isChoice, boolean isUnbounded, Property prop, boolean shouldSetType) { Element gElement = new Element(); @@ -1441,9 +1406,6 @@ public Element createGlobalElement(XPathFragment frag, Schema workingSchema, Sch * method will typically be called when processing an XPath and a * prefixed path element is encountered that requires an element ref. * - * @param elementRefName - * @param particle - * @return */ public Element createRefElement(String elementRefName, TypeDefParticle particle) { Element refElement = new Element(); @@ -1462,9 +1424,6 @@ public Element createRefElement(String elementRefName, TypeDefParticle particle) * and a prefixed path element is encountered that requires an * attribute ref. * - * @param attributeRefName - * @param owningComplexType - * @return */ public Attribute createRefAttribute(String attributeRefName, ComplexType owningComplexType) { Attribute refAttribute = new Attribute(); @@ -1631,7 +1590,6 @@ private AddToSchemaResult addXmlElementWrapperToSchema(Property property, Schema * * @param attributeName name of the Attribute * @param typeName type of the Attribute - * @return */ private Attribute buildAttribute(QName attributeName, String typeName) { Attribute attribute = new Attribute(); @@ -1645,7 +1603,6 @@ private Attribute buildAttribute(QName attributeName, String typeName) { * * @param property the Property used to build the Attribute * @param schema the schema currently being generated - * @return */ private Attribute buildAttribute(Property property, Schema schema) { Attribute attribute = new Attribute(); @@ -2083,7 +2040,6 @@ private void addElementRefToSchema(Schema schema, TypeDefParticle compositor, El * @param elementName name of the Element * @param elementType type of the Element * @param isAll indicates if the Element will be added to an All structure - * @return */ private Element buildElement(String elementName, String elementType, boolean isAll) { Element element = new Element(); @@ -2103,7 +2059,6 @@ private Element buildElement(String elementName, String elementType, boolean isA * @param isAll true if the Element will be added to an All structure * @param schema the schema currently being built * @param typeInfo the TypeInfo that owns the given Property - * @return */ private Element buildElement(Property property, boolean isAll, Schema schema, TypeInfo typeInfo) { Element element = new Element(); @@ -2206,18 +2161,18 @@ private void processFacet(Element element, Facet facet) { * @author Marcel Valovy */ private static final class FacetVisitorHolder { - private static final FacetVisitor VISITOR = new FacetVisitor() { + private static final FacetVisitor VISITOR = new FacetVisitor<>() { @Override public Void visit(DecimalMinFacet t, Restriction restriction) { - if (t.isInclusive()) restriction.setMinInclusive(t.getValue()); - else restriction.setMinExclusive(t.getValue()); + if (t.isInclusive()) restriction.setMinInclusive(t.getValue()); + else restriction.setMinExclusive(t.getValue()); return null; } @Override public Void visit(DecimalMaxFacet t, Restriction restriction) { - if (t.isInclusive()) restriction.setMaxInclusive(t.getValue()); - else restriction.setMaxExclusive(t.getValue()); + if (t.isInclusive()) restriction.setMaxInclusive(t.getValue()); + else restriction.setMaxExclusive(t.getValue()); return null; } @@ -2484,29 +2439,29 @@ private static String introduceShorthands(String regex) { * @see Special shorthands in XML Schema. */ private static final class RegexMutator { - private static final Map shorthandReplacements = new LinkedHashMap(32) {{ - put(Pattern.compile("[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]" , Pattern.LITERAL),"\\\\i"); - put(Pattern.compile("[^:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]" , Pattern.LITERAL),"\\\\I"); - put(Pattern.compile("[-.0-9:A-Z_a-z\\u00B7\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]" , Pattern.LITERAL),"\\\\c"); - put(Pattern.compile("[^-.0-9:A-Z_a-z\\u00B7\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]" , Pattern.LITERAL),"\\\\C"); - put(Pattern.compile("[\\u0009-\\u000D\\u0020\\u0085\\u00A0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]" , Pattern.LITERAL),"\\\\s"); - put(Pattern.compile("[^\\u0009-\\u000D\\u0020\\u0085\\u00A0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]" , Pattern.LITERAL),"\\\\S"); - put(Pattern.compile("[\\u000A-\\u000D\\u0085\\u2028\\u2029]" , Pattern.LITERAL),"\\\\v"); - put(Pattern.compile("[^\\u000A-\\u000D\\u0085\\u2028\\u2029]" , Pattern.LITERAL),"\\\\V"); - put(Pattern.compile("[\\u0009\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]" , Pattern.LITERAL),"\\\\h"); - put(Pattern.compile("[^\\u0009\\u0020\\u00A0\\u1680\\u180E\\u2000\\u2001-\\u200A\\u202F\\u205F\\u3000]" , Pattern.LITERAL),"\\\\H"); - put(Pattern.compile("[\\pL\\pM\\p{Nd}\\p{Nl}\\p{Pc}[\\p{InEnclosedAlphanumerics}&&\\p{So}]]" , Pattern.LITERAL),"\\\\w"); - put(Pattern.compile("[^\\pL\\pM\\p{Nd}\\p{Nl}\\p{Pc}[\\p{InEnclosedAlphanumerics}&&\\p{So}]]" , Pattern.LITERAL),"\\\\W"); - put(Pattern.compile("(?:(?<=[\\pL\\pM\\p{Nd}\\p{Nl}\\p{Pc}[\\p{InEnclosedAlphanumerics}&&\\p{So}]])(?![\\pL\\pM\\p{Nd}\\p{Nl}\\p{Pc}[\\p{InEnclosedAlphanumerics}&&\\p{So}]])|(?\\u000D\\u000A)|[\\u000A\\u000B\\u000C\\u000D\\u0085\\u2028\\u2029])" , Pattern.LITERAL),"\\\\R"); - put(Pattern.compile("(?:(?:\\u000D\\u000A)|(?:[\\u0E40\\u0E41\\u0E42\\u0E43\\u0E44\\u0EC0\\u0EC1\\u0EC2\\u0EC3\\u0EC4\\uAAB5\\uAAB6\\uAAB9\\uAABB\\uAABC]*(?:[\\u1100-\\u115F\\uA960-\\uA97C]+|([\\u1100-\\u115F\\uA960-\\uA97C]*((?:[[\\u1160-\\u11A2\\uD7B0-\\uD7C6][\\uAC00\\uAC1C\\uAC38]][\\u1160-\\u11A2\\uD7B0-\\uD7C6]*|[\\uAC01\\uAC02\\uAC03\\uAC04])[\\u11A8-\\u11F9\\uD7CB-\\uD7FB]*))|[\\u11A8-\\u11F9\\uD7CB-\\uD7FB]+|[^[\\p{Zl}\\p{Zp}\\p{Cc}\\p{Cf}&&[^\\u000D\\u000A\\u200C\\u200D]]\\u000D\\u000A])[[\\p{Mn}\\p{Me}\\u200C\\u200D\\u0488\\u0489\\u20DD\\u20DE\\u20DF\\u20E0\\u20E2\\u20E3\\u20E4\\uA670\\uA671\\uA672\\uFF9E\\uFF9F][\\p{Mc}\\u0E30\\u0E32\\u0E33\\u0E45\\u0EB0\\u0EB2\\u0EB3]]*)|(?s:.))" , Pattern.LITERAL),"\\\\X"); - put(Pattern.compile("[_:A-Za-z]" , Pattern.LITERAL),"\\\\i"); // ascii only - put(Pattern.compile("[^:A-Z_a-z]" , Pattern.LITERAL),"\\\\I"); // ascii only - put(Pattern.compile("[-.0-9:A-Z_a-z]" , Pattern.LITERAL),"\\\\c"); // ascii only - put(Pattern.compile("[^-.0-9:A-Z_a-z]" , Pattern.LITERAL),"\\\\C"); // ascii only + private static final Map shorthandReplacements = new LinkedHashMap<>(32) {{ + put(Pattern.compile("[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]", Pattern.LITERAL), "\\\\i"); + put(Pattern.compile("[^:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]", Pattern.LITERAL), "\\\\I"); + put(Pattern.compile("[-.0-9:A-Z_a-z\\u00B7\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]", Pattern.LITERAL), "\\\\c"); + put(Pattern.compile("[^-.0-9:A-Z_a-z\\u00B7\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]", Pattern.LITERAL), "\\\\C"); + put(Pattern.compile("[\\u0009-\\u000D\\u0020\\u0085\\u00A0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]", Pattern.LITERAL), "\\\\s"); + put(Pattern.compile("[^\\u0009-\\u000D\\u0020\\u0085\\u00A0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]", Pattern.LITERAL), "\\\\S"); + put(Pattern.compile("[\\u000A-\\u000D\\u0085\\u2028\\u2029]", Pattern.LITERAL), "\\\\v"); + put(Pattern.compile("[^\\u000A-\\u000D\\u0085\\u2028\\u2029]", Pattern.LITERAL), "\\\\V"); + put(Pattern.compile("[\\u0009\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]", Pattern.LITERAL), "\\\\h"); + put(Pattern.compile("[^\\u0009\\u0020\\u00A0\\u1680\\u180E\\u2000\\u2001-\\u200A\\u202F\\u205F\\u3000]", Pattern.LITERAL), "\\\\H"); + put(Pattern.compile("[\\pL\\pM\\p{Nd}\\p{Nl}\\p{Pc}[\\p{InEnclosedAlphanumerics}&&\\p{So}]]", Pattern.LITERAL), "\\\\w"); + put(Pattern.compile("[^\\pL\\pM\\p{Nd}\\p{Nl}\\p{Pc}[\\p{InEnclosedAlphanumerics}&&\\p{So}]]", Pattern.LITERAL), "\\\\W"); + put(Pattern.compile("(?:(?<=[\\pL\\pM\\p{Nd}\\p{Nl}\\p{Pc}[\\p{InEnclosedAlphanumerics}&&\\p{So}]])(?![\\pL\\pM\\p{Nd}\\p{Nl}\\p{Pc}[\\p{InEnclosedAlphanumerics}&&\\p{So}]])|(?\\u000D\\u000A)|[\\u000A\\u000B\\u000C\\u000D\\u0085\\u2028\\u2029])", Pattern.LITERAL), "\\\\R"); + put(Pattern.compile("(?:(?:\\u000D\\u000A)|(?:[\\u0E40\\u0E41\\u0E42\\u0E43\\u0E44\\u0EC0\\u0EC1\\u0EC2\\u0EC3\\u0EC4\\uAAB5\\uAAB6\\uAAB9\\uAABB\\uAABC]*(?:[\\u1100-\\u115F\\uA960-\\uA97C]+|([\\u1100-\\u115F\\uA960-\\uA97C]*((?:[[\\u1160-\\u11A2\\uD7B0-\\uD7C6][\\uAC00\\uAC1C\\uAC38]][\\u1160-\\u11A2\\uD7B0-\\uD7C6]*|[\\uAC01\\uAC02\\uAC03\\uAC04])[\\u11A8-\\u11F9\\uD7CB-\\uD7FB]*))|[\\u11A8-\\u11F9\\uD7CB-\\uD7FB]+|[^[\\p{Zl}\\p{Zp}\\p{Cc}\\p{Cf}&&[^\\u000D\\u000A\\u200C\\u200D]]\\u000D\\u000A])[[\\p{Mn}\\p{Me}\\u200C\\u200D\\u0488\\u0489\\u20DD\\u20DE\\u20DF\\u20E0\\u20E2\\u20E3\\u20E4\\uA670\\uA671\\uA672\\uFF9E\\uFF9F][\\p{Mc}\\u0E30\\u0E32\\u0E33\\u0E45\\u0EB0\\u0EB2\\u0EB3]]*)|(?s:.))", Pattern.LITERAL), "\\\\X"); + put(Pattern.compile("[_:A-Za-z]", Pattern.LITERAL), "\\\\i"); // ascii only + put(Pattern.compile("[^:A-Z_a-z]", Pattern.LITERAL), "\\\\I"); // ascii only + put(Pattern.compile("[-.0-9:A-Z_a-z]", Pattern.LITERAL), "\\\\c"); // ascii only + put(Pattern.compile("[^-.0-9:A-Z_a-z]", Pattern.LITERAL), "\\\\C"); // ascii only }}; private RegexMutator() { diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/TypeInfo.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/TypeInfo.java index b2d11a3dbb8..3a36a9095f3 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/TypeInfo.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/TypeInfo.java @@ -137,7 +137,6 @@ public class TypeInfo { * This constructor sets the Helper to be used throughout XML and Annotations * processing. Other fields are initialized here as well. * - * @param helper */ public TypeInfo(Helper helper, JavaClass javaClass) { propertyNames = new ArrayList(); @@ -164,7 +163,6 @@ public Descriptor getDescriptor() { /** * Set the XmlDescriptor on this TypeInfo. * - * @param desc */ public void setDescriptor(Descriptor desc) { descriptor = desc; @@ -257,7 +255,6 @@ public ArrayList getPropertyNames() { * Return the TypeProperty 'idProperty'. This method will typically be used in conjunction with * isIDSet method to determine if an @XmlID exists, and hence 'idProperty' is non-null. * - * @return */ public Property getIDProperty() { return idProperty; @@ -266,7 +263,6 @@ public Property getIDProperty() { /** * Return the Map of Properties for this TypeInfo. * - * @return */ public HashMap getProperties() { return properties; @@ -333,7 +329,6 @@ public void setIDProperty(Property idProperty) { /** * Set the Map of Properties for this TypeInfo. * - * @param properties */ public void setProperties(ArrayList properties) { if (properties != null) { @@ -373,7 +368,6 @@ public boolean isEnumerationType() { * Indicates if an @XmlID is set on a field/property. If so, the TypeProperty 'idProperty' will * be non-null. * - * @return */ public boolean isIDSet() { return idProperty != null; @@ -402,8 +396,6 @@ public Schema getSchema() { /** * Return the xmladapter class for a given bound type class. * - * @param boundType - * @return */ public JavaClass getPackageLevelAdapterClass(JavaClass boundType) { if(hasPackageLevelAdaptersByClass()) { @@ -419,8 +411,6 @@ public boolean isAnonymousComplexType() { /** * Return the xmladapter class for a given bound type class name. * - * @param boundTypeName - * @return */ public JavaClass getPackageLevelAdapterClass(String boundTypeName) { if(hasPackageLevelAdaptersByClass()) { @@ -432,7 +422,6 @@ public JavaClass getPackageLevelAdapterClass(String boundTypeName) { /** * Return the Map of XmlAdapters for this TypeInfo. * - * @return */ public HashMap getPackageLevelAdaptersByClass() { if(!hasPackageLevelAdaptersByClass()) { @@ -448,8 +437,6 @@ boolean hasPackageLevelAdaptersByClass() { /** * Put a bound type class to adapter class entry in the Map. * - * @param adapterClass - * @param boundType */ public void addPackageLevelAdapterClass(JavaClass adapterClass, JavaClass boundType) { getPackageLevelAdaptersByClass().put(boundType.getQualifiedName(), adapterClass); @@ -462,7 +449,6 @@ public boolean hasRootElement() { /** * Indicates if this TypeInfo contains an XmlElementRefs property. * - * @return */ public boolean hasElementRefs() { return elementRefsPropertyName != null; @@ -471,7 +457,6 @@ public boolean hasElementRefs() { /** * Return the XmlElementRefs property name, if one has been set. * - * @return */ public String getElementRefsPropName() { return elementRefsPropertyName; @@ -512,7 +497,6 @@ public void setFactoryMethodParamTypes(String[] paramTypes) { * Indicates if an xmlValueProperty is set on this TypeInfo, i.e. * is non-null. * - * @return */ public boolean isSetXmlValueProperty() { return xmlValueProperty != null; @@ -529,7 +513,6 @@ public void setXmlValueProperty(Property xmlValueProperty) { /** * Indicates if the class represented by this TypeInfo is marked XmlTransient. * - * @return */ public boolean isTransient() { return isTransient; @@ -546,7 +529,6 @@ public void setTransient(boolean isTransient) { /** * Return all non-transient properties that exist in the propOrder array. * - * @return */ public List getNonTransientPropertiesInPropOrder() { List propertiesInOrder = new ArrayList(); @@ -603,7 +585,6 @@ private void addPropertyToList(List propertiesInOrder, String property /** * Indicates if XmlTransient is set. * - * @return */ public boolean isSetXmlTransient() { return isSetXmlTransient; @@ -612,7 +593,6 @@ public boolean isSetXmlTransient() { /** * Set the XmlTransient for this TypeInfo. * - * @param isTransient */ public void setXmlTransient(boolean isTransient) { isSetXmlTransient = true; @@ -622,7 +602,6 @@ public void setXmlTransient(boolean isTransient) { /** * Indicates if XmlElementNillable is set. * - * @return */ public boolean isXmlElementNillable() { return isXmlElementNillable; @@ -631,7 +610,6 @@ public boolean isXmlElementNillable() { /** * Set the XmlElementNillable for this TypeInfo. * - * @param isXmlElementNillable */ public void setXmlElementNillable(boolean isXmlElementNillable) { this.isXmlElementNillable = isXmlElementNillable; @@ -649,7 +627,6 @@ public XmlNullPolicy getXmlNullPolicy() { /** * Set the XmlNullPolicy for this TypeInfo. * - * @param xmlNullPolicy */ public void setXmlNullPolicy(XmlNullPolicy xmlNullPolicy) { this.xmlNullPolicy = xmlNullPolicy; @@ -667,7 +644,6 @@ public boolean isSetXmlSeeAlso() { /** * Return the List of XmlSeeAlso class names for this TypeInfo. * - * @return */ public List getXmlSeeAlso() { return xmlSeeAlso; @@ -676,7 +652,6 @@ public List getXmlSeeAlso() { /** * Set the List of XmlSeeAlso class names for this TypeInfo. * - * @param xmlSeeAlso */ public void setXmlSeeAlso(List xmlSeeAlso) { this.xmlSeeAlso = xmlSeeAlso; @@ -694,7 +669,6 @@ public boolean isSetXmlRootElement() { /** * Return the xmlRootElement set on this TypeInfo. * - * @return */ public XmlRootElement getXmlRootElement() { return xmlRootElement; @@ -703,7 +677,6 @@ public XmlRootElement getXmlRootElement() { /** * Set the xmlRootElement for this TypeInfo. * - * @param xmlRootElement */ public void setXmlRootElement(XmlRootElement xmlRootElement) { this.xmlRootElement = xmlRootElement; @@ -721,7 +694,6 @@ public boolean isSetXmlType() { /** * Return the xmlType set on this TypeInfo. * - * @return */ public XmlType getXmlType() { return xmlType; @@ -730,7 +702,6 @@ public XmlType getXmlType() { /** * Set the xmlType for this TypeInfo. * - * @param xmlType */ public void setXmlType(XmlType xmlType) { this.xmlType = xmlType; @@ -748,7 +719,6 @@ public boolean isSetXmlAccessType() { /** * Return the xmlAccessType for this TypeInfo. * - * @return */ public XmlAccessType getXmlAccessType() { return xmlAccessType; @@ -757,7 +727,6 @@ public XmlAccessType getXmlAccessType() { /** * Set the xmlAccessType for this TypeInfo. * - * @param xmlAccessType */ public void setXmlAccessType(XmlAccessType xmlAccessType) { this.xmlAccessType = xmlAccessType; @@ -775,7 +744,6 @@ public boolean isSetXmlAccessOrder() { /** * Return the xmlAccessOrder for this TypeInfo. * - * @return */ public XmlAccessOrder getXmlAccessOrder() { return xmlAccessOrder; @@ -784,7 +752,6 @@ public XmlAccessOrder getXmlAccessOrder() { /** * Set the xmlAccessOrder for this TypeInfo. * - * @param xmlAccessOrder */ public void setXmlAccessOrder(XmlAccessOrder xmlAccessOrder) { this.xmlAccessOrder = xmlAccessOrder; @@ -854,7 +821,6 @@ public XmlJavaTypeAdapter getXmlJavaTypeAdapter() { /** * Set an XmlJavaTypeAdapter on this Type. * - * @param xmlJavaTypeAdapter * @see XmlJavaTypeAdapter */ public void setXmlJavaTypeAdapter(XmlJavaTypeAdapter xmlJavaTypeAdapter) { @@ -875,7 +841,6 @@ public String getXmlCustomizer() { /** * Sets the XmlCustomizer class name on this TypeInfo. * - * @param xmlCustomizerClassName * @see DescriptorCustomizer */ public void setXmlCustomizer(String xmlCustomizerClassName) { @@ -885,7 +850,6 @@ public void setXmlCustomizer(String xmlCustomizerClassName) { /** * Indicates if the name of the XmlAnyElement property has been set. * - * @return */ public boolean isSetAnyElementPropertyName() { return getAnyElementPropertyName() != null; @@ -894,7 +858,6 @@ public boolean isSetAnyElementPropertyName() { /** * Return the name of the XmlAnyElement property, if one is set. * - * @return */ public String getAnyElementPropertyName() { return anyElementPropertyName; @@ -903,7 +866,6 @@ public String getAnyElementPropertyName() { /** * Set the name of the XmlAnyElement property * - * @param anyElementPropertyName */ public void setAnyElementPropertyName(String anyElementPropertyName) { this.anyElementPropertyName = anyElementPropertyName; @@ -912,7 +874,6 @@ public void setAnyElementPropertyName(String anyElementPropertyName) { /** * Indicates if the name of the XmlAnyAttribute property has been set. * - * @return */ public boolean isSetAnyAttributePropertyName() { return getAnyAttributePropertyName() != null; @@ -921,7 +882,6 @@ public boolean isSetAnyAttributePropertyName() { /** * Return the name of the XmlAnyAttribute property, if one is set. * - * @return */ public String getAnyAttributePropertyName() { return anyAttributePropertyName; @@ -930,7 +890,6 @@ public String getAnyAttributePropertyName() { /** * Set the name of the XmlAnyAttribute property * - * @param anyAttributePropertyName */ public void setAnyAttributePropertyName(String anyAttributePropertyName) { this.anyAttributePropertyName = anyAttributePropertyName; @@ -939,7 +898,6 @@ public void setAnyAttributePropertyName(String anyAttributePropertyName) { /** * Indicates if all binary data types are to be inlined for this class. * - * @return */ public boolean isBinaryDataToBeInlined() { return isBinaryDataInlined; @@ -949,7 +907,6 @@ public boolean isBinaryDataToBeInlined() { * Sets the flag that indicates if all binary data types are to * be inlined for this class. * - * @param isBinaryDataInlined */ public void setInlineBinaryData(boolean isBinaryDataInlined) { this.isBinaryDataInlined = isBinaryDataInlined; @@ -977,7 +934,6 @@ public String getClassExtractorName() { /** * Set the ClassExtractor class name. * - * @param classExtractorName */ public void setClassExtractorName(String classExtractorName) { this.classExtractorName = classExtractorName; @@ -986,7 +942,6 @@ public void setClassExtractorName(String classExtractorName) { /** * Return the Map of user-defined properties. * - * @return */ public Map getUserProperties() { return userProperties; @@ -995,7 +950,6 @@ public Map getUserProperties() { /** * Set the Map of user-defined properties. * - * @param userProperties */ public void setUserProperties(Map userProperties) { this.userProperties = userProperties; @@ -1004,7 +958,6 @@ public void setUserProperties(Map userProperties) { /** * Return the JavaClass name for this typeinfo. * - * @return */ public String getJavaClassName() { return javaClassName; @@ -1013,7 +966,6 @@ public String getJavaClassName() { /** * Set the JavaClass name for this typeinfo. * - * @param javaClassName */ public void setJavaClassName(String javaClassName) { this.javaClassName = javaClassName; @@ -1022,7 +974,6 @@ public void setJavaClassName(String javaClassName) { /** * Return the class indicator field name for this type info. * - * @return */ public String getXmlDiscriminatorNode() { return xmlDiscriminatorNode; @@ -1031,7 +982,6 @@ public String getXmlDiscriminatorNode() { /** * Sets the class indicator field name (for use with inheritance). * - * @param xmlDiscriminatorNode */ public void setXmlDiscriminatorNode(String xmlDiscriminatorNode) { this.xmlDiscriminatorNode = xmlDiscriminatorNode; @@ -1050,7 +1000,6 @@ public boolean isSetXmlDiscriminatorNode() { * Return the value of the class indicator field for the java-type * associated with this type info. * - * @return */ public String getXmlDiscriminatorValue() { return xmlDiscriminatorValue; @@ -1060,7 +1009,6 @@ public String getXmlDiscriminatorValue() { * Set the value of the class indicator field for the java-type * associated with this type info. * - * @param xmlDiscriminatorValue */ public void setXmlDiscriminatorValue(String xmlDiscriminatorValue) { this.xmlDiscriminatorValue = xmlDiscriminatorValue; @@ -1080,7 +1028,6 @@ public boolean isSetXmlDiscriminatorValue() { * Add an XmlKey property to the list. Each entry will be * set as a primary key on the owning descriptor. * - * @param xmlKeyProp */ public void addXmlKeyProperty(Property xmlKeyProp) { if (xmlKeyProperties == null) { @@ -1093,7 +1040,6 @@ public void addXmlKeyProperty(Property xmlKeyProp) { * Return the list of XmlKey property entries. Each entry * will be set as a primary key on the owning descriptor. * - * @return */ public List getXmlKeyProperties() { return xmlKeyProperties; @@ -1103,7 +1049,6 @@ public List getXmlKeyProperties() { * Indicates if the list of XmlKey property entries has * been set, i.e. is non-null. * - * @return */ public boolean hasXmlKeyProperties() { return xmlKeyProperties != null; @@ -1131,7 +1076,6 @@ boolean hasAdditionalProperties() { * properties were created during annotations processing, and have * not been modified since. * - * @return */ public HashMap getOriginalProperties() { return originalProperties; @@ -1148,7 +1092,6 @@ public void setXmlVirtualAccessMethods(XmlVirtualAccessMethods xmlExtensible) { /** * Return the XMLNameTransformer used when converting Java names to XML names - * @return */ public XMLNameTransformer getXmlNameTransformer() { return xmlNameTransformer; @@ -1156,7 +1099,6 @@ public XMLNameTransformer getXmlNameTransformer() { /** * Set the XMLNameTransformer used when converting Java names to XML names - * @param xmlNameTransformer */ public void setXmlNameTransformer(XMLNameTransformer xmlNameTransformer) { this.xmlNameTransformer = xmlNameTransformer; @@ -1166,7 +1108,6 @@ public void setXmlNameTransformer(XMLNameTransformer xmlNameTransformer) { /** * INTERNAL: * Return the list of predicate properties. Lazy initializes the list. - * @return */ public List getPredicateProperties() { if(predicateProperties == null) { @@ -1193,7 +1134,6 @@ public boolean hasPredicateProperty(Property property) { /** * INTERNAL: * Return true if the list of predicate properties hasn't been initialized. - * @return */ public boolean hasPredicateProperties() { return this.predicateProperties != null && this.predicateProperties.size() > 0; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/UnmarshalCallback.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/UnmarshalCallback.java index 89ee438b407..ab5f573100b 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/UnmarshalCallback.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/UnmarshalCallback.java @@ -62,7 +62,6 @@ public Class getDomainClass() { } /** - * @param loader */ public void initialize(ClassLoader loader) { try { @@ -148,7 +147,6 @@ public void setHasBeforeUnmarshalCallback() { * Should use setDomainClassName - the init method will overwrite * the set value with Class.forName(domainClassName) * - * @param clazz */ public void setDomainClass(Class clazz) { domainClass = clazz; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/XMLProcessor.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/XMLProcessor.java index 55ddd682847..cb52583cecb 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/XMLProcessor.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/XMLProcessor.java @@ -115,7 +115,6 @@ public class XMLProcessor { /** * This is the preferred constructor. * - * @param bindings */ public XMLProcessor(Map bindings) { this.xmlBindingMap = bindings; @@ -125,7 +124,6 @@ public XMLProcessor(Map bindings) { * Process XmlBindings on a per package basis for a given * AnnotationsProcessor instance. * - * @param annotationsProcessor */ public void processXML(AnnotationsProcessor annotationsProcessor, JavaModelInput jModelInput, TypeMappingInfo[] typeMappingInfos, JavaClass[] originalJavaClasses) { this.jModelInput = jModelInput; @@ -495,9 +493,6 @@ private XMLNameTransformer getXMLNameTransformerClassFromString(String transform /** * Process a given JavaType's attributes. * - * @param javaType - * @param typeInfo - * @param nsInfo */ private void processJavaType(JavaType javaType, TypeInfo typeInfo, NamespaceInfo nsInfo) { // process field/property overrides @@ -675,10 +670,6 @@ private Property createProperty(TypeInfo info, JavaAttribute javaAttribute) { /** * Process a given JavaAtribute. * - * @param javaAttribute - * @param oldProperty - * @param nsInfo - * @return */ private Property processJavaAttribute(TypeInfo typeInfo, JavaAttribute javaAttribute, Property oldProperty, NamespaceInfo nsInfo, JavaType javaType) { if (javaAttribute instanceof XmlVariableNode) { @@ -730,9 +721,6 @@ private Property processJavaAttribute(TypeInfo typeInfo, JavaAttribute javaAttri /** * Handle property-level XmlJavaTypeAdapter * - * @param xmlAdapter - * @param oldProperty - * @return */ private Property processXmlJavaTypeAdapter(XmlJavaTypeAdapter xmlAdapter, Property oldProperty) { oldProperty.setXmlJavaTypeAdapter(xmlAdapter); @@ -742,9 +730,6 @@ private Property processXmlJavaTypeAdapter(XmlJavaTypeAdapter xmlAdapter, Proper /** * Handle xml-inverse-reference. * - * @param xmlInverseReference - * @param oldProperty - * @return */ private Property processXmlInverseReference(XmlInverseReference xmlInverseReference, Property oldProperty, TypeInfo info) { resetProperty(oldProperty, info); @@ -782,11 +767,6 @@ private Property processXmlInverseReference(XmlInverseReference xmlInverseRefere /** * Handle xml-any-attribute. * - * @param xmlAnyAttribute - * @param oldProperty - * @param tInfo - * @param javaType - * @return */ private Property processXmlAnyAttribute(XmlAnyAttribute xmlAnyAttribute, Property oldProperty, TypeInfo tInfo, JavaType javaType) { // if oldProperty is already an Any (via @XmlAnyAttribute annotation) @@ -876,11 +856,6 @@ private Property processXmlVariableNodeAttribute(XmlVariableNode xmlVariableNode * Handle xml-any-element. If the property was annotated with @XmlAnyElement * in code all values will be overridden. * - * @param xmlAnyElement - * @param oldProperty - * @param tInfo - * @param javaType - * @return */ private Property processXmlAnyElement(XmlAnyElement xmlAnyElement, Property oldProperty, TypeInfo tInfo, JavaType javaType) { @@ -947,10 +922,6 @@ private Property processXmlAnyElement(XmlAnyElement xmlAnyElement, Property oldP /** * XmlAttribute override will completely replace the existing values. * - * @param xmlAttribute - * @param oldProperty - * @param nsInfo - * @return */ private Property processXmlAttribute(XmlAttribute xmlAttribute, Property oldProperty, TypeInfo typeInfo, NamespaceInfo nsInfo, JavaType javaType) { // reset any existing values @@ -1099,11 +1070,6 @@ private Property processXmlAttribute(XmlAttribute xmlAttribute, Property oldProp /** * XmlElement override will completely replace the existing values. * - * @param xmlElement - * @param oldProperty - * @param typeInfo - * @param nsInfo - * @return */ private Property processXmlElement(XmlElement xmlElement, Property oldProperty, TypeInfo typeInfo, NamespaceInfo nsInfo, JavaType javaType) { // reset any existing values @@ -1335,10 +1301,6 @@ private Property processXmlMap(XmlMap xmlMap, Property oldProperty) { * The XmlElements object will be set on the property, and it will be * flagged as a 'choice'. * - * @param xmlElements - * @param oldProperty - * @param tInfo - * @return */ private Property processXmlElements(XmlElements xmlElements, Property oldProperty, TypeInfo tInfo) { resetProperty(oldProperty, tInfo); @@ -1392,10 +1354,6 @@ private Property processXmlElements(XmlElements xmlElements, Property oldPropert /** * Process an xml-element-ref. * - * @param xmlElementRef - * @param oldProperty - * @param info - * @return */ private Property processXmlElementRef(XmlElementRef xmlElementRef, Property oldProperty, TypeInfo info) { processObjectFactory(info); @@ -1447,10 +1405,6 @@ private Property processXmlElementRef(XmlElementRef xmlElementRef, Property oldP /** * Process an xml-element-refs. * - * @param xmlElementRefs - * @param oldProperty - * @param info - * @return */ private Property processXmlElementRefs(XmlElementRefs xmlElementRefs, Property oldProperty, TypeInfo info) { processObjectFactory(info); @@ -1581,8 +1535,6 @@ private Property processXmlValue(XmlValue xmlValue, Property oldProperty, TypeIn * Process an XmlSchema. This involves creating a NamespaceInfo instance and * populating it based on the given XmlSchema. * - * @param xmlBindings - * @param packageName * @see NamespaceInfo * @see AnnotationsProcessor * @return newly created namespace info, or null if schema is null @@ -1628,9 +1580,6 @@ private NamespaceInfo processXmlSchema(XmlBindings xmlBindings, String packageNa * Process an XmlTransformation. The info in the XmlTransformation will be * used to generate an XmlTransformationMapping in MappingsGenerator. * - * @param xmlTransformation - * @param oldProperty - * @param tInfo */ private Property processXmlTransformation(XmlTransformation xmlTransformation, Property oldProperty, TypeInfo tInfo) { // reset any existing values @@ -1657,9 +1606,6 @@ private Property processXmlTransformation(XmlTransformation xmlTransformation, P * Process XmlJoinNodes. This method sets the XmlJoinNodes instance on the Property * for use in MappingsGen and SchemaGen. * - * @param xmlJoinNodes - * @param oldProperty - * @return */ private Property processXmlJoinNodes(XmlJoinNodes xmlJoinNodes, Property oldProperty, TypeInfo typeInfo) { // reset any existing values @@ -1691,7 +1637,6 @@ private Property processXmlJoinNodes(XmlJoinNodes xmlJoinNodes, Property oldProp /** * Convenience method for building a Map of package to classes. * - * @return */ private Map> buildPackageToJavaClassMap() { Map> theMap = new HashMap>(); @@ -1759,7 +1704,6 @@ private void addClassToList(List classes, String name, String packageName){ /** * Lazy load the metadata logger. * - * @return */ private JAXBMetadataLogger getLogger() { if (logger == null) { @@ -1780,8 +1724,6 @@ public boolean classExistsInArray(JavaClass theClass, ArrayList exist * Convenience method for resetting a number of properties on a given * property. * - * @param oldProperty - * @return */ private Property resetProperty(Property oldProperty, TypeInfo tInfo) { oldProperty.setIsAttribute(false); @@ -1834,8 +1776,6 @@ private Property resetProperty(Property oldProperty, TypeInfo tInfo) { /** * Ensure that a given property is not set as an xml-id. * - * @param oldProperty - * @param tInfo */ private void unsetXmlID(Property oldProperty, TypeInfo tInfo) { oldProperty.setIsXmlId(false); @@ -1848,8 +1788,6 @@ private void unsetXmlID(Property oldProperty, TypeInfo tInfo) { /** * Ensure that a given property is not set as an xml-key. * - * @param oldProperty - * @param tInfo */ private void unsetXmlKey(Property oldProperty, TypeInfo tInfo) { if (tInfo.hasXmlKeyProperties()) { @@ -1868,8 +1806,6 @@ private void unsetXmlKey(Property oldProperty, TypeInfo tInfo) { /** * Ensure that a given property is not set as an xml-element-refs. * - * @param oldProperty - * @param tInfo */ private void unsetXmlElementRefs(Property oldProperty, TypeInfo tInfo) { if (tInfo.hasElementRefs() && tInfo.getElementRefsPropName().equals(oldProperty.getPropertyName())) { @@ -1880,7 +1816,6 @@ private void unsetXmlElementRefs(Property oldProperty, TypeInfo tInfo) { /** * Ensure that a given property is not set as an xml-elements. * - * @param oldProperty */ private void unsetXmlElements(Property oldProperty) { oldProperty.setXmlElements(null); @@ -1890,8 +1825,6 @@ private void unsetXmlElements(Property oldProperty) { /** * Ensure that a given property is not set as an xml-any-attribute. * - * @param oldProperty - * @param tInfo */ private void unsetXmlAnyAttribute(Property oldProperty, TypeInfo tInfo) { oldProperty.setIsAnyAttribute(false); @@ -1903,8 +1836,6 @@ private void unsetXmlAnyAttribute(Property oldProperty, TypeInfo tInfo) { /** * Ensure that a given property is not set as an xml-any-element. * - * @param oldProperty - * @param tInfo */ private void unsetXmlAnyElement(Property oldProperty, TypeInfo tInfo) { oldProperty.setIsAny(false); @@ -1916,8 +1847,6 @@ private void unsetXmlAnyElement(Property oldProperty, TypeInfo tInfo) { /** * Ensure that a given property is not set as an xml-value. * - * @param oldProperty - * @param tInfo */ private void unsetXmlValue(Property oldProperty, TypeInfo tInfo) { oldProperty.setIsXmlValue(false); @@ -1939,10 +1868,6 @@ private void unsetXmlValue(Property oldProperty, TypeInfo tInfo) { * - returns 'project' for xml-path 'projects/prj:project/text()' * - returns 'data' for xml-path 'pieces-of-data/data[1]/text()' * - * @param xpath - * @param propertyName - * @param isAttribute - * @return */ public static String getNameFromXPath(String xpath, String propertyName, boolean isAttribute) { // handle self mapping @@ -2008,8 +1933,6 @@ private void processObjectFactory(TypeInfo tInfo){ * other simple type that was converted by ConversionManager, * i.e. numerical, boolean, temporal. * - * @param propList - * @return */ private Map createUserPropertyMap(List propList) { return mergeUserPropertyMap(propList, new HashMap()); @@ -2028,8 +1951,6 @@ private Map createUserPropertyMap(List propList) { * String or some other simple type that was converted by * ConversionManager, i.e. numerical, boolean, temporal. * - * @param propList - * @return */ private Map mergeUserPropertyMap(List propList, Map existingMap) { Map propMap = existingMap; @@ -2050,8 +1971,6 @@ private Map mergeUserPropertyMap(List propList, Map existingMap) { * doing so, so the original generic type will be retrieved and set after * the call to set the container type. * - * @param property - * @param containerClassName */ private void setContainerType(Property property, String containerClassName) { // store the original generic type as the call to setType will overwrite it diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/Helper.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/Helper.java index da705a622e5..b9186fddb0b 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/Helper.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/Helper.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 @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.eclipse.persistence.internal.core.helper.CoreClassConstants; @@ -29,6 +30,8 @@ import org.eclipse.persistence.internal.oxm.Constants; +import javax.xml.namespace.QName; + /** * INTERNAL: *

Purpose:To provide helper methods and constants to assist @@ -53,7 +56,7 @@ public class Helper { protected ClassLoader loader; protected JavaModel jModel; - private HashMap xmlToJavaTypeMap; + private Map xmlToJavaTypeMap; private boolean facets; public final static String APBYTE = "byte[]"; @@ -113,7 +116,6 @@ public class Helper { * This constructor builds the map of XML-Java type pairs, * and sets the JavaModel and ClassLoader. * - * @param model */ public Helper(JavaModel model) { xmlToJavaTypeMap = buildXMLToJavaTypeMap(); @@ -130,10 +132,9 @@ public Helper(JavaModel model) { /** * Builds a map of Java types to XML types. * - * @return */ - private HashMap buildXMLToJavaTypeMap() { - HashMap javaTypes = new HashMap(); + private Map buildXMLToJavaTypeMap() { + Map javaTypes = new HashMap<>(); // jaxb 2.0 spec pairs javaTypes.put(APBYTE, Constants.BASE_64_BINARY_QNAME); javaTypes.put(BIGDECIMAL, Constants.DECIMAL_QNAME); @@ -176,17 +177,15 @@ private HashMap buildXMLToJavaTypeMap() { /** * Return a given method's generic return type as a JavaClass. * - * @param meth - * @return */ public JavaClass getGenericReturnType(JavaMethod meth) { JavaClass result = meth.getReturnType(); JavaClass jClass = null; if (result == null) { return null; } - Collection args = result.getActualTypeArguments(); + Collection args = result.getActualTypeArguments(); if (args.size() >0) { - jClass = (JavaClass) args.iterator().next(); + jClass = args.iterator().next(); } return jClass; } @@ -196,8 +195,6 @@ public JavaClass getGenericReturnType(JavaMethod meth) { * This assumes that the provided class exists on the classpath * - null is returned otherwise. * - * @param javaClass - * @return */ public JavaClass getJavaClass(Class javaClass) { return jModel.getClass(javaClass); @@ -207,7 +204,6 @@ public JavaClass getJavaClass(Class javaClass) { * Return array of JavaClass instances created based on the provided classes. * This assumes provided classes exist on the classpath. * - * @param classes * @return JavaClass array */ public JavaClass[] getJavaClassArray(Class... classes) { @@ -227,8 +223,6 @@ public JavaClass[] getJavaClassArray(Class... classes) { * class name. This assumes that a class with the provided name * exists on the classpath - null is returned otherwise. * - * @param javaClassName - * @return */ public JavaClass getJavaClass(String javaClassName) { return jModel.getClass(javaClassName); @@ -236,9 +230,8 @@ public JavaClass getJavaClass(String javaClassName) { /** * Return a map of default Java types to XML types. - * @return */ - public HashMap getXMLToJavaTypeMap() { + public Map getXMLToJavaTypeMap() { return xmlToJavaTypeMap; } @@ -249,9 +242,6 @@ public HashMap getXMLToJavaTypeMap() { * exist. * Intended to be used in conjunction with isAnnotationPresent. * - * @param element - * @param annotationClass - * @return * @see #isAnnotationPresent */ public Annotation getAnnotation(JavaHasAnnotations element, Class annotationClass) { @@ -266,8 +256,6 @@ public Annotation getAnnotation(JavaHasAnnotations element, Class annotationClas * Returns a JavaClass instance wrapping the provided field's resolved * type. * - * @param field - * @return */ public JavaClass getType(JavaField field) { JavaClass type = field.getResolvedType(); @@ -282,7 +270,6 @@ public JavaClass getType(JavaField field) { * * Replacement of direct access to JAXBELEMENT_CLASS field. * - * @return */ public JavaClass getJaxbElementClass() { return jaxbElementClass; @@ -293,7 +280,6 @@ public JavaClass getJaxbElementClass() { * * Replacement of direct access to OBJECT_CLASS field. * - * @return */ public JavaClass getObjectClass() { return objectClass; @@ -302,9 +288,6 @@ public JavaClass getObjectClass() { /** * Indicates if element contains a given annotation. * - * @param element - * @param annotationClass - * @return */ public boolean isAnnotationPresent(JavaHasAnnotations element, Class annotationClass) { if (element == null || annotationClass == null) { @@ -322,8 +305,6 @@ public boolean isAnnotationPresent(JavaHasAnnotations element, Class annotationC * 2 - the provided JavaClass' raw name starts with "java." * 3 - the provided JavaClass' raw name starts with "javax.", with * the exception of "jakarta.xml.ws." and "javax.xml.rpc" - * @param jClass - * @return */ public boolean isBuiltInJavaType(JavaClass jClass) { String rawName = jClass.getRawName(); @@ -399,9 +380,6 @@ public boolean classExistsInArray(JavaClass theClass, List existingCl /** * Convenience method to determine if two JavaClass instances are equal. * - * @param classA - * @param classB - * @return */ private boolean areClassesEqual(JavaClass classA, JavaClass classB) { if (classA == classB) { @@ -411,8 +389,8 @@ private boolean areClassesEqual(JavaClass classA, JavaClass classB) { return false; } - Collection classAargs = classA.getActualTypeArguments(); - Collection classBargs = classB.getActualTypeArguments(); + Collection classAargs = classA.getActualTypeArguments(); + Collection classBargs = classB.getActualTypeArguments(); if (classAargs != null) { if (classBargs == null) { return false; @@ -421,12 +399,12 @@ private boolean areClassesEqual(JavaClass classA, JavaClass classB) { return false; } - Iterator classAargsIter = classAargs.iterator(); - Iterator classBargsIter = classBargs.iterator(); + Iterator classAargsIter = classAargs.iterator(); + Iterator classBargsIter = classBargs.iterator(); while(classAargsIter.hasNext()){ - JavaClass nestedClassA = (JavaClass) classAargsIter.next(); - JavaClass nestedClassB = (JavaClass) classBargsIter.next(); + JavaClass nestedClassA = classAargsIter.next(); + JavaClass nestedClassB = classBargsIter.next(); if (!areClassesEqual(nestedClassA, nestedClassB)) { return false; } diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/JavaClass.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/JavaClass.java index 85969ba331a..232d2ef3f5a 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/JavaClass.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/JavaClass.java @@ -31,22 +31,22 @@ * @see java.lang.Class */ public interface JavaClass extends JavaHasAnnotations { - Collection getActualTypeArguments(); + Collection getActualTypeArguments(); JavaClass getComponentType(); String getQualifiedName(); String getRawName(); boolean hasActualTypeArguments(); - Collection getDeclaredClasses(); + Collection getDeclaredClasses(); JavaField getDeclaredField(String arg0); - Collection getDeclaredFields(); + Collection getDeclaredFields(); JavaMethod getDeclaredMethod(String arg0, JavaClass[] arg1); - Collection getDeclaredMethods(); + Collection getDeclaredMethods(); JavaMethod getMethod(String arg0, JavaClass[] arg1); - Collection getMethods(); + Collection getMethods(); JavaConstructor getConstructor(JavaClass[] parameterTypes); - Collection getConstructors(); + Collection getConstructors(); JavaConstructor getDeclaredConstructor(JavaClass[] parameterTypes); - Collection getDeclaredConstructors(); + Collection getDeclaredConstructors(); int getModifiers(); String getName(); JavaPackage getPackage(); diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/reflection/JavaClassImpl.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/reflection/JavaClassImpl.java index 14407869621..36df38a61b6 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/reflection/JavaClassImpl.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/reflection/JavaClassImpl.java @@ -84,7 +84,7 @@ public void setJavaModelImpl(JavaModelImpl javaModel) { this.javaModelImpl = javaModel; } @Override - public Collection getActualTypeArguments() { + public Collection getActualTypeArguments() { ArrayList argCollection = new ArrayList<>(); if (jType != null) { Type[] params = jType.getActualTypeArguments(); @@ -209,7 +209,7 @@ public JavaMethod getDeclaredMethod(String arg0, JavaClass[] arg1) { } @Override - public Collection getDeclaredMethods() { + public Collection getDeclaredMethods() { ArrayList methodCollection = new ArrayList<>(); Method[] methods = jClass.getDeclaredMethods(); for (Method method : methods) { @@ -258,7 +258,7 @@ public JavaConstructor getDeclaredConstructor(JavaClass[] paramTypes) { } @Override - public Collection getConstructors() { + public Collection getConstructors() { Constructor[] constructors = this.jClass.getConstructors(); ArrayList constructorCollection = new ArrayList(constructors.length); for(Constructor next:constructors) { @@ -268,7 +268,7 @@ public Collection getConstructors() { } @Override - public Collection getDeclaredConstructors() { + public Collection getDeclaredConstructors() { Constructor[] constructors = this.jClass.getDeclaredConstructors(); ArrayList constructorCollection = new ArrayList(constructors.length); for(Constructor next:constructors) { @@ -323,7 +323,7 @@ public JavaMethod getMethod(String arg0, JavaClass[] arg1) { } @Override - public Collection getMethods() { + public Collection getMethods() { ArrayList methodCollection = new ArrayList<>(); Method[] methods = PrivilegedAccessHelper.getMethods(jClass); for (Method method : methods) { @@ -584,7 +584,6 @@ public void setSuperClassOverride(JavaClass superClassOverride) { * Set the indicator for XML metadata complete - if true, * annotations will be ignored. * - * @param isMetadataComplete */ void setIsMetadataComplete(Boolean isMetadataComplete) { if(isMetadataComplete != null){ diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/reflection/JavaModelImpl.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/reflection/JavaModelImpl.java index 19440c847ea..1fb26b9d68e 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/reflection/JavaModelImpl.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/reflection/JavaModelImpl.java @@ -124,7 +124,6 @@ public AnnotationHelper getAnnotationHelper() { * JavaModelInput. If a given package has no entry in this map it is * assumed to be metadata incomplete. * - * @param metadataCompletePackageMap */ public void setMetadataCompletePackageMap(Map metadataCompletePackageMap) { this.metadataCompletePackages = metadataCompletePackageMap; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/reflection/JavaModelInputImpl.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/reflection/JavaModelInputImpl.java index 99236c6c537..d6381f6a2f3 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/reflection/JavaModelInputImpl.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/javamodel/reflection/JavaModelInputImpl.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 @@ -54,8 +54,6 @@ public class JavaModelInputImpl implements JavaModelInput { * This constructor assumes that the a given type in the list will * either be a Class or ParameterizedType. * - * @param types - * @param javaModel */ public JavaModelInputImpl(Type[] types, JavaModel javaModel) { jModel = javaModel; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/rs/MOXyJsonProvider.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/rs/MOXyJsonProvider.java index 97fa74851d9..adfd07d7bde 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/rs/MOXyJsonProvider.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/rs/MOXyJsonProvider.java @@ -306,8 +306,6 @@ private Set> asSet(Class clazz) { * @param annotations - The annotations corresponding to domain object. * @param mediaType - The media type for the HTTP entity. * @param httpHeaders - HTTP headers associated with HTTP entity. - * @return - * @throws JAXBException */ protected JAXBContext getJAXBContext(Set> domainClasses, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders) throws JAXBException { @@ -623,7 +621,6 @@ public boolean isWriteable(Class type, Type genericType, Annotation[] annotat * @param httpHeaders - HTTP headers associated with HTTP entity. * @param unmarshaller - The instance of Unmarshaller that will be * used to unmarshal the JSON message. - * @throws JAXBException * @see org.eclipse.persistence.jaxb.UnmarshallerProperties */ protected void preReadFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, Unmarshaller unmarshaller) throws JAXBException { @@ -643,7 +640,6 @@ protected void preReadFrom(Class type, Type genericType, Annotation[] an * @param httpHeaders - HTTP headers associated with HTTP entity. * @param marshaller - The instance of Marshaller that will be used * to marshal the domain object to JSON. - * @throws JAXBException * @see org.eclipse.persistence.jaxb.MarshallerProperties */ protected void preWriteTo(Object object, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, Marshaller marshaller) throws JAXBException { diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlAttribute.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlAttribute.java index cb68eaa6a26..d375bd29c7e 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlAttribute.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlAttribute.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 @@ -296,7 +296,6 @@ public void setNamespace(String value) { /** * Indicates if the required flag was set via external metadata. * - * @return */ public boolean isSetRequired() { return required != null; @@ -553,7 +552,6 @@ public void setReadOnly(Boolean value) { /** * Indicates if the isReadOnly flag was set. * - * @return */ public boolean isSetReadOnly() { return this.readOnly != null; @@ -590,7 +588,6 @@ public void setWriteOnly(Boolean value) { /** * Indicates if the isWriteOnly flag was set. * - * @return */ public boolean isSetWriteOnly() { return this.writeOnly != null; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlElement.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlElement.java index 15bbcee1fef..d1dd6fce117 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlElement.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlElement.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 @@ -768,7 +768,6 @@ public void setReadOnly(Boolean value) { /** * Indicates if the isReadOnly flag was set. * - * @return */ public boolean isSetReadOnly() { return this.readOnly != null; @@ -805,7 +804,6 @@ public void setWriteOnly(Boolean value) { /** * Indicates if the isWriteOnly flag was set. * - * @return */ public boolean isSetWriteOnly() { return this.writeOnly != null; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlTransformation.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlTransformation.java index 8a65ddca73d..516147d923b 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlTransformation.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlTransformation.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 @@ -139,7 +139,6 @@ public void setXmlProperties(XmlProperties value) { /** * Indicates if an XmlReadTransformer has been set, i.e. is non-null. * - * @return */ public boolean isSetXmlReadTransformer() { return xmlReadTransformer != null; @@ -174,7 +173,6 @@ public void setXmlReadTransformer(XmlTransformation.XmlReadTransformer value) { * set, i.e. the List of is XmlWriteTransformers is non-null * and non-empty. * - * @return */ public boolean isSetXmlWriteTransformers() { return xmlWriteTransformer != null && xmlWriteTransformer.size() > 0; @@ -292,7 +290,6 @@ public void setMethod(String value) { /** * Indicates if a method has been set, i.e. the method property is non-null. * - * @return */ public boolean isSetMethod() { return method != null; @@ -326,7 +323,6 @@ public void setTransformerClass(String value) { * Indicates if a transformerClass has been set, i.e. the * transformerClass property is non-null. * - * @return */ public boolean isSetTransformerClass() { return transformerClass != null; @@ -391,7 +387,6 @@ public void setMethod(String value) { /** * Indicates if a method has been set, i.e. the method property is non-null. * - * @return */ public boolean isSetMethod() { return method != null; @@ -424,7 +419,6 @@ public void setXmlPath(String value) { /** * Indicates if a xmlPath has been set, i.e. the xmlPath property is non-null. * - * @return */ public boolean isSetXmlPath() { return xmlPath != null; @@ -458,7 +452,6 @@ public void setTransformerClass(String value) { * Indicates if a transformerClass has been set, i.e. the * transformerClass property is non-null. * - * @return */ public boolean isSetTransformerClass() { return transformerClass != null; diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlValue.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlValue.java index 3e7f33489df..123ef0cf98d 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlValue.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/xmlmodel/XmlValue.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 @@ -211,7 +211,6 @@ public void setReadOnly(Boolean value) { /** * Indicates if the isReadOnly flag was set. * - * @return */ public boolean isSetReadOnly() { return this.readOnly != null; @@ -248,7 +247,6 @@ public void setWriteOnly(Boolean value) { /** * Indicates if the isWriteOnly flag was set. * - * @return */ public boolean isSetWriteOnly() { return this.writeOnly != null; diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/SchemaGeneratorTestCase.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/SchemaGeneratorTestCase.java index b858f7441c2..cdf894c7d2a 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/SchemaGeneratorTestCase.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/SchemaGeneratorTestCase.java @@ -115,7 +115,7 @@ public void javaxXmlRpcStringHolderTest() { @Override public boolean isSynthetic() { return false; } @Override - public Collection getActualTypeArguments() { return null; } + public Collection getActualTypeArguments() { return null; } @Override public JavaClass getComponentType() { return null; } @Override @@ -123,27 +123,27 @@ public void javaxXmlRpcStringHolderTest() { @Override public boolean hasActualTypeArguments() { return false; } @Override - public Collection getDeclaredClasses() { return null; } + public Collection getDeclaredClasses() { return null; } @Override public JavaField getDeclaredField(String arg0) { return null; } @Override - public Collection getDeclaredFields() { return null; } + public Collection getDeclaredFields() { return null; } @Override public JavaMethod getDeclaredMethod(String arg0, JavaClass[] arg1) { return null; } @Override - public Collection getDeclaredMethods() { return null; } + public Collection getDeclaredMethods() { return null; } @Override public JavaMethod getMethod(String arg0, JavaClass[] arg1) { return null; } @Override - public Collection getMethods() { return null ;} + public Collection getMethods() { return null ;} @Override public JavaConstructor getConstructor(JavaClass[] parameterTypes) { return null; } @Override - public Collection getConstructors() { return null; } + public Collection getConstructors() { return null; } @Override public JavaConstructor getDeclaredConstructor(JavaClass[] parameterTypes) { return null; } @Override - public Collection getDeclaredConstructors() { return null; } + public Collection getDeclaredConstructors() { return null; } @Override public int getModifiers() { return 0; } @Override diff --git a/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/SDOType.java b/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/SDOType.java index def14e3ac39..b2cceb0d440 100644 --- a/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/SDOType.java +++ b/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/SDOType.java @@ -717,7 +717,7 @@ public void initializeNamespaces(List namespaceResolvers) { NamespaceResolver nextNR = (NamespaceResolver)namespaceResolvers.get(i); if (nextNR != null) { for (int j = 0, size = nextNR.getNamespaces().size(); j < size; j++) { - Namespace nextNamespace = (Namespace)nextNR.getNamespaces().get(j); + Namespace nextNamespace = nextNR.getNamespaces().get(j); if ((!nextNamespace.getPrefix().equals(javax.xml.XMLConstants.XMLNS_ATTRIBUTE)) && (!nextNamespace.getNamespaceURI().equals(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI)) && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDOJAVA_URL)) && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDOXML_URL)) && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDO_URL))) { @@ -788,7 +788,7 @@ public void setupInheritance(SDOType parentType) { NamespaceResolver parentNR = parentDescriptor.getNonNullNamespaceResolver(); if (parentNR != null) { for (int i = 0; i < parentNR.getNamespaces().size(); i++) { - Namespace nextNamespace = (Namespace)parentNR.getNamespaces().get(i); + Namespace nextNamespace = parentNR.getNamespaces().get(i); if ((!nextNamespace.getPrefix().equals(javax.xml.XMLConstants.XMLNS_ATTRIBUTE)) && (!nextNamespace.getNamespaceURI().equals(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI)) && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDOJAVA_URL)) && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDOXML_URL)) && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDO_URL))) { diff --git a/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/SDOSchemaGenerator.java b/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/SDOSchemaGenerator.java index fc27274bd88..6b8ad63ca25 100644 --- a/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/SDOSchemaGenerator.java +++ b/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/SDOSchemaGenerator.java @@ -46,7 +46,7 @@ * @see commonj.sdo.helper.XSDHelper */ public class SDOSchemaGenerator { - private Map namespaceToSchemaLocation; + private Map namespaceToSchemaLocation; private SchemaLocationResolver schemaLocationResolver; private List allTypes; private Schema generatedSchema; @@ -85,10 +85,10 @@ public String generate(List types, SchemaLocationResolver aSchemaLocationResolve //Now we have a built schema model Project p = new SchemaModelProject(); - Vector generatedNamespaces = generatedSchema.getNamespaceResolver().getNamespaces(); + Vector generatedNamespaces = generatedSchema.getNamespaceResolver().getNamespaces(); XMLDescriptor desc = ((XMLDescriptor)p.getDescriptor(Schema.class)); for (int i = 0; i < generatedNamespaces.size(); i++) { - Namespace next = (Namespace)generatedNamespaces.get(i); + Namespace next = generatedNamespaces.get(i); desc.getNamespaceResolver().put(next.getPrefix(), next.getNamespaceURI()); if (next.getNamespaceURI().equals(SDOConstants.SDO_URL) || next.getNamespaceURI().equals(SDOConstants.SDOXML_URL) || next.getNamespaceURI().equals(SDOConstants.SDOJAVA_URL)) { @@ -156,7 +156,7 @@ public String generate(List types, SchemaLocationResolver aSchemaLocationResolve * used for getting the value of the schemaLocation attribute of generated imports and includes * @return String The generated XSD. */ - public String generate(List types, Map aNamespaceToSchemaLocation) { + public String generate(List types, Map aNamespaceToSchemaLocation) { if ((types == null) || (types.size() == 0)) { throw new IllegalArgumentException("No Schema was generated from null or empty list of types."); } @@ -175,9 +175,9 @@ public String generate(List types, Map aNamespaceToSchemaLocation) { //Now we have a built schema model Project p = new SchemaModelProject(); - Vector namespaces = generatedSchema.getNamespaceResolver().getNamespaces(); + Vector namespaces = generatedSchema.getNamespaceResolver().getNamespaces(); for (int i = 0; i < namespaces.size(); i++) { - Namespace next = (Namespace)namespaces.get(i); + Namespace next = namespaces.get(i); ((XMLDescriptor)p.getDescriptor(Schema.class)).getNamespaceResolver().put(next.getPrefix(), next.getNamespaceURI()); } @@ -277,10 +277,10 @@ private SimpleType generateSimpleType(Type type) { } Object value = sdoType.get(SDOConstants.JAVA_CLASS_PROPERTY); - if ((value != null) && value instanceof String) { + if (value instanceof String) { String sdoJavaPrefix = getPrefixForURI(SDOConstants.SDOJAVA_URL); QName qname = new QName(SDOConstants.SDOJAVA_URL, SDOConstants.SDOJAVA_INSTANCECLASS, sdoJavaPrefix); - simpleType.getAttributesMap().put(qname, value); + simpleType.getAttributesMap().put(qname, (String) value); } SDOType baseType = null; @@ -747,7 +747,7 @@ private void addTypeToListIfNeeded(Type sourceType, Type targetType) { boolean alreadyGenerated = allTypes.contains(targetType); String schemaLocation = null; if (namespaceToSchemaLocation != null) { - schemaLocation = (String)namespaceToSchemaLocation.get(targetType.getURI()); + schemaLocation = namespaceToSchemaLocation.get(targetType.getURI()); if (targetType.getURI().equals(generatedSchema.getTargetNamespace())) { if (!alreadyGenerated) { @@ -807,7 +807,7 @@ private Element buildElementForComplexType(Schema schema, ComplexType type) { } String lowerName = Character.toLowerCase(name.charAt(0)) + name.substring(1, name.length()); - Object exists = schema.getTopLevelElements().get(lowerName); + Element exists = schema.getTopLevelElements().get(lowerName); if (exists != null) { elem.setName(name); } else { diff --git a/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/SDOTypesGenerator.java b/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/SDOTypesGenerator.java index ac7b093c16a..cbbcfe8d4df 100644 --- a/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/SDOTypesGenerator.java +++ b/sdo/org.eclipse.persistence.sdo/src/main/java/org/eclipse/persistence/sdo/helper/SDOTypesGenerator.java @@ -78,11 +78,11 @@ public class SDOTypesGenerator { private Project schemaProject; private Schema rootSchema; - private HashMap processedComplexTypes; - private HashMap processedSimpleTypes; - private HashMap processedElements; - private HashMap processedAttributes; - private Map itemNameToSDOName; + private Map processedComplexTypes; + private Map processedSimpleTypes; + private Map processedElements; + private Map processedAttributes; + private Map itemNameToSDOName; private boolean processImports; private boolean returnAllTypes; private java.util.List namespaceResolvers; @@ -91,24 +91,24 @@ public class SDOTypesGenerator { private HelperContext aHelperContext; private java.util.List anonymousTypes; - private java.util.Map generatedTypes; - private java.util.Map generatedTypesByXsdQName; - private java.util.Map generatedGlobalElements; - private java.util.Map generatedGlobalAttributes; + private Map generatedTypes; + private Map generatedTypesByXsdQName; + private Map generatedGlobalElements; + private Map generatedGlobalAttributes; private String packageName; private java.util.List nonContainmentReferences; private Map> globalRefs; private boolean isImportProcessor; public SDOTypesGenerator(HelperContext aContext) { - anonymousTypes = new ArrayList(); - generatedTypesByXsdQName = new HashMap(); - processedComplexTypes = new HashMap(); - processedSimpleTypes = new HashMap(); - processedElements = new HashMap(); - processedAttributes = new HashMap(); - itemNameToSDOName = new HashMap(); - namespaceResolvers = new ArrayList(); + anonymousTypes = new ArrayList<>(); + generatedTypesByXsdQName = new HashMap<>(); + processedComplexTypes = new HashMap<>(); + processedSimpleTypes = new HashMap<>(); + processedElements = new HashMap<>(); + processedAttributes = new HashMap<>(); + itemNameToSDOName = new HashMap<>(); + namespaceResolvers = new ArrayList<>(); this.aHelperContext = aContext; } @@ -252,13 +252,13 @@ private void processSchema(Schema parsedSchema) { postProcessing(); } - private void processImports(java.util.List imports) { + private void processImports(java.util.List imports) { if ((imports == null) || (imports.size() == 0) || !isProcessImports()) { return; } - Iterator iter = imports.iterator(); + Iterator iter = imports.iterator(); while (iter.hasNext()) { - Import nextImport = (Import) iter.next(); + Import nextImport = iter.next(); try { processImportIncludeInternal(nextImport); } catch (Exception e) { @@ -267,13 +267,13 @@ private void processImports(java.util.List imports) { } } - private void processIncludes(java.util.List includes) { + private void processIncludes(java.util.List includes) { if ((includes == null) || (includes.size() == 0) || !isProcessImports()) { return; } - Iterator iter = includes.iterator(); + Iterator iter = includes.iterator(); while (iter.hasNext()) { - Include nextInclude = (Include) iter.next(); + Include nextInclude = iter.next(); try { processImportIncludeInternal(nextInclude); } catch (Exception e) { @@ -338,7 +338,7 @@ private boolean typesExists(String targetNamespace, String sdoTypeName) { alreadyProcessed = true; } else { QName qname = new QName(targetNamespace, sdoTypeName); - Object processed = processedComplexTypes.get(qname); + ComplexType processed = processedComplexTypes.get(qname); if (processed != null) { alreadyProcessed = true; } @@ -365,14 +365,14 @@ private boolean typesExists(String targetNamespace, String sdoTypeName) { } private void processGlobalComplexTypes(Schema schema) { - Collection complexTypes = schema.getTopLevelComplexTypes().values(); + Collection complexTypes = schema.getTopLevelComplexTypes().values(); if (complexTypes == null) { return; } - Iterator complexTypesIter = complexTypes.iterator(); + Iterator complexTypesIter = complexTypes.iterator(); while (complexTypesIter.hasNext()) { - ComplexType complexType = (ComplexType) complexTypesIter.next(); + ComplexType complexType = complexTypesIter.next(); String targetNamespace = schema.getTargetNamespace(); if(null == targetNamespace) { targetNamespace = ""; @@ -383,7 +383,7 @@ private void processGlobalComplexTypes(Schema schema) { private void processGlobalComplexType(String targetNamespace, String defaultNamespace, ComplexType complexType) { QName qname = new QName(targetNamespace, complexType.getName()); - Object processed = processedComplexTypes.get(qname); + ComplexType processed = processedComplexTypes.get(qname); if (processed == null) { processComplexType(targetNamespace, defaultNamespace, complexType.getName(), complexType); @@ -426,7 +426,7 @@ private SDOType processComplexType(String targetNamespace, String defaultNamespa //return true if a new type was created private SDOType startComplexType(String targetNamespace, String defaultNamespace, String name, ComplexType complexType) { - String nameValue = (String) complexType.getAttributesMap().get(SDOConstants.SDOXML_NAME_QNAME); + String nameValue = complexType.getAttributesMap().get(SDOConstants.SDOXML_NAME_QNAME); String originalName = name; if (nameValue != null) { itemNameToSDOName.put(name, nameValue); @@ -467,14 +467,14 @@ private SDOType startNewComplexType(String targetNamespace, String sdoTypeName, currentType.setAbstract(complexType.isAbstractValue()); currentType.setDataType(false); - String value = (String) complexType.getAttributesMap().get(SDOConstants.SDOXML_ALIASNAME_QNAME); + String value = complexType.getAttributesMap().get(SDOConstants.SDOXML_ALIASNAME_QNAME); if (value != null) { XMLConversionManager xmlConversionManager = ((SDOXMLHelper) aHelperContext.getXMLHelper()).getXmlConversionManager(); java.util.List names = xmlConversionManager.convertObject(value, java.util.List.class); currentType.setAliasNames(names); } - String sequencedValue = (String) complexType.getAttributesMap().get(SDOConstants.SDOXML_SEQUENCE_QNAME); + String sequencedValue = complexType.getAttributesMap().get(SDOConstants.SDOXML_SEQUENCE_QNAME); if (sequencedValue != null) { currentType.setSequenced(Boolean.parseBoolean(sequencedValue)); } @@ -509,13 +509,13 @@ private void processOrderedAttributes(String targetNamespace, String defaultName } private void processGlobalAttributes(Schema schema) { - Collection attributes = schema.getTopLevelAttributes().values(); + Collection attributes = schema.getTopLevelAttributes().values(); if (attributes == null) { return; } - Iterator attributesIter = attributes.iterator(); + Iterator attributesIter = attributes.iterator(); while (attributesIter.hasNext()) { - Attribute nextAttribute = (Attribute) attributesIter.next(); + Attribute nextAttribute = attributesIter.next(); String targetNamespace = schema.getTargetNamespace(); if(null == targetNamespace) { targetNamespace = ""; @@ -527,7 +527,7 @@ private void processGlobalAttributes(Schema schema) { private void processGlobalAttribute(String targetNamespace, String defaultNamespace, Attribute attribute) { if (attribute.getName() != null) { QName qname = new QName(targetNamespace, attribute.getName()); - Object processed = processedAttributes.get(qname); + Attribute processed = processedAttributes.get(qname); if (processed == null) { SDOType attributeType = processAttribute(targetNamespace, defaultNamespace, null, attribute, true); @@ -613,7 +613,7 @@ private void processAttributeGroup(String targetNamespace, String defaultNamespa processAnyAttribute(targetNamespace, defaultNamespace, owningType); } for (int j = 0; j < size; j++) { - processAttribute(targetNamespace, defaultNamespace, owningType, (Attribute) globalAttributeGroup.getAttributes().get(j), false); + processAttribute(targetNamespace, defaultNamespace, owningType, globalAttributeGroup.getAttributes().get(j), false); } } } @@ -630,14 +630,14 @@ private void processAttributes(String targetNamespace, String defaultNamespace, } private void processGlobalSimpleTypes(Schema schema) { - Collection simpleTypes = schema.getTopLevelSimpleTypes().values(); + Collection simpleTypes = schema.getTopLevelSimpleTypes().values(); if (simpleTypes == null) { return; } - Iterator simpleTypesIter = simpleTypes.iterator(); + Iterator simpleTypesIter = simpleTypes.iterator(); while (simpleTypesIter.hasNext()) { - SimpleType simpleType = (SimpleType) simpleTypesIter.next(); + SimpleType simpleType = simpleTypesIter.next(); String targetNamespace = schema.getTargetNamespace(); if(null == targetNamespace) { targetNamespace = ""; @@ -704,7 +704,7 @@ private SDOType startNewSimpleType(String targetNamespace, String defaultNamespa typeHelper.getImplClassesToSDOType().put(wrapperType.getXmlDescriptor().getJavaClass(), wrapperType); // Add descriptor to XMLHelper - ArrayList list = new ArrayList(1); + ArrayList list = new ArrayList<>(1); list.add(wrapperType); ((SDOXMLHelper) aHelperContext.getXMLHelper()).addDescriptors(list); @@ -722,7 +722,7 @@ private SDOType processSimpleType(String targetNamespace, String defaultNamespac boolean addedNR = addNextNamespaceResolver(simpleType.getAttributesMap()); String name = sdoTypeName; String originalName = name; - String nameValue = (String) simpleType.getAttributesMap().get(SDOConstants.SDOXML_NAME_QNAME); + String nameValue = simpleType.getAttributesMap().get(SDOConstants.SDOXML_NAME_QNAME); if (nameValue != null) { itemNameToSDOName.put(sdoTypeName, nameValue); name = nameValue; @@ -755,20 +755,20 @@ private SDOType processSimpleType(String targetNamespace, String defaultNamespac } private void finishSimpleType(String targetNamespace, String defaultNamespace, String sdoTypeName, SimpleType simpleType, SDOType currentType) { - String value = (String) simpleType.getAttributesMap().get(SDOConstants.SDOXML_ALIASNAME_QNAME); + String value = simpleType.getAttributesMap().get(SDOConstants.SDOXML_ALIASNAME_QNAME); if (value != null) { XMLConversionManager xmlConversionManager = ((SDOXMLHelper) aHelperContext.getXMLHelper()).getXmlConversionManager(); java.util.List names = xmlConversionManager.convertObject(value, java.util.List.class); currentType.setAliasNames(names); } - String instanceClassValue = (String) simpleType.getAttributesMap().get(SDOConstants.SDOJAVA_INSTANCECLASS_QNAME); + String instanceClassValue = simpleType.getAttributesMap().get(SDOConstants.SDOJAVA_INSTANCECLASS_QNAME); if (instanceClassValue != null) { currentType.setInstanceProperty(SDOConstants.JAVA_CLASS_PROPERTY, instanceClassValue); currentType.setBaseTypes(null); } - String extendedInstanceClassValue = (String) simpleType.getAttributesMap().get(SDOConstants.SDOJAVA_EXTENDEDINSTANCECLASS_QNAME); + String extendedInstanceClassValue = simpleType.getAttributesMap().get(SDOConstants.SDOJAVA_EXTENDEDINSTANCECLASS_QNAME); if (extendedInstanceClassValue != null) { currentType.setInstanceClassName(extendedInstanceClassValue); } @@ -875,12 +875,12 @@ private void processExtension(String targetNamespace, String defaultNamespace, S if(baseType != null) { if(!baseType.isFinalized() && baseQName.getNamespaceURI().equals(targetNamespace)) { if(baseType.isDataType()) { - SimpleType baseSimpleType = (SimpleType) rootSchema.getTopLevelSimpleTypes().get(baseQName.getLocalPart()); + SimpleType baseSimpleType = rootSchema.getTopLevelSimpleTypes().get(baseQName.getLocalPart()); if(baseSimpleType != null){ processGlobalSimpleType(targetNamespace, defaultNamespace, baseSimpleType); } } else { - ComplexType baseComplexType = (ComplexType) rootSchema.getTopLevelComplexTypes().get(baseQName.getLocalPart()); + ComplexType baseComplexType = rootSchema.getTopLevelComplexTypes().get(baseQName.getLocalPart()); if(baseComplexType != null){ processGlobalComplexType(targetNamespace, defaultNamespace, baseComplexType); } @@ -936,7 +936,7 @@ private void processUnion(String targetNamespace, String defaultNamespace, Strin SDOType typeForMemberType = getTypeForName(targetNamespace, defaultNamespace, nextMemberType); QName baseQName = this.getQNameForString(defaultNamespace, nextMemberType); if(!typeForMemberType.isFinalized() && baseQName.getNamespaceURI().equals(targetNamespace)) { - SimpleType baseSimpleType = (SimpleType) rootSchema.getTopLevelSimpleTypes().get(baseQName.getLocalPart()); + SimpleType baseSimpleType = rootSchema.getTopLevelSimpleTypes().get(baseQName.getLocalPart()); processSimpleType(targetNamespace, defaultNamespace, baseQName.getLocalPart(), baseSimpleType); } if (i == 0) { @@ -1000,10 +1000,10 @@ private Type processBaseType(String targetNamespace, String defaultNamespace, SD if(!baseType.isFinalized() && baseQName.getNamespaceURI().equals(targetNamespace)) { if(baseType.isDataType()) { - SimpleType baseSimpleType = (SimpleType) rootSchema.getTopLevelSimpleTypes().get(baseQName.getLocalPart()); + SimpleType baseSimpleType = rootSchema.getTopLevelSimpleTypes().get(baseQName.getLocalPart()); processGlobalSimpleType(targetNamespace, defaultNamespace, baseSimpleType); } else { - ComplexType baseComplexType = (ComplexType) rootSchema.getTopLevelComplexTypes().get(baseQName.getLocalPart()); + ComplexType baseComplexType = rootSchema.getTopLevelComplexTypes().get(baseQName.getLocalPart()); processGlobalComplexType(targetNamespace, defaultNamespace, baseComplexType); } } @@ -1130,13 +1130,13 @@ private void processAny(String targetNamespace, String defaultNamespace, Any any } private void processGlobalElements(Schema schema) { - Collection elements = schema.getTopLevelElements().values(); + Collection elements = schema.getTopLevelElements().values(); if (elements == null) { return; } - Iterator elementsIter = elements.iterator(); + Iterator elementsIter = elements.iterator(); while (elementsIter.hasNext()) { - Element nextElement = (Element) elementsIter.next(); + Element nextElement = elementsIter.next(); String targetNamespace = schema.getTargetNamespace(); if(null == targetNamespace) { targetNamespace = ""; @@ -1153,7 +1153,7 @@ private void processGlobalElement(String targetNamespace, String defaultNamespac return; } QName qname = new QName(targetNamespace, element.getName()); - Object processed = processedElements.get(qname); + Element processed = processedElements.get(qname); if (processed == null) { SDOType elementType = processElement(targetNamespace, defaultNamespace, null, null, element, true, true); @@ -1214,7 +1214,7 @@ private void processSimpleElement( // return; } - String manyValue = (String) element.getAttributesMap().get(SDOConstants.SDOXML_MANY_QNAME); + String manyValue = element.getAttributesMap().get(SDOConstants.SDOXML_MANY_QNAME); if (manyValue != null) { isMany = Boolean.parseBoolean(manyValue); } @@ -1303,11 +1303,11 @@ private void processSimpleElement( // p.setXsdType(qname); } - String mimeType = (String) element.getAttributesMap().get(SDOConstants.XML_MIME_TYPE_QNAME); + String mimeType = element.getAttributesMap().get(SDOConstants.XML_MIME_TYPE_QNAME); if (mimeType != null) { p.setInstanceProperty(SDOConstants.MIME_TYPE_PROPERTY, mimeType); } - String mimeTypePropName = (String) element.getAttributesMap().get(SDOConstants.XML_MIME_TYPE_PROPERTY_QNAME); + String mimeTypePropName = element.getAttributesMap().get(SDOConstants.XML_MIME_TYPE_PROPERTY_QNAME); if (mimeTypePropName != null) { p.setInstanceProperty(SDOConstants.MIME_TYPE_PROPERTY_PROPERTY, mimeTypePropName); } @@ -1315,7 +1315,7 @@ private void processSimpleElement( // sdoPropertyType = getSDOTypeForName(targetNamespace, defaultNamespace, typeName); if(!sdoPropertyType.isFinalized() && qname.getNamespaceURI().equals(targetNamespace)) { if(sdoPropertyType.isDataType()) { - SimpleType baseSimpleType = (SimpleType) rootSchema.getTopLevelSimpleTypes().get(qname.getLocalPart()); + SimpleType baseSimpleType = rootSchema.getTopLevelSimpleTypes().get(qname.getLocalPart()); processGlobalSimpleType(targetNamespace, defaultNamespace, baseSimpleType); } } @@ -1529,13 +1529,13 @@ private void updateOwnerAndBuildMapping(SDOType owningType, SDOProperty p, Strin owningType.setInstanceProperty(SDOConstants.ID_PROPERTY, p.getName()); } else if (xsdType.getLocalPart().equals(SDOConstants.IDREF)) { p.setContainment(false); - String propertyTypeValue = (String) simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_PROPERTYTYPE_QNAME); + String propertyTypeValue = simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_PROPERTYTYPE_QNAME); if (propertyTypeValue != null) { buildMapping = false; } } else if (xsdType.getLocalPart().equals(SDOConstants.IDREFS)) { p.setContainment(false); - String propertyTypeValue = (String) simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_PROPERTYTYPE_QNAME); + String propertyTypeValue = simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_PROPERTYTYPE_QNAME); if (propertyTypeValue != null) { buildMapping = false; p.setMany(true); @@ -1668,7 +1668,7 @@ private void processSimpleAttribute(String targetNamespace, String defaultNamesp sdoPropertyType = getSDOTypeForName(targetNamespace, defaultNamespace, typeName); if(!sdoPropertyType.isFinalized() && qname.getNamespaceURI().equals(targetNamespace)) { if(sdoPropertyType.isDataType()) { - SimpleType baseSimpleType = (SimpleType) rootSchema.getTopLevelSimpleTypes().get(qname.getLocalPart()); + SimpleType baseSimpleType = rootSchema.getTopLevelSimpleTypes().get(qname.getLocalPart()); processGlobalSimpleType(targetNamespace, defaultNamespace, baseSimpleType); } } @@ -1700,7 +1700,7 @@ private void processSimpleAttribute(String targetNamespace, String defaultNamesp private SDOType processSimpleComponentAnnotations(SDOType owningType, SimpleComponent simpleComponent, SDOProperty p, String targetNamespace, String defaultNamespace, SDOType sdoPropertyType) { //aliasName annotation - String aliasNamesValue = (String) simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_ALIASNAME_QNAME); + String aliasNamesValue = simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_ALIASNAME_QNAME); if (aliasNamesValue != null) { XMLConversionManager xmlConversionManager = ((SDOXMLHelper) aHelperContext.getXMLHelper()).getXmlConversionManager(); java.util.List names = xmlConversionManager.convertObject(aliasNamesValue, java.util.List.class); @@ -1708,13 +1708,13 @@ private SDOType processSimpleComponentAnnotations(SDOType owningType, SimpleComp } //readOnly annotation - String readOnlyValue = (String) simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_READONLY_QNAME); + String readOnlyValue = simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_READONLY_QNAME); if (readOnlyValue != null) { p.setReadOnly(Boolean.parseBoolean(readOnlyValue)); } //dataType annotation - String dataTypeValue = (String) simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_DATATYPE_QNAME); + String dataTypeValue = simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_DATATYPE_QNAME); if (dataTypeValue != null) { QName xsdQName = ((SDOTypeHelper) aHelperContext.getTypeHelper()).getXSDTypeFromSDOType(sdoPropertyType); if ((xsdQName == null) && !sdoPropertyType.isDataType()) { @@ -1728,7 +1728,7 @@ private SDOType processSimpleComponentAnnotations(SDOType owningType, SimpleComp } //string annotation - String stringValue = (String) simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_STRING_QNAME); + String stringValue = simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_STRING_QNAME); if (stringValue != null) { QName xsdTypeQName = getQNameForString(defaultNamespace, simpleComponent.getType()); p.setXsdType(xsdTypeQName); @@ -1736,7 +1736,7 @@ private SDOType processSimpleComponentAnnotations(SDOType owningType, SimpleComp } //name annotation - String nameValue = (String) simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_NAME_QNAME); + String nameValue = simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_NAME_QNAME); if (nameValue != null) { //itemNameToSDOName.put(sdoTypeName, nameValue); p.setName(nameValue); @@ -1752,7 +1752,7 @@ private SDOType processSimpleComponentAnnotations(SDOType owningType, SimpleComp } // propertyType annotation - String propertyTypeValue = (String) simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_PROPERTYTYPE_QNAME); + String propertyTypeValue = simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_PROPERTYTYPE_QNAME); if (propertyTypeValue != null) { String uri = targetNamespace; int colonIndex = propertyTypeValue.indexOf(':'); @@ -1765,7 +1765,7 @@ private SDOType processSimpleComponentAnnotations(SDOType owningType, SimpleComp nonContainmentReference.setPropertyTypeURI(uri); nonContainmentReference.setOwningType(owningType); nonContainmentReference.setOwningProp(p); - String oppositePropValue = (String) simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_OPPOSITEPROPERTY_QNAME); + String oppositePropValue = simpleComponent.getAttributesMap().get(SDOConstants.SDOXML_OPPOSITEPROPERTY_QNAME); nonContainmentReference.setOppositePropName(oppositePropValue); getNonContainmentReferences().add(nonContainmentReference); @@ -1810,9 +1810,9 @@ private void postProcessing() { Iterator iter = getGlobalRefs().keySet().iterator(); while (iter.hasNext()) { - Object nextKey = iter.next(); + Type nextKey = iter.next(); java.util.List value = getGlobalRefs().get(nextKey); - java.util.List refsToRemove = new ArrayList(); + java.util.List refsToRemove = new ArrayList<>(); if (value != null) { for (int i = 0; i < value.size(); i++) { GlobalRef nextGlobalRef = value.get(i); @@ -1831,7 +1831,7 @@ private void postProcessing() { private void addGlobalRef(GlobalRef ref) { java.util.List refs = getGlobalRefs().get(ref.getOwningType()); if (null == refs) { - refs = new ArrayList(); + refs = new ArrayList<>(); refs.add(ref); getGlobalRefs().put(ref.getOwningType(), refs); } else { @@ -1845,7 +1845,7 @@ private void addGlobalRef(GlobalRef ref) { */ private void initialize() { if (null == packageName) { - String packageValue = (String) rootSchema.getAttributesMap().get(SDOConstants.SDOJAVA_PACKAGE_QNAME); + String packageValue = rootSchema.getAttributesMap().get(SDOConstants.SDOJAVA_PACKAGE_QNAME); if (null != packageValue) { packageName = packageValue; } else if ((null == rootSchema.getTargetNamespace()) || rootSchema.getTargetNamespace().equals(SDOConstants.EMPTY_STRING)) { @@ -1905,7 +1905,7 @@ private SDOType getSDOTypeForName(String targetNamespace, String defaultNamespac return sdoType; } else { - String sdoName = (String) itemNameToSDOName.get(name); + String sdoName = itemNameToSDOName.get(name); if (sdoName != null) { name = sdoName; } @@ -1992,7 +1992,7 @@ private SDOType findSdoType(String targetNamespace, String defaultNamespace, Str // Do not execute the following if theURI isn't the target namespace if (type == null && ((theURI != null && theURI.equals(targetNamespace)) || (theURI == null && targetNamespace == null))) { processGlobalItem(targetNamespace, defaultNamespace, qualifiedName); - String sdoName = (String) itemNameToSDOName.get(localName); + String sdoName = itemNameToSDOName.get(localName); if (sdoName != null) { localName = sdoName; } @@ -2032,14 +2032,14 @@ public void setAnonymousTypes(java.util.List anonymousTypes) { public Map getGeneratedTypes() { if (null == generatedTypes) { - generatedTypes = new HashMap(); + generatedTypes = new HashMap<>(); } return generatedTypes; } public Map getGeneratedGlobalElements() { if (null == generatedGlobalElements) { - generatedGlobalElements = new HashMap(); + generatedGlobalElements = new HashMap<>(); } return generatedGlobalElements; } @@ -2054,15 +2054,15 @@ public void setGeneratedTypesByXsdQName(Map generatedTypesByXsdQ public Map getGeneratedGlobalAttributes() { if (null == generatedGlobalAttributes) { - generatedGlobalAttributes = new HashMap(); + generatedGlobalAttributes = new HashMap<>(); } return generatedGlobalAttributes; } - private void processSubstitutionGroups(Collection elements, String targetNamespace, String defaultNamespace) { - Iterator elementsIter = elements.iterator(); + private void processSubstitutionGroups(Collection elements, String targetNamespace, String defaultNamespace) { + Iterator elementsIter = elements.iterator(); while (elementsIter.hasNext()) { - Element nextElement = (Element) elementsIter.next(); + Element nextElement = elementsIter.next(); if (nextElement.getSubstitutionGroup() != null) { String substitutionGroup = nextElement.getSubstitutionGroup(); String localName = null; @@ -2082,7 +2082,7 @@ private void processSubstitutionGroups(Collection elements, String targetNamespa if (rootProp != null && thisProperty != null) { if (rootProp.getSubstitutableElements() == null) { - rootProp.setSubstitutableElements(new java.util.ArrayList()); + rootProp.setSubstitutableElements(new java.util.ArrayList<>()); rootProp.setSubstitutable(true); } rootProp.getSubstitutableElements().add(thisProperty); @@ -2100,7 +2100,7 @@ private SDOType getTypeForName(String targetNamespace, String defaultNamespace, if (value != null) { return (SDOType) value; } else { - String sdoName = (String) itemNameToSDOName.get(typeName); + String sdoName = itemNameToSDOName.get(typeName); if (sdoName != null) { return getTypeForName(targetNamespace, defaultNamespace, sdoName); } else { @@ -2138,13 +2138,13 @@ private void processGlobalItem(String targetNamespace, String defaultNamespace, localName = qualifiedName; } - SimpleType simpleType = (SimpleType) rootSchema.getTopLevelSimpleTypes().get(localName); + SimpleType simpleType = rootSchema.getTopLevelSimpleTypes().get(localName); if (simpleType == null) { - ComplexType complexType = (ComplexType) rootSchema.getTopLevelComplexTypes().get(localName); + ComplexType complexType = rootSchema.getTopLevelComplexTypes().get(localName); if (complexType == null) { - Element element = (Element) rootSchema.getTopLevelElements().get(localName); + Element element = rootSchema.getTopLevelElements().get(localName); if (element == null) { - Attribute attribute = (Attribute) rootSchema.getTopLevelAttributes().get(localName); + Attribute attribute = rootSchema.getTopLevelAttributes().get(localName); if (attribute != null) { processGlobalAttribute(targetNamespace, defaultNamespace, attribute); } @@ -2204,10 +2204,10 @@ public Schema getSchema(Source xsdSource, SchemaResolverWrapper schemaResolverWr closeSource(xsdSource); } //populate Imports - java.util.List imports = schema.getImports(); - Iterator iter = imports.iterator(); + java.util.List imports = schema.getImports(); + Iterator iter = imports.iterator(); while (iter.hasNext()) { - Import nextImport = (Import) iter.next(); + Import nextImport = iter.next(); Source referencedSchema = getReferencedSchema(xsdSource, nextImport.getNamespace(), nextImport.getSchemaLocation(), schemaResolverWrapper); if (referencedSchema != null) { Schema importedSchema = getSchema(referencedSchema, schemaResolverWrapper, true); @@ -2216,10 +2216,10 @@ public Schema getSchema(Source xsdSource, SchemaResolverWrapper schemaResolverWr } //populate includes - java.util.List includes = schema.getIncludes(); - Iterator includesIter = includes.iterator(); + java.util.List includes = schema.getIncludes(); + Iterator includesIter = includes.iterator(); while (includesIter.hasNext()) { - Include nextInclude = (Include) includesIter.next(); + Include nextInclude = includesIter.next(); Source referencedSchema = getReferencedSchema(xsdSource, schema.getTargetNamespace(), nextInclude.getSchemaLocation(), schemaResolverWrapper); if (referencedSchema != null) { @@ -2232,7 +2232,7 @@ public Schema getSchema(Source xsdSource, SchemaResolverWrapper schemaResolverWr } private void closeSource(Source source){ - if(source != null && source instanceof StreamSource){ + if(source instanceof StreamSource){ StreamSource ss = (StreamSource)source; try{ if(ss.getInputStream() != null){ @@ -2309,7 +2309,7 @@ private String getURIForPrefix(String prefix) { return uri; } - public class NonContainmentReference { + public static class NonContainmentReference { private SDOType owningType; private SDOProperty owningProp; private String propertyTypeName; @@ -2363,7 +2363,7 @@ public String getOppositePropName() { } } - public class GlobalRef { + public static class GlobalRef { private SDOType owningType; private boolean isElement; private String uri; @@ -2419,14 +2419,14 @@ public void setIsElement(boolean isElem) { private java.util.List getNonContainmentReferences() { if (null == nonContainmentReferences) { - nonContainmentReferences = new ArrayList(); + nonContainmentReferences = new ArrayList<>(); } return nonContainmentReferences; } private Map> getGlobalRefs() { if (null == globalRefs) { - globalRefs = new HashMap>(); + globalRefs = new HashMap<>(); } return globalRefs; } @@ -2465,7 +2465,7 @@ private void preprocessGlobalTypes(Schema schema) { * Return the SDOType (new or existing) corresponding to this complex type. */ private SDOType preprocessComplexType(ComplexType complexType, Schema schema) { - String typeName = (String) complexType.getAttributesMap().get(SDOConstants.SDOXML_NAME_QNAME); + String typeName = complexType.getAttributesMap().get(SDOConstants.SDOXML_NAME_QNAME); if(null == typeName) { typeName = complexType.getName(); } @@ -2498,7 +2498,7 @@ private SDOType preprocessComplexType(ComplexType complexType, Schema schema) { * Return the SDODataType (new or existing) corresponding to this simple type. */ private SDODataType preprocessSimpleType(SimpleType simpleType, Schema schema) { - String typeName = (String) simpleType.getAttributesMap().get(SDOConstants.SDOXML_NAME_QNAME); + String typeName = simpleType.getAttributesMap().get(SDOConstants.SDOXML_NAME_QNAME); if(null == typeName) { typeName = simpleType.getName(); } @@ -2516,7 +2516,7 @@ private SDODataType preprocessSimpleType(SimpleType simpleType, Schema schema) { return (SDODataType)existingType; } sdoDataType = new SDODataType(typeURI, typeName, sdoTypeHelper); - String instanceClassValue = (String) simpleType.getAttributesMap().get(SDOConstants.SDOJAVA_INSTANCECLASS_QNAME); + String instanceClassValue = simpleType.getAttributesMap().get(SDOConstants.SDOJAVA_INSTANCECLASS_QNAME); if (instanceClassValue != null) { sdoDataType.setInstanceProperty(SDOConstants.JAVA_CLASS_PROPERTY, instanceClassValue); } diff --git a/utils/eclipselink.dbws.builder.test.oracle/src/it/java/dbws/testing/simpletablewithnestedsql/SimpleTableWithNestedSQLTestSuite.java b/utils/eclipselink.dbws.builder.test.oracle/src/it/java/dbws/testing/simpletablewithnestedsql/SimpleTableWithNestedSQLTestSuite.java index 0c98c3f9dbe..d6f87c0524a 100644 --- a/utils/eclipselink.dbws.builder.test.oracle/src/it/java/dbws/testing/simpletablewithnestedsql/SimpleTableWithNestedSQLTestSuite.java +++ b/utils/eclipselink.dbws.builder.test.oracle/src/it/java/dbws/testing/simpletablewithnestedsql/SimpleTableWithNestedSQLTestSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -209,9 +209,9 @@ public void validateElementRefType() throws TransformerFactoryConfigurationError XMLUnmarshaller unmarshaller = xmlContext2.createUnmarshaller(); Schema schema = (Schema)unmarshaller.unmarshal(new StringReader(sw.toString())); ComplexType findByNameResponseType = - (ComplexType) schema.getTopLevelComplexTypes().get(FINDBYNAME_RESPONSETYPE); - Element result = (Element)findByNameResponseType.getSequence().getElements().get(0); - Element unnamed = (Element)result.getComplexType().getSequence().getElements().get(0); + schema.getTopLevelComplexTypes().get(FINDBYNAME_RESPONSETYPE); + Element result = findByNameResponseType.getSequence().getElements().get(0); + Element unnamed = result.getComplexType().getSequence().getElements().get(0); assertTrue("wrong refType for " + FINDBYNAME_RESPONSETYPE, TABLE_ALIAS.equals(unnamed.getRef())); } } diff --git a/utils/org.eclipse.persistence.dbws.builder/src/it/java/dbws/testing/simpletablewithnestedsql/SimpleTableWithNestedSQLTestSuite.java b/utils/org.eclipse.persistence.dbws.builder/src/it/java/dbws/testing/simpletablewithnestedsql/SimpleTableWithNestedSQLTestSuite.java index 1b7dc9b97ac..ac9216eb928 100644 --- a/utils/org.eclipse.persistence.dbws.builder/src/it/java/dbws/testing/simpletablewithnestedsql/SimpleTableWithNestedSQLTestSuite.java +++ b/utils/org.eclipse.persistence.dbws.builder/src/it/java/dbws/testing/simpletablewithnestedsql/SimpleTableWithNestedSQLTestSuite.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 @@ -205,9 +205,9 @@ public void start() { unmarshaller = xmlContext2.createUnmarshaller(); Schema schema = (Schema)unmarshaller.unmarshal(new StringReader(sw.toString())); ComplexType findByNameResponseType = - (ComplexType) schema.getTopLevelComplexTypes().get(FINDBYNAME_RESPONSETYPE); - Element result = (Element)findByNameResponseType.getSequence().getElements().get(0); - Element unnamed = (Element)result.getComplexType().getSequence().getElements().get(0); + schema.getTopLevelComplexTypes().get(FINDBYNAME_RESPONSETYPE); + Element result = findByNameResponseType.getSequence().getElements().get(0); + Element unnamed = result.getComplexType().getSequence().getElements().get(0); assertTrue("wrong refType for " + FINDBYNAME_RESPONSETYPE, TABLE_ALIAS.equals(unnamed.getRef())); } From 559cb3fbea0633f58278733dbd610967fbca9a35 Mon Sep 17 00:00:00 2001 From: Lukas Jungmann Date: Wed, 22 Sep 2021 01:03:30 +0200 Subject: [PATCH 2/6] don't change bigdecimal creation Signed-off-by: Lukas Jungmann --- .../persistence/internal/helper/ConversionManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConversionManager.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConversionManager.java index f20182b3bae..4d828b80068 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConversionManager.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConversionManager.java @@ -285,7 +285,7 @@ protected BigDecimal convertObjectToBigDecimal(Object sourceObject) throws Conve // treated as BigDecimal(1). String numberString = String.valueOf(sourceObject); if(numberString.endsWith(".0") || numberString.contains(".0E+")) { - bigDecimal = BigDecimal.valueOf(((Number) sourceObject).doubleValue()); + bigDecimal = new BigDecimal(((Number)sourceObject).doubleValue()); } else { bigDecimal = new BigDecimal(numberString); } @@ -686,7 +686,7 @@ protected BigDecimal convertObjectToNumber(Object sourceObject) throws Conversio } if (sourceObject instanceof Number) { - return BigDecimal.valueOf(((Number) sourceObject).doubleValue()); + return new BigDecimal(((Number)sourceObject).doubleValue()); } if (sourceObject instanceof Boolean) { From c5edd2248324841a45648f470d847cebee101512 Mon Sep 17 00:00:00 2001 From: Lukas Jungmann Date: Wed, 22 Sep 2021 02:05:41 +0200 Subject: [PATCH 3/6] attempt to harden modules with no warnings, warning means compile-time error here Signed-off-by: Lukas Jungmann --- bundles/tests/pom.xml | 13 +++++++++++++ .../osgi/beanvalidation/BeanValidationTest.java | 4 ++-- .../osgi/beanvalidation/NoBeanValidationTest.java | 4 ++-- dbws/eclipselink.dbws.test.oracle/pom.xml | 13 +++++++++++++ .../plsqlcollection/PLSQLcollectionTestSuite.java | 3 +-- .../sessions/serializers/kryo/KryoSerializer.java | 3 +++ jpa/eclipselink.jpa.nosql.test/pom.xml | 13 +++++++++++++ .../testing/framework/server/TestRunnerBean.java | 10 +++++----- .../framework/server/TestRunnerBean.java_nonjtaDS | 8 ++++---- jpa/eclipselink.jpa.spring.test/pom.xml | 13 +++++++++++++ .../tests/jpa/spring/EntityManagerWrapper.java | 4 ++-- jpa/org.eclipse.persistence.jpars/pom.xml | 13 +++++++++++++ sdo/eclipselink.sdo.test.server/pom.xml | 13 +++++++++++++ .../persistence/testing/sdo/server/DeptImpl.java | 2 ++ .../sdo/server/DeptServiceInitException.java | 4 +++- utils/eclipselink.dbws.builder.test.oracle/pom.xml | 12 ++++++++++++ .../shadowddlgeneration/oldjpub/ViewCache.java | 2 ++ 17 files changed, 116 insertions(+), 18 deletions(-) diff --git a/bundles/tests/pom.xml b/bundles/tests/pom.xml index 907aba5db1e..ca39f30ab6e 100644 --- a/bundles/tests/pom.xml +++ b/bundles/tests/pom.xml @@ -31,6 +31,10 @@ jar + -Xlint:all + -Xdoclint:all,-missing + -Xlint:all + archive-tmp ${project.build.directory}/stage @@ -174,6 +178,15 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + -Werror + + + org.apache.maven.plugins maven-dependency-plugin diff --git a/bundles/tests/src/test/java/org/eclipse/persistence/testing/osgi/beanvalidation/BeanValidationTest.java b/bundles/tests/src/test/java/org/eclipse/persistence/testing/osgi/beanvalidation/BeanValidationTest.java index 4ef4f669af8..82acf11208f 100644 --- a/bundles/tests/src/test/java/org/eclipse/persistence/testing/osgi/beanvalidation/BeanValidationTest.java +++ b/bundles/tests/src/test/java/org/eclipse/persistence/testing/osgi/beanvalidation/BeanValidationTest.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 @@ -63,7 +63,7 @@ public static Option[] config() { @BeforeClass public static void setUp() throws Exception { - Class[] classes = new Class[1]; + Class[] classes = new Class[1]; classes[0] = Customer.class; jaxbContext = JAXBContextFactory.createContext(classes, null); } diff --git a/bundles/tests/src/test/java/org/eclipse/persistence/testing/osgi/beanvalidation/NoBeanValidationTest.java b/bundles/tests/src/test/java/org/eclipse/persistence/testing/osgi/beanvalidation/NoBeanValidationTest.java index fe5899bc434..9e01e02f98d 100644 --- a/bundles/tests/src/test/java/org/eclipse/persistence/testing/osgi/beanvalidation/NoBeanValidationTest.java +++ b/bundles/tests/src/test/java/org/eclipse/persistence/testing/osgi/beanvalidation/NoBeanValidationTest.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 @@ -52,7 +52,7 @@ public static Option[] config() { @BeforeClass public static void setUp() throws Exception { - Class[] classes = new Class[1]; + Class[] classes = new Class[1]; classes[0] = Customer.class; jaxbContext = JAXBContextFactory.createContext(classes, null); } diff --git a/dbws/eclipselink.dbws.test.oracle/pom.xml b/dbws/eclipselink.dbws.test.oracle/pom.xml index 5925c9ee3a9..d079856edf4 100644 --- a/dbws/eclipselink.dbws.test.oracle/pom.xml +++ b/dbws/eclipselink.dbws.test.oracle/pom.xml @@ -31,6 +31,10 @@ + -Xlint:all + -Xdoclint:all,-missing + -Xlint:all + ${skipTests} @@ -79,6 +83,15 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + -Werror + + + org.apache.maven.plugins maven-surefire-plugin diff --git a/dbws/eclipselink.dbws.test.oracle/src/it/java/dbws/testing/plsqlcollection/PLSQLcollectionTestSuite.java b/dbws/eclipselink.dbws.test.oracle/src/it/java/dbws/testing/plsqlcollection/PLSQLcollectionTestSuite.java index d9f435bd36c..4d17610f3e0 100644 --- a/dbws/eclipselink.dbws.test.oracle/src/it/java/dbws/testing/plsqlcollection/PLSQLcollectionTestSuite.java +++ b/dbws/eclipselink.dbws.test.oracle/src/it/java/dbws/testing/plsqlcollection/PLSQLcollectionTestSuite.java @@ -55,7 +55,6 @@ import org.eclipse.persistence.queries.DatabaseQuery; import org.eclipse.persistence.sessions.DatabaseLogin; import org.eclipse.persistence.sessions.DatabaseSession; -import org.eclipse.persistence.sessions.DatasourceLogin; import org.eclipse.persistence.sessions.Project; import org.eclipse.persistence.sessions.Session; import org.eclipse.persistence.sessions.factories.XMLProjectReader; @@ -292,7 +291,7 @@ public void fromProjectXML() { Class t1Clz = t1Descriptor.getJavaClass(); ((DatabaseSession)session).login(); String[] elements = {"first string", "second string", "third string"}; - NonSynchronizedVector queryArgs = new NonSynchronizedVector(); + NonSynchronizedVector queryArgs = new NonSynchronizedVector<>(); queryArgs.add(elements); queryArgs.add("barf"); boolean worked = false; diff --git a/foundation/org.eclipse.persistence.extension/src/main/java/org/eclipse/persistence/sessions/serializers/kryo/KryoSerializer.java b/foundation/org.eclipse.persistence.extension/src/main/java/org/eclipse/persistence/sessions/serializers/kryo/KryoSerializer.java index 3fa7a67a6b8..2d9b3062913 100644 --- a/foundation/org.eclipse.persistence.extension/src/main/java/org/eclipse/persistence/sessions/serializers/kryo/KryoSerializer.java +++ b/foundation/org.eclipse.persistence.extension/src/main/java/org/eclipse/persistence/sessions/serializers/kryo/KryoSerializer.java @@ -30,6 +30,9 @@ * @author James Sutherland */ public class KryoSerializer extends AbstractSerializer { + + private static final long serialVersionUID = 6538902324232789378L; + /** Kryo is not thread safe, so need thread local. */ transient ThreadLocal kryo; transient Constructor kryoConstructor; diff --git a/jpa/eclipselink.jpa.nosql.test/pom.xml b/jpa/eclipselink.jpa.nosql.test/pom.xml index 2bdb10a9f7d..55ce317b567 100644 --- a/jpa/eclipselink.jpa.nosql.test/pom.xml +++ b/jpa/eclipselink.jpa.nosql.test/pom.xml @@ -31,6 +31,10 @@ + -Xlint:all + -Xdoclint:all,-missing + -Xlint:all + ${db.platform} @@ -188,6 +192,15 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + -Werror + + + org.apache.maven.plugins diff --git a/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java b/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java index cf5589b8d89..fc721911a7c 100644 --- a/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java +++ b/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.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 @@ -12,7 +12,7 @@ // Contributors: // Oracle - initial API and implementation from Oracle TopLink - package org.eclipse.persistence.testing.framework.server; +package org.eclipse.persistence.testing.framework.server; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -58,9 +58,9 @@ public Throwable runTest(String className, String test, Properties props) { // load the test class and create an instance TestCase testInstance = null; try { - Class testClass = getClass().getClassLoader().loadClass(className); - Constructor c = testClass.getConstructor(new Class[] { String.class }); - testInstance = (TestCase) c.newInstance(new Object[] { test }); + Class testClass = (Class) getClass().getClassLoader().loadClass(className); + Constructor c = testClass.getConstructor(String.class); + testInstance = c.newInstance(test); } catch (ClassNotFoundException e) { throw new EJBException(e); } catch (NoSuchMethodException e) { diff --git a/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java_nonjtaDS b/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java_nonjtaDS index 22c4d0554a3..8426243f7c6 100644 --- a/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java_nonjtaDS +++ b/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java_nonjtaDS @@ -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 @@ -58,9 +58,9 @@ public class TestRunnerBean implements TestRunner { // load the test class and create an instance TestCase testInstance = null; try { - Class testClass = getClass().getClassLoader().loadClass(className); - Constructor c = testClass.getConstructor(new Class[] { String.class }); - testInstance = (TestCase) c.newInstance(new Object[] { test }); + Class testClass = (Class) getClass().getClassLoader().loadClass(className); + Constructor c = testClass.getConstructor(String.class); + testInstance = c.newInstance(test); } catch (ClassNotFoundException e) { throw new EJBException(e); } catch (NoSuchMethodException e) { diff --git a/jpa/eclipselink.jpa.spring.test/pom.xml b/jpa/eclipselink.jpa.spring.test/pom.xml index 4cf6f9b924f..fe6ded19074 100644 --- a/jpa/eclipselink.jpa.spring.test/pom.xml +++ b/jpa/eclipselink.jpa.spring.test/pom.xml @@ -31,6 +31,10 @@ + -Xlint:all + -Xdoclint:all,-missing + -Xlint:all + ${db.platform} @@ -140,6 +144,15 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + -Werror + + + org.apache.maven.plugins maven-surefire-plugin diff --git a/jpa/eclipselink.jpa.spring.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/spring/EntityManagerWrapper.java b/jpa/eclipselink.jpa.spring.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/spring/EntityManagerWrapper.java index f32995e396f..887e9b33f82 100644 --- a/jpa/eclipselink.jpa.spring.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/spring/EntityManagerWrapper.java +++ b/jpa/eclipselink.jpa.spring.test/src/it/java/org/eclipse/persistence/testing/tests/jpa/spring/EntityManagerWrapper.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 @@ -96,7 +96,7 @@ public int executeNativeQuery(String string) { return em.createNativeQuery(string).executeUpdate(); } - public Query createNativeQuery(String string, Class clazz) { + public Query createNativeQuery(String string, Class clazz) { return em.createNativeQuery(string, clazz); } diff --git a/jpa/org.eclipse.persistence.jpars/pom.xml b/jpa/org.eclipse.persistence.jpars/pom.xml index 6ec0e5dad5f..9f553050766 100644 --- a/jpa/org.eclipse.persistence.jpars/pom.xml +++ b/jpa/org.eclipse.persistence.jpars/pom.xml @@ -30,6 +30,10 @@ + -Xlint:all + -Xdoclint:all,-missing + -Xlint:all + ${db.user} @@ -120,6 +124,15 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + -Werror + + + org.apache.maven.plugins maven-surefire-plugin diff --git a/sdo/eclipselink.sdo.test.server/pom.xml b/sdo/eclipselink.sdo.test.server/pom.xml index 3d1d06985b9..e6376df7e4f 100644 --- a/sdo/eclipselink.sdo.test.server/pom.xml +++ b/sdo/eclipselink.sdo.test.server/pom.xml @@ -31,6 +31,10 @@ + -Xlint:all + -Xdoclint:all,-missing + -Xlint:all + true jdbc/EclipseLinkDS @@ -102,6 +106,15 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + -Werror + + + org.apache.maven.plugins diff --git a/sdo/eclipselink.sdo.test.server/src/it/java/org/eclipse/persistence/testing/sdo/server/DeptImpl.java b/sdo/eclipselink.sdo.test.server/src/it/java/org/eclipse/persistence/testing/sdo/server/DeptImpl.java index bef1363f4b7..f5eb4c6cb3e 100644 --- a/sdo/eclipselink.sdo.test.server/src/it/java/org/eclipse/persistence/testing/sdo/server/DeptImpl.java +++ b/sdo/eclipselink.sdo.test.server/src/it/java/org/eclipse/persistence/testing/sdo/server/DeptImpl.java @@ -18,6 +18,8 @@ public class DeptImpl extends SDODataObject implements Dept { + private static final long serialVersionUID = 4475447330847016834L; + public static final int START_PROPERTY_INDEX = 0; public static final int END_PROPERTY_INDEX = START_PROPERTY_INDEX + 3; diff --git a/sdo/eclipselink.sdo.test.server/src/it/java/org/eclipse/persistence/testing/sdo/server/DeptServiceInitException.java b/sdo/eclipselink.sdo.test.server/src/it/java/org/eclipse/persistence/testing/sdo/server/DeptServiceInitException.java index bc49a5114cf..9cf8cdc2fc9 100644 --- a/sdo/eclipselink.sdo.test.server/src/it/java/org/eclipse/persistence/testing/sdo/server/DeptServiceInitException.java +++ b/sdo/eclipselink.sdo.test.server/src/it/java/org/eclipse/persistence/testing/sdo/server/DeptServiceInitException.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 @@ -19,6 +19,8 @@ */ public class DeptServiceInitException extends RuntimeException { + private static final long serialVersionUID = 2104702765526786415L; + public DeptServiceInitException(Throwable cause) { super(cause); } diff --git a/utils/eclipselink.dbws.builder.test.oracle/pom.xml b/utils/eclipselink.dbws.builder.test.oracle/pom.xml index bcbb106c3f4..7a5ee1eed13 100644 --- a/utils/eclipselink.dbws.builder.test.oracle/pom.xml +++ b/utils/eclipselink.dbws.builder.test.oracle/pom.xml @@ -31,6 +31,9 @@ + -Xlint:all + -Xdoclint:all,-missing + -Xlint:all ${skipTests} @@ -101,6 +104,15 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + -Werror + + + org.apache.maven.plugins maven-surefire-plugin diff --git a/utils/eclipselink.dbws.builder.test.oracle/src/it/java/dbws/testing/shadowddlgeneration/oldjpub/ViewCache.java b/utils/eclipselink.dbws.builder.test.oracle/src/it/java/dbws/testing/shadowddlgeneration/oldjpub/ViewCache.java index 50b3adcdc15..2f9d5c50139 100644 --- a/utils/eclipselink.dbws.builder.test.oracle/src/it/java/dbws/testing/shadowddlgeneration/oldjpub/ViewCache.java +++ b/utils/eclipselink.dbws.builder.test.oracle/src/it/java/dbws/testing/shadowddlgeneration/oldjpub/ViewCache.java @@ -39,6 +39,8 @@ @SuppressWarnings({"unchecked","rawtypes"}) public class ViewCache implements Externalizable { + private static final long serialVersionUID = 5009092516275895424L; + static final String VIEW_CACHE_PREFIX = "viewcachefor"; public static final String PARAMETER_USER = "USER"; public static final String PARAMETER_ALL = "ALL"; From 0e1a804275d73d38bdb70507837d37bcbfd4265e Mon Sep 17 00:00:00 2001 From: Lukas Jungmann Date: Wed, 22 Sep 2021 08:16:24 +0200 Subject: [PATCH 4/6] hide corba dependencies in osgi tests for now Signed-off-by: Lukas Jungmann --- bundles/tests/pom.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bundles/tests/pom.xml b/bundles/tests/pom.xml index ca39f30ab6e..78ddf5f01c3 100644 --- a/bundles/tests/pom.xml +++ b/bundles/tests/pom.xml @@ -90,16 +90,16 @@ parsson test - - org.glassfish.corba - glassfish-corba-omgapi - test - - - org.glassfish.corba - glassfish-corba-orb - test - + + + + + + + + + + junit junit From 76a6bb978abd4f3a4b9be216f67fe5ecf0ac4234 Mon Sep 17 00:00:00 2001 From: Lukas Jungmann Date: Wed, 22 Sep 2021 08:48:13 +0200 Subject: [PATCH 5/6] jpa.nosql build fix Signed-off-by: Lukas Jungmann --- jpa/eclipselink.jpa.nosql.test/pom.xml | 1 + .../persistence/testing/framework/server/TestRunnerBean.java | 1 + .../testing/framework/server/TestRunnerBean.java_nonjtaDS | 1 + 3 files changed, 3 insertions(+) diff --git a/jpa/eclipselink.jpa.nosql.test/pom.xml b/jpa/eclipselink.jpa.nosql.test/pom.xml index 55ce317b567..2b5a6be053d 100644 --- a/jpa/eclipselink.jpa.nosql.test/pom.xml +++ b/jpa/eclipselink.jpa.nosql.test/pom.xml @@ -199,6 +199,7 @@ -Werror + none diff --git a/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java b/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java index fc721911a7c..14305e5b416 100644 --- a/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java +++ b/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java @@ -58,6 +58,7 @@ public Throwable runTest(String className, String test, Properties props) { // load the test class and create an instance TestCase testInstance = null; try { + @SuppressWarnings({"unchecked"}) Class testClass = (Class) getClass().getClassLoader().loadClass(className); Constructor c = testClass.getConstructor(String.class); testInstance = c.newInstance(test); diff --git a/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java_nonjtaDS b/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java_nonjtaDS index 8426243f7c6..fff6625dff1 100644 --- a/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java_nonjtaDS +++ b/jpa/eclipselink.jpa.nosql.test/src/it/java-templates/org/eclipse/persistence/testing/framework/server/TestRunnerBean.java_nonjtaDS @@ -58,6 +58,7 @@ public class TestRunnerBean implements TestRunner { // load the test class and create an instance TestCase testInstance = null; try { + @SuppressWarnings({"unchecked"}) Class testClass = (Class) getClass().getClassLoader().loadClass(className); Constructor c = testClass.getConstructor(String.class); testInstance = c.newInstance(test); From 0d12bf797dde382cbf7df47f12b73d91860cc354 Mon Sep 17 00:00:00 2001 From: Lukas Jungmann Date: Wed, 22 Sep 2021 10:33:52 +0200 Subject: [PATCH 6/6] fix wrong collection lookup Signed-off-by: Lukas Jungmann --- .../eclipse/persistence/jaxb/compiler/MappingsGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/MappingsGenerator.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/MappingsGenerator.java index 974d92f3fb0..3d96104cd88 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/MappingsGenerator.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/compiler/MappingsGenerator.java @@ -2160,7 +2160,7 @@ private Mapping generateMappingForType(JavaClass theType, String attributeName){ QName schemaType = userDefinedSchemaTypes.get(theType.getQualifiedName()); if (schemaType == null) { - schemaType = helper.getXMLToJavaTypeMap().get(theType); + schemaType = helper.getXMLToJavaTypeMap().get(theType.getName()); } ((Field) mapping.getField()).setSchemaType(schemaType); if(info != null && info.isEnumerationType()) {