Skip to content

Commit

Permalink
Intern javac options in JavaCompilationInfoProvider
Browse files Browse the repository at this point in the history
This is almost always the same set of options used for compilation, so we use the same interner.

Of course, this change means, all else remaining the same, we will incur an even larger regression when we switch to pure Starlark instances of `JavaInfo`[^1].

PiperOrigin-RevId: 551185053
Change-Id: I0a528b76625ad27adde675a112c232a99d9e7abe
  • Loading branch information
hvadehra authored and copybara-github committed Jul 26, 2023
1 parent b225036 commit 481311d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ public JavaCompilationHelper(
additionalInputsForDatabinding);
}

@Nullable
static ImmutableList<String> internJavacOpts(@Nullable ImmutableList<String> javacOpts) {
if (javacOpts == null) {
return null;
}
return javacOptsInterner.intern(javacOpts);
}

public void enableJspecify(boolean enableJspecify) {
this.enableJspecify = enableJspecify;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ public Builder setBootClasspath(BootClassPathInfo bootClasspath) {

public JavaCompilationInfoProvider build() {
return new AutoValue_JavaCompilationInfoProvider(
javacOpts, runtimeClasspath, compilationClasspath, bootClasspath.bootclasspath());
JavaCompilationHelper.internJavacOpts(javacOpts),
runtimeClasspath,
compilationClasspath,
bootClasspath.bootclasspath());
}
}

Expand Down

0 comments on commit 481311d

Please sign in to comment.