Add a compiler parameter to generate not-null parameter assertions

Enable/disable assertion generation on parameters in the beginning of
methods accessible from Java
This commit is contained in:
Alexander Udalov
2012-10-04 16:05:03 +04:00
parent 12ce447c24
commit 753ae9e550
8 changed files with 29 additions and 8 deletions
@@ -70,8 +70,10 @@ public class GenerationState {
private final boolean generateNotNullAssertions;
private final boolean generateNotNullParamAssertions;
public GenerationState(Project project, ClassBuilderFactory builderFactory, AnalyzeExhaust analyzeExhaust, List<JetFile> files) {
this(project, builderFactory, Progress.DEAF, analyzeExhaust, files, BuiltinToJavaTypesMapping.ENABLED, true);
this(project, builderFactory, Progress.DEAF, analyzeExhaust, files, BuiltinToJavaTypesMapping.ENABLED, true, false);
}
public GenerationState(
@@ -81,7 +83,8 @@ public class GenerationState {
@NotNull AnalyzeExhaust exhaust,
@NotNull List<JetFile> files,
@NotNull BuiltinToJavaTypesMapping builtinToJavaTypesMapping,
boolean generateNotNullAssertions
boolean generateNotNullAssertions,
boolean generateNotNullParamAssertions
) {
this.project = project;
this.progress = progress;
@@ -102,6 +105,7 @@ public class GenerationState {
this.classFileFactory = injector.getClassFileFactory();
this.generateNotNullAssertions = generateNotNullAssertions;
this.generateNotNullParamAssertions = generateNotNullParamAssertions;
}
@NotNull
@@ -158,6 +162,10 @@ public class GenerationState {
return generateNotNullAssertions;
}
public boolean isGenerateNotNullParamAssertions() {
return generateNotNullParamAssertions;
}
public void beforeCompile() {
markUsed();