Skip to content

Commit

Permalink
clean up warnings (eclipse-ee4j#1269)
Browse files Browse the repository at this point in the history
* warnings in sdo, moxy, dbws
* add override ann
* remove redundant casts, inheritdoc

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
(cherry picked from commit ed8460e)
  • Loading branch information
lukasj committed Sep 1, 2021
1 parent bc0f0b2 commit fc0108b
Show file tree
Hide file tree
Showing 3,147 changed files with 12,761 additions and 21,171 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions dbws/org.eclipse.persistence.dbws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
</parent>

<properties>
<!-- disable warnings for exports for now -->
<comp.xlint>-Xlint:all,-rawtypes,-unchecked,-serial,-exports</comp.xlint>
<test-skip-dbws>${skipTests}</test-skip-dbws>
</properties>

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -717,7 +717,7 @@ public void getAllEmployees() {
for (DynamicEntity employee : resultVector) {
xrDynEntityCol.add(employee);
xrDynEntityCol.add(employee.get("address"));
Vector<DynamicEntity> phones = (Vector<DynamicEntity>)employee.get("phones");
Vector<DynamicEntity> phones = employee.get("phones");
phones.size(); // trigger IndirectList
for (DynamicEntity phone : phones) {
xrDynEntityCol.add(phone);
Expand Down Expand Up @@ -745,7 +745,7 @@ public void buildEmployees() {
assertTrue("employee1 __pk incorrent", Integer.valueOf(1).equals(employee1.get("employeeId")));
assertTrue("employee1 first name incorrent", "Mike".equals(employee1.get("firstName")));
assertTrue("employee1 last name incorrent", "Norman".equals(employee1.get("lastName")));
ArrayList<DynamicEntity> phones = (ArrayList<DynamicEntity>)employee1.get("phones"); // phones
ArrayList<DynamicEntity> phones = employee1.get("phones"); // phones
assertTrue("employee1 has wrong number of phones", phones.size() == 2);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -25,6 +25,7 @@ public XRCustomer() {
super();
}

@Override
public XRDynamicPropertiesManager fetchPropertiesManager() {
return DPM;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -88,20 +88,19 @@ public void buildTestClass() throws ClassNotFoundException {

@SuppressWarnings("unchecked")
@Test
public void buildTestEntity() throws InstantiationException, IllegalAccessException,
NoSuchFieldException {
public void buildTestEntity() throws ReflectiveOperationException {
XRDynamicClassLoader xrdcl =
new XRDynamicClassLoader(XRDynamicEntityTestSuite.class.getClassLoader());
Class<XRDynamicEntity> testClass =
(Class<XRDynamicEntity>)xrdcl.createDynamicClass(TEST_CLASSNAME);
XRDynamicEntity newInstance = testClass.newInstance();
XRDynamicEntity newInstance = testClass.getConstructor().newInstance();
XRDynamicPropertiesManager xrDPM = newInstance.fetchPropertiesManager();
Set<String> propertyNames = new HashSet<String>();
propertyNames.add(FIELD_1);
propertyNames.add(FIELD_2);
xrDPM.setPropertyNames(propertyNames);
//build instance
XRDynamicEntity newInstance2 = testClass.newInstance();
XRDynamicEntity newInstance2 = testClass.getConstructor().newInstance();
assertNotNull(newInstance2);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -283,6 +283,7 @@ protected XMLDescriptor buildResultDescriptor() {

XMLDirectMapping isCollection = new XMLDirectMapping();
isCollection.setAttributeAccessor(new AttributeAccessor() {

@Override
public String getAttributeName() {
return "isCollection";
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -206,11 +206,9 @@ public SOAPMessage generateResponse(Operation op, boolean useSOAP12, Object resu
XMLDescriptor descriptor = resultDescriptors.get(op.getName());
SOAPResponse response = null;
try {
response = (SOAPResponse) descriptor.getJavaClass().newInstance();
} catch (InstantiationException ie) {
response = (SOAPResponse) descriptor.getJavaClass().getConstructor().newInstance();
} catch (ReflectiveOperationException ie) {
throw new SOAPException(ie);
} catch (IllegalAccessException iae) {
throw new SOAPException(iae);
}
response.setResult(result);

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -39,9 +39,6 @@ public void setJpqlString(String sqlString) {
this.jpqlString = sqlString;
}

/**
* {@inheritDoc}
*/
@Override
public void initializeCall(XRServiceAdapter xrService, QueryOperation queryOperation,
DatabaseQuery databaseQuery) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -52,9 +52,6 @@ public void setDescriptor(String descriptor) {
this.descriptor = descriptor;
}

/**
* {@inheritDoc}
*/
@Override
public void validate(XRServiceAdapter xrService, QueryOperation queryOperation) {
if (descriptor != null) {
Expand Down Expand Up @@ -90,9 +87,6 @@ public void validate(XRServiceAdapter xrService, QueryOperation queryOperation)
}
}

/**
* {@inheritDoc}
*/
@Override
public void initialize(XRServiceAdapter xrService, QueryOperation queryOperation) {
if (descriptor != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -62,7 +62,7 @@ public static void fixOROXAccessors(Project orProject, Project oxProject) {
XRDynamicPropertiesManager xrDPM = null;
if (!clz.getName().endsWith(COLLECTION_WRAPPER_SUFFIX)) {
try {
XRDynamicEntity newInstance = (XRDynamicEntity)clz.newInstance();
XRDynamicEntity newInstance = (XRDynamicEntity)clz.getConstructor().newInstance();
xrDPM = newInstance.fetchPropertiesManager();
}
catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -450,8 +450,8 @@ public Object invoke(XRServiceAdapter xrService, Invocation invocation) {
}
// handle BLOB types
if (value instanceof Blob) {
value = ((XMLConversionManager) xrService.getOXSession().
getDatasourcePlatform().getConversionManager()).
value = xrService.getOXSession().
getDatasourcePlatform().getConversionManager().
convertObject(value, ClassConstants.APBYTE);
}
return AttachmentHelper.buildAttachmentHandler((byte[])value, mimeType);
Expand Down Expand Up @@ -506,7 +506,7 @@ public Object invoke(XRServiceAdapter xrService, Invocation invocation) {
objs[0] = ((ArrayList<?>)value).get(0);
DatabaseRecord dr = new DatabaseRecord();
dr.add(new DatabaseField(ITEMS_STR), objs);
populateTargetObjectFromRecord(desc.getMappings(), (AbstractRecord) dr, targetObject, (AbstractSession)xrService.getORSession());
populateTargetObjectFromRecord(desc.getMappings(), dr, targetObject, (AbstractSession)xrService.getORSession());
}
value = targetObject;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -41,18 +41,12 @@ public void setSqlString(String sqlString) {
this.sqlString = sqlString;
}

/**
* {@inheritDoc}
*/
@Override
public void initialize(XRServiceAdapter xrService, QueryOperation queryOperation) {
super.initialize(xrService, queryOperation);
getDatabaseQuery().setIsUserDefined(true);
}

/**
* {@inheritDoc}
*/
@Override
public void initializeCall(XRServiceAdapter xrService, QueryOperation queryOperation,
DatabaseQuery databaseQuery) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -194,8 +194,8 @@ public void initializeCall(XRServiceAdapter xrService, QueryOperation queryOpera
field.setSqlType(queryOperation.getResult().getJdbcType());
field.setSqlTypeName(getTypeNameForJDBCType(queryOperation.getResult().getJdbcType()));
// replace the original field with the new one
((StoredFunctionCall)spCall).getParameters().remove(0);
((StoredFunctionCall)spCall).getParameters().add(0, field);
spCall.getParameters().remove(0);
spCall.getParameters().add(0, field);
}
// support stored function with out args
for (ProcedureOutputArgument arg : getOutArguments()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 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
Expand Down Expand Up @@ -39,18 +39,21 @@ public DynamicRestClassLoader(ClassLoader delegate, DynamicClassWriter writer) {
super(delegate, writer);
}

@Override
public void createDynamicAdapter(String className) {
// Reference adapter for JPARS version < 2.0
RestAdapterClassWriter restAdapter = new RestAdapterClassWriter(className);
addClass(restAdapter.getClassName(), restAdapter);
}

@Override
public void createDynamicCollectionAdapter(String className) {
// Collection adapter for JPARS version >= 2.0
RestCollectionAdapterClassWriter restCollectionAdapter = new RestCollectionAdapterClassWriter(className);
addClass(restCollectionAdapter.getClassName(), restCollectionAdapter);
}

@Override
public void createDynamicReferenceAdapter(String className) {
// Reference adapter for JPARS version >= 2.0
RestReferenceAdapterV2ClassWriter restReferenceAdapterV2 = new RestReferenceAdapterV2ClassWriter(className);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -43,17 +43,11 @@
@SuppressWarnings({ "rawtypes", "unchecked" })
public class FeatureResponseBuilderImpl implements FeatureResponseBuilder {

/**
* {@inheritDoc}
*/
@Override
public Object buildReadAllQueryResponse(PersistenceContext context, Map<String, Object> queryParams, List<Object> items, UriInfo uriInfo) {
return items;
}

/**
* {@inheritDoc}
*/
@Override
public Object buildReportQueryResponse(PersistenceContext context, Map<String, Object> queryParams, List<Object[]> results, List<ReportItem> items, UriInfo uriInfo) {
if ((results != null) && (!results.isEmpty())) {
Expand All @@ -64,9 +58,6 @@ public Object buildReportQueryResponse(PersistenceContext context, Map<String, O
}
}

/**
* {@inheritDoc}
*/
@Override
public Object buildAttributeResponse(PersistenceContext context, Map<String, Object> queryParams, String attribute, Object result, UriInfo uriInfo) {
if (result instanceof Collection) {
Expand All @@ -81,9 +72,6 @@ public Object buildAttributeResponse(PersistenceContext context, Map<String, Obj
return result;
}

/**
* {@inheritDoc}
*/
@Override
public Object buildSingleResultQueryResponse(PersistenceContext context, Map<String, Object> queryParams, Object result, List<ReportItem> items, UriInfo uriInfo) {
final SingleResultQueryList response = new SingleResultQueryList();
Expand All @@ -92,9 +80,6 @@ public Object buildSingleResultQueryResponse(PersistenceContext context, Map<Str
return response;
}

/**
* {@inheritDoc}
*/
@Override
public Object buildSingleEntityResponse(PersistenceContext context, Map<String, Object> queryParams, Object result, UriInfo uriInfo) {
return result;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -46,9 +46,6 @@
*/
public class FeatureSetPreV2 implements FeatureSet {

/**
* {@inheritDoc}
*/
@Override
public boolean isSupported(Feature feature) {
switch (feature) {
Expand All @@ -60,9 +57,6 @@ public boolean isSupported(Feature feature) {
}
}

/**
* {@inheritDoc}
*/
@Override
public FeatureResponseBuilder getResponseBuilder(Feature feature) {
switch (feature) {
Expand All @@ -73,9 +67,6 @@ public FeatureResponseBuilder getResponseBuilder(Feature feature) {
}
}

/**
* {@inheritDoc}
*/
@Override
public List<MetadataSource> getMetadataSources() {
final List<MetadataSource> metadataSources = new ArrayList<MetadataSource>();
Expand All @@ -98,17 +89,11 @@ public List<MetadataSource> getMetadataSources() {
return metadataSources;
}

/**
* {@inheritDoc}
*/
@Override
public MetadataSource getDynamicMetadataSource(AbstractSession session, String packageName) {
return new DynamicXMLMetadataSource(session, packageName);
}

/**
* {@inheritDoc}
*/
@Override
public SessionEventListener getSessionEventListener(AbstractSession session) {
return new PreLoginMappingAdapter(session);
Expand Down

0 comments on commit fc0108b

Please sign in to comment.