mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
[java, rt] simplify and improve error message
GitOrigin-RevId: 3711bda1c1147443fc8318e19eca7ae1888b620e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9a04255f75
commit
f2b1eb4b6a
@@ -109,27 +109,22 @@ public final class AppMainV2 {
|
||||
try {
|
||||
declaredConstructor = appClass.getDeclaredConstructor();
|
||||
} catch (NoSuchMethodException e) {
|
||||
System.err.println("Class must have constructor with no parameters");
|
||||
System.err.println("Non-static main() method was invoked: class must have constructor with no parameters");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
m.setAccessible(true);
|
||||
int parameterCount = m.getParameterTypes().length;
|
||||
if (Modifier.isStatic(m.getModifiers())) {
|
||||
if (parameterCount == 0) {
|
||||
m.invoke(null);
|
||||
} else {
|
||||
m.invoke(null, new Object[]{params});
|
||||
}
|
||||
} else {
|
||||
Object objInstance = null;
|
||||
if (!Modifier.isStatic(m.getModifiers())) {
|
||||
declaredConstructor.setAccessible(true);
|
||||
Object objInstance = declaredConstructor.newInstance();
|
||||
if (parameterCount == 0) {
|
||||
m.invoke(objInstance);
|
||||
} else {
|
||||
m.invoke(objInstance, new Object[]{params});
|
||||
}
|
||||
objInstance = declaredConstructor.newInstance();
|
||||
}
|
||||
if (parameterCount == 0) {
|
||||
m.invoke(objInstance);
|
||||
} else {
|
||||
m.invoke(objInstance, new Object[]{params});
|
||||
}
|
||||
}
|
||||
catch (InvocationTargetException ite) {
|
||||
|
||||
Reference in New Issue
Block a user