mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javafx: check for no-arg constructor optimized
(cherry picked from commit 049c492804b570bf0537ccb90d3d6c221dfbb2ef)
This commit is contained in:
@@ -406,15 +406,12 @@ public class JavaFxPsiUtil {
|
||||
|
||||
public static String isAbleToInstantiate(final PsiClass psiClass) {
|
||||
if(psiClass.getConstructors().length > 0) {
|
||||
final Project project = psiClass.getProject();
|
||||
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
|
||||
final PsiMethod noArgConstructor = psiClass
|
||||
.findMethodBySignature(factory.createConstructor(psiClass.getName()), false);
|
||||
if (noArgConstructor == null) {
|
||||
final PsiMethod valueOf = findValueOfMethod(psiClass);
|
||||
if (valueOf == null) {
|
||||
if (!hasBuilder(psiClass)) return "Unable to instantiate";
|
||||
}
|
||||
for (PsiMethod constr : psiClass.getConstructors()) {
|
||||
if (constr.getParameterList().getParametersCount() == 0) return null;
|
||||
}
|
||||
final PsiMethod valueOf = findValueOfMethod(psiClass);
|
||||
if (valueOf == null) {
|
||||
if (!hasBuilder(psiClass)) return "Unable to instantiate";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user