mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
compiler: mark CompileContext::getProject as @NotNull to simplify code
It's now required to pass Project instance to DummyCompileContext.
This commit is contained in:
@@ -94,7 +94,7 @@ public class CompileDriver {
|
||||
startup(scope, false, false, withModalProgress, callback, null);
|
||||
}
|
||||
else {
|
||||
callback.finished(true, 0, 0, DummyCompileContext.getInstance());
|
||||
callback.finished(true, 0, 0, DummyCompileContext.create(myProject));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public class CompileDriver {
|
||||
startup(scope, false, true, callback, null);
|
||||
}
|
||||
else {
|
||||
callback.finished(true, 0, 0, DummyCompileContext.getInstance());
|
||||
callback.finished(true, 0, 0, DummyCompileContext.create(myProject));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class CompileDriver {
|
||||
startup(compileScope, true, false, callback, null);
|
||||
}
|
||||
else {
|
||||
callback.finished(true, 0, 0, DummyCompileContext.getInstance());
|
||||
callback.finished(true, 0, 0, DummyCompileContext.create(myProject));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ final class AutomakeCompileContext extends UserDataHolderBase implements Compile
|
||||
myAnnotationProcessingEnabled = CompilerConfiguration.getInstance(project).isAnnotationProcessorsEnabled();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return myProject;
|
||||
|
||||
@@ -144,6 +144,7 @@ public interface CompileContext extends UserDataHolder {
|
||||
|
||||
boolean isRebuild();
|
||||
|
||||
@NotNull
|
||||
Project getProject();
|
||||
|
||||
boolean isAnnotationProcessorsEnabled();
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.roots.CompilerModuleExtension;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -27,19 +28,39 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class DummyCompileContext implements CompileContext {
|
||||
protected DummyCompileContext() {
|
||||
private final Project myProject;
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #create(Project)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public DummyCompileContext() {
|
||||
this(ProjectManager.getInstance().getDefaultProject());
|
||||
}
|
||||
|
||||
private static final DummyCompileContext OUR_INSTANCE = new DummyCompileContext();
|
||||
protected DummyCompileContext(Project project) {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #create(Project)} instead
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public static DummyCompileContext getInstance() {
|
||||
return OUR_INSTANCE;
|
||||
return new DummyCompileContext(ProjectManager.getInstance().getDefaultProject());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static DummyCompileContext create(@NotNull Project project) {
|
||||
return new DummyCompileContext(project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return null;
|
||||
return myProject;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user