View | Details | Raw Unified | Return to bug 293861 | Differences between
and this patch

Collapse All | Expand All

(-)core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java (-9 / +23 lines)
Lines 239-246 Link Here
239
			IMethod alienDeclaration= (IMethod) iter.next();
239
			IMethod alienDeclaration= (IMethod) iter.next();
240
			IType alienType= alienDeclaration.getDeclaringType();
240
			IType alienType= alienDeclaration.getDeclaringType();
241
			alienTypes.add(alienType);
241
			alienTypes.add(alienType);
242
			if (alienType.isInterface())
242
			try {
243
				hasAlienInterfaces= true;
243
				if (alienType.isInterface())
244
					hasAlienInterfaces= true;
245
			} catch (Exception ignore) {
246
			}
244
		}
247
		}
245
		if (alienTypes.size() == 0) //no nasty marriage scenarios without types to marry with...
248
		if (alienTypes.size() == 0) //no nasty marriage scenarios without types to marry with...
246
			return (IMethod[]) relatedMethods.toArray(new IMethod[relatedMethods.size()]);
249
			return (IMethod[]) relatedMethods.toArray(new IMethod[relatedMethods.size()]);
Lines 272-280 Link Here
272
				IType alienType= (IType) iter.next();
275
				IType alienType= (IType) iter.next();
273
				IMethod alienMethod= (IMethod) fTypeToMethod.get(alienType);
276
				IMethod alienMethod= (IMethod) fTypeToMethod.get(alienType);
274
				ITypeHierarchy hierarchy= getCachedHierarchy(alienType, owner, new SubProgressMonitor(pm, 1));
277
				ITypeHierarchy hierarchy= getCachedHierarchy(alienType, owner, new SubProgressMonitor(pm, 1));
275
				if (hierarchy == null)
278
				try {
276
					hierarchy= alienType.newTypeHierarchy(owner, new SubProgressMonitor(pm, 1));
279
					if (hierarchy == null)
277
				IType[] allSubtypes= hierarchy.getAllSubtypes(alienType);
280
						hierarchy= alienType.newTypeHierarchy(owner, new SubProgressMonitor(pm, 1));
281
				} catch (Exception ignore) {
282
				}
283
				IType[] allSubtypes= hierarchy == null ? new IType[0] : hierarchy.getAllSubtypes(alienType);
278
				for (int i= 0; i < allSubtypes.length; i++) {
284
				for (int i= 0; i < allSubtypes.length; i++) {
279
					IType subtype= allSubtypes[i];
285
					IType subtype= allSubtypes[i];
280
					if (relatedSubTypes.contains(subtype)) {
286
					if (relatedSubTypes.contains(subtype)) {
Lines 318-327 Link Here
318
				IType root= (IType) iter.next();
324
				IType root= (IType) iter.next();
319
				ITypeHierarchy hierarchy= (ITypeHierarchy) fRootHierarchies.get(root);
325
				ITypeHierarchy hierarchy= (ITypeHierarchy) fRootHierarchies.get(root);
320
				if (hierarchy == null) {
326
				if (hierarchy == null) {
321
					hierarchy= root.newTypeHierarchy(owner, new SubProgressMonitor(monitor, 1));
327
					try {
322
					fRootHierarchies.put(root, hierarchy);
328
						hierarchy= root.newTypeHierarchy(owner, new SubProgressMonitor(monitor, 1));
329
						fRootHierarchies.put(root, hierarchy);
330
					} catch (Exception ignore) {
331
					}
323
				}
332
				}
324
				if (hierarchy.contains(type))
333
				if (hierarchy != null && hierarchy.contains(type))
325
					return hierarchy;
334
					return hierarchy;
326
			}
335
			}
327
		}
336
		}
Lines 404-410 Link Here
404
			} else {
413
			} else {
405
				//check whether method in supertype is really overridden:
414
				//check whether method in supertype is really overridden:
406
				IMember superMethod= (IMember) fTypeToMethod.get(supertype);
415
				IMember superMethod= (IMember) fTypeToMethod.get(supertype);
407
				if (JavaModelUtil.isVisibleInHierarchy(superMethod, anchor.getPackageFragment())) {
416
				boolean isVisibleInHierarchy = false;
417
				try {
418
					isVisibleInHierarchy = JavaModelUtil.isVisibleInHierarchy(superMethod, anchor.getPackageFragment());
419
				} catch (Exception ignore) {
420
				}
421
				if (isVisibleInHierarchy) {
408
					IType rep= fUnionFind.find(anchor);
422
					IType rep= fUnionFind.find(anchor);
409
					fUnionFind.union(rep, superRep);
423
					fUnionFind.union(rep, superRep);
410
					// current type is no root anymore
424
					// current type is no root anymore

Return to bug 293861