Skip to content

Commit

Permalink
Invalidate the environment in project when the compiler crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
azinneera committed Jun 17, 2022
1 parent 7d57315 commit 6dd999f
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package io.ballerina.projects;

import io.ballerina.projects.environment.ProjectEnvironment;
import org.wso2.ballerinalang.compiler.PackageCache;
import org.wso2.ballerinalang.compiler.util.CompilerContext;
import org.wso2.ballerinalang.compiler.util.CompilerOptions;

Expand All @@ -36,7 +35,7 @@ public abstract class Project {
protected final Path sourceRoot;
private Package currentPackage;
private BuildOptions buildOptions;
private final ProjectEnvironment projectEnvironment;
private ProjectEnvironment projectEnvironment;
private final ProjectKind projectKind;

protected Project(ProjectKind projectKind,
Expand Down Expand Up @@ -112,10 +111,7 @@ protected void populateCompilerContext() {
*/
public void clearCaches() {
cloneProject(this);
CompilerContext compilerContext = this.projectEnvironmentContext()
.getService(CompilerContext.class);
PackageCache packageCache = PackageCache.getInstance(compilerContext);
packageCache.flush();
this.projectEnvironment = ProjectEnvironmentBuilder.getDefaultBuilder().build(this);
}

/**
Expand Down

0 comments on commit 6dd999f

Please sign in to comment.