[java compiler] API cleanup: mark CompileContext.isRebuildRequested and related methods as deprecated and remove implementations

This is needed to avoid confusion since these methods aren't called by the compilation engine anymore.

GitOrigin-RevId: 203140c584e7ed667751468002c89cba4479e4d7
This commit is contained in:
Nikolay Chashnikov
2025-06-25 10:01:46 +00:00
committed by intellij-monorepo-bot
parent d1fbdec880
commit 70dc7ee0e3
4 changed files with 24 additions and 52 deletions
@@ -26,7 +26,6 @@ import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.Navigatable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.UUID;
@@ -41,8 +40,6 @@ public final class CompileContextImpl extends UserDataHolderBase implements Comp
private final boolean myMake;
private final boolean myIsRebuild;
private final boolean myIsAnnotationProcessorsEnabled;
private boolean myRebuildRequested;
private String myRebuildReason;
private final ProjectFileIndex myProjectFileIndex; // cached for performance reasons
private final ProjectCompileScope myProjectCompileScope;
private final long myStartCompilationStamp;
@@ -137,24 +134,6 @@ public final class CompileContextImpl extends UserDataHolderBase implements Comp
return myProjectCompileScope;
}
@Override
public void requestRebuildNextTime(String message) {
if (!myRebuildRequested) {
myRebuildRequested = true;
myRebuildReason = message;
}
}
@Override
public boolean isRebuildRequested() {
return myRebuildRequested;
}
@Override
public @Nullable String getRebuildReason() {
return myRebuildReason;
}
@Override
public @NotNull ProgressIndicator getProgressIndicator() {
return myBuildSession.getIndicator();
@@ -94,20 +94,6 @@ final class AutomakeCompileContext extends UserDataHolderBase implements Compile
return myIndicator;
}
@Override
public void requestRebuildNextTime(String message) {
}
@Override
public boolean isRebuildRequested() {
return false;
}
@Override
public @Nullable String getRebuildReason() {
return null;
}
@Override
public Module getModuleByFile(@NotNull VirtualFile file) {
return ProjectRootManager.getInstance(myProject).getFileIndex().getModuleForFile(file);
@@ -7,6 +7,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.UserDataHolder;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.Navigatable;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -17,6 +18,7 @@ import java.util.Collections;
/**
* An interface allowing access and modification of the data associated with the current compile session.
*/
@ApiStatus.NonExtendable
public interface CompileContext extends UserDataHolder {
/**
* Allows adding a message to be shown in `Compiler` message view.
@@ -111,13 +113,32 @@ public interface CompileContext extends UserDataHolder {
/**
* A compiler may call this method to request complete project rebuild.
* This may be necessary, for example, when compiler caches are corrupted.
* @deprecated calls of this method don't affect the behavior of the compilation engine; code which performs compilation should be
* migrated to be run in a separate JPS build process, see {@link Compiler} for details.
*/
void requestRebuildNextTime(String message);
@Deprecated(forRemoval = true)
default void requestRebuildNextTime(String message) {
}
boolean isRebuildRequested();
/**
* @deprecated the compilation engine doesn't support triggering rebuild from the IDE process; code which performs compilation should be
* migrated to be run in a separate JPS build process, see {@link Compiler} for details.
*/
@Deprecated(forRemoval = true)
default boolean isRebuildRequested() {
return false;
}
/**
* @deprecated the compilation engine doesn't support triggering rebuild from the IDE process; code which performs compilation should be
* migrated to be run in a separate JPS build process, see {@link Compiler} for details.
*/
@Deprecated(forRemoval = true)
@Nullable
String getRebuildReason();
default String getRebuildReason() {
return null;
}
/**
* Returns the module to which the specified file belongs. This method is aware of the file->module mapping
@@ -64,20 +64,6 @@ public class DummyCompileContext implements CompileContext {
return null;
}
@Override
public void requestRebuildNextTime(String message) {
}
@Override
public boolean isRebuildRequested() {
return false;
}
@Override
public @Nullable String getRebuildReason() {
return null;
}
@Override
public Module getModuleByFile(@NotNull VirtualFile file) {
return null;