IDEMPIERE-3798:Move iDempiere default branch to openjdk 10 (clazz.getDeclaredConstructor().newInstance())

This commit is contained in:
hieplq 2018-10-24 12:10:32 +07:00
parent af75e7911f
commit bf3561fc0d
28 changed files with 38 additions and 33 deletions

View File

@ -358,7 +358,7 @@ public class ReplenishReport extends SvrProcess
if(custom==null){
// if no OSGi plugin is found try the legacy way (in my own classpath)
Class<?> clazz = Class.forName(className);
custom = (ReplenishInterface) clazz.newInstance();
custom = (ReplenishInterface) clazz.getDeclaredConstructor().newInstance();
}
}
catch (Exception e)

View File

@ -392,7 +392,7 @@ public class ReplenishReportProduction extends SvrProcess
if(custom==null){
// if no OSGi plugin is found try the legacy way (in my own classpath)
Class<?> clazz = Class.forName(className);
custom = (ReplenishInterface) clazz.newInstance();
custom = (ReplenishInterface) clazz.getDeclaredConstructor().newInstance();
}
}
catch (Exception e)

View File

@ -44,7 +44,7 @@ public class DefaultAddressValidationFactory implements IAddressValidationFactor
{
Class<?> ppClass = Class.forName(className);
if (ppClass != null)
myProcessor = (IAddressValidation) ppClass.newInstance();
myProcessor = (IAddressValidation) ppClass.getDeclaredConstructor().newInstance();
}
catch (Error e1)
{ // NoClassDefFound

View File

@ -80,7 +80,7 @@ public class DefaultCalloutFactory implements ICalloutFactory {
//Get callout
try
{
callout = (Callout)calloutClass.newInstance();
callout = (Callout)calloutClass.getDeclaredConstructor().newInstance();
}
catch (Exception ex)
{

View File

@ -56,7 +56,7 @@ public class DefaultModelValidatorFactory implements IModelValidatorFactory {
}
if (clazz != null) {
try {
validator = (ModelValidator)clazz.newInstance();
validator = (ModelValidator)clazz.getDeclaredConstructor().newInstance();
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -42,7 +42,7 @@ public class DefaultPaymentExporterFactory implements IPaymentExporterFactory {
try {
Class<?> peClass = Class.forName(className);
if (peClass != null)
myExporter = (PaymentExport)peClass.newInstance();
myExporter = (PaymentExport)peClass.getDeclaredConstructor().newInstance();
} catch (Error e1) { // NoClassDefFound
s_log.log(Level.SEVERE, className + " - Error=" + e1.getMessage());
return null;

View File

@ -45,7 +45,7 @@ public class DefaultPaymentProcessorFactory implements IPaymentProcessorFactory
try {
Class<?> ppClass = Class.forName(className);
if (ppClass != null)
myProcessor = (PaymentProcessor)ppClass.newInstance();
myProcessor = (PaymentProcessor)ppClass.getDeclaredConstructor().newInstance();
} catch (Error e1) { // NoClassDefFound
s_log.log(Level.SEVERE, className + " - Error=" + e1.getMessage());
return null;

View File

@ -77,7 +77,7 @@ public class DefaultProcessFactory implements IProcessFactory {
//Get Process
try
{
process = (ProcessCall)processClass.newInstance();
process = (ProcessCall)processClass.getDeclaredConstructor().newInstance();
}
catch (Exception ex)
{

View File

@ -43,7 +43,7 @@ public class DefaultShipmentProcessorFactory implements IShipmentProcessorFactor
{
Class<?> ppClass = Class.forName(className);
if (ppClass != null)
myProcessor = (IShipmentProcessor) ppClass.newInstance();
myProcessor = (IShipmentProcessor) ppClass.getDeclaredConstructor().newInstance();
}
catch (Error e1)
{ // NoClassDefFound

View File

@ -38,7 +38,7 @@ public class DefaultTaxProviderFactory implements ITaxProviderFactory {
{
Class<?> ppClass = Class.forName(className);
if (ppClass != null)
myCalculator = (ITaxProvider) ppClass.newInstance();
myCalculator = (ITaxProvider) ppClass.getDeclaredConstructor().newInstance();
}
catch (Error e1)
{ // NoClassDefFound

View File

@ -310,7 +310,7 @@ public final class ImpFormatRow
if (methodStart != -1) // no class
{
Class<?> cClass = Class.forName(callout.substring(0,methodStart));
m_callout = (Callout)cClass.newInstance();
m_callout = (Callout)cClass.getDeclaredConstructor().newInstance();
m_method = callout.substring(methodStart+1);
}
}

View File

@ -2927,7 +2927,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
if (call == null) {
//no match from factory, check java classpath
Class<?> cClass = Class.forName(className);
call = (Callout)cClass.newInstance();
call = (Callout)cClass.getDeclaredConstructor().newInstance();
}
}
}

View File

@ -132,7 +132,7 @@ import org.compiere.util.Util;
if(m_loader==null){
// if no OSGi plugin is found try the legacy way (in my own classpath)
Class<?> bsrClass = Class.forName(getStmtLoaderClass());
m_loader = (BankStatementLoaderInterface) bsrClass.newInstance();
m_loader = (BankStatementLoaderInterface) bsrClass.getDeclaredConstructor().newInstance();
}
}
catch(Exception e)

View File

@ -141,7 +141,7 @@ public class MBankStatementMatcher extends X_C_BankStatementMatcher
if(m_matcher==null){
// if no OSGi plugin is found try the legacy way (in my own classpath)
Class<?> bsrClass = Class.forName(className);
m_matcher = (BankStatementMatcherInterface) bsrClass.newInstance();
m_matcher = (BankStatementMatcherInterface) bsrClass.getDeclaredConstructor().newInstance();
}
m_matcherValid = Boolean.TRUE;
}

View File

@ -634,7 +634,7 @@ public class MMeasure extends X_PA_Measure
try
{
Class<?> clazz = Class.forName(cmd);
custom = (MeasureInterface)clazz.newInstance();
custom = (MeasureInterface)clazz.getDeclaredConstructor().newInstance();
}
catch (Exception e)
{

View File

@ -134,7 +134,7 @@ public class MSLACriteria extends X_PA_SLA_Criteria
try
{
Class<?> clazz = Class.forName(getClassname());
SLACriteria retValue = (SLACriteria)clazz.newInstance();
SLACriteria retValue = (SLACriteria)clazz.getDeclaredConstructor().newInstance();
return retValue;
}
catch (Exception e)

View File

@ -527,7 +527,7 @@ public abstract class SvrProcess implements ProcessCall
try
{
Class<?> clazz = Class.forName(className);
Object object = clazz.newInstance();
Object object = clazz.getDeclaredConstructor().newInstance();
Method[] methods = clazz.getMethods();
for (int i = 0; i < methods.length; i++)
{

View File

@ -147,7 +147,7 @@ public final class DB
try
{
Class<?> clazz = Class.forName("org.compiere.MigrateData");
clazz.newInstance();
clazz.getDeclaredConstructor().newInstance();
}
catch (Exception e)
{

View File

@ -429,7 +429,7 @@ public final class Msg
{
className += language.getLanguageCode().toUpperCase();
Class<?> clazz = Class.forName(className);
AmtInWords aiw = (AmtInWords)clazz.newInstance();
AmtInWords aiw = (AmtInWords)clazz.getDeclaredConstructor().newInstance();
return aiw.getAmtInWords(amount);
}
catch (ClassNotFoundException e)

View File

@ -193,7 +193,7 @@ public class SecureEngine
try
{
Class<?> clazz = Class.forName(realClass);
implementation = (SecureInterface)clazz.newInstance();
implementation = (SecureInterface)clazz.getDeclaredConstructor().newInstance();
}
catch (Exception e)
{

View File

@ -127,7 +127,7 @@ public class ReplicationProcessor extends AdempiereServer {
try
{
Class<?> clazz = Class.forName(javaClass);
importProcessor = (IImportProcessor)clazz.newInstance();
importProcessor = (IImportProcessor)clazz.getDeclaredConstructor().newInstance();
importProcessor.process(mImportProcessor.getCtx(), this, trxName );
}
catch (Exception e)

View File

@ -170,7 +170,7 @@ public class ExportHelper {
String javaClass = expProcessor_Type.getJavaClass();
try {
Class<?> clazz = Class.forName(javaClass);
IExportProcessor exportProcessor = (IExportProcessor)clazz.newInstance();
IExportProcessor exportProcessor = (IExportProcessor)clazz.getDeclaredConstructor().newInstance();
exportProcessor.process(po.getCtx(), mExportProcessor, outDocument, Trx.get( po.get_TrxName(), false ));

View File

@ -350,7 +350,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
try
{
Class<?> clazz = this.getClass().getClassLoader().loadClass(className);
appDesktop = (IDesktop) clazz.newInstance();
appDesktop = (IDesktop) clazz.getDeclaredConstructor().newInstance();
}
catch (Throwable t)
{

View File

@ -86,7 +86,7 @@ public class DefaultFormFactory implements IFormFactory {
if (clazz != null) {
try
{
form = clazz.newInstance();
form = clazz.getDeclaredConstructor().newInstance();
}
catch (Exception e)
{

View File

@ -36,7 +36,7 @@ public class ProcessFactoryImpl implements IProcessFactory {
ProcessCall process = null;
try {
Class<?> clazz = getClass().getClassLoader().loadClass(className);
process = (ProcessCall) clazz.newInstance();
process = (ProcessCall) clazz.getDeclaredConstructor().newInstance();
} catch (Exception e) {
}
return process;

View File

@ -264,7 +264,7 @@ public class PayPrint {
if (m_PaymentExport == null)
{
Class<?> clazz = Class.forName (m_PaymentExportClass);
m_PaymentExport = (PaymentExport)clazz.newInstance();
m_PaymentExport = (PaymentExport)clazz.getDeclaredConstructor().newInstance();
}
}

View File

@ -13,6 +13,8 @@
*****************************************************************************/
package org.idempiere.fitnesse.fixture;
import java.lang.reflect.InvocationTargetException;
import org.idempiere.fitnesse.server.fit.IFitFixtureFactory;
import fit.FixtureName;
@ -40,20 +42,20 @@ public class FitFixtureFactory implements IFitFixtureFactory {
String className = fixtureName.toString();
try {
Class<?> clazz = getClass().getClassLoader().loadClass(className);
return clazz.newInstance();
return clazz.getDeclaredConstructor().newInstance();
} catch (ClassNotFoundException e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
}
if (!fixtureName.isFullyQualified()) {
className = DEFAULT_PACKAGE + "." + fixtureName.toString();
try {
Class<?> clazz = getClass().getClassLoader().loadClass(className);
return clazz.newInstance();
return clazz.getDeclaredConstructor().newInstance();
} catch (ClassNotFoundException e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
}
}
return null;

View File

@ -13,6 +13,8 @@
*****************************************************************************/
package org.idempiere.ui.zk.selenium.fitnesse;
import java.lang.reflect.InvocationTargetException;
import org.idempiere.fitnesse.server.fit.IFitFixtureFactory;
import fit.FixtureName;
@ -41,22 +43,23 @@ public class FitFixtureFactory implements IFitFixtureFactory {
Object obj = null;
try {
Class<?> clazz = getClass().getClassLoader().loadClass(className);
obj = clazz.newInstance();
obj = clazz.getDeclaredConstructor().newInstance();
return obj;
} catch (ClassNotFoundException e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
}
if (!fixtureName.isFullyQualified()) {
className = DEFAULT_PACKAGE + "." + fixtureName.toString();
try {
Class<?> clazz = (Class<?>) getClass().getClassLoader().loadClass(className);
obj = clazz.newInstance();
obj = clazz.getDeclaredConstructor().newInstance();
return obj;
} catch (ClassNotFoundException e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException | NoSuchMethodException ex) {
}
}
return null;