Add a compiler parameter to generate not-null assertions on method call sites
It is off by default when invoking compiler directly, and on by default when compiling from IDE
This commit is contained in:
@@ -68,14 +68,20 @@ public class GenerationState {
|
||||
@NotNull
|
||||
private final JetTypeMapper typeMapper;
|
||||
|
||||
private final boolean generateNotNullAssertions;
|
||||
|
||||
public GenerationState(Project project, ClassBuilderFactory builderFactory, AnalyzeExhaust analyzeExhaust, List<JetFile> files) {
|
||||
this(project, builderFactory, Progress.DEAF, analyzeExhaust, files, BuiltinToJavaTypesMapping.ENABLED);
|
||||
this(project, builderFactory, Progress.DEAF, analyzeExhaust, files, BuiltinToJavaTypesMapping.ENABLED, true);
|
||||
}
|
||||
|
||||
public GenerationState(
|
||||
@NotNull Project project,
|
||||
ClassBuilderFactory builderFactory, Progress progress,
|
||||
@NotNull AnalyzeExhaust exhaust, @NotNull List<JetFile> files, @NotNull BuiltinToJavaTypesMapping builtinToJavaTypesMapping
|
||||
ClassBuilderFactory builderFactory,
|
||||
@NotNull Progress progress,
|
||||
@NotNull AnalyzeExhaust exhaust,
|
||||
@NotNull List<JetFile> files,
|
||||
@NotNull BuiltinToJavaTypesMapping builtinToJavaTypesMapping,
|
||||
boolean generateNotNullAssertions
|
||||
) {
|
||||
this.project = project;
|
||||
this.progress = progress;
|
||||
@@ -94,6 +100,8 @@ public class GenerationState {
|
||||
this.scriptCodegen = injector.getScriptCodegen();
|
||||
this.intrinsics = injector.getIntrinsics();
|
||||
this.classFileFactory = injector.getClassFileFactory();
|
||||
|
||||
this.generateNotNullAssertions = generateNotNullAssertions;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -146,6 +154,10 @@ public class GenerationState {
|
||||
return intrinsics;
|
||||
}
|
||||
|
||||
public boolean isGenerateNotNullAssertions() {
|
||||
return generateNotNullAssertions;
|
||||
}
|
||||
|
||||
public void beforeCompile() {
|
||||
markUsed();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user