Skip to content

Commit

Permalink
Replace deprecated constructors by valueOf for Byte(),Double()...
Browse files Browse the repository at this point in the history
Remove compiler warnings (valueOf instead of constructors/new Byte(),Double()... ) (eclipse-ee4j#1940)

Signed-off-by: Radek Felcman <[email protected]>
  • Loading branch information
rfelcman authored Sep 7, 2023
1 parent 84a4e1e commit da74397
Show file tree
Hide file tree
Showing 680 changed files with 3,335 additions and 3,335 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 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 @@ -171,18 +171,18 @@ public void computeResults() {
// Set the test average count as the test time.
this.setAverageTestCount((long)testAverage);

this.testAverages.add(new Double(testAverage));
this.testAverages.add(Double.valueOf(testAverage));
this.testMins.add(PerformanceComparisonTestResult.minResults(times));
this.testMaxs.add(PerformanceComparisonTestResult.maxResults(times));
this.testStandardDeviations.add(new Double(testStandardDeviation));
this.testStandardDeviations.add(Double.valueOf(testStandardDeviation));

if (testIndex > 0) {
double testBaseLineAverage = ((Number)this.testAverages.get(0)).doubleValue();

// Difference
double percentageDifference =
PerformanceComparisonTestResult.percentageDifference(testAverage, testBaseLineAverage);
this.percentageDifferences.add(new Double(percentageDifference));
this.percentageDifferences.add(Double.valueOf(percentageDifference));
}
}
}
Expand Down Expand Up @@ -215,7 +215,7 @@ public void addTestCount(long time, int test) {
if (getTestCounts().size() <= test) {
getTestCounts().add(new ArrayList());
}
((List)getTestCounts().get(test)).add(new Long(time));
((List)getTestCounts().get(test)).add(Long.valueOf(time));
}

/**
Expand Down Expand Up @@ -295,7 +295,7 @@ public void logResult(Writer log) {
* Compute the max of the results.
*/
public static Number maxResults(List times) {
Number testMax = new Double(0);
Number testMax = Double.valueOf(0);
for (int index = 0; index < times.size(); index++) {
Number time = (Number)times.get(index);
if (time.doubleValue() > testMax.doubleValue()) {
Expand All @@ -309,7 +309,7 @@ public static Number maxResults(List times) {
* Compute the min of the results.
*/
public static Number minResults(List times) {
Number testMin = new Double(0);
Number testMin = Double.valueOf(0);
for (int index = 0; index < times.size(); index++) {
Number time = (Number)times.get(index);
if ((testMin.doubleValue() == 0) || (time.doubleValue() < testMin.doubleValue())) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 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 @@ -92,12 +92,12 @@ public static void verify(PerformanceRegressionTest test) {
TestResult lastResult = (TestResult)stream.nextElement();
double lastCount = lastResult.getTestTime();
PerformanceComparisonTestResult testResult = (PerformanceComparisonTestResult)((TestCase)test).getTestResult();
testResult.getBaselineVersionResults().add(new Double(lastCount));
testResult.getBaselineVersionResults().add(Double.valueOf(lastCount));
// Average last 5 runs.
int numberOfRuns = 0;
while (stream.hasMoreElements() && (numberOfRuns < 4)) {
TestResult nextResult = (TestResult)stream.nextElement();
testResult.getBaselineVersionResults().add(new Double(nextResult.getTestTime()));
testResult.getBaselineVersionResults().add(Double.valueOf(nextResult.getTestTime()));
numberOfRuns++;
}
stream.close();
Expand All @@ -115,11 +115,11 @@ public static void verify(PerformanceRegressionTest test) {
query.useCursoredStream(1, 1);
stream = (CursoredStream)session.executeQuery(query);
// Average last 5 runs.
testResult.getCurrentVersionResults().add(new Double(currentCount));
testResult.getCurrentVersionResults().add(Double.valueOf(currentCount));
numberOfRuns = 0;
while (stream.hasMoreElements() && (numberOfRuns < 4)) {
TestResult nextResult = (TestResult)stream.nextElement();
testResult.getCurrentVersionResults().add(new Double(nextResult.getTestTime()));
testResult.getCurrentVersionResults().add(Double.valueOf(nextResult.getTestTime()));
numberOfRuns++;
}
stream.close();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 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 @@ -91,7 +91,7 @@ public void postAcquireConnection(SessionEvent event) {
stmt1 = conn.createStatement();
result = stmt1.executeQuery("select @@isolation");
result.next();
isolationLevel = new Integer(result.getInt(1));
isolationLevel = Integer.valueOf(result.getInt(1));
if(isolationLevel > 0) {
// If conn1 began transaction and updated the row (but hasn't committed the transaction yet),
// then conn2 should be able to read the original (not updated) state of the row.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 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 @@ -252,7 +252,7 @@ protected void setup() throws Throwable {
}

if (setters[i] != null) {
Object[] args = { new Boolean(required[i]) };
Object[] args = { Boolean.valueOf(required[i]) };
setters[i].invoke(object, args);
} else {
fields[i].setBoolean(object, required[i]);
Expand All @@ -265,7 +265,7 @@ public void reset() throws Throwable {
super.reset();
for (int i = required.length - 1; i >= 0; i--) {
if (setters[i] != null) {
Object[] args = { new Boolean(original[i]) };
Object[] args = { Boolean.valueOf(original[i]) };
setters[i].invoke(object, args);
} else {
fields[i].setBoolean(object, original[i]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 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 @@ -873,12 +873,12 @@ public void poppulateLoadBuildTable(Vector summaries) {
row.addElement(summary.getLoadBuildSummary().jvm);
row.addElement(summary.getLoadBuildSummary().machine);
row.addElement(summary.getLoadBuildSummary().toplinkVersion);
row.addElement(new Integer(summary.getTotalTests()));
row.addElement(new Integer(summary.getSetupFailures()));
row.addElement(new Integer(summary.getErrors()));
row.addElement(new Integer(summary.getFatalErrors()));
row.addElement(new Integer(summary.getProblems()));
row.addElement(new Long(summary.getTotalTime()));
row.addElement(Integer.valueOf(summary.getTotalTests()));
row.addElement(Integer.valueOf(summary.getSetupFailures()));
row.addElement(Integer.valueOf(summary.getErrors()));
row.addElement(Integer.valueOf(summary.getFatalErrors()));
row.addElement(Integer.valueOf(summary.getProblems()));
row.addElement(Long.valueOf(summary.getTotalTime()));
tableModel.addRow(row);
}
getSelectedTable().setModel(tableModel);
Expand All @@ -900,9 +900,9 @@ public void poppulateTestResultTable(Vector results) {
Vector row = new Vector();
row.addElement(result.getName());
row.addElement(result.getOutcome());
row.addElement(new Long(result.getTestTime()));
row.addElement(new Long(result.getTotalTime()));
row.addElement(new Boolean(result.getException() != null));
row.addElement(Long.valueOf(result.getTestTime()));
row.addElement(Long.valueOf(result.getTotalTime()));
row.addElement(Boolean.valueOf(result.getException() != null));
row.addElement(result.getLoadBuildSummary().timestamp);
row.addElement(result.getLoadBuildSummary().loginChoice);
row.addElement(result.getLoadBuildSummary().os);
Expand All @@ -929,14 +929,14 @@ public void poppulateTestSummaryTable(Vector summaries) {
TestResultsSummary summary = (TestResultsSummary)enumtr.nextElement();
Vector row = new Vector();
row.addElement(summary.getName());
row.addElement(new Integer(summary.getTotalTests()));
row.addElement(new Integer(summary.getSetupFailures()));
row.addElement(new Integer(summary.getPassed()));
row.addElement(new Integer(summary.getErrors()));
row.addElement(new Integer(summary.getFatalErrors()));
row.addElement(new Integer(summary.getProblems()));
row.addElement(new Integer(summary.getWarnings()));
row.addElement(new Long(summary.getTotalTime()));
row.addElement(Integer.valueOf(summary.getTotalTests()));
row.addElement(Integer.valueOf(summary.getSetupFailures()));
row.addElement(Integer.valueOf(summary.getPassed()));
row.addElement(Integer.valueOf(summary.getErrors()));
row.addElement(Integer.valueOf(summary.getFatalErrors()));
row.addElement(Integer.valueOf(summary.getProblems()));
row.addElement(Integer.valueOf(summary.getWarnings()));
row.addElement(Long.valueOf(summary.getTotalTime()));
tableModel.addRow(row);
}
getSelectedTable().setModel(tableModel);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 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 @@ -1532,8 +1532,8 @@ public void buildVehicleDescriptor() {
descriptor.getDescriptorInheritancePolicy().setShouldReadSubclasses(true);
descriptor.getDescriptorInheritancePolicy().setClassIndicatorFieldName("TYPE");
descriptor.getDescriptorInheritancePolicy().setShouldUseClassNameAsIndicator(false);
descriptor.getDescriptorInheritancePolicy().addClassIndicator(org.eclipse.persistence.testing.models.aggregate.Car.class, new java.lang.Integer(1));
descriptor.getDescriptorInheritancePolicy().addClassIndicator(org.eclipse.persistence.testing.models.aggregate.Bicycle.class, new java.lang.Integer(2));
descriptor.getDescriptorInheritancePolicy().addClassIndicator(org.eclipse.persistence.testing.models.aggregate.Car.class, Integer.valueOf(1));
descriptor.getDescriptorInheritancePolicy().addClassIndicator(org.eclipse.persistence.testing.models.aggregate.Bicycle.class, Integer.valueOf(2));

// SECTION: COPY POLICY
descriptor.createCopyPolicy("constructor");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 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 @@ -29,7 +29,7 @@ public House() {
super();
sellingPoints = new Vector();
insuranceId = new Oid();
insuranceId.setOid(new Integer(0));
insuranceId.setOid(Integer.valueOf(0));
}

public java.lang.String getDescriptions() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 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 @@ -31,7 +31,7 @@ public static SingleHouse example1() {
SingleHouse example1 = new SingleHouse();

Oid insurancePolicyId = new Oid();
insurancePolicyId.setOid(new Integer(15));
insurancePolicyId.setOid(Integer.valueOf(15));
example1.setInsuranceId(insurancePolicyId);
example1.setDescriptions("beautiful 4 bedroom single house");
example1.setLocation("435 Carling Ave.");
Expand All @@ -48,7 +48,7 @@ public static SingleHouse example2() {
SingleHouse example2 = new SingleHouse();

Oid insurancePolicyId = new Oid();
insurancePolicyId.setOid(new Integer(27));
insurancePolicyId.setOid(Integer.valueOf(27));
example2.setInsuranceId(insurancePolicyId);
example2.setDescriptions("spacious 5 bedroom banglow");
example2.setLocation("33D King Edward Street");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 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 @@ -23,7 +23,7 @@ public static TownHouse example3() {
TownHouse example3 = new TownHouse();

Oid insurancePolicyId = new Oid();
insurancePolicyId.setOid(new Integer(333));
insurancePolicyId.setOid(Integer.valueOf(333));
example3.setInsuranceId(insurancePolicyId);
example3.setDescriptions("renovated 3-bedroom gardon house");
example3.setLocation("2236 Baseline Rd");
Expand All @@ -34,7 +34,7 @@ public static TownHouse example4() {
TownHouse example4 = new TownHouse();

Oid insurancePolicyId = new Oid();
insurancePolicyId.setOid(new Integer(4444));
insurancePolicyId.setOid(Integer.valueOf(4444));
example4.setInsuranceId(insurancePolicyId);
example4.setDescriptions("two bedroom luxury townhouse");
example4.setLocation("790C Bank Street");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 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 @@ -244,7 +244,7 @@ public void setName(String newValue) {
}

public void setPrice(float newValue) {
propertyChange("price", new Float(this.price), new Float(newValue));
propertyChange("price", Float.valueOf(this.price), Float.valueOf(newValue));
this.price = newValue;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2023 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 @@ -114,9 +114,9 @@ public AggregateAggregateMapHolder getAggregateAggregateMapHolder(){
public AggregateDirectMapHolder getAggregateDirectMapHolder(){
AggregateDirectMapHolder holder = new AggregateDirectMapHolder();
AggregateMapKey mapKey = getAggregateMapKey1();
holder.addAggregateToDirectMapItem(mapKey, new Integer(1));
holder.addAggregateToDirectMapItem(mapKey, Integer.valueOf(1));
AggregateMapKey mapKey2 = getAggregateMapKey2();
holder.addAggregateToDirectMapItem(mapKey2, new Integer(2));
holder.addAggregateToDirectMapItem(mapKey2, Integer.valueOf(2));
return holder;
}

Expand Down Expand Up @@ -161,48 +161,48 @@ public AggregateEntityU1MMapHolder getAggregateEntityU1MMapHolder(){
public DirectAggregateMapHolder getDirectAggregateMapHolder(){
DirectAggregateMapHolder holder = new DirectAggregateMapHolder();
AggregateMapValue value = getAggregateMapValue1();
holder.addDirectToAggregateMapItem(new Integer(1), value);
holder.addDirectToAggregateMapItem(Integer.valueOf(1), value);
value = getAggregateMapValue2();
holder.addDirectToAggregateMapItem(new Integer(2), value);
holder.addDirectToAggregateMapItem(Integer.valueOf(2), value);
return holder;
}

public DirectDirectMapHolder getDirectDirectMapHolder(){
DirectDirectMapHolder holder = new DirectDirectMapHolder();
holder.addDirectToDirectMapItem(new Integer(1), new Integer(1));
holder.addDirectToDirectMapItem(new Integer(2), new Integer(2));
holder.addDirectToDirectMapItem(Integer.valueOf(1), Integer.valueOf(1));
holder.addDirectToDirectMapItem(Integer.valueOf(2), Integer.valueOf(2));
return holder;
}

public DirectEntity1MMapHolder getDirectEntity1MMapHolder(){
DirectEntity1MMapHolder initialHolder = new DirectEntity1MMapHolder();
DEOTMMapValue value = getDEOTMMapValue1();
value.getHolder().setValue(initialHolder);
initialHolder.addDirectToEntityMapItem(new Integer(11), value);
initialHolder.addDirectToEntityMapItem(Integer.valueOf(11), value);

DEOTMMapValue value2 = getDEOTMMapValue2();
value2.getHolder().setValue(initialHolder);
initialHolder.addDirectToEntityMapItem(new Integer(22), value2);
initialHolder.addDirectToEntityMapItem(Integer.valueOf(22), value2);
return initialHolder;
}

public DirectEntityMapHolder getDirectEntityMapHolder(){
DirectEntityMapHolder holder = new DirectEntityMapHolder();
EntityMapValue value = getEntityMapValue1();
holder.addDirectToEntityMapItem(new Integer(11), value);
holder.addDirectToEntityMapItem(Integer.valueOf(11), value);

EntityMapValue value2 = getEntityMapValue2();
holder.addDirectToEntityMapItem(new Integer(22), value2);
holder.addDirectToEntityMapItem(Integer.valueOf(22), value2);
return holder;
}

public DirectEntityU1MMapHolder getDirectEntityU1MMapHolder(){
DirectEntityU1MMapHolder holder = new DirectEntityU1MMapHolder();
EntityMapValue value = getEntityMapValue3();
holder.addDirectToEntityMapItem(new Integer(11), value);
holder.addDirectToEntityMapItem(Integer.valueOf(11), value);

EntityMapValue value2 = getEntityMapValue4();
holder.addDirectToEntityMapItem(new Integer(22), value2);
holder.addDirectToEntityMapItem(Integer.valueOf(22), value2);
return holder;
}

Expand All @@ -220,9 +220,9 @@ public EntityAggregateMapHolder getEntityAggregateMapHolder(){
public EntityDirectMapHolder getEntityDirectMapHolder(){
EntityDirectMapHolder holder = new EntityDirectMapHolder();
EntityMapKey mapKey = getEntityMapKey3();
holder.addEntityDirectMapItem(mapKey, new Integer(1));
holder.addEntityDirectMapItem(mapKey, Integer.valueOf(1));
EntityMapKey mapKey2 = getEntityMapKey4();
holder.addEntityDirectMapItem(mapKey2, new Integer(2));
holder.addEntityDirectMapItem(mapKey2, Integer.valueOf(2));
return holder;
}

Expand Down
Loading

0 comments on commit da74397

Please sign in to comment.