private ConstructorReferenceFinder(IType type) throws JavaModelException{ fConstructors= JavaElementUtil.getAllConstructors(type); fType= type; }
private ConstructorReferenceFinder(IType type) throws JavaModelException{ fConstructors= JavaElementUtil.getAllConstructors(type); fType= type; }
private ConstructorReferenceFinder(IType type) throws JavaModelException{ fConstructors= JavaElementUtil.getAllConstructors(type); fType= type; }
private static String[] getParameterNamesOfAllConstructors(IType type) throws JavaModelException { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); Set<String> result= new HashSet<>(); for (int i= 0; i < constructors.length; i++) { result.addAll(Arrays.asList(constructors[i].getParameterNames())); } return result.toArray(new String[result.size()]); }
private static String[] getParameterNamesOfAllConstructors(IType type) throws JavaModelException { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); Set<String> result= new HashSet<>(); for (int i= 0; i < constructors.length; i++) { result.addAll(Arrays.asList(constructors[i].getParameterNames())); } return result.toArray(new String[result.size()]); }
private static String[] getParameterNamesOfAllConstructors(IType type) throws JavaModelException { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); Set result= new HashSet(); for (int i= 0; i < constructors.length; i++) { result.addAll(Arrays.asList(constructors[i].getParameterNames())); } return (String[]) result.toArray(new String[result.size()]); }
private static Collection<SearchMatch> getAllSuperConstructorInvocations(IType type) throws JavaModelException { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); CompilationUnit cuNode= new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL).parse(type.getCompilationUnit(), false); List<SearchMatch> result= new ArrayList<>(constructors.length); for (int i= 0; i < constructors.length; i++) { ASTNode superCall= getSuperConstructorCallNode(constructors[i], cuNode); if (superCall != null) result.add(createSearchResult(superCall, constructors[i])); } return result; }
private static SearchPattern createSearchPattern(IType type) throws JavaModelException { SearchPattern pattern= SearchPattern.createPattern(type, IJavaSearchConstants.ALL_OCCURRENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE); IMethod[] constructors= JavaElementUtil.getAllConstructors(type); if (constructors.length == 0) return pattern; SearchPattern constructorDeclarationPattern= RefactoringSearchEngine.createOrPattern(constructors, IJavaSearchConstants.DECLARATIONS); return SearchPattern.createOrPattern(pattern, constructorDeclarationPattern); }
private static SearchPattern createSearchPattern(IType type) throws JavaModelException { SearchPattern pattern= SearchPattern.createPattern(type, IJavaSearchConstants.ALL_OCCURRENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE); IMethod[] constructors= JavaElementUtil.getAllConstructors(type); if (constructors.length == 0) return pattern; SearchPattern constructorDeclarationPattern= RefactoringSearchEngine.createOrPattern(constructors, IJavaSearchConstants.DECLARATIONS); return SearchPattern.createOrPattern(pattern, constructorDeclarationPattern); }
private static SearchPattern createSearchPattern(IType type) throws JavaModelException { SearchPattern pattern= SearchPattern.createPattern(type, IJavaSearchConstants.ALL_OCCURRENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE); IMethod[] constructors= JavaElementUtil.getAllConstructors(type); if (constructors.length == 0) return pattern; SearchPattern constructorDeclarationPattern= RefactoringSearchEngine.createOrPattern(constructors, IJavaSearchConstants.DECLARATIONS); return SearchPattern.createOrPattern(pattern, constructorDeclarationPattern); }
private static Collection<SearchMatch> getAllSuperConstructorInvocations(IType type) throws JavaModelException { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); CompilationUnit cuNode= new RefactoringASTParser(IASTSharedValues.SHARED_AST_LEVEL).parse(type.getCompilationUnit(), false); List<SearchMatch> result= new ArrayList<>(constructors.length); for (int i= 0; i < constructors.length; i++) { ASTNode superCall= getSuperConstructorCallNode(constructors[i], cuNode); if (superCall != null) result.add(createSearchResult(superCall, constructors[i])); } return result; }
private static Collection getAllSuperConstructorInvocations(IType type) throws JavaModelException { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); CompilationUnit cuNode= new RefactoringASTParser(AST.JLS3).parse(type.getCompilationUnit(), false); List result= new ArrayList(constructors.length); for (int i= 0; i < constructors.length; i++) { ASTNode superCall= getSuperConstructorCallNode(constructors[i], cuNode); if (superCall != null) result.add(createSearchResult(superCall, constructors[i])); } return result; }
private MethodWrapper[] getRoots(IMember[] members, boolean callers) { ArrayList<MethodWrapper> roots= new ArrayList<>(); for (int i= 0; i < members.length; i++) { IMember member= members[i]; if (member instanceof IType) { IType type= (IType) member; try { if (! type.isAnonymous()) { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); if (constructors.length == 0) { addRoot(member, roots, callers); // IType is a stand-in for the non-existing default constructor } else { for (int j= 0; j < constructors.length; j++) { IMethod constructor= constructors[j]; addRoot(constructor, roots, callers); } } } else { addRoot(member, roots, callers); } } catch (JavaModelException e) { JavaPlugin.log(e); } } else { addRoot(member, roots, callers); } } return roots.toArray(new MethodWrapper[roots.size()]); }
private MethodWrapper[] getRoots(IMember[] members, boolean callers) { ArrayList<MethodWrapper> roots= new ArrayList<>(); for (int i= 0; i < members.length; i++) { IMember member= members[i]; if (member instanceof IType) { IType type= (IType) member; try { if (! type.isAnonymous()) { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); if (constructors.length == 0) { addRoot(member, roots, callers); // IType is a stand-in for the non-existing default constructor } else { for (int j= 0; j < constructors.length; j++) { IMethod constructor= constructors[j]; addRoot(constructor, roots, callers); } } } else { addRoot(member, roots, callers); } } catch (JavaModelException e) { JavaPlugin.log(e); } } else { addRoot(member, roots, callers); } } return roots.toArray(new MethodWrapper[roots.size()]); }
if (!remove) { if (!JdtFlags.isStatic(fType) && fCreateInstanceField) { if (JavaElementUtil.getAllConstructors(fType).length == 0) createConstructor(declaration, rewrite); else
if (!remove) { if (!JdtFlags.isStatic(fType) && fCreateInstanceField) { if (JavaElementUtil.getAllConstructors(fType).length == 0) createConstructor(declaration, rewrite); else
if (!remove) { if (!JdtFlags.isStatic(fType) && fCreateInstanceField) { if (JavaElementUtil.getAllConstructors(fType).length == 0) createConstructor(declaration, rewrite); else
return new Object[] { anonymousWrapper, new RealCallers(methodWrapper, caller.getMethodCall()) }; } else { IMember[] constructors= JavaElementUtil.getAllConstructors(type); if (constructors.length == 0) { constructors= new IType[] { type }; // type stands for the default constructor
return new Object[] { anonymousWrapper, new RealCallers(methodWrapper, caller.getMethodCall()) }; } else { IMember[] constructors= JavaElementUtil.getAllConstructors(type); if (constructors.length == 0) { constructors= new IType[] { type }; // type stands for the default constructor