Lines 47-52
Link Here
|
47 |
import com.sun.source.tree.Tree; |
47 |
import com.sun.source.tree.Tree; |
48 |
import com.sun.source.util.TreePath; |
48 |
import com.sun.source.util.TreePath; |
49 |
import java.io.IOException; |
49 |
import java.io.IOException; |
|
|
50 |
import java.net.URL; |
50 |
import java.util.*; |
51 |
import java.util.*; |
51 |
import java.util.concurrent.atomic.AtomicBoolean; |
52 |
import java.util.concurrent.atomic.AtomicBoolean; |
52 |
import javax.lang.model.element.Element; |
53 |
import javax.lang.model.element.Element; |
Lines 54-61
Link Here
|
54 |
import javax.lang.model.element.ExecutableElement; |
55 |
import javax.lang.model.element.ExecutableElement; |
55 |
import javax.lang.model.element.Modifier; |
56 |
import javax.lang.model.element.Modifier; |
56 |
import javax.lang.model.element.TypeElement; |
57 |
import javax.lang.model.element.TypeElement; |
|
|
58 |
import org.netbeans.api.annotations.common.NonNull; |
57 |
import org.netbeans.api.fileinfo.NonRecursiveFolder; |
59 |
import org.netbeans.api.fileinfo.NonRecursiveFolder; |
58 |
import org.netbeans.api.java.classpath.ClassPath; |
60 |
import org.netbeans.api.java.classpath.ClassPath; |
|
|
61 |
import org.netbeans.api.java.queries.AnnotationProcessingQuery; |
59 |
import org.netbeans.api.java.source.*; |
62 |
import org.netbeans.api.java.source.*; |
60 |
import org.netbeans.api.java.source.ClassIndex.SearchScopeType; |
63 |
import org.netbeans.api.java.source.ClassIndex.SearchScopeType; |
61 |
import org.netbeans.modules.refactoring.api.*; |
64 |
import org.netbeans.modules.refactoring.api.*; |
Lines 69-74
Link Here
|
69 |
import org.netbeans.modules.refactoring.java.spi.JavaWhereUsedFilters.ReadWrite; |
72 |
import org.netbeans.modules.refactoring.java.spi.JavaWhereUsedFilters.ReadWrite; |
70 |
import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; |
73 |
import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; |
71 |
import org.netbeans.modules.refactoring.spi.ui.FiltersDescription; |
74 |
import org.netbeans.modules.refactoring.spi.ui.FiltersDescription; |
|
|
75 |
import org.netbeans.spi.java.classpath.support.ClassPathSupport; |
72 |
import org.openide.ErrorManager; |
76 |
import org.openide.ErrorManager; |
73 |
import org.openide.filesystems.FileObject; |
77 |
import org.openide.filesystems.FileObject; |
74 |
import org.openide.loaders.DataObject; |
78 |
import org.openide.loaders.DataObject; |
Lines 360-366
Link Here
|
360 |
} |
364 |
} |
361 |
// filter out files that are not on source path |
365 |
// filter out files that are not on source path |
362 |
Set<FileObject> set2 = new HashSet<>(set.size()); |
366 |
Set<FileObject> set2 = new HashSet<>(set.size()); |
363 |
ClassPath cp = cpInfo.getClassPath(ClasspathInfo.PathKind.SOURCE); |
367 |
final ClassPath scp = cpInfo.getClassPath(ClasspathInfo.PathKind.SOURCE); |
|
|
368 |
final ClassPath aps = collectAnnotationProcessingGenSourceRoots(scp); |
369 |
final ClassPath cp = ClassPathSupport.createProxyClassPath(scp, aps); |
364 |
for (FileObject fo : set) { |
370 |
for (FileObject fo : set) { |
365 |
if (cp.contains(fo)) { |
371 |
if (cp.contains(fo)) { |
366 |
set2.add(fo); |
372 |
set2.add(fo); |
Lines 371-377
Link Here
|
371 |
} |
377 |
} |
372 |
return set2; |
378 |
return set2; |
373 |
} |
379 |
} |
374 |
|
380 |
|
|
|
381 |
@NonNull |
382 |
private static ClassPath collectAnnotationProcessingGenSourceRoots(@NonNull final ClassPath scp) { |
383 |
final FileObject[] srcRoots = scp.getRoots(); |
384 |
final Collection<URL> apRoots = new ArrayList<>(srcRoots.length); |
385 |
for (FileObject srcRoot : srcRoots) { |
386 |
apRoots.add(AnnotationProcessingQuery.getAnnotationProcessingOptions(srcRoot).sourceOutputDirectory()); |
387 |
} |
388 |
return ClassPathSupport.createClassPath(apRoots.toArray(new URL[apRoots.size()])); |
389 |
} |
390 |
|
375 |
private static Collection<FileObject> getImplementorsRecursive(ClassIndex idx, ClasspathInfo cpInfo, TypeElement el, AtomicBoolean cancel) { |
391 |
private static Collection<FileObject> getImplementorsRecursive(ClassIndex idx, ClasspathInfo cpInfo, TypeElement el, AtomicBoolean cancel) { |
376 |
Set<?> implementorsAsHandles = RefactoringUtils.getImplementorsAsHandles(idx, cpInfo, el, cancel); |
392 |
Set<?> implementorsAsHandles = RefactoringUtils.getImplementorsAsHandles(idx, cpInfo, el, cancel); |
377 |
|
393 |
|