Fix deprecation warnings.
* Class.newInstance in favor of
Class.getDeclaredConstructor.newInstance.
* Number.valueOf instead of new Number
Change-Id: Icbb8c3570cbc711e0a18f6388870c8820e06c781
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/InternalPerformanceMeter.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/InternalPerformanceMeter.java
index 12a937c..02b2f2c 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/InternalPerformanceMeter.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/InternalPerformanceMeter.java
@@ -1,6 +1,8 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: IBM Corporation - initial API and implementation
@@ -134,7 +136,7 @@
while (ns++ < 40)
printBuffer.append(' ');
printBuffer
- .append(format.format(new Object[] { new Double(percentile.inside()),
+ .append(format.format(new Object[] { Double.valueOf(percentile.inside()),
dimension.getDisplayValue(confidenceInterval[0]),
dimension.getDisplayValue(confidenceInterval[1]) }));
}
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/performance/Performance.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/performance/Performance.java
index 47e3dd1..c0c10ed 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/performance/Performance.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/performance/Performance.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * Copyright (c) 2000, 2018 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
@@ -8,6 +8,8 @@
package org.eclipse.test.performance;
+import java.lang.reflect.InvocationTargetException;
+
import org.eclipse.core.runtime.Platform;
import org.eclipse.test.internal.performance.InternalDimensions;
import org.eclipse.test.internal.performance.InternalPerformanceMeter;
@@ -226,18 +228,16 @@
} else {
c = Class.forName(className);
}
- instance = (PerformanceMeterFactory) c.newInstance();
- }
- catch (ClassNotFoundException e) {
- PerformanceTestPlugin.log(e);
- }
- catch (InstantiationException e) {
- PerformanceTestPlugin.log(e);
- }
- catch (IllegalAccessException e) {
- PerformanceTestPlugin.log(e);
- }
- catch (ClassCastException e) {
+ instance = (PerformanceMeterFactory) c.getDeclaredConstructor().newInstance();
+ } catch (
+ ClassNotFoundException |
+ InstantiationException |
+ IllegalAccessException |
+ ClassCastException |
+ IllegalArgumentException |
+ InvocationTargetException |
+ NoSuchMethodException |
+ SecurityException e) {
PerformanceTestPlugin.log(e);
}
}
diff --git a/bundles/org.eclipse.test/src/org/eclipse/test/EclipseTestRunner.java b/bundles/org.eclipse.test/src/org/eclipse/test/EclipseTestRunner.java
index c1ad5cb..3983a46 100644
--- a/bundles/org.eclipse.test/src/org/eclipse/test/EclipseTestRunner.java
+++ b/bundles/org.eclipse.test/src/org/eclipse/test/EclipseTestRunner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -874,8 +874,9 @@
Object o = null;
try {
- o = f.newInstance();
- } catch (InstantiationException|IllegalAccessException e) {
+ o = f.getDeclaredConstructor().newInstance();
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
+ | NoSuchMethodException | SecurityException e) {
throw new BuildException(e);
}