initial cleanup in helpers and custom collections,
minor updates to dbws
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/dbws/org.eclipse.persistence.dbws/src/it/java/dbws/testing/keymappings/KeyMappingsTestSuite.java b/dbws/org.eclipse.persistence.dbws/src/it/java/dbws/testing/keymappings/KeyMappingsTestSuite.java
index 20cc162..6073a76 100644
--- a/dbws/org.eclipse.persistence.dbws/src/it/java/dbws/testing/keymappings/KeyMappingsTestSuite.java
+++ b/dbws/org.eclipse.persistence.dbws/src/it/java/dbws/testing/keymappings/KeyMappingsTestSuite.java
@@ -731,7 +731,6 @@
comparer.isNodeEqual(controlDoc, doc));
}
- @SuppressWarnings("unchecked")
@Test
public void buildEmployees() {
XMLUnmarshaller unMarshaller = xrService.getXMLContext().createUnmarshaller();
diff --git a/dbws/org.eclipse.persistence.dbws/src/it/java/dbws/testing/relationships/RelationshipsEmployee.java b/dbws/org.eclipse.persistence.dbws/src/it/java/dbws/testing/relationships/RelationshipsEmployee.java
index f6dbafd..df94f95 100644
--- a/dbws/org.eclipse.persistence.dbws/src/it/java/dbws/testing/relationships/RelationshipsEmployee.java
+++ b/dbws/org.eclipse.persistence.dbws/src/it/java/dbws/testing/relationships/RelationshipsEmployee.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,8 +33,8 @@
public String gender;
public BigDecimal salary;
public RelationshipsAddress address;
- public Collection<RelationshipsPhone> phones = new ArrayList<RelationshipsPhone>();
- public Collection<String> responsibilities = new ArrayList<String>();
+ public Collection<RelationshipsPhone> phones = new ArrayList<>();
+ public Collection<String> responsibilities = new ArrayList<>();
public RelationshipsEmployee() {
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/it/java/dbws/testing/xrdynamicentity/XRDynamicEntityTestSuite.java b/dbws/org.eclipse.persistence.dbws/src/it/java/dbws/testing/xrdynamicentity/XRDynamicEntityTestSuite.java
index 1dc8a68..0bd2898 100644
--- a/dbws/org.eclipse.persistence.dbws/src/it/java/dbws/testing/xrdynamicentity/XRDynamicEntityTestSuite.java
+++ b/dbws/org.eclipse.persistence.dbws/src/it/java/dbws/testing/xrdynamicentity/XRDynamicEntityTestSuite.java
@@ -50,7 +50,7 @@
@BeforeClass
public static void setUp() throws NoSuchFieldException, IllegalArgumentException,
IllegalAccessException {
- Set<String> propertyNames = new HashSet<String>();
+ Set<String> propertyNames = new HashSet<>();
propertyNames.add(FIELD_1);
propertyNames.add(FIELD_2);
XRCustomer.DPM.setPropertyNames(propertyNames);
@@ -95,7 +95,7 @@
(Class<XRDynamicEntity>)xrdcl.createDynamicClass(TEST_CLASSNAME);
XRDynamicEntity newInstance = testClass.getConstructor().newInstance();
XRDynamicPropertiesManager xrDPM = newInstance.fetchPropertiesManager();
- Set<String> propertyNames = new HashSet<String>();
+ Set<String> propertyNames = new HashSet<>();
propertyNames.add(FIELD_1);
propertyNames.add(FIELD_2);
xrDPM.setPropertyNames(propertyNames);
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 172bbe3..29ca226 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
@@ -183,7 +183,7 @@
}
protected InputStream initXRSchemaStream(ClassLoader parentClassLoader, ServletContext sc) {
- InputStream xrSchemaStream = null;
+ InputStream xrSchemaStream;
String path = WSDL_DIR + DBWS_SCHEMA_XML;
if (sc != null) {
path = "/" + WEB_INF_DIR + path;
@@ -200,7 +200,7 @@
}
protected InputStream initWSDLInputStream(ClassLoader parentClassLoader, ServletContext sc) {
- InputStream wsdlInputStream = null;
+ InputStream wsdlInputStream;
String path = WSDL_DIR + DBWS_WSDL;
if (sc != null) {
path = "/" + WEB_INF_DIR + path;
@@ -430,11 +430,11 @@
if (mtomEnabled) {
attachments = (Map<String, DataHandler>)mc.get(INBOUND_MESSAGE_ATTACHMENTS);
}
- SOAPMessage response = null;
- boolean usesSOAP12 = false;
+ SOAPMessage response;
+ boolean usesSOAP12;
DBWSAdapter dbwsAdapter = (DBWSAdapter)xrService;
- SOAPEnvelope envelope = null;
+ SOAPEnvelope envelope;
try {
envelope = request.getSOAPPart().getEnvelope();
}
@@ -454,15 +454,15 @@
}
if (body == null) {
- SOAPFault soapFault = null;
+ SOAPFault soapFault;
try {
- SOAPFactory soapFactory = null;
+ SOAPFactory soapFactory;
if (usesSOAP12) {
soapFactory = SOAPFactory.newInstance(SOAP_1_2_PROTOCOL);
} else {
soapFactory = SOAPFactory.newInstance();
}
- QName faultCodeQName = null;
+ QName faultCodeQName;
if (usesSOAP12) {
faultCodeQName = SENDER_QNAME;
} else {
@@ -475,7 +475,7 @@
throw new SOAPFaultException(soapFault);
}
- XMLRoot xmlRoot = null;
+ XMLRoot xmlRoot;
try {
XMLContext xmlContext = dbwsAdapter.getXMLContext();
XMLUnmarshaller unmarshaller = xmlContext.createUnmarshaller();
@@ -529,15 +529,15 @@
xmlRoot = (XMLRoot)unmarshaller.unmarshal(body, Invocation.class);
}
catch (Exception e) {
- SOAPFault soapFault = null;
+ SOAPFault soapFault;
try {
- SOAPFactory soapFactory = null;
+ SOAPFactory soapFactory;
if (usesSOAP12) {
soapFactory = SOAPFactory.newInstance(SOAP_1_2_PROTOCOL);
} else {
soapFactory = SOAPFactory.newInstance();
}
- QName faultCodeQName = null;
+ QName faultCodeQName;
if (usesSOAP12) {
faultCodeQName = SENDER_QNAME;
} else {
@@ -606,7 +606,7 @@
// incoming attachments ?
}
}
- Object result = null;
+ Object result;
try {
result = op.invoke(dbwsAdapter, invocation);
if (result instanceof ValueObject) {
@@ -622,15 +622,15 @@
response = responseWriter.generateResponse(op, usesSOAP12, e);
}
catch (SOAPException soape1) {
- SOAPFault soapFault = null;
+ SOAPFault soapFault;
try {
- SOAPFactory soapFactory = null;
+ SOAPFactory soapFactory;
if (usesSOAP12) {
soapFactory = SOAPFactory.newInstance(SOAP_1_2_PROTOCOL);
} else {
soapFactory = SOAPFactory.newInstance();
}
- QName faultCodeQName = null;
+ QName faultCodeQName;
if (usesSOAP12) {
faultCodeQName = RECEIVER_QNAME;
} else {
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/dbws/SOAPAttachmentHandler.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/dbws/SOAPAttachmentHandler.java
index fc38f06..670f789 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/dbws/SOAPAttachmentHandler.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/dbws/SOAPAttachmentHandler.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,7 @@
public class SOAPAttachmentHandler implements XMLAttachmentMarshaller {
private int count = 0;
- private HashMap<String, DataHandler> attachments = new HashMap<String,DataHandler>();
+ private HashMap<String, DataHandler> attachments = new HashMap<>();
public boolean hasAttachments() {
return attachments.size() > 0;
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/dbws/SOAPResponseWriter.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/dbws/SOAPResponseWriter.java
index 361c4e1..4b237f8 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/dbws/SOAPResponseWriter.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/dbws/SOAPResponseWriter.java
@@ -58,7 +58,7 @@
public class SOAPResponseWriter {
protected DBWSAdapter dbwsAdapter;
- protected Map<String, XMLDescriptor> resultDescriptors = new HashMap<String, XMLDescriptor>();
+ protected Map<String, XMLDescriptor> resultDescriptors = new HashMap<>();
public static final QName RECEIVER_QNAME = new QName(URI_NS_SOAP_1_2_ENVELOPE, "Receiver");
public static final QName SERVER_QNAME = new QName(URI_NS_SOAP_1_1_ENVELOPE, "Server");
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/Descriptor.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/Descriptor.java
index 74480af..a0c3d6f 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/Descriptor.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/Descriptor.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
@@ -26,9 +26,9 @@
protected String name = null;
protected String type = null;
- protected List<LinkTemplate> linkTemplates = new ArrayList<LinkTemplate>();
- protected List<Attribute> attributes = new ArrayList<Attribute>();
- protected List<Query> queries = new ArrayList<Query>();
+ protected List<LinkTemplate> linkTemplates = new ArrayList<>();
+ protected List<Attribute> attributes = new ArrayList<>();
+ protected List<Query> queries = new ArrayList<>();
public String getName() {
return name;
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/ItemLinks.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/ItemLinks.java
index 718e39d..6218c44 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/ItemLinks.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/ItemLinks.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019 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
@@ -43,7 +43,7 @@
*/
public void setLinks(List<LinkV2> links) {
if (this.links == null) {
- this.links = new ArrayList<LinkV2>();
+ this.links = new ArrayList<>();
}
this.links = links;
@@ -56,7 +56,7 @@
*/
public void addLink(LinkV2 link) {
if (this.links == null) {
- this.links = new ArrayList<LinkV2>();
+ this.links = new ArrayList<>();
}
this.links.add(link);
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/PersistenceUnit.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/PersistenceUnit.java
index e4b241a..19e7be3 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/PersistenceUnit.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/PersistenceUnit.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
@@ -25,7 +25,7 @@
public class PersistenceUnit {
protected String persistenceUnitName = null;
- protected List<Link> types = new ArrayList<Link>();
+ protected List<Link> types = new ArrayList<>();
public String getPersistenceUnitName() {
return persistenceUnitName;
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/Query.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/Query.java
index 3e6f195..df03b20 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/Query.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/Query.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
@@ -26,7 +26,7 @@
protected String queryName;
protected String jpql;
protected LinkTemplate linkTemplate;
- protected List<String> returnTypes = new ArrayList<String>();
+ protected List<String> returnTypes = new ArrayList<>();
public Query() {
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/SessionBeanCall.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/SessionBeanCall.java
index 17ebba5..5683ddb 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/SessionBeanCall.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/SessionBeanCall.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
@@ -27,7 +27,7 @@
private String jndiName = null;
private String methodName = null;
private String context = null;
- private List<Parameter> parameters = new ArrayList<Parameter>();
+ private List<Parameter> parameters = new ArrayList<>();
public String getContext() {
return context;
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/v2/ContextsCatalog.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/v2/ContextsCatalog.java
index f6c75b7..e08220c 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/v2/ContextsCatalog.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/v2/ContextsCatalog.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
@@ -45,7 +45,7 @@
*/
public void addContext(Resource context) {
if (items == null) {
- items = new ArrayList<Resource>();
+ items = new ArrayList<>();
}
items.add(context);
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/v2/MetadataCatalog.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/v2/MetadataCatalog.java
index 41a43dd..ae1b97d 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/v2/MetadataCatalog.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/v2/MetadataCatalog.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
@@ -54,7 +54,7 @@
public void addResource(Resource resource) {
if (items == null) {
- items = new ArrayList<Resource>();
+ items = new ArrayList<>();
}
items.add(resource);
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/v2/ResourceSchema.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/v2/ResourceSchema.java
index e4ebe99..ea427d2 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/v2/ResourceSchema.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/jpa/rs/metadata/model/v2/ResourceSchema.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
@@ -108,23 +108,23 @@
public void addProperty(String name, Property property) {
if (properties == null) {
- properties = new ArrayList<JAXBElement>();
+ properties = new ArrayList<>();
}
- properties.add(new JAXBElement<Property>(new QName(name), Property.class, property));
+ properties.add(new JAXBElement<>(new QName(name), Property.class, property));
}
public void addDefinition(String name, ResourceSchema definition) {
// Lazy initialization
if (definitions == null) {
- definitions = new ArrayList<JAXBElement>(1);
+ definitions = new ArrayList<>(1);
}
- definitions.add(new JAXBElement<ResourceSchema>(new QName(name), ResourceSchema.class, definition));
+ definitions.add(new JAXBElement<>(new QName(name), ResourceSchema.class, definition));
}
public void addAllOf(Reference reference) {
// Lazy initialization
if (allOf == null) {
- allOf = new ArrayList<Reference>(1);
+ allOf = new ArrayList<>(1);
}
allOf.add(reference);
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/DeleteOperation.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/DeleteOperation.java
index a0af2ce..15b2429 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/DeleteOperation.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/DeleteOperation.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
@@ -40,7 +40,6 @@
* @author Mike Norman - michael.norman@oracle.com
* @since EclipseLink 1.x
*/
-@SuppressWarnings({"unchecked"})
public class DeleteOperation extends Operation {
protected String descriptorName;
protected ClassDescriptor classDescriptor;
@@ -127,11 +126,11 @@
// set query args or execute args for the non-JPAQuery case,
// i.e. stored proc/funcs get populated from ORM metadata
// whereas named queries (SQL strings) do not...
- List queryArguments = query.getArguments();
+ List<String> queryArguments = query.getArguments();
int queryArgumentsSize = queryArguments.size();
- Vector executeArguments = new NonSynchronizedVector();
+ Vector<Object> executeArguments = new NonSynchronizedVector<>();
for (int i = 0; i < queryArgumentsSize; i++) {
- String argName = (String)queryArguments.get(i);
+ String argName = queryArguments.get(i);
executeArguments.add(invocation.getParameter(argName));
}
toBeDeleted = uow.executeQuery(query, executeArguments);
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/Invocation.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/Invocation.java
index 8f70d87..440b650 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/Invocation.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/Invocation.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 Invocation {
protected String name;
- protected Map<String, Object> parameters = new HashMap<String, Object>();
+ protected Map<String, Object> parameters = new HashMap<>();
public Invocation() {
super();
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/Operation.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/Operation.java
index f4911de..ccb42a7 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/Operation.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/Operation.java
@@ -35,7 +35,7 @@
public abstract class Operation {
protected String name;
- protected List<Parameter> parameters = new ArrayList<Parameter>();
+ protected List<Parameter> parameters = new ArrayList<>();
/**
* <p><b>INTERNAL</b>:
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/ProjectHelper.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/ProjectHelper.java
index baa812e..2ebf6a1 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/ProjectHelper.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/ProjectHelper.java
@@ -69,7 +69,7 @@
e.printStackTrace();
}
}
- Set<String> propertiesNameSet = new HashSet<String>();
+ Set<String> propertiesNameSet = new HashSet<>();
for (Iterator j = desc.getMappings().iterator(); j.hasNext();) {
DatabaseMapping dm = (DatabaseMapping)j.next();
String attributeName = dm.getAttributeName();
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/QNameTransformer.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/QNameTransformer.java
index d40acd7..7f02ee8 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/QNameTransformer.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/QNameTransformer.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
@@ -85,7 +85,7 @@
public static final Map<String, QName> SCHEMA_QNAMES;
static {
- SCHEMA_QNAMES = Collections.unmodifiableMap(new HashMap<String, QName>() {
+ SCHEMA_QNAMES = Collections.unmodifiableMap(new HashMap<>() {
{
put(ANY, ANY_QNAME);
put(ANY_SIMPLE_TYPE, ANY_SIMPLE_TYPE_QNAME);
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/QueryOperation.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/QueryOperation.java
index db03b34..3f6f556 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/QueryOperation.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/QueryOperation.java
@@ -203,7 +203,7 @@
// Made static final for performance reasons.
private static final class DataHandlerInstantiationPolicy extends InstantiationPolicy {
- protected String mimeType;
+ private String mimeType;
public DataHandlerInstantiationPolicy(String mimeType) {
super();
this.mimeType = mimeType;
@@ -418,7 +418,7 @@
if (returnedList.size() > 0 && returnedList.get(0) instanceof Object[]) {
Object[] objs = (Object[]) returnedList.get(0);
if (isCollection()) {
- value = new ArrayList<Object>();
+ value = new ArrayList<>();
for (Object obj : objs) {
((ArrayList<Object>) value).add(obj);
}
@@ -547,7 +547,7 @@
// assumes JPAQuery
JPAQuery jpaQuery = (JPAQuery) queryHandler.getDatabaseQuery();
// to match field names with results, we need to gather the database fields from each of the Output parameters
- List<DatabaseField> paramFlds = new ArrayList<DatabaseField>();
+ List<DatabaseField> paramFlds = new ArrayList<>();
DatasourceCall dsCall = (DatasourceCall) jpaQuery.getDatabaseQuery().getDatasourceCall();
for (Object obj : dsCall.getParameters()) {
if (obj instanceof OutputParameterForCallableStatement) {
@@ -571,20 +571,20 @@
} else {
dr.add(new DatabaseField(RESULT_STR), ((ArrayList<?>) value).get(0));
}
- records = new Vector<DatabaseRecord>();
+ records = new Vector<>();
records.add(dr);
} else if (value instanceof Vector) {
Class<?> vectorContent = ((Vector<?>)value).firstElement().getClass();
if (DatabaseRecord.class.isAssignableFrom(vectorContent)) {
records = (Vector<DatabaseRecord>)value;
} else {
- records = new Vector<DatabaseRecord>();
+ records = new Vector<>();
DatabaseRecord dr = new DatabaseRecord();
dr.add(new DatabaseField(RESULT_STR), ((Vector<?>)value).firstElement());
records.add(dr);
}
} else {
- records = new Vector<DatabaseRecord>();
+ records = new Vector<>();
DatabaseRecord dr = new DatabaseRecord();
dr.add(new DatabaseField(RESULT_STR), value);
records.add(dr);
@@ -655,8 +655,6 @@
getStringMethod = PrivilegedAccessHelper.getDeclaredMethod(xmlTypeFactoryClass, GETSTRING_METHOD, new Class[] {oracleOPAQUE});
fieldValue = PrivilegedAccessHelper.invokeMethod(getStringMethod, xmlTypeFactory, new Object[] {fieldValue});
}
- } catch (RuntimeException x) {
- throw x;
} catch (ReflectiveOperationException | PrivilegedActionException e) {
// if the required resources are not available there's nothing we can do...
log.logThrowable(SessionLog.FINE, SessionLog.DBWS, e);
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/StoredProcedureQueryHandler.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/StoredProcedureQueryHandler.java
index 139f22c..f8df6d5 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/StoredProcedureQueryHandler.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/StoredProcedureQueryHandler.java
@@ -49,9 +49,9 @@
public class StoredProcedureQueryHandler extends QueryHandler {
public static final String CURSOR_STR = "CURSOR";
protected String name;
- protected List<ProcedureArgument> inArguments = new ArrayList<ProcedureArgument>();
- protected List<ProcedureOutputArgument> inOutArguments = new ArrayList<ProcedureOutputArgument>();
- protected List<ProcedureOutputArgument> outArguments = new ArrayList<ProcedureOutputArgument>();
+ protected List<ProcedureArgument> inArguments = new ArrayList<>();
+ protected List<ProcedureOutputArgument> inOutArguments = new ArrayList<>();
+ protected List<ProcedureOutputArgument> outArguments = new ArrayList<>();
public String getName() {
return name;
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/Util.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/Util.java
index a054da2..9942856 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/Util.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/Util.java
@@ -444,36 +444,36 @@
public static final Map<QName, Class<?>> SCHEMA_2_CLASS;
static {
SCHEMA_2_CLASS = Collections.unmodifiableMap(new HashMap<QName, Class<?>>() {{
- put(ANY_SIMPLE_TYPE_QNAME,CoreClassConstants.OBJECT);
- put(BASE_64_BINARY_QNAME, APBYTE);
- put(BOOLEAN_QNAME, BOOLEAN);
- put(BYTE_QNAME, BYTE);
- //put(DATE_QNAME, SQLDATE);
- put(DATE_QNAME, CALENDAR);
- //put(DATE_TIME_QNAME, TIMESTAMP);
- put(DATE_TIME_QNAME, CALENDAR);
- put(DECIMAL_QNAME, BIGDECIMAL);
- put(DOUBLE_QNAME, DOUBLE);
- put(DURATION_QNAME, STRING);
- put(FLOAT_QNAME, FLOAT);
- put(G_YEAR_MONTH_QNAME, STRING);
- put(G_YEAR_QNAME, STRING);
- put(G_MONTH_QNAME, STRING);
- put(G_MONTH_DAY_QNAME, STRING);
- put(G_DAY_QNAME, STRING);
- put(HEX_BINARY_QNAME, APBYTE);
- put(INT_QNAME, INTEGER);
- put(INTEGER_QNAME, BIGINTEGER);
- put(LONG_QNAME, LONG);
- put(QNAME_QNAME, QName.class);
- put(SHORT_QNAME, SHORT);
- put(STRING_QNAME, STRING);
- //put(TIME_QNAME, TIME);
- put(TIME_QNAME, CALENDAR);
- put(UNSIGNED_BYTE_QNAME, SHORT);
- put(UNSIGNED_INT_QNAME, LONG);
- put(UNSIGNED_SHORT_QNAME, INTEGER);
- }});
+ put(ANY_SIMPLE_TYPE_QNAME, CoreClassConstants.OBJECT);
+ put(BASE_64_BINARY_QNAME, APBYTE);
+ put(BOOLEAN_QNAME, BOOLEAN);
+ put(BYTE_QNAME, BYTE);
+ //put(DATE_QNAME, SQLDATE);
+ put(DATE_QNAME, CALENDAR);
+ //put(DATE_TIME_QNAME, TIMESTAMP);
+ put(DATE_TIME_QNAME, CALENDAR);
+ put(DECIMAL_QNAME, BIGDECIMAL);
+ put(DOUBLE_QNAME, DOUBLE);
+ put(DURATION_QNAME, STRING);
+ put(FLOAT_QNAME, FLOAT);
+ put(G_YEAR_MONTH_QNAME, STRING);
+ put(G_YEAR_QNAME, STRING);
+ put(G_MONTH_QNAME, STRING);
+ put(G_MONTH_DAY_QNAME, STRING);
+ put(G_DAY_QNAME, STRING);
+ put(HEX_BINARY_QNAME, APBYTE);
+ put(INT_QNAME, INTEGER);
+ put(INTEGER_QNAME, BIGINTEGER);
+ put(LONG_QNAME, LONG);
+ put(QNAME_QNAME, QName.class);
+ put(SHORT_QNAME, SHORT);
+ put(STRING_QNAME, STRING);
+ //put(TIME_QNAME, TIME);
+ put(TIME_QNAME, CALENDAR);
+ put(UNSIGNED_BYTE_QNAME, SHORT);
+ put(UNSIGNED_INT_QNAME, LONG);
+ put(UNSIGNED_SHORT_QNAME, INTEGER);
+ }});
}
/**
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRDynamicEntity_CollectionWrapper.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRDynamicEntity_CollectionWrapper.java
index 248034b..164cbd8 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRDynamicEntity_CollectionWrapper.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRDynamicEntity_CollectionWrapper.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,14 +28,14 @@
static final String ITEMS_PROPERTY = "items";
public static final XRDynamicPropertiesManager DPM = new XRDynamicPropertiesManager();
static {
- Set<String> propertiesNameSet = new HashSet<String>();
+ Set<String> propertiesNameSet = new HashSet<>();
propertiesNameSet.add(ITEMS_PROPERTY);
DPM.setPropertyNames(propertiesNameSet);
}
public XRDynamicEntity_CollectionWrapper() {
super();
- super.set(ITEMS_PROPERTY, new ArrayList<Object>());
+ super.set(ITEMS_PROPERTY, new ArrayList<>());
}
@Override
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRDynamicPropertiesManager.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRDynamicPropertiesManager.java
index 6100254..329fb14 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRDynamicPropertiesManager.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRDynamicPropertiesManager.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
@@ -57,7 +57,7 @@
@Override
public List<String> getPropertyNames() {
- List<String> tmp = new ArrayList<String>();
+ List<String> tmp = new ArrayList<>();
if (propertyNames != null) {
for (String propertyName : propertyNames) {
tmp.add(propertyName);
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRFieldInfo.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRFieldInfo.java
index ad1ba8b..84155eb 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRFieldInfo.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRFieldInfo.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
@@ -21,7 +21,7 @@
public class XRFieldInfo {
- protected HashMap<String, Index> fieldInfo = new HashMap<String, Index>();
+ protected HashMap<String, Index> fieldInfo = new HashMap<>();
public XRFieldInfo() {
super();
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRServiceAdapter.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRServiceAdapter.java
index 9e93e87..4ec6598 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRServiceAdapter.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRServiceAdapter.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
@@ -41,7 +41,7 @@
protected Session oxSession;
protected XMLContext xmlContext;
protected Schema schema;
- protected Map<QName, XMLDescriptor> descriptorsByQName = new HashMap<QName, XMLDescriptor>();
+ protected Map<QName, XMLDescriptor> descriptorsByQName = new HashMap<>();
public Session getORSession() {
return orSession;
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRServiceFactory.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRServiceFactory.java
index 6d3b7c7..ec8c1ea 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRServiceFactory.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRServiceFactory.java
@@ -270,7 +270,7 @@
*/
protected Project loadORMetadata(final XRDynamicClassLoader xrdecl, final ServerSession session) {
Project orProject = null;
- String searchPath = null;
+ String searchPath;
InputStream inStream = null;
// try "META-INF/" and "/META-INF/"
@@ -309,7 +309,7 @@
protected Project loadOXMetadata(final ClassLoader xrdecl, final Session session) {
Project oxProject = null;
InputStream inStream = null;
- String searchPath = null;
+ String searchPath;
// try "META-INF/" and "/META-INF/"
for (String prefix : META_INF_PATHS) {
@@ -329,7 +329,7 @@
JAXBElement<XmlBindingsModel> jaxbElt = unmarshaller.unmarshal(xml, XmlBindingsModel.class);
XmlBindingsModel model = jaxbElt.getValue();
if (model.getBindingsList() != null) {
- metadataMap = new HashMap<String, OXMMetadataSource>();
+ metadataMap = new HashMap<>();
for (XmlBindings xmlBindings : model.getBindingsList()) {
metadataMap.put(xmlBindings.getPackageName(), new OXMMetadataSource(xmlBindings));
}
@@ -342,7 +342,7 @@
}
if (metadataMap != null) {
- Map<String, Map<String, OXMMetadataSource>> properties = new HashMap<String, Map<String, OXMMetadataSource>>();
+ Map<String, Map<String, OXMMetadataSource>> properties = new HashMap<>();
properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataMap);
try {
DynamicJAXBContext jCtx = DynamicJAXBContextFactory.createContextFromOXM(xrdecl, properties);
@@ -458,7 +458,7 @@
xrService.oxSession = (Session) sessions.get(oxSessionKey);
// load OX project via xml-bindings
- Project oxProject = null;
+ Project oxProject;
if ((oxProject = loadOXMetadata(projectLoader, xrService.oxSession)) == null) {
// at this point we may have a legacy deployment XML project, or none set
oxProject = xrService.oxSession.getProject();
@@ -472,7 +472,7 @@
((XMLLogin) oxProject.getDatasourceLogin()).setEqualNamespaceResolvers(false);
// load OR project via entity-mappings
- Project orProject = null;
+ Project orProject;
if ((orProject = loadORMetadata(projectLoader, (ServerSession) xrService.orSession)) == null) {
// at this point we may have a legacy deployment XML project, or none set
orProject = xrService.orSession.getProject();
@@ -497,9 +497,8 @@
/**
* <p>INTERNAL:
*/
- @SuppressWarnings("rawtypes")
public void buildDescriptorIndex() {
- for (Iterator i = xrService.oxSession.getProject().getOrderedDescriptors().iterator();
+ for (Iterator<ClassDescriptor> i = xrService.oxSession.getProject().getOrderedDescriptors().iterator();
i.hasNext();) {
XMLDescriptor xd = (XMLDescriptor)i.next();
XMLSchemaReference schemaReference = xd.getSchemaReference();
@@ -703,13 +702,13 @@
@Override
public ClassLoader getNewTempClassLoader() { return xrdecl; }
@Override
- public List<String> getMappingFileNames() { return new ArrayList<String>(); }
+ public List<String> getMappingFileNames() { return new ArrayList<>(); }
@Override
- public List<String> getManagedClassNames() { return new ArrayList<String>(); }
+ public List<String> getManagedClassNames() { return new ArrayList<>(); }
@Override
public DataSource getJtaDataSource() { return null; }
@Override
- public List<URL> getJarFileUrls() { return new ArrayList<URL>(); }
+ public List<URL> getJarFileUrls() { return new ArrayList<>(); }
@Override
public ClassLoader getClassLoader() { return xrdecl; }
@Override
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRServiceModel.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRServiceModel.java
index df9fc03..c04c0cc 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRServiceModel.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/XRServiceModel.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 XRServiceModel {
protected String name;
- protected Map<String, Operation> operations = new HashMap<String, Operation>();
+ protected Map<String, Operation> operations = new HashMap<>();
protected String sessionsFile;
public String getName() {
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/sxf/SimpleXMLFormatModel.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/sxf/SimpleXMLFormatModel.java
index 634605d..12a47ed 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/sxf/SimpleXMLFormatModel.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/internal/xr/sxf/SimpleXMLFormatModel.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 SimpleXMLFormatModel() {
super();
- simpleXML = new ArrayList<Node>();
+ simpleXML = new ArrayList<>();
}
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/DataStorage.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/DataStorage.java
index be5ac7d..96a5cce 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/DataStorage.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/DataStorage.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
@@ -15,15 +15,16 @@
package org.eclipse.persistence.jpa.rs;
import java.util.HashMap;
+import java.util.Map;
public class DataStorage {
// key names in the data storage
public static final String REQUEST_ID = "requestId";
- private final static InheritableThreadLocal<HashMap<String, Object>> storage = new InheritableThreadLocal<HashMap<String, Object>>() {
+ private final static InheritableThreadLocal<Map<String, Object>> storage = new InheritableThreadLocal<Map<String, Object>>() {
@Override
- protected HashMap<String, Object> initialValue() {
- return new HashMap<String, Object>();
+ protected Map<String, Object> initialValue() {
+ return new HashMap<>();
}
};
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/PersistenceContext.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/PersistenceContext.java
index 99e1221..7cd4959 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/PersistenceContext.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/PersistenceContext.java
@@ -218,12 +218,9 @@
try {
this.jaxbContext = createDynamicJAXBContext(emf.getDatabaseSession());
- } catch (JAXBException jaxbe) {
+ } catch (JAXBException | IOException jaxbe) {
JPARSLogger.exception(getSessionLog(), "exception_creating_jaxb_context", new Object[] { emfName, jaxbe.toString() }, jaxbe);
emf.close();
- } catch (IOException e) {
- JPARSLogger.exception(getSessionLog(), "exception_creating_jaxb_context", new Object[] { emfName, e.toString() }, e);
- emf.close();
}
}
@@ -265,7 +262,7 @@
* that is used for JSON and XML translation.
*/
protected void addDynamicXMLMetadataSources(List<Object> metadataSources, AbstractSession session) {
- Set<String> packages = new HashSet<String>();
+ Set<String> packages = new HashSet<>();
for (Class<?> descriptorClass : session.getDescriptors().keySet()) {
String packageName = "";
int lastDotIndex = descriptorClass.getName().lastIndexOf('.');
@@ -344,10 +341,10 @@
* Build the set of properties used to create the JAXBContext based on the EntityManagerFactory that
* this PersistenceContext wraps
*/
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({"rawtypes" })
protected Map<String, Object> createJAXBProperties(AbstractSession session) throws IOException {
- Map<String, Object> properties = new HashMap<String, Object>(1);
- List<Object> metadataLocations = new ArrayList<Object>();
+ Map<String, Object> properties = new HashMap<>(1);
+ List<Object> metadataLocations = new ArrayList<>();
addDynamicXMLMetadataSources(metadataLocations, session);
@@ -596,7 +593,6 @@
}
}
- @SuppressWarnings("unchecked")
private Object getAttribute(Object entity, String propertyName) {
try {
BeanInfo info = Introspector.getBeanInfo(entity.getClass(), Object.class);
@@ -607,7 +603,7 @@
Method getter = pd.getReadMethod();
Object value;
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
- value = AccessController.doPrivileged(new PrivilegedMethodInvoker(getter, entity));
+ value = AccessController.doPrivileged(new PrivilegedMethodInvoker<>(getter, entity));
} else {
value = PrivilegedAccessHelper.invokeMethod(getter, entity);
}
@@ -778,7 +774,7 @@
try {
transaction.beginTransaction(em);
if (entity instanceof List) {
- List<Object> mergeList = new ArrayList<Object>();
+ List<Object> mergeList = new ArrayList<>();
for (Object o : (List) entity) {
mergeList.add(em.merge(o));
}
@@ -912,7 +908,6 @@
* @param hints the hints
* @return the query
*/
- @SuppressWarnings("rawtypes")
public Query buildQuery(Map<String, String> tenantId, String name, Map<?, ?> parameters, Map<String, ?> hints) {
EntityManager em = getEmf().createEntityManager(tenantId);
Query query = em.createNamedQuery(name);
@@ -922,7 +917,7 @@
while (i.hasNext()) {
Map.Entry<?, ?> entry = (Map.Entry<?, ?>) i.next();
String key = (String) entry.getKey();
- Class parameterClass = null;
+ Class<?> parameterClass = null;
int index = dbQuery.getArguments().indexOf(key);
if (index >= 0) {
parameterClass = dbQuery.getArgumentTypes().get(index);
@@ -1149,6 +1144,7 @@
* the actual objects in the relationships.
* @param fieldsFilter Specifies fields to include/exclude from the response.
*/
+ @SuppressWarnings({"unchecked"})
public void marshall(final Object object, final MediaType mediaType, final OutputStream output, boolean sendRelationships, final FieldsFilter fieldsFilter) throws JAXBException {
if (version.compareTo(ServiceVersion.VERSION_2_0) < 0 && sendRelationships) {
preMarshallEntity(object);
@@ -1274,7 +1270,7 @@
if ((entity != null) && (entity instanceof PersistenceWeavedRest)) {
ClassDescriptor descriptor = getServerSession().getClassDescriptor(entity.getClass());
if (descriptor != null) {
- ((PersistenceWeavedRest) entity)._persistence_setRelationships(new ArrayList<RelationshipInfo>());
+ ((PersistenceWeavedRest) entity)._persistence_setRelationships(new ArrayList<>());
for (DatabaseMapping mapping : descriptor.getMappings()) {
if (mapping.isForeignReferenceMapping()) {
ForeignReferenceMapping frMapping = (ForeignReferenceMapping) mapping;
@@ -1305,11 +1301,11 @@
if (object instanceof List) {
for (Object entity : ((List) object)) {
if (entity instanceof PersistenceWeavedRest) {
- ((PersistenceWeavedRest) entity)._persistence_setRelationships(new ArrayList<RelationshipInfo>());
+ ((PersistenceWeavedRest) entity)._persistence_setRelationships(new ArrayList<>());
}
}
} else if (object instanceof PersistenceWeavedRest) {
- ((PersistenceWeavedRest) object)._persistence_setRelationships(new ArrayList<RelationshipInfo>());
+ ((PersistenceWeavedRest) object)._persistence_setRelationships(new ArrayList<>());
}
}
@@ -1318,7 +1314,7 @@
if (adapters != null) {
return adapters;
}
- adapters = new ArrayList<XmlAdapter<?, ?>>();
+ adapters = new ArrayList<>();
try {
final ClassLoader cl = getServerSession().getDatasourcePlatform().getConversionManager().getLoader();
@@ -1459,7 +1455,7 @@
* Initializes pageableQueries map by reading RestPageableQueries entity annotations.
*/
private void initPageableQueries() {
- pageableQueries = new HashMap<String, RestPageableQuery>();
+ pageableQueries = new HashMap<>();
// Iterate on all entity classes
for (Class<?> clazz : getServerSession().getProject().getDescriptors().keySet()) {
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/exceptions/AbstractExceptionMapper.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/exceptions/AbstractExceptionMapper.java
index ad220f7..b1e8717 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/exceptions/AbstractExceptionMapper.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/exceptions/AbstractExceptionMapper.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
@@ -59,7 +59,7 @@
UriInfo uriInfo;
private static final Map<String, Status> HTTP_STATUS_CODE_MAPPING =
- Collections.unmodifiableMap(new HashMap<String, Status>() {
+ Collections.unmodifiableMap(new HashMap<>() {
{
put(ClassNotFoundException.class.getName(), Status.BAD_REQUEST);
put(ConversionException.class.getName(), Status.BAD_REQUEST);
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/FeatureResponseBuilderImpl.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/FeatureResponseBuilderImpl.java
index 8bea568..9f8c580 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/FeatureResponseBuilderImpl.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/FeatureResponseBuilderImpl.java
@@ -125,7 +125,7 @@
private SimpleHomogeneousList populateSimpleHomogeneousList(Collection collection, String attributeName) {
SimpleHomogeneousList simpleList = new SimpleHomogeneousList();
- List<JAXBElement> items = new ArrayList<JAXBElement>();
+ List<JAXBElement> items = new ArrayList<>();
for (Iterator iterator = collection.iterator(); iterator.hasNext();) {
Object collectionItem = iterator.next();
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/FeatureSetPreV2.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/FeatureSetPreV2.java
index 9841022..9022364 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/FeatureSetPreV2.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/FeatureSetPreV2.java
@@ -69,7 +69,7 @@
@Override
public List<MetadataSource> getMetadataSources() {
- final List<MetadataSource> metadataSources = new ArrayList<MetadataSource>();
+ final List<MetadataSource> metadataSources = new ArrayList<>();
metadataSources.add(new LinkMetadataSource());
metadataSources.add(new ReportQueryResultListMetadataSource());
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/FeatureSetV2.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/FeatureSetV2.java
index e10c888..808a1ac 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/FeatureSetV2.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/FeatureSetV2.java
@@ -73,7 +73,7 @@
@Override
public List<MetadataSource> getMetadataSources() {
- final List<MetadataSource> metadataSources = new ArrayList<MetadataSource>();
+ final List<MetadataSource> metadataSources = new ArrayList<>();
metadataSources.add(new ReportQueryResultListMetadataSource());
metadataSources.add(new ReportQueryResultListItemMetadataSource());
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/ItemLinksBuilder.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/ItemLinksBuilder.java
index f79083b..4acaa10 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/ItemLinksBuilder.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/features/ItemLinksBuilder.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
@@ -29,7 +29,7 @@
* @since EclipseLink 2.6.0
*/
public final class ItemLinksBuilder {
- private final List<LinkV2> links = new ArrayList<LinkV2>();
+ private final List<LinkV2> links = new ArrayList<>();
/**
* Adds a 'self' link.
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/resources/MetadataResource.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/resources/MetadataResource.java
index 6e63c55..5dcd47b 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/resources/MetadataResource.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/resources/MetadataResource.java
@@ -70,7 +70,7 @@
@Path("/{version : " + SERVICE_VERSION_FORMAT + "}/{context}/metadata-catalog/")
public class MetadataResource extends AbstractResource {
private static final String CLASS_NAME = MetadataResource.class.getName();
- private static final Map<Class<?>, String> PRIMITIVE_TO_JSON = new HashMap<Class<?>, String>();
+ private static final Map<Class<?>, String> PRIMITIVE_TO_JSON = new HashMap<>();
static {
PRIMITIVE_TO_JSON.put(boolean.class, "boolean");
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/resources/common/AbstractPersistenceUnitResource.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/resources/common/AbstractPersistenceUnitResource.java
index 5224a46..1e60f3c 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/resources/common/AbstractPersistenceUnitResource.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/resources/common/AbstractPersistenceUnitResource.java
@@ -86,7 +86,7 @@
try {
PersistenceContext context = getPersistenceContext(persistenceUnit, null, uriInfo.getBaseUri(), version, null);
- List<Query> queries = new ArrayList<Query>();
+ List<Query> queries = new ArrayList<>();
addQueries(queries, context, null);
String mediaType = StreamingOutputMarshaller.mediaType(headers.getAcceptableMediaTypes()).toString();
QueryList queryList = new QueryList();
@@ -107,7 +107,7 @@
JPARSLogger.entering(CLASS_NAME, "getQueryMetadataInternal", new Object[] { "GET", version, persistenceUnit, queryName, uriInfo.getRequestUri().toASCIIString() });
try {
PersistenceContext context = getPersistenceContext(persistenceUnit, null, uriInfo.getBaseUri(), version, null);
- List<Query> returnQueries = new ArrayList<Query>();
+ List<Query> returnQueries = new ArrayList<>();
Map<String, List<DatabaseQuery>> queries = context.getServerSession().getQueries();
if (queries.get(queryName) != null) {
for (DatabaseQuery query : queries.get(queryName)) {
@@ -130,7 +130,6 @@
}
}
- @SuppressWarnings("rawtypes")
protected Response getTypesInternal(String version, String persistenceUnit, HttpHeaders headers, UriInfo uriInfo) {
JPARSLogger.entering(CLASS_NAME, "getTypesInternal", new Object[] { "GET", version, persistenceUnit, uriInfo.getRequestUri().toASCIIString() });
try {
@@ -218,7 +217,7 @@
private void addQueries(List<Query> queryList, PersistenceContext context, String javaClassName) {
Map<String, List<DatabaseQuery>> queries = context.getServerSession().getQueries();
- List<DatabaseQuery> returnQueries = new ArrayList<DatabaseQuery>();
+ List<DatabaseQuery> returnQueries = new ArrayList<>();
for (List<DatabaseQuery> keyQueries : queries.values()) {
Iterator<DatabaseQuery> queryIterator = keyQueries.iterator();
while (queryIterator.hasNext()) {
@@ -315,9 +314,9 @@
if (clazz == null) {
return null;
}
- LinkedHashSet<Class<?>> all = new LinkedHashSet<Class<?>>();
+ LinkedHashSet<Class<?>> all = new LinkedHashSet<>();
getInterfaces(clazz, all);
- ArrayList<Class<?>> list = new ArrayList<Class<?>>(all);
+ ArrayList<Class<?>> list = new ArrayList<>(all);
for (int i = 0; i < all.size(); i++) {
Class<?> clas = list.get(i);
if (clas.getName().equals(List.class.getName())) {
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/resources/common/AbstractResource.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/resources/common/AbstractResource.java
index d2e4663..8532baa 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/resources/common/AbstractResource.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/resources/common/AbstractResource.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
@@ -132,7 +132,7 @@
* @return the matrix parameters
*/
protected static Map<String, String> getMatrixParameters(UriInfo info, String segment) {
- Map<String, String> matrixParameters = new HashMap<String, String>();
+ Map<String, String> matrixParameters = new HashMap<>();
for (PathSegment pathSegment : info.getPathSegments()) {
if (pathSegment.getPath() != null && pathSegment.getPath().equals(segment)) {
for (Entry<String, List<String>> entry : pathSegment.getMatrixParameters().entrySet()) {
@@ -155,7 +155,7 @@
* @return the query parameters
*/
public static Map<String, Object> getQueryParameters(UriInfo info) {
- Map<String, Object> queryParameters = new HashMap<String, Object>();
+ Map<String, Object> queryParameters = new HashMap<>();
for (String key : info.getQueryParameters().keySet()) {
queryParameters.put(key, info.getQueryParameters().getFirst(key));
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/CollectionWrapperBuilder.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/CollectionWrapperBuilder.java
index aca8428..acdcb20 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/CollectionWrapperBuilder.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/CollectionWrapperBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
@@ -74,7 +74,7 @@
final String id = IdHelper.stringifyId(entity, entity.getClass().getSimpleName(), context);
// Generate links
- final List<LinkV2> links = new ArrayList<LinkV2>(2);
+ final List<LinkV2> links = new ArrayList<>(2);
final String href = HrefHelper.buildEntityFieldHref(context, entity.getClass().getSimpleName(), id, field.getName());
links.add(new LinkV2(ReservedWords.JPARS_REL_SELF, href));
links.add(new LinkV2(ReservedWords.JPARS_REL_CANONICAL, href));
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/IdHelper.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/IdHelper.java
index dd09760..6913d73 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/IdHelper.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/IdHelper.java
@@ -196,7 +196,7 @@
// If there are more that one PK, we assume an array as produced
// by buildId() above with the keys
// based on a sorted order of PK fields
- List<SortableKey> pkIndices = new ArrayList<SortableKey>();
+ List<SortableKey> pkIndices = new ArrayList<>();
int index = 0;
for (DatabaseMapping mapping : pkMappings) {
pkIndices.add(new SortableKey(mapping, index));
@@ -226,7 +226,7 @@
public static List<SortableKey> getPrimaryKey(PersistenceContext context, String entityName) {
ClassDescriptor descriptor = context.getDescriptor(entityName);
List<DatabaseMapping> pkMappings = descriptor.getObjectBuilder().getPrimaryKeyMappings();
- List<SortableKey> pkIndices = new ArrayList<SortableKey>();
+ List<SortableKey> pkIndices = new ArrayList<>();
int index = 0;
for (DatabaseMapping mapping : pkMappings) {
if (!mapping.isMultitenantPrimaryKeyMapping()) {
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/ObjectGraphBuilder.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/ObjectGraphBuilder.java
index 17ad199..498db36 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/ObjectGraphBuilder.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/ObjectGraphBuilder.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
@@ -188,7 +188,7 @@
* Internal object graph node.
*/
private static class Node {
- private final Map<String, Node> nodesMap = new HashMap<String, Node>();
+ private final Map<String, Node> nodesMap = new HashMap<>();
public void addAttributeNode(final String attribute) {
nodesMap.put(attribute, null);
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/list/ReportQueryResultCollection.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/list/ReportQueryResultCollection.java
index f090616..a8b12f6 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/list/ReportQueryResultCollection.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/list/ReportQueryResultCollection.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
@@ -51,7 +51,7 @@
*/
public void addItem(ReportQueryResultListItem item) {
if (items == null) {
- items = new ArrayList<ReportQueryResultListItem>();
+ items = new ArrayList<>();
}
items.add(item);
}
@@ -64,7 +64,7 @@
@Override
public void addLink(LinkV2 link) {
if (links == null) {
- links = new ArrayList<LinkV2>();
+ links = new ArrayList<>();
}
links.add(link);
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/list/ReportQueryResultList.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/list/ReportQueryResultList.java
index 879973d..62f0f26 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/list/ReportQueryResultList.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/list/ReportQueryResultList.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
@@ -65,7 +65,7 @@
*/
public void addItem(ReportQueryResultListItem item) {
if (items == null) {
- items = new ArrayList<ReportQueryResultListItem>();
+ items = new ArrayList<>();
}
items.add(item);
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/list/SingleResultQueryResult.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/list/SingleResultQueryResult.java
index 68b34fb..ed770f3 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/list/SingleResultQueryResult.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/list/SingleResultQueryResult.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
@@ -61,7 +61,7 @@
public void addLink(LinkV2 link) {
if (links == null) {
- links = new ArrayList<LinkV2>();
+ links = new ArrayList<>();
}
links.add(link);
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/xmladapters/LinkAdapter.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/xmladapters/LinkAdapter.java
index 9c0b26a..2a35c30 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/xmladapters/LinkAdapter.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/xmladapters/LinkAdapter.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
@@ -78,7 +78,7 @@
for (DatabaseMapping mapping: pkMappings){
fetchGroup.addAttribute(mapping.getAttributeName());
}
- Map<String, Object> properties = new HashMap<String, Object>();
+ Map<String, Object> properties = new HashMap<>();
properties.put(QueryHints.FETCH_GROUP, fetchGroup);
properties.put(QueryHints.CACHE_USAGE, CacheUsage.CheckCacheOnly);
Object entity = context.find(null, entityType, id, properties);
diff --git a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/xmladapters/RestCollectionAdapter.java b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/xmladapters/RestCollectionAdapter.java
index bebff73..a1ab31d 100644
--- a/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/xmladapters/RestCollectionAdapter.java
+++ b/dbws/org.eclipse.persistence.dbws/src/main/java/org/eclipse/persistence/jpa/rs/util/xmladapters/RestCollectionAdapter.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
@@ -63,7 +63,7 @@
return null;
}
- final Collection<T> result = new ArrayList<T>();
+ final Collection<T> result = new ArrayList<>();
// Check if links exist and items from there if it does
if (v.getLinks() != null && !v.getLinks().isEmpty()) {
@@ -76,7 +76,7 @@
if (v.getItems() != null) {
// Process each item (load from href, etc.)
- final ReferenceAdapterV2<T> referenceAdapter = new ReferenceAdapterV2<T>(context);
+ final ReferenceAdapterV2<T> referenceAdapter = new ReferenceAdapterV2<>(context);
for (T item : v.getItems()) {
if (context != null) {
result.add(referenceAdapter.unmarshal(item));
@@ -94,7 +94,7 @@
return null;
}
- final CollectionWrapper<T> result = new CollectionWrapper<T>();
+ final CollectionWrapper<T> result = new CollectionWrapper<>();
// Currently it returns only links. It will return items when 'expand'
// feature will be implemented.
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/ClassDescriptor.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/ClassDescriptor.java
index a04a542..7e09c22 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/ClassDescriptor.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/descriptors/ClassDescriptor.java
@@ -370,12 +370,12 @@
// Properties
this.tables = NonSynchronizedVector.newInstance(3);
this.mappings = NonSynchronizedVector.newInstance();
- this.primaryKeyFields = new ArrayList(2);
+ this.primaryKeyFields = new ArrayList<>(2);
this.fields = NonSynchronizedVector.newInstance();
this.allFields = NonSynchronizedVector.newInstance();
this.constraintDependencies = NonSynchronizedVector.newInstance(2);
- this.multipleTableForeignKeys = new HashMap(5);
- this.queryKeys = new HashMap(5);
+ this.multipleTableForeignKeys = new HashMap<>(5);
+ this.queryKeys = new HashMap<>(5);
this.initializationStage = UNINITIALIZED;
this.interfaceInitializationStage = UNINITIALIZED;
this.descriptorType = NORMAL;
@@ -384,7 +384,7 @@
this.shouldAlwaysConformResultsInUnitOfWork = false;
this.shouldAcquireCascadedLocks = false;
this.hasSimplePrimaryKey = false;
- this.derivesIdMappings = new HashMap(5);
+ this.derivesIdMappings = new HashMap<>(5);
this.referencingClasses = new HashSet<>();
@@ -392,7 +392,7 @@
this.objectBuilder = new ObjectBuilder(this);
this.cachePolicy = new CachePolicy();
- this.additionalWritableMapKeyFields = new ArrayList(2);
+ this.additionalWritableMapKeyFields = new ArrayList<>(2);
this.foreignKeyValuesForCaching = new HashSet<>();
}
@@ -4082,11 +4082,11 @@
}
private void prepareReturnFields(List<ReturningPolicy> returningPolicies) {
- Vector<DatabaseField> returnFieldsInsert = new NonSynchronizedVector();
- Vector<DatabaseField> returnFieldsUpdate = new NonSynchronizedVector();
+ Vector<DatabaseField> returnFieldsInsert = new NonSynchronizedVector<>();
+ Vector<DatabaseField> returnFieldsUpdate = new NonSynchronizedVector<>();
List<DatabaseField> returnFieldsToMergeInsert = new ArrayList<>();
List<DatabaseField> returnFieldsToMergeUpdate = new ArrayList<>();
- Collection tmpFields;
+ Collection<DatabaseField> tmpFields;
for (ReturningPolicy returningPolicy: returningPolicies) {
tmpFields = returningPolicy.getFieldsToGenerateInsert(this.defaultTable);
if (tmpFields != null) {
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 4b88232..0717882 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
@@ -123,14 +123,14 @@
/**
* INTERNAL:
*/
- public List<? extends DatabaseField> getFieldsToGenerateInsert(DatabaseTable table) {
+ public List<DatabaseField> getFieldsToGenerateInsert(DatabaseTable table) {
return getVectorOfFieldsToGenerate(INSERT, table);
}
/**
* INTERNAL:
*/
- public List<? extends DatabaseField> getFieldsToGenerateUpdate(DatabaseTable table) {
+ public List<DatabaseField> getFieldsToGenerateUpdate(DatabaseTable table) {
return getVectorOfFieldsToGenerate(UPDATE, table);
}
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 412d7da..3c9da3b 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
@@ -818,7 +818,7 @@
* This code is not currently publicly supported.
*/
protected Vector buildThreadCursoredResult(final DatabaseCall dbCall, final ResultSet resultSet, final Statement statement, final ResultSetMetaData metaData, final AbstractSession session) {
- final ThreadCursoredList results = new ThreadCursoredList(20);
+ final ThreadCursoredList<AbstractRecord> results = new ThreadCursoredList<>(20);
Runnable runnable = new Runnable() {
@Override
public void run() {
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConcurrencyManager.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConcurrencyManager.java
index b09cc54..ec8970a 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConcurrencyManager.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConcurrencyManager.java
@@ -391,8 +391,8 @@
/**
* Init the deferred lock managers (thread - DeferredLockManager).
*/
- protected static Map initializeDeferredLockManagers() {
- return new ConcurrentHashMap();
+ protected static Map<Thread, DeferredLockManager> initializeDeferredLockManagers() {
+ return new ConcurrentHashMap<>();
}
/**
@@ -449,7 +449,7 @@
* contain the thread we will explore next.
* @return true if object is complete
*/
- public static boolean isBuildObjectOnThreadComplete(Thread thread, Map recursiveSet, List<Thread> parentChainOfThreads, boolean deadLockDiagnostic) {
+ public static boolean isBuildObjectOnThreadComplete(Thread thread, Map<Thread, Thread> recursiveSet, List<Thread> parentChainOfThreads, boolean deadLockDiagnostic) {
if (recursiveSet.containsKey(thread)) {
return true;
}
@@ -460,10 +460,10 @@
return true;
}
- Vector deferredLocks = lockManager.getDeferredLocks();
- for (Enumeration deferredLocksEnum = deferredLocks.elements();
+ Vector<ConcurrencyManager> deferredLocks = lockManager.getDeferredLocks();
+ for (Enumeration<ConcurrencyManager> deferredLocksEnum = deferredLocks.elements();
deferredLocksEnum.hasMoreElements();) {
- ConcurrencyManager deferedLock = (ConcurrencyManager)deferredLocksEnum.nextElement();
+ ConcurrencyManager deferedLock = deferredLocksEnum.nextElement();
Thread activeThread = null;
if (deferedLock.isAcquired()) {
activeThread = deferedLock.getActiveThread();
@@ -636,7 +636,7 @@
boolean isBuildObjectCompleteSlow = ConcurrencyUtil.SINGLETON.tooMuchTimeHasElapsed(whileStartTimeMillis, ConcurrencyUtil.SINGLETON.getBuildObjectCompleteWaitTime());
try{
// 2612538 - the default size of Map (32) is appropriate
- Map recursiveSet = new IdentityHashMap();
+ Map<Thread, Thread> recursiveSet = new IdentityHashMap<>();
if (isBuildObjectOnThreadComplete(currentThread, recursiveSet, Arrays.asList(currentThread), isBuildObjectCompleteSlow)) {// Thread job done.
// Remove from debug metadata the fact that the current thread needed to wait
// for one or more build objects to be completed by other threads.
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 5ae4f25..f767721 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
@@ -1420,11 +1420,12 @@
* references. But the objects it refers to (e.g. cache keys) can be mutating all the time if new readers or
* active threads arrive.
*/
- @SuppressWarnings("rawtypes")
public DeferredLockManager cloneDeferredLockManager(DeferredLockManager deferredLockManagerOriginal) {
// (a) Start by cloning from the original the two vectors of cache keys is administers
- Vector cloneOfActiveLocks = (Vector) deferredLockManagerOriginal.getActiveLocks().clone();
- Vector cloneOfDeferredLocks = (Vector) deferredLockManagerOriginal.getDeferredLocks().clone();
+ @SuppressWarnings("unchecked")
+ Vector<ConcurrencyManager> cloneOfActiveLocks = (Vector<ConcurrencyManager>) deferredLockManagerOriginal.getActiveLocks().clone();
+ @SuppressWarnings("unchecked")
+ Vector<ConcurrencyManager> cloneOfDeferredLocks = (Vector<ConcurrencyManager>) deferredLockManagerOriginal.getDeferredLocks().clone();
// (b) Build our clone object
DeferredLockManager deferredLockManagerClone = new DeferredLockManager();
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/CustomObjectInputStream.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/CustomObjectInputStream.java
index ea67253..4257245 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/CustomObjectInputStream.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/CustomObjectInputStream.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
@@ -41,7 +41,7 @@
}
@Override
- public Class resolveClass(ObjectStreamClass classDesc) throws ClassNotFoundException, IOException {
+ public Class<?> resolveClass(ObjectStreamClass classDesc) throws ClassNotFoundException, IOException {
return m_conversionManager.convertClassNameToClass(classDesc.getName());
}
}
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DBPlatformHelper.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DBPlatformHelper.java
index 3120e79..f9df821 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DBPlatformHelper.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DBPlatformHelper.java
@@ -175,10 +175,10 @@
* Open resourceName as input stream inside doPriviledged block
*/
private static InputStream openResourceInputStream(final String resourceName, final ClassLoader classLoader) {
- return (InputStream) AccessController.doPrivileged(
- new PrivilegedAction() {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<InputStream>() {
@Override
- public Object run() {
+ public InputStream run() {
if (classLoader != null) {
return classLoader.getResourceAsStream(resourceName);
} else {
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DeferredLockManager.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DeferredLockManager.java
index 82a9794..de0e869 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DeferredLockManager.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DeferredLockManager.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,8 +30,8 @@
* </ul>
*/
public class DeferredLockManager {
- protected Vector deferredLocks;
- protected Vector activeLocks;
+ protected Vector<ConcurrencyManager> deferredLocks;
+ protected Vector<ConcurrencyManager> activeLocks;
protected int threadDepth;
protected boolean isThreadComplete;
@@ -42,8 +42,8 @@
*/
public DeferredLockManager() {
super();
- this.deferredLocks = new Vector(1);
- this.activeLocks = new Vector(1);
+ this.deferredLocks = new Vector<>(1);
+ this.activeLocks = new Vector<>(1);
this.threadDepth = 0;
this.isThreadComplete = false;
}
@@ -52,14 +52,14 @@
* add a concurrency manager as active locks to the DLM
*/
public void addActiveLock(Object manager) {
- getActiveLocks().addElement(manager);
+ getActiveLocks().addElement((ConcurrencyManager) manager);
}
/**
* add a concurrency manager as deferred locks to the DLM
*/
public void addDeferredLock(Object manager) {
- getDeferredLocks().addElement(manager);
+ getDeferredLocks().addElement((ConcurrencyManager) manager);
}
/**
@@ -72,14 +72,14 @@
/**
* Return a set of the active locks from the DLM
*/
- public Vector getActiveLocks() {
+ public Vector<ConcurrencyManager> getActiveLocks() {
return activeLocks;
}
/**
* Return a set of the deferred locks
*/
- public Vector getDeferredLocks() {
+ public Vector<ConcurrencyManager> getDeferredLocks() {
return deferredLocks;
}
@@ -115,11 +115,11 @@
* Release the active lock on the DLM
*/
public void releaseActiveLocksOnThread() {
- Vector activeLocks = getActiveLocks();
+ Vector<ConcurrencyManager> activeLocks = getActiveLocks();
if (!activeLocks.isEmpty()) {
- for (Enumeration activeLocksEnum = activeLocks.elements();
+ for (Enumeration<ConcurrencyManager> activeLocksEnum = activeLocks.elements();
activeLocksEnum.hasMoreElements();) {
- ConcurrencyManager manager = (ConcurrencyManager)activeLocksEnum.nextElement();
+ ConcurrencyManager manager = activeLocksEnum.nextElement();
manager.release();
}
}
@@ -129,14 +129,14 @@
/**
* set a set of the active locks to the DLM
*/
- public void setActiveLocks(Vector activeLocks) {
+ public void setActiveLocks(Vector<ConcurrencyManager> activeLocks) {
this.activeLocks = activeLocks;
}
/**
* set a set of the deferred locks to the DLM
*/
- public void setDeferredLocks(Vector deferredLocks) {
+ public void setDeferredLocks(Vector<ConcurrencyManager> deferredLocks) {
this.deferredLocks = deferredLocks;
}
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DescriptorCompare.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DescriptorCompare.java
index 5c46b3e..61abe5b 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DescriptorCompare.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/DescriptorCompare.java
@@ -28,6 +28,12 @@
private static final long serialVersionUID = -2792350655245140468L;
+ /**
+ * Default constructor.
+ */
+ public DescriptorCompare() {
+ }
+
@Override
public int compare(ClassDescriptor arg1, ClassDescriptor arg2) {
return arg1.getJavaClassName().compareTo(arg2.getJavaClassName());
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 b36b7cf..cc6d074 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
@@ -774,7 +774,7 @@
// is not able to make progress.
// To understand why we do this one would need to have a good look at the concurrenyc manager implementation
// at the logic that of the logic of the releaseDeferredLock method
- IsBuildObjectCompleteOutcome result = isBuildObjectOnThreadComplete(concurrencyManagerStateDto, currentCandidateThreadPartOfTheDeadLock, new IdentityHashMap());
+ IsBuildObjectCompleteOutcome result = isBuildObjectOnThreadComplete(concurrencyManagerStateDto, currentCandidateThreadPartOfTheDeadLock, new IdentityHashMap<>());
// (b) Our expectation is that the result of the step above is always different than null
// after all if this candidate thread is stuck trying to release deferred locks there must be an explanation for it not making progress
@@ -885,7 +885,7 @@
*/
public static IsBuildObjectCompleteOutcome isBuildObjectOnThreadComplete(
final ConcurrencyManagerState concurrencyManagerStateDto, Thread thread,
- Map recursiveSet) {
+ Map<Thread, Thread> recursiveSet) {
if (recursiveSet.containsKey(thread)) {
// if the thread we are consider as we go deeper in the recursion is thread in an upper stack of the
// recursion
@@ -904,9 +904,9 @@
return IsBuildObjectCompleteOutcome.BUILD_OBJECT_IS_COMPLETE_TRUE;
}
- Vector deferredLocks = lockManager.getDeferredLocks();
- for (Enumeration deferredLocksEnum = deferredLocks.elements(); deferredLocksEnum.hasMoreElements();) {
- ConcurrencyManager deferedLock = (ConcurrencyManager) deferredLocksEnum.nextElement();
+ Vector<ConcurrencyManager> deferredLocks = lockManager.getDeferredLocks();
+ for (Enumeration<ConcurrencyManager> deferredLocksEnum = deferredLocks.elements(); deferredLocksEnum.hasMoreElements();) {
+ ConcurrencyManager deferedLock = deferredLocksEnum.nextElement();
Thread activeThread = null;
if (deferedLock.isAcquired()) {
activeThread = deferedLock.getActiveThread();
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 27202af..a18b402 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
@@ -173,8 +173,8 @@
* PERF:
* Init the calendar cache use to avoid calendar creation for processing java.sql/util.Date/Time/Timestamp objects.
*/
- public static Queue initCalendarCache() {
- Queue calendarCache = new ConcurrentLinkedQueue();
+ public static Queue<Calendar> initCalendarCache() {
+ Queue<Calendar> calendarCache = new ConcurrentLinkedQueue<>();
for (int index = 0; index < 10; index++) {
calendarCache.add(Calendar.getInstance());
}
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/JavaPlatform.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/JavaPlatform.java
index 9ebf0a9..e54e977 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/JavaPlatform.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/JavaPlatform.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
@@ -36,13 +36,13 @@
* PERF: The like expression compiled Pattern objects are cached
* to avoid re-compilation on every usage.
*/
- private static final ConcurrentHashMap patternCache = new ConcurrentHashMap();
+ private static final ConcurrentHashMap<Object, Pattern> patternCache = new ConcurrentHashMap<>();
/**
* PERF: The regular expression compiled Pattern objects are cached
* to avoid re-compilation on every usage.
*/
- private static final ConcurrentHashMap regexpPatternCache = new ConcurrentHashMap();
+ private static final ConcurrentHashMap<Object, Pattern> regexpPatternCache = new ConcurrentHashMap<>();
/**
* INTERNAL:
@@ -59,7 +59,7 @@
right = String.valueOf(right);
// PERF: First check the pattern cache for the pattern.
// Note that the original string is the key, to avoid having to translate it first.
- Pattern pattern = (Pattern)patternCache.get(right);
+ Pattern pattern = patternCache.get(right);
if (pattern == null) {
// Bug 3936427 - Replace regular expression reserved characters with escaped version of those characters
// For instance replace ? with \?
@@ -90,7 +90,7 @@
right = String.valueOf(right);
// PERF: First check the pattern cache for the pattern.
// Note that the original string is the key, to avoid having to translate it first.
- Pattern pattern = (Pattern)regexpPatternCache.get(right);
+ Pattern pattern = regexpPatternCache.get(right);
if (pattern == null) {
pattern = Pattern.compile((String)right);
// Ensure cache does not grow beyond 100.
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/LOBValueWriter.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/LOBValueWriter.java
index 2be49ea..e5dbe99 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/LOBValueWriter.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/LOBValueWriter.java
@@ -55,7 +55,7 @@
*/
public class LOBValueWriter {
//DatabaseCalls still to be processed
- private Collection calls = null;
+ private Collection<DatabaseCall> calls = null;
private Accessor accessor;
private boolean isNativeConnectionRequired;
@@ -93,7 +93,7 @@
*/
public void fetchLocatorAndWriteValue(DatabaseCall dbCall, Object resultSet) throws SQLException {
Enumeration<DatabaseField> enumFields = dbCall.getContexts().getFields().elements();
- Enumeration enumValues = dbCall.getContexts().getValues().elements();
+ Enumeration<?> enumValues = dbCall.getContexts().getValues().elements();
AbstractSession executionSession = dbCall.getQuery().getSession().getExecutionSession(dbCall.getQuery());
while (enumFields.hasMoreElements()) {
DatabaseField field = enumFields.nextElement();
@@ -171,9 +171,9 @@
public void addCall(Call call) {
if (calls == null) {
//use lazy initialization
- calls = new ArrayList(2);
+ calls = new ArrayList<>(2);
}
- calls.add(call);
+ calls.add((DatabaseCall) call);
}
// Bug 3110860: RETURNINGPOLICY-OBTAINED PK CAUSES LOB TO BE INSERTED INCORRECTLY
@@ -194,8 +194,8 @@
//all INSERTs have been executed, time to execute the SELECTs
try {
- for (Iterator callIt = calls.iterator(); callIt.hasNext();) {
- DatabaseCall dbCall = (DatabaseCall)callIt.next();
+ for (Iterator<DatabaseCall> callIt = calls.iterator(); callIt.hasNext();) {
+ DatabaseCall dbCall = callIt.next();
buildAndExecuteCall(dbCall, session);
}
} finally {
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/MappingCompare.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/MappingCompare.java
index 7705671..ad0e262 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/MappingCompare.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/MappingCompare.java
@@ -26,21 +26,21 @@
* Avoid using this class as sun.misc is not part of many VM's like Netscapes.
*
*/
-public class MappingCompare implements Comparator, Serializable {
+public class MappingCompare implements Comparator<DatabaseMapping>, Serializable {
private static final long serialVersionUID = -2749222441763925989L;
@Override
- public int compare(Object arg1, Object arg2) {
- int arg1Value = ((DatabaseMapping) arg1).getWeight();
- int arg2Value = ((DatabaseMapping) arg2).getWeight();
+ public int compare(DatabaseMapping arg1, DatabaseMapping arg2) {
+ int arg1Value = arg1.getWeight();
+ int arg2Value = arg2.getWeight();
if (arg1Value == arg2Value) {
- int result = ((DatabaseMapping)arg1).getClass().getName().compareTo(((DatabaseMapping)arg2).getClass().getName());
+ int result = arg1.getClass().getName().compareTo(arg2.getClass().getName());
// For same classes, compare attribute names.
if (result == 0) {
// Can be null for TransformationMapping.
- if (((DatabaseMapping)arg1).getAttributeName() != null && ((DatabaseMapping)arg2).getAttributeName() != null) {
- result = ((DatabaseMapping)arg1).getAttributeName().compareTo(((DatabaseMapping)arg2).getAttributeName());
+ if (arg1.getAttributeName() != null && arg2.getAttributeName() != null) {
+ result = arg1.getAttributeName().compareTo(arg2.getAttributeName());
}
}
return result;
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/NonSynchronizedProperties.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/NonSynchronizedProperties.java
index 4f6b65f..fce293a 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/NonSynchronizedProperties.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/NonSynchronizedProperties.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
@@ -26,7 +26,7 @@
public NonSynchronizedProperties(int size) {
super();
- this.values = new HashMap(size);
+ this.values = new HashMap<>(size);
}
@Override
@@ -59,7 +59,7 @@
@Override
public Enumeration<Object> elements() {
- return new Hashtable(this.values).elements();
+ return new Hashtable<>(this.values).elements();
}
@Override
@@ -89,7 +89,7 @@
@Override
public Enumeration<Object> keys() {
- return new Hashtable(this.values).keys();
+ return new Hashtable<>(this.values).keys();
}
@Override
@@ -107,7 +107,7 @@
}
@Override
- public void putAll(Map<? extends Object, ? extends Object> t) {
+ public void putAll(Map<?, ?> t) {
this.values.putAll(t);
}
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/NonSynchronizedSubVector.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/NonSynchronizedSubVector.java
index f8b8d45..58315bc 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/NonSynchronizedSubVector.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/NonSynchronizedSubVector.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
@@ -19,12 +19,12 @@
/**
* SubList that implements Vector.
*/
-public class NonSynchronizedSubVector extends NonSynchronizedVector {
- private Vector l;
+public class NonSynchronizedSubVector<E> extends NonSynchronizedVector<E> {
+ private Vector<E> l;
private int offset;
private int size;
- public NonSynchronizedSubVector(Vector list, int fromIndex, int toIndex) {
+ public NonSynchronizedSubVector(Vector<E> list, int fromIndex, int toIndex) {
super(0);
if (fromIndex < 0)
throw new IndexOutOfBoundsException("fromIndex = " + fromIndex);
@@ -39,27 +39,27 @@
}
@Override
- public Object set(int index, Object element) {
+ public E set(int index, E element) {
return l.set(index+offset, element);
}
@Override
- public void setElementAt(Object obj, int index) {
+ public void setElementAt(E obj, int index) {
set(index, obj);
}
@Override
- public Object elementAt(int index) {
+ public E elementAt(int index) {
return get(index);
}
@Override
- public Object firstElement() {
+ public E firstElement() {
return get(0);
}
@Override
- public Object lastElement() {
+ public E lastElement() {
return get(size() - 1);
}
@@ -96,7 +96,7 @@
}
@Override
- public Object get(int index) {
+ public E get(int index) {
return l.get(index+offset);
}
@@ -106,7 +106,7 @@
}
@Override
- public void add(int index, Object element) {
+ public void add(int index, E element) {
if (index<0 || index>size)
throw new IndexOutOfBoundsException();
l.add(index+offset, element);
@@ -115,8 +115,8 @@
}
@Override
- public Object remove(int index) {
- Object result = l.remove(index+offset);
+ public E remove(int index) {
+ E result = l.remove(index+offset);
size--;
modCount++;
return result;
@@ -129,12 +129,12 @@
}*/
@Override
- public boolean addAll(Collection c) {
+ public boolean addAll(Collection<? extends E> c) {
return addAll(size, c);
}
@Override
- public boolean addAll(int index, Collection c) {
+ public boolean addAll(int index, Collection<? extends E> c) {
if (index<0 || index>size)
throw new IndexOutOfBoundsException(
"Index: "+index+", Size: "+size);
@@ -148,8 +148,8 @@
}
@Override
- public Enumeration elements() {
- return new Enumeration() {
+ public Enumeration<E> elements() {
+ return new Enumeration<E>() {
int count = 0;
@Override
@@ -158,7 +158,7 @@
}
@Override
- public Object nextElement() {
+ public E nextElement() {
if (count < elementCount) {
return get(count++);
}
@@ -175,10 +175,10 @@
}
@Override
- public Object[] toArray(Object a[]) {
+ @SuppressWarnings({"unchecked"})
+ public <T> T[] toArray(T[] a) {
if (a.length < size)
- a = (Object[])java.lang.reflect.Array.newInstance(
- a.getClass().getComponentType(), size);
+ return (T[]) Arrays.copyOfRange(elementData, offset, size, a.getClass());
System.arraycopy(l.toArray(), offset, a, 0, size);
@@ -189,18 +189,18 @@
}
@Override
- public Iterator iterator() {
+ public Iterator<E> iterator() {
return listIterator();
}
@Override
- public ListIterator listIterator(final int index) {
+ public ListIterator<E> listIterator(final int index) {
if (index<0 || index>size)
throw new IndexOutOfBoundsException(
"Index: "+index+", Size: "+size);
- return new ListIterator() {
- private ListIterator i = l.listIterator(index+offset);
+ return new ListIterator<E>() {
+ private ListIterator<E> i = l.listIterator(index+offset);
@Override
public boolean hasNext() {
@@ -208,7 +208,7 @@
}
@Override
- public Object next() {
+ public E next() {
if (hasNext())
return i.next();
else
@@ -221,7 +221,7 @@
}
@Override
- public Object previous() {
+ public E previous() {
if (hasPrevious())
return i.previous();
else
@@ -246,12 +246,12 @@
}
@Override
- public void set(Object o) {
+ public void set(E o) {
i.set(o);
}
@Override
- public void add(Object o) {
+ public void add(E o) {
i.add(o);
size++;
modCount++;
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/NonSynchronizedVector.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/NonSynchronizedVector.java
index 7b80f02..7f44216 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/NonSynchronizedVector.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/NonSynchronizedVector.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,32 @@
// Oracle - initial API and implementation from Oracle TopLink
package org.eclipse.persistence.internal.helper;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.StreamCorruptedException;
import java.util.*;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
/**
* Vector subclass that removes the synchronization.
*/
-public class NonSynchronizedVector extends Vector {
- public static NonSynchronizedVector newInstance(int initialCapacity, int capacityIncrement) {
- return new NonSynchronizedVector(initialCapacity, capacityIncrement);
+public class NonSynchronizedVector<E> extends Vector<E> {
+ public static <E> NonSynchronizedVector<E> newInstance(int initialCapacity, int capacityIncrement) {
+ return new NonSynchronizedVector<E>(initialCapacity, capacityIncrement);
}
- public static NonSynchronizedVector newInstance(int initialCapacity) {
- return new NonSynchronizedVector(initialCapacity);
+ public static <E> NonSynchronizedVector<E> newInstance(int initialCapacity) {
+ return new NonSynchronizedVector<E>(initialCapacity);
}
- public static NonSynchronizedVector newInstance() {
- return new NonSynchronizedVector();
+ public static <E> NonSynchronizedVector<E> newInstance() {
+ return new NonSynchronizedVector<>();
}
- public static NonSynchronizedVector newInstance(Collection c) {
- return new NonSynchronizedVector(c);
+ public static <E> NonSynchronizedVector<E> newInstance(Collection<? extends E> c) {
+ return new NonSynchronizedVector<>(c);
}
public NonSynchronizedVector(int initialCapacity, int capacityIncrement) {
@@ -48,12 +54,12 @@
super();
}
- public NonSynchronizedVector(Collection c) {
+ public NonSynchronizedVector(Collection<? extends E> c) {
super(c);
}
@Override
- public void copyInto(Object anArray[]) {
+ public void copyInto(Object[] anArray) {
System.arraycopy(elementData, 0, anArray, 0, elementCount);
}
@@ -62,42 +68,61 @@
modCount++;
int oldCapacity = elementData.length;
if (elementCount < oldCapacity) {
- Object oldData[] = elementData;
- elementData = new Object[elementCount];
- System.arraycopy(oldData, 0, elementData, 0, elementCount);
+ elementData = Arrays.copyOf(elementData, elementCount);
}
}
@Override
public void ensureCapacity(int minCapacity) {
- modCount++;
- ensureCapacityHelper(minCapacity);
- }
-
- private void ensureCapacityHelper(int minCapacity) {
- int oldCapacity = elementData.length;
- if (minCapacity > oldCapacity) {
- Object oldData[] = elementData;
- int newCapacity = (capacityIncrement > 0) ?
- (oldCapacity + capacityIncrement) : (oldCapacity * 2);
- if (newCapacity < minCapacity) {
- newCapacity = minCapacity;
- }
- elementData = new Object[newCapacity];
- System.arraycopy(oldData, 0, elementData, 0, elementCount);
+ if (minCapacity > 0) {
+ modCount++;
+ if (minCapacity > elementData.length)
+ grow(minCapacity);
}
}
+ private Object[] grow(int minCapacity) {
+ int oldCapacity = elementData.length;
+ int newCapacity = newLength(oldCapacity, minCapacity - oldCapacity,
+ capacityIncrement > 0 ? capacityIncrement : oldCapacity);
+ return elementData = Arrays.copyOf(elementData, newCapacity);
+ }
+
+ private int newLength(int oldLength, int minGrowth, int prefGrowth) {
+ int prefLength = oldLength + Math.max(minGrowth, prefGrowth); // might overflow
+ if (0 < prefLength && prefLength <= Integer.MAX_VALUE - 16) {
+ return prefLength;
+ }
+ throw new OutOfMemoryError("Required array length is too large");
+ }
+
+ private Object[] grow() {
+ return grow(elementCount + 1);
+ }
+
+
+// private void ensureCapacityHelper(int minCapacity) {
+// int oldCapacity = elementData.length;
+// if (minCapacity > oldCapacity) {
+// Object oldData[] = elementData;
+// int newCapacity = (capacityIncrement > 0) ?
+// (oldCapacity + capacityIncrement) : (oldCapacity * 2);
+// if (newCapacity < minCapacity) {
+// newCapacity = minCapacity;
+// }
+// elementData = new Object[newCapacity];
+// System.arraycopy(oldData, 0, elementData, 0, elementCount);
+// }
+// }
+
@Override
public void setSize(int newSize) {
modCount++;
- if (newSize > elementCount) {
- ensureCapacityHelper(newSize);
- } else {
- for (int i = newSize ; i < elementCount ; i++) {
- elementData[i] = null;
- }
- }
+ if (newSize > elementData.length)
+ grow(newSize);
+ final Object[] es = elementData;
+ for (int to = elementCount, i = newSize; i < to; i++)
+ es[i] = null;
elementCount = newSize;
}
@@ -108,7 +133,7 @@
@Override
public Object clone() {
- return new NonSynchronizedVector(this);
+ return new NonSynchronizedVector<>(this);
}
@Override
@@ -122,19 +147,17 @@
}
@Override
- public Enumeration elements() {
- return new Enumeration() {
+ public Enumeration<E> elements() {
+ return new Enumeration<E>() {
int count = 0;
- @Override
public boolean hasMoreElements() {
return count < elementCount;
}
- @Override
- public Object nextElement() {
+ public E nextElement() {
if (count < elementCount) {
- return elementData[count++];
+ return elementData(count++);
}
throw new NoSuchElementException("Vector Enumeration");
}
@@ -145,12 +168,12 @@
public int indexOf(Object elem, int index) {
if (elem == null) {
for (int i = index ; i < elementCount ; i++)
- if (elementData[i]==null)
- return i;
+ if (elementData[i]==null)
+ return i;
} else {
for (int i = index ; i < elementCount ; i++)
- if (elem.equals(elementData[i]))
- return i;
+ if (elem.equals(elementData[i]))
+ return i;
}
return -1;
}
@@ -166,84 +189,90 @@
throw new IndexOutOfBoundsException(index + " >= "+ elementCount);
if (elem == null) {
for (int i = index; i >= 0; i--)
- if (elementData[i]==null)
- return i;
+ if (elementData[i]==null)
+ return i;
} else {
for (int i = index; i >= 0; i--)
- if (elem.equals(elementData[i]))
- return i;
+ if (elem.equals(elementData[i]))
+ return i;
}
return -1;
}
@Override
- public Object elementAt(int index) {
+ public E elementAt(int index) {
if (index >= elementCount) {
throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount);
}
- return elementData[index];
+
+ return elementData(index);
}
@Override
- public Object firstElement() {
+ public E firstElement() {
if (elementCount == 0) {
throw new NoSuchElementException();
}
- return elementData[0];
+ return elementData(0);
}
@Override
- public Object lastElement() {
+ public E lastElement() {
if (elementCount == 0) {
throw new NoSuchElementException();
}
- return elementData[elementCount - 1];
+ return elementData(elementCount - 1);
}
@Override
- public void setElementAt(Object obj, int index) {
+ public void setElementAt(E obj, int index) {
if (index >= elementCount) {
throw new ArrayIndexOutOfBoundsException(index + " >= " +
- elementCount);
+ elementCount);
}
elementData[index] = obj;
}
@Override
public void removeElementAt(int index) {
- modCount++;
if (index >= elementCount) {
throw new ArrayIndexOutOfBoundsException(index + " >= " +
- elementCount);
- } else if (index < 0) {
+ elementCount);
+ }
+ else if (index < 0) {
throw new ArrayIndexOutOfBoundsException(index);
}
int j = elementCount - index - 1;
if (j > 0) {
System.arraycopy(elementData, index + 1, elementData, index, j);
}
+ modCount++;
elementCount--;
elementData[elementCount] = null; /* to let gc do its work */
}
@Override
- public void insertElementAt(Object obj, int index) {
- modCount++;
+ public void insertElementAt(E obj, int index) {
if (index > elementCount) {
throw new ArrayIndexOutOfBoundsException(index
- + " > " + elementCount);
+ + " > " + elementCount);
}
- ensureCapacityHelper(elementCount + 1);
- System.arraycopy(elementData, index, elementData, index + 1, elementCount - index);
+ modCount++;
+ final int s = elementCount;
+ Object[] elementData = this.elementData;
+ if (s == elementData.length)
+ elementData = grow();
+ System.arraycopy(elementData, index,
+ elementData, index + 1,
+ s - index);
elementData[index] = obj;
- elementCount++;
+ elementCount = s + 1;
}
@Override
- public void addElement(Object obj) {
+ public void addElement(E obj) {
modCount++;
- ensureCapacityHelper(elementCount + 1);
- elementData[elementCount++] = obj;
+ add(obj, elementData, elementCount);
}
@Override
@@ -259,26 +288,22 @@
@Override
public void removeAllElements() {
+ final Object[] es = elementData;
+ for (int to = elementCount, i = elementCount = 0; i < to; i++)
+ es[i] = null;
modCount++;
- // Let gc do its work
- for (int i = 0; i < elementCount; i++)
- elementData[i] = null;
-
- elementCount = 0;
}
@Override
public Object[] toArray() {
- Object[] result = new Object[elementCount];
- System.arraycopy(elementData, 0, result, 0, elementCount);
- return result;
+ return Arrays.copyOf(elementData, elementCount);
}
@Override
- public Object[] toArray(Object a[]) {
+ @SuppressWarnings({"unchecked"})
+ public <T> T[] toArray(T[] a) {
if (a.length < elementCount)
- a = (Object[])java.lang.reflect.Array.newInstance(
- a.getClass().getComponentType(), elementCount);
+ return (T[]) Arrays.copyOf(elementData, elementCount, a.getClass());
System.arraycopy(elementData, 0, a, 0, elementCount);
@@ -288,113 +313,168 @@
return a;
}
- @Override
- public Object get(int index) {
- if (index >= elementCount)
- throw new ArrayIndexOutOfBoundsException(index);
+ @SuppressWarnings("unchecked")
+ E elementData(int index) {
+ return (E) elementData[index];
+ }
- return elementData[index];
+ @SuppressWarnings("unchecked")
+ static <E> E elementAt(Object[] es, int index) {
+ return (E) es[index];
}
@Override
- public Object set(int index, Object element) {
+ public E get(int index) {
if (index >= elementCount)
throw new ArrayIndexOutOfBoundsException(index);
- Object oldValue = elementData[index];
+ return elementData(index);
+ }
+
+ @Override
+ public E set(int index, E element) {
+ if (index >= elementCount)
+ throw new ArrayIndexOutOfBoundsException(index);
+
+ E oldValue = elementData(index);
elementData[index] = element;
return oldValue;
}
+ private void add(E e, Object[] elementData, int s) {
+ if (s == elementData.length)
+ elementData = grow();
+ elementData[s] = e;
+ elementCount = s + 1;
+ }
+
@Override
- public boolean add(Object o) {
+ public boolean add(E o) {
modCount++;
- ensureCapacityHelper(elementCount + 1);
- elementData[elementCount++] = o;
+ add(o, elementData, elementCount);
return true;
}
@Override
- public Object remove(int index) {
+ public E remove(int index) {
modCount++;
if (index >= elementCount)
throw new ArrayIndexOutOfBoundsException(index);
- Object oldValue = elementData[index];
+ E oldValue = elementData(index);
int numMoved = elementCount - index - 1;
if (numMoved > 0)
System.arraycopy(elementData, index+1, elementData, index,
- numMoved);
+ numMoved);
elementData[--elementCount] = null; // Let gc do its work
return oldValue;
}
@Override
- public boolean containsAll(Collection c) {
- Iterator e = c.iterator();
- while (e.hasNext())
- if(!contains(e.next()))
+ public boolean containsAll(Collection<?> c) {
+ for (Object e : c)
+ if (!contains(e))
return false;
-
return true;
}
@Override
- public boolean addAll(Collection c) {
+ public boolean addAll(Collection<? extends E> c) {
+ Object[] a = c.toArray();
modCount++;
- Object[] a = c.toArray();
- int numNew = a.length;
- ensureCapacityHelper(elementCount + numNew);
- System.arraycopy(a, 0, elementData, elementCount, numNew);
- elementCount += numNew;
- return numNew != 0;
+ int numNew = a.length;
+ if (numNew == 0)
+ return false;
+ Object[] elementData = this.elementData;
+ final int s = elementCount;
+ if (numNew > elementData.length - s)
+ elementData = grow(s + numNew);
+ System.arraycopy(a, 0, elementData, s, numNew);
+ elementCount = s + numNew;
+ return true;
}
- @Override
- public boolean removeAll(Collection c) {
- boolean modified = false;
- Iterator e = iterator();
- while (e.hasNext()) {
- if(c.contains(e.next())) {
- e.remove();
- modified = true;
- }
+ private static long[] nBits(int n) {
+ return new long[((n - 1) >> 6) + 1];
+ }
+ private static void setBit(long[] bits, int i) {
+ bits[i >> 6] |= 1L << i;
+ }
+ private static boolean isClear(long[] bits, int i) {
+ return (bits[i >> 6] & (1L << i)) == 0;
+ }
+
+ private boolean bulkRemove(Predicate<? super E> filter) {
+ int expectedModCount = modCount;
+ final Object[] es = elementData;
+ final int end = elementCount;
+ int i;
+ // Optimize for initial run of survivors
+ for (i = 0; i < end && !filter.test(elementAt(es, i)); i++)
+ ;
+ // Tolerate predicates that reentrantly access the collection for
+ // read (but writers still get CME), so traverse once to find
+ // elements to delete, a second pass to physically expunge.
+ if (i < end) {
+ final int beg = i;
+ final long[] deathRow = nBits(end - beg);
+ deathRow[0] = 1L; // set bit 0
+ for (i = beg + 1; i < end; i++)
+ if (filter.test(elementAt(es, i)))
+ setBit(deathRow, i - beg);
+ if (modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ modCount++;
+ int w = beg;
+ for (i = beg; i < end; i++)
+ if (isClear(deathRow, i - beg))
+ es[w++] = es[i];
+ for (i = elementCount = w; i < end; i++)
+ es[i] = null;
+ return true;
+ } else {
+ if (modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return false;
}
- return modified;
}
@Override
- public boolean retainAll(Collection c) {
- boolean modified = false;
- Iterator e = iterator();
- while (e.hasNext()) {
- if(!c.contains(e.next())) {
- e.remove();
- modified = true;
- }
- }
- return modified;
+ public boolean removeAll(Collection<?> c) {
+ Objects.requireNonNull(c);
+ return bulkRemove(e -> c.contains(e));
}
@Override
- public boolean addAll(int index, Collection c) {
- modCount++;
+ public boolean retainAll(Collection<?> c) {
+ Objects.requireNonNull(c);
+ return bulkRemove(e -> !c.contains(e));
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends E> c) {
if (index < 0 || index > elementCount)
throw new ArrayIndexOutOfBoundsException(index);
- Object[] a = c.toArray();
+ Object[] a = c.toArray();
+ modCount++;
int numNew = a.length;
- ensureCapacityHelper(elementCount + numNew);
+ if (numNew == 0)
+ return false;
+ Object[] elementData = this.elementData;
+ final int s = elementCount;
+ if (numNew > elementData.length - s)
+ elementData = grow(s + numNew);
- int numMoved = elementCount - index;
+ int numMoved = s - index;
if (numMoved > 0)
- System.arraycopy(elementData, index, elementData, index + numNew,
- numMoved);
-
- System.arraycopy(a, 0, elementData, index, numNew);
- elementCount += numNew;
- return numNew != 0;
+ System.arraycopy(elementData, index,
+ elementData, index + numNew,
+ numMoved);
+ System.arraycopy(a, 0, elementData, index, numNew);
+ elementCount = s + numNew;
+ return true;
}
@Override
@@ -404,70 +484,291 @@
if (!(o instanceof List))
return false;
- List list = (List) o;
- int size = size();
- if (list.size() != size) {
- return false;
- }
- for (int index = 0; index < size; index++) {
- Object left = get(index);
- Object right = list.get(index);
- if ((left != right) && ((left == null) || (right == null) || (!left.equals(right)))) {
+ ListIterator<E> e1 = listIterator();
+ ListIterator<?> e2 = ((List<?>) o).listIterator();
+ while (e1.hasNext() && e2.hasNext()) {
+ E o1 = e1.next();
+ Object o2 = e2.next();
+ if (!(o1==null ? o2==null : o1.equals(o2)))
return false;
- }
}
- return true;
+ return !(e1.hasNext() || e2.hasNext());
}
@Override
public int hashCode() {
int hashCode = 1;
- int size = size();
- for (int index = 0; index < size; index++) {
- Object obj = get(index);
- hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
- }
+ for (E e : this)
+ hashCode = 31*hashCode + (e==null ? 0 : e.hashCode());
return hashCode;
}
@Override
public String toString() {
- StringBuilder buf = new StringBuilder();
- Iterator e = iterator();
- buf.append("[");
- int maxIndex = size() - 1;
- for (int i = 0; i <= maxIndex; i++) {
- buf.append(String.valueOf(e.next()));
- if (i < maxIndex)
- buf.append(", ");
+ Iterator<E> it = iterator();
+ if (! it.hasNext())
+ return "[]";
+
+ StringBuilder sb = new StringBuilder();
+ sb.append('[');
+ for (;;) {
+ E e = it.next();
+ sb.append(e == this ? "(this Collection)" : e);
+ if (! it.hasNext())
+ return sb.append(']').toString();
+ sb.append(',').append(' ');
}
- buf.append("]");
- return buf.toString();
+ }
+
+ @Override
+ public List<E> subList(int fromIndex, int toIndex) {
+ return new NonSynchronizedSubVector<E>(this, fromIndex, toIndex);
}
@Override
protected void removeRange(int fromIndex, int toIndex) {
modCount++;
- int numMoved = elementCount - toIndex;
- System.arraycopy(elementData, toIndex, elementData, fromIndex,
- numMoved);
+ shiftTailOverGap(elementData, fromIndex, toIndex);
+ }
- // Let gc do its work
- int newElementCount = elementCount - (toIndex-fromIndex);
- while (elementCount != newElementCount)
- elementData[--elementCount] = null;
+ private void shiftTailOverGap(Object[] es, int lo, int hi) {
+ System.arraycopy(es, hi, es, lo, elementCount - hi);
+ for (int to = elementCount, i = (elementCount -= hi - lo); i < to; i++)
+ es[i] = null;
+ }
+
+ private void readObject(ObjectInputStream in)
+ throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
}
private void writeObject(java.io.ObjectOutputStream s)
- throws java.io.IOException
- {
+ throws java.io.IOException {
s.defaultWriteObject();
}
- @Override
- public List subList(int fromIndex, int toIndex) {
- return new NonSynchronizedSubVector(this, fromIndex, toIndex);
+ public ListIterator<E> listIterator(int index) {
+ if (index < 0 || index > elementCount)
+ throw new IndexOutOfBoundsException("Index: "+index);
+ return new ListItr(index);
}
+ public ListIterator<E> listIterator() {
+ return new ListItr(0);
+ }
+
+ public Iterator<E> iterator() {
+ return new Itr();
+ }
+
+ private class Itr implements Iterator<E> {
+ int cursor; // index of next element to return
+ int lastRet = -1; // index of last element returned; -1 if no such
+ int expectedModCount = modCount;
+
+ public boolean hasNext() {
+ // Racy but within spec, since modifications are checked
+ // within or after synchronization in next/previous
+ return cursor != elementCount;
+ }
+
+ public E next() {
+ checkForComodification();
+ int i = cursor;
+ if (i >= elementCount)
+ throw new NoSuchElementException();
+ cursor = i + 1;
+ return elementData(lastRet = i);
+ }
+
+ public void remove() {
+ if (lastRet == -1)
+ throw new IllegalStateException();
+ checkForComodification();
+ NonSynchronizedVector.this.remove(lastRet);
+ expectedModCount = modCount;
+ cursor = lastRet;
+ lastRet = -1;
+ }
+
+ @Override
+ public void forEachRemaining(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ final int size = elementCount;
+ int i = cursor;
+ if (i >= size) {
+ return;
+ }
+ final Object[] es = elementData;
+ if (i >= es.length)
+ throw new ConcurrentModificationException();
+ while (i < size && modCount == expectedModCount)
+ action.accept(elementAt(es, i++));
+ // update once at end of iteration to reduce heap write traffic
+ cursor = i;
+ lastRet = i - 1;
+ checkForComodification();
+ }
+
+ final void checkForComodification() {
+ if (modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ /**
+ * An optimized version of AbstractList.ListItr
+ */
+ final class ListItr extends Itr implements ListIterator<E> {
+ ListItr(int index) {
+ super();
+ cursor = index;
+ }
+
+ public boolean hasPrevious() {
+ return cursor != 0;
+ }
+
+ public int nextIndex() {
+ return cursor;
+ }
+
+ public int previousIndex() {
+ return cursor - 1;
+ }
+
+ public E previous() {
+ checkForComodification();
+ int i = cursor - 1;
+ if (i < 0)
+ throw new NoSuchElementException();
+ cursor = i;
+ return elementData(lastRet = i);
+ }
+
+ public void set(E e) {
+ if (lastRet == -1)
+ throw new IllegalStateException();
+ checkForComodification();
+ NonSynchronizedVector.this.set(lastRet, e);
+ }
+
+ public void add(E e) {
+ int i = cursor;
+ checkForComodification();
+ NonSynchronizedVector.this.add(i, e);
+ expectedModCount = modCount;
+ cursor = i + 1;
+ lastRet = -1;
+ }
+ }
+
+ @Override
+ public void forEach(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ final int expectedModCount = modCount;
+ final Object[] es = elementData;
+ final int size = elementCount;
+ for (int i = 0; modCount == expectedModCount && i < size; i++)
+ action.accept(elementAt(es, i));
+ if (modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ */
+ @Override
+ public void replaceAll(UnaryOperator<E> operator) {
+ Objects.requireNonNull(operator);
+ final ListIterator<E> li = this.listIterator();
+ while (li.hasNext()) {
+ li.set(operator.apply(li.next()));
+ }
+ }
+
+ @Override
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public void sort(Comparator<? super E> c) {
+ Object[] a = this.toArray();
+ Arrays.sort(a, (Comparator) c);
+ ListIterator<E> i = this.listIterator();
+ for (Object e : a) {
+ i.next();
+ i.set((E) e);
+ }
+ }
+
+ @Override
+ public Spliterator<E> spliterator() {
+ return new VectorSpliterator(null, 0, -1, 0);
+ }
+
+ /** Similar to ArrayList Spliterator */
+ final class VectorSpliterator implements Spliterator<E> {
+ private Object[] array;
+ private int index; // current index, modified on advance/split
+ private int fence; // -1 until used; then one past last index
+ private int expectedModCount; // initialized when fence set
+
+ /** Creates new spliterator covering the given range. */
+ VectorSpliterator(Object[] array, int origin, int fence,
+ int expectedModCount) {
+ this.array = array;
+ this.index = origin;
+ this.fence = fence;
+ this.expectedModCount = expectedModCount;
+ }
+
+ private int getFence() { // initialize on first use
+ int hi;
+ if ((hi = fence) < 0) {
+ array = elementData;
+ expectedModCount = modCount;
+ hi = fence = elementCount;
+ }
+ return hi;
+ }
+
+ public Spliterator<E> trySplit() {
+ int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+ return (lo >= mid) ? null :
+ new VectorSpliterator(array, lo, index = mid, expectedModCount);
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean tryAdvance(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ int i;
+ if (getFence() > (i = index)) {
+ index = i + 1;
+ action.accept((E)array[i]);
+ if (modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ return true;
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void forEachRemaining(Consumer<? super E> action) {
+ Objects.requireNonNull(action);
+ final int hi = getFence();
+ final Object[] a = array;
+ int i;
+ for (i = index, index = hi; i < hi; i++)
+ action.accept((E) a[i]);
+ if (modCount != expectedModCount)
+ throw new ConcurrentModificationException();
+ }
+
+ public long estimateSize() {
+ return getFence() - index;
+ }
+
+ public int characteristics() {
+ return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED;
+ }
+ }
}
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ThreadCursoredList.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ThreadCursoredList.java
index b2a5607..17bce4f 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ThreadCursoredList.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ThreadCursoredList.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
@@ -36,7 +36,7 @@
* @author James Sutherland
* @since OracleAS 10g TopLink (10.0.3)
*/
-public class ThreadCursoredList extends Vector {
+public class ThreadCursoredList<E> extends Vector<E> {
/** Store if the list is fully populated. */
protected boolean isComplete;
@@ -73,7 +73,7 @@
* Add and notify any waiters that there are new elements.
*/
@Override
- public synchronized void add(int index, Object element) {
+ public synchronized void add(int index, E element) {
super.add(index, element);
this.notifyAll();
}
@@ -82,7 +82,7 @@
* Add and notify any waiters that there are new elements.
*/
@Override
- public synchronized boolean add(Object element) {
+ public synchronized boolean add(E element) {
boolean result = super.add(element);
notifyAll();
return result;
@@ -92,7 +92,7 @@
* Add and notify any waiters that there are new elements.
*/
@Override
- public synchronized boolean addAll(int index, Collection collection) {
+ public synchronized boolean addAll(int index, Collection<? extends E> collection) {
boolean result = super.addAll(index, collection);
notifyAll();
return result;
@@ -102,7 +102,7 @@
* Add and notify any waiters that there are new elements.
*/
@Override
- public synchronized boolean addAll(Collection collection) {
+ public synchronized boolean addAll(Collection<? extends E> collection) {
boolean result = super.addAll(collection);
notifyAll();
return result;
@@ -112,7 +112,7 @@
* Add and notify any waiters that there are new elements.
*/
@Override
- public synchronized void addElement(Object object) {
+ public synchronized void addElement(E object) {
super.addElement(object);
notifyAll();
}
@@ -220,7 +220,7 @@
* If it does not contain the object must wait until it is complete.
*/
@Override
- public synchronized boolean containsAll(Collection collection) {
+ public synchronized boolean containsAll(Collection<?> collection) {
boolean result = super.containsAll(collection);
if ((result != true) && (!isComplete())) {
waitUntilComplete();
@@ -242,8 +242,8 @@
* If the index is beyond the size wait until complete.
*/
@Override
- public synchronized Object elementAt(int index) {
- Object result = super.elementAt(index);
+ public synchronized E elementAt(int index) {
+ E result = super.elementAt(index);
if ((result == null) && (!isComplete())) {
waitUntilComplete();
result = super.elementAt(index);
@@ -259,8 +259,8 @@
* Allow concurrent streaming of the elements.
*/
@Override
- public Enumeration elements() {
- return new Enumeration() {
+ public Enumeration<E> elements() {
+ return new Enumeration<E>() {
int count = 0;
@Override
@@ -276,7 +276,7 @@
}
@Override
- public Object nextElement() {
+ public E nextElement() {
synchronized (ThreadCursoredList.this) {
boolean result = count < ThreadCursoredList.this.getSize();
while ((!result) && (!isComplete())) {
@@ -305,7 +305,7 @@
* Wait until has an element or is complete.
*/
@Override
- public synchronized Object firstElement() {
+ public synchronized E firstElement() {
while ((!isComplete()) && (super.size() < 1)) {
waitUntilAdd();
}
@@ -316,7 +316,7 @@
* Wait until has the element or is complete.
*/
@Override
- public synchronized Object get(int index) {
+ public synchronized E get(int index) {
while ((!isComplete()) && (super.size() < index)) {
waitUntilAdd();
}
@@ -362,7 +362,7 @@
* Add the element a notify any waiters that there are new elements.
*/
@Override
- public synchronized void insertElementAt(Object element, int index) {
+ public synchronized void insertElementAt(E element, int index) {
super.insertElementAt(element, index);
notify();
}
@@ -381,7 +381,7 @@
}
@Override
- public Iterator iterator() {
+ public Iterator<E> iterator() {
return listIterator(0);
}
@@ -389,7 +389,7 @@
* First wait until complete.
*/
@Override
- public synchronized Object lastElement() {
+ public synchronized E lastElement() {
waitUntilComplete();
return super.lastElement();
}
@@ -413,7 +413,7 @@
}
@Override
- public ListIterator listIterator() {
+ public ListIterator<E> listIterator() {
return listIterator(0);
}
@@ -421,8 +421,8 @@
* Iterate while waiting at end until complete.
*/
@Override
- public ListIterator listIterator(final int index) {
- return new ListIterator() {
+ public ListIterator<E> listIterator(final int index) {
+ return new ListIterator<E>() {
int count = index;
@Override
@@ -438,7 +438,7 @@
}
@Override
- public Object next() {
+ public E next() {
synchronized (ThreadCursoredList.this) {
boolean result = count < ThreadCursoredList.this.getSize();
while ((!result) && (!isComplete())) {
@@ -478,7 +478,7 @@
}
@Override
- public Object previous() {
+ public E previous() {
count--;
return get(count);
}
@@ -494,7 +494,7 @@
* If index is missing wait until is there.
*/
@Override
- public synchronized Object remove(int index) {
+ public synchronized E remove(int index) {
while ((!isComplete()) && (super.size() < index)) {
waitUntilAdd();
}
@@ -518,7 +518,7 @@
* First wait until complete.
*/
@Override
- public synchronized boolean removeAll(Collection collection) {
+ public synchronized boolean removeAll(Collection<?> collection) {
waitUntilComplete();
return super.removeAll(collection);
}
@@ -560,7 +560,7 @@
* First wait until complete.
*/
@Override
- public synchronized boolean retainAll(Collection collection) {
+ public synchronized boolean retainAll(Collection<?> collection) {
waitUntilComplete();
return super.retainAll(collection);
}
@@ -569,7 +569,7 @@
* If index is missing wait until reached or complete.
*/
@Override
- public synchronized Object set(int index, Object element) {
+ public synchronized E set(int index, E element) {
while ((!isComplete()) && (super.size() < index)) {
waitUntilAdd();
}
@@ -580,7 +580,7 @@
* If index is missing wait until reached or complete.
*/
@Override
- public synchronized void setElementAt(Object element, int index) {
+ public synchronized void setElementAt(E element, int index) {
while ((!isComplete()) && (super.size() < index)) {
waitUntilAdd();
}
@@ -600,7 +600,7 @@
* If index is missing wait until reached or complete.
*/
@Override
- public List subList(int fromIndex, int toIndex) {
+ public List<E> subList(int fromIndex, int toIndex) {
while ((!isComplete()) && (super.size() < toIndex)) {
waitUntilAdd();
}
@@ -620,7 +620,7 @@
* First wait until complete.
*/
@Override
- public synchronized Object[] toArray(Object[] array) {
+ public synchronized <T> T[] toArray(T[] array) {
waitUntilComplete();
return super.toArray(array);
}
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/ExpressionQueryMechanism.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/ExpressionQueryMechanism.java
index d7f618a..863a7d7 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/ExpressionQueryMechanism.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/ExpressionQueryMechanism.java
@@ -574,7 +574,7 @@
insertStatement.setModifyRow(getModifyRow());
if (getDescriptor().hasReturningPolicies() && getDescriptor().getReturnFieldsToGenerateInsert() != null) {
// In case of RelationalDescriptor only return fields for current table must be used.
- Vector<DatabaseField> returnFieldsForTable = new NonSynchronizedVector();
+ Vector<DatabaseField> returnFieldsForTable = new NonSynchronizedVector<>();
for (DatabaseField item: getDescriptor().getReturnFieldsToGenerateInsert()) {
if (table.equals(item.getTable())) {
returnFieldsForTable.add(item);
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/JoinedAttributeManager.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/JoinedAttributeManager.java
index ccd0d8e..6872328 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/JoinedAttributeManager.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/JoinedAttributeManager.java
@@ -32,6 +32,7 @@
import org.eclipse.persistence.internal.expressions.ForUpdateOfClause;
import org.eclipse.persistence.internal.expressions.ObjectExpression;
import org.eclipse.persistence.internal.expressions.QueryKeyExpression;
+import org.eclipse.persistence.internal.helper.DatabaseField;
import org.eclipse.persistence.internal.helper.NonSynchronizedSubVector;
import org.eclipse.persistence.internal.sessions.AbstractRecord;
import org.eclipse.persistence.internal.sessions.AbstractSession;
@@ -990,14 +991,14 @@
List<AbstractRecord> childRows = null;
ObjectBuilder builder = getDescriptor().getObjectBuilder();
int parentIndex = getParentResultIndex();
- Vector trimedFields = null;
+ Vector<DatabaseField> trimedFields = null;
for (int dataResultsIndex = 0; dataResultsIndex < size; dataResultsIndex++) {
AbstractRecord row = this.dataResults.get(dataResultsIndex);
AbstractRecord parentRow = row;
// Must adjust for the parent index to ensure the correct pk is extracted.
if (parentIndex > 0) {
if (trimedFields == null) { // The fields are always the same, so only build once.
- trimedFields = new NonSynchronizedSubVector(row.getFields(), parentIndex, row.size());
+ trimedFields = new NonSynchronizedSubVector<>(row.getFields(), parentIndex, row.size());
}
Vector trimedValues = new NonSynchronizedSubVector(row.getValues(), parentIndex, row.size());
parentRow = new DatabaseRecord(trimedFields, trimedValues);
@@ -1057,14 +1058,14 @@
*/
public AbstractRecord processDataResults(AbstractRecord row, Cursor cursor, boolean forward) {
if (this.dataResultsByPrimaryKey == null) {
- this.dataResultsByPrimaryKey = new HashMap();
+ this.dataResultsByPrimaryKey = new HashMap<>();
}
AbstractRecord parentRow = row;
List<AbstractRecord> childRows = new ArrayList<>();
childRows.add(row);
int parentIndex = getParentResultIndex();
// Must adjust for the parent index to ensure the correct pk is extracted.
- Vector trimedFields = new NonSynchronizedSubVector(row.getFields(), parentIndex, row.size());
+ Vector<DatabaseField> trimedFields = new NonSynchronizedSubVector<>(row.getFields(), parentIndex, row.size());
if (parentIndex > 0) {
Vector trimedValues = new NonSynchronizedSubVector(row.getValues(), parentIndex, row.size());
parentRow = new DatabaseRecord(trimedFields, trimedValues);
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 b4274ba..0d02c26 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
@@ -73,7 +73,7 @@
* converts JDBC results to collections of rows.
*/
protected AbstractRecord() {
- this.fields = new NonSynchronizedVector();
+ this.fields = new NonSynchronizedVector<>();
this.values = new NonSynchronizedVector();
this.size = 0;
this.nullValueInFields = false;
@@ -84,7 +84,7 @@
* converts JDBC results to collections of rows.
*/
protected AbstractRecord(int initialCapacity) {
- this.fields = new NonSynchronizedVector(initialCapacity);
+ this.fields = new NonSynchronizedVector<>(initialCapacity);
this.values = new NonSynchronizedVector(initialCapacity);
this.size = 0;
this.nullValueInFields = false;
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/DatabaseMapping.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/DatabaseMapping.java
index 66b2b85..50a3773 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/DatabaseMapping.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/DatabaseMapping.java
@@ -926,7 +926,7 @@
* @return TODO
*/
public Vector getSelectTables() {
- return new NonSynchronizedVector(0);
+ return new NonSynchronizedVector<>(0);
}
/**
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 2f62d30..036750e 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
@@ -1212,7 +1212,7 @@
*/
@Override
public Vector getSelectFields() {
- Vector fields = new NonSynchronizedVector(2);
+ Vector<DatabaseField> fields = new NonSynchronizedVector<>(2);
fields.add(getDirectField());
return fields;
}
@@ -1224,7 +1224,7 @@
*/
@Override
public Vector getSelectTables() {
- Vector tables = new NonSynchronizedVector(0);
+ Vector<DatabaseTable> tables = new NonSynchronizedVector<>(0);
tables.add(getReferenceTable());
return tables;
}
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/ForeignReferenceMapping.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/ForeignReferenceMapping.java
index 40e490d..afc1cc3 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/ForeignReferenceMapping.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/mappings/ForeignReferenceMapping.java
@@ -2398,7 +2398,7 @@
}
fieldStartIndex = (Integer) map.get(cls);
}
- Vector trimedFields = new NonSynchronizedSubVector(row.getFields(), fieldStartIndex, row.size());
+ Vector<DatabaseField> trimedFields = new NonSynchronizedSubVector<>(row.getFields(), fieldStartIndex, row.size());
Vector trimedValues = new NonSynchronizedSubVector(row.getValues(), fieldStartIndex, row.size());
return new DatabaseRecord(trimedFields, trimedValues);
}
diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLCollectionReferenceMapping.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLCollectionReferenceMapping.java
index 6564e72..637b82e 100644
--- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLCollectionReferenceMapping.java
+++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/oxm/mappings/XMLCollectionReferenceMapping.java
@@ -84,8 +84,8 @@
* and sourceToTargetKeys data structures.
*/
public XMLCollectionReferenceMapping() {
- sourceToTargetKeyFieldAssociations = new HashMap();
- sourceToTargetKeys = new NonSynchronizedVector();
+ sourceToTargetKeyFieldAssociations = new HashMap<>();
+ sourceToTargetKeys = new NonSynchronizedVector<>();
this.containerPolicy = ContainerPolicy.buildDefaultPolicy();
this.usesSingleNode = false;
}
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 322e729..232a317 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
@@ -39,6 +39,7 @@
import org.eclipse.persistence.internal.expressions.FunctionExpression;
import org.eclipse.persistence.internal.expressions.MapEntryExpression;
import org.eclipse.persistence.internal.helper.ConversionManager;
+import org.eclipse.persistence.internal.helper.DatabaseField;
import org.eclipse.persistence.internal.helper.NonSynchronizedSubVector;
import org.eclipse.persistence.internal.queries.JoinedAttributeManager;
import org.eclipse.persistence.internal.queries.ReportItem;
@@ -250,7 +251,7 @@
AbstractRecord subRow = row;
// Check if at the start of the row, then avoid building a subRow.
if (itemIndex > 0) {
- Vector trimedFields = new NonSynchronizedSubVector(row.getFields(), itemIndex, rowSize);
+ Vector<DatabaseField> trimedFields = new NonSynchronizedSubVector<>(row.getFields(), itemIndex, rowSize);
Vector trimedValues = new NonSynchronizedSubVector(row.getValues(), itemIndex, rowSize);
subRow = new DatabaseRecord(trimedFields, trimedValues);
}