Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -367,23 +367,8 @@ protected JavaSource getJavaSource(Phase p) {
if (treePathHandle == null && docTreePathHandle == null) {
return null;
}
switch (p) {
case PRECHECK:
case FASTCHECKPARAMETERS:
return JavaSource.forFileObject(docTreePathHandle != null? docTreePathHandle.getTreePathHandle().getFileObject()
: treePathHandle.getFileObject());
case PREPARE:
case CHECKPARAMETERS:
if(treePathHandle != null && treePathHandle.getKind() == Tree.Kind.LABELED_STATEMENT) {
return JavaSource.forFileObject(treePathHandle.getFileObject());
}
ClasspathInfo cpInfo = getClasspathInfo(refactoring);
JavaSource source = JavaSource.create(cpInfo, docTreePathHandle != null? docTreePathHandle.getTreePathHandle().getFileObject()
: treePathHandle.getFileObject());
return source;

}
throw new IllegalStateException();
return JavaSource.forFileObject(docTreePathHandle != null? docTreePathHandle.getTreePathHandle().getFileObject()
: treePathHandle.getFileObject());
}

@Override
Expand All @@ -408,16 +393,10 @@ private Set<FileObject> getRelevantFiles() {
JavaSource source = getJavaSource(Phase.PREPARE);

try {
source.runUserActionTask(new CancellableTask<CompilationController>() {

@Override
public void cancel() {
throw new UnsupportedOperationException("Not supported yet."); // NOI18N
}

source.runUserActionTask(new Task<CompilationController>() {
@Override
public void run(CompilationController info) throws Exception {
final ClassIndex idx = info.getClasspathInfo().getClassIndex();
final ClassIndex idx = getClasspathInfo(refactoring).getClassIndex();
info.toPhase(JavaSource.Phase.RESOLVED);
Element el = docTreePathHandle != null? ((DocTrees)info.getTrees()).getElement(docTreePathHandle.resolve(info))
: treePathHandle.resolveElement(info);
Expand Down Expand Up @@ -631,7 +610,7 @@ public Problem prepare(RefactoringElementsBag elements) {
Set<FileObject> a = getRelevantFiles();
fireProgressListenerStart(AbstractRefactoring.PREPARE, a.size());
TransformTask transform = new TransformTask(new RenameTransformer(treePathHandle, docTreePathHandle, refactoring, allMethods, recordLinkedDeclarations, refactoring.isSearchInComments()), treePathHandle != null && treePathHandle.getKind() == Tree.Kind.LABELED_STATEMENT ? null : treePathHandle);
Problem problem = createAndAddElements(a, transform, elements, refactoring,getClasspathInfo(refactoring));
Problem problem = createAndAddElements(a, transform, elements, null);
fireProgressListenerStop();
return problem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,15 @@ private Collection<ModificationResult> processFiles(Set<FileObject> sourceFiles,
return results;
}

private void processFiles(Map<FileObject, List<FileObject>> work, ClasspathInfo info, boolean modification, Collection<ModificationResult> results, CancellableTask<? extends CompilationController> task) throws IOException, IllegalArgumentException {
//the meaning of overrideInfo (used to be info) is very unclear, and is suspicious. Possibly, it should be eliminated:
private void processFiles(Map<FileObject, List<FileObject>> work, ClasspathInfo overrideInfo, boolean modification, Collection<ModificationResult> results, CancellableTask<? extends CompilationController> task) throws IOException, IllegalArgumentException {
for (Map.Entry<FileObject, List<FileObject>> entry : work.entrySet()) {
if (cancelRequested.get()) {
results.clear();
return;
}
final FileObject root = entry.getKey();
ClasspathInfo info = overrideInfo;
if (info == null) {
ClassPath bootPath = ClassPath.getClassPath(root, ClassPath.BOOT);
if (bootPath == null) {
Expand Down
Loading