private static boolean anySubtypeCanBeShown(final IType type, final Map typeToMemberArray, final ITypeHierarchy hierarchy) { final IType[] subTypes= hierarchy.getSubtypes(type); for (int i= 0; i < subTypes.length; i++) { if (canBeShown(subTypes[i], typeToMemberArray, hierarchy)) return true; } return false; }
private static boolean anySubtypeCanBeShown(final IType type, final Map<IType, IMember[]> typeToMemberArray, final ITypeHierarchy hierarchy) { final IType[] subTypes= hierarchy.getSubtypes(type); for (int i= 0; i < subTypes.length; i++) { if (canBeShown(subTypes[i], typeToMemberArray, hierarchy)) return true; } return false; }
private static boolean anySubtypeCanBeShown(final IType type, final Map<IType, IMember[]> typeToMemberArray, final ITypeHierarchy hierarchy) { final IType[] subTypes= hierarchy.getSubtypes(type); for (int i= 0; i < subTypes.length; i++) { if (canBeShown(subTypes[i], typeToMemberArray, hierarchy)) return true; } return false; }
static IType[] computeInheritancePath(IType subType, IType superType) throws JavaModelException { if (superType == null) { return null; } // optimization: avoid building the type hierarchy for the identity case if (superType.equals(subType)) { return new IType[] { subType }; } ITypeHierarchy hierarchy= subType.newSupertypeHierarchy(new NullProgressMonitor()); if (!hierarchy.contains(superType)) { return null; // no path } List<IType> path= new LinkedList<>(); path.add(superType); do { // any sub type must be on a hierarchy chain from superType to subType superType= hierarchy.getSubtypes(superType)[0]; path.add(superType); } while (!superType.equals(subType)); // since the equality case is handled above, we can spare one check return path.toArray(new IType[path.size()]); }
private static Set<IType> getAffectedSubTypes(final ITypeHierarchy hierarchy, final IType type) throws JavaModelException { IType[] types= null; final boolean isInterface= type.isInterface(); if (isInterface) { final Collection<IType> remove= new ArrayList<>(); final List<IType> list= new ArrayList<>(Arrays.asList(hierarchy.getSubtypes(type))); for (final Iterator<IType> iterator= list.iterator(); iterator.hasNext();) { final IType element= iterator.next(); if (element.isInterface()) remove.add(element); } list.removeAll(remove); types= list.toArray(new IType[list.size()]); } else types= hierarchy.getSubclasses(type); final Set<IType> result= new HashSet<>(); for (int index= 0; index < types.length; index++) { if (!isInterface && JdtFlags.isAbstract(types[index])) result.addAll(getAffectedSubTypes(hierarchy, types[index])); else result.add(types[index]); } return result; }
private static Set getEffectedSubTypes(final ITypeHierarchy hierarchy, final IType type) throws JavaModelException { IType[] types= null; final boolean isInterface= type.isInterface(); if (isInterface) { final Collection remove= new ArrayList(); final List list= new ArrayList(Arrays.asList(hierarchy.getSubtypes(type))); for (final Iterator iterator= list.iterator(); iterator.hasNext();) { final IType element= (IType) iterator.next(); if (element.isInterface()) remove.add(element); } list.removeAll(remove); types= (IType[]) list.toArray(new IType[list.size()]); } else types= hierarchy.getSubclasses(type); final Set result= new HashSet(); for (int index= 0; index < types.length; index++) { if (!isInterface && JdtFlags.isAbstract(types[index])) result.addAll(getEffectedSubTypes(hierarchy, types[index])); else result.add(types[index]); } return result; }
private static Set<IType> getAffectedSubTypes(final ITypeHierarchy hierarchy, final IType type) throws JavaModelException { IType[] types= null; final boolean isInterface= type.isInterface(); if (isInterface) { final Collection<IType> remove= new ArrayList<>(); final List<IType> list= new ArrayList<>(Arrays.asList(hierarchy.getSubtypes(type))); for (final Iterator<IType> iterator= list.iterator(); iterator.hasNext();) { final IType element= iterator.next(); if (element.isInterface()) remove.add(element); } list.removeAll(remove); types= list.toArray(new IType[list.size()]); } else types= hierarchy.getSubclasses(type); final Set<IType> result= new HashSet<>(); for (int index= 0; index < types.length; index++) { if (!isInterface && JdtFlags.isAbstract(types[index])) result.addAll(getAffectedSubTypes(hierarchy, types[index])); else result.add(types[index]); } return result; }
protected final void getTypesInHierarchy(IType type, List res) { ITypeHierarchy hierarchy= getHierarchy(); if (hierarchy != null) { IType[] types= hierarchy.getSubtypes(type); if (isObject(type)) { for (int i= 0; i < types.length; i++) { IType curr= types[i]; if (!isAnonymousFromInterface(curr)) { res.add(curr); } } } else { for (int i= 0; i < types.length; i++) { res.add(types[i]); } } } }
@Override protected final void getTypesInHierarchy(IType type, List<IType> res) { ITypeHierarchy hierarchy= getHierarchy(); if (hierarchy != null) { IType[] types= hierarchy.getSubtypes(type); if (isObject(type)) { for (int i= 0; i < types.length; i++) { IType curr= types[i]; if (!isAnonymousFromInterface(curr)) { res.add(curr); } } } else { for (int i= 0; i < types.length; i++) { res.add(types[i]); } } } }
do { superType= hierarchy.getSubtypes(superType)[0]; path.add(superType); } while (!superType.equals(subType)); // since the equality case is handled above, we can spare one check
do { superType = hierarchy.getSubtypes(superType)[0]; path.add(superType); } while (!superType.equals(subType)); // since the equality case is handled above, we can spare one check
@Override protected final void getTypesInHierarchy(IType type, List<IType> res) { ITypeHierarchy hierarchy= getHierarchy(); if (hierarchy != null) { IType[] types= hierarchy.getSubtypes(type); if (isObject(type)) { for (int i= 0; i < types.length; i++) { IType curr= types[i]; if (!isAnonymousFromInterface(curr)) { res.add(curr); } } } else { for (int i= 0; i < types.length; i++) { res.add(types[i]); } } } }
do { superType = hierarchy.getSubtypes(superType)[0]; path.add(superType); } while (!superType.equals(subType)); // since the equality case is handled above, we can spare one check
superType= hierarchy.getSubtypes(superType)[0]; } catch (ArrayIndexOutOfBoundsException e) { // see bug 433587 String message= "Illegal supertype hierarchy for " + subType.getFullyQualifiedName('.') + ". No subtype found for " + superType.getFullyQualifiedName('.') + " in the hierarchy."; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
final IType superType= getDeclaringSuperTypeHierarchy(new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).getSuperclass(declaring); if (superType != null) { fPossibleCandidates= superType.newTypeHierarchy(fOwner, new SubProgressMonitor(monitor, 9, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).getSubtypes(superType); final LinkedList<IType> list= new LinkedList<>(Arrays.asList(fPossibleCandidates)); final Set<String> names= new HashSet<>();
final IType superType= getDeclaringSuperTypeHierarchy(new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).getSuperclass(declaring); if (superType != null) { fPossibleCandidates= superType.newTypeHierarchy(fOwner, new SubProgressMonitor(monitor, 9, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).getSubtypes(superType); final LinkedList list= new LinkedList(Arrays.asList(fPossibleCandidates)); final Set names= new HashSet();
final IType superType= getDeclaringSuperTypeHierarchy(new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).getSuperclass(declaring); if (superType != null) { fPossibleCandidates= superType.newTypeHierarchy(fOwner, new SubProgressMonitor(monitor, 9, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).getSubtypes(superType); final LinkedList<IType> list= new LinkedList<>(Arrays.asList(fPossibleCandidates)); final Set<String> names= new HashSet<>();
protected final void getTypesInHierarchy(IType type, List res) { ITypeHierarchy hierarchy= getHierarchy(); if (hierarchy != null) { IType[] types= hierarchy.getSubtypes(type); if (isObject(type)) { for (int i= 0; i < types.length; i++) { IType curr= types[i]; if (!isAnonymousFromInterface(curr)) { // no anonymous classes on 'Object' -> will be children of interface res.add(curr); } } } else { boolean isHierarchyOnType= (hierarchy.getType() != null); boolean isClass= !Flags.isInterface(hierarchy.getCachedFlags(type)); if (isClass || isHierarchyOnType) { for (int i= 0; i < types.length; i++) { res.add(types[i]); } } else { for (int i= 0; i < types.length; i++) { IType curr= types[i]; // no classes implementing interfaces, only if anonymous if (Flags.isInterface(hierarchy.getCachedFlags(curr)) || isAnonymous(curr)) { res.add(curr); } } } } } }
ITypeHierarchy hierarchy= getHierarchy(); if (hierarchy != null) { IType[] types= hierarchy.getSubtypes(type); if (isObject(type)) { for (int i= 0; i < types.length; i++) {
ITypeHierarchy hierarchy= getHierarchy(); if (hierarchy != null) { IType[] types= hierarchy.getSubtypes(type); if (isObject(type)) { for (int i= 0; i < types.length; i++) {