Skip to content

Commit

Permalink
Fix broken Library.newEmpty().
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 700163323
  • Loading branch information
rluble authored and copybara-github committed Nov 26, 2024
1 parent 794e55d commit bb7802b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions transpiler/java/com/google/j2cl/transpiler/ast/Library.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.j2cl.common.visitor.Processor;
import com.google.j2cl.common.visitor.Visitable;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

Expand Down Expand Up @@ -63,7 +65,7 @@ Node acceptInternal(Processor processor) {
}

public static Library newEmpty() {
return new Builder().build();
return new Builder().setCompilationUnits(ImmutableList.of()).build();
}

public static Builder newBuilder() {
Expand All @@ -81,7 +83,7 @@ public static Builder from(Library library) {

@CanIgnoreReturnValue
public Builder setCompilationUnits(List<CompilationUnit> compilationUnits) {
this.compilationUnits = compilationUnits;
this.compilationUnits = new ArrayList<>(compilationUnits);
return this;
}

Expand Down

0 comments on commit bb7802b

Please sign in to comment.