@@ -49,7 +49,7 @@ public final class CelSource {
4949 private CelSource (Builder builder ) {
5050 this .codePoints = checkNotNull (builder .codePoints );
5151 this .description = checkNotNull (builder .description );
52- this .positions = checkNotNull (builder .positions . buildOrThrow ( ));
52+ this .positions = checkNotNull (ImmutableMap . copyOf ( builder .positions ));
5353 this .lineOffsets = checkNotNull (ImmutableList .copyOf (builder .lineOffsets ));
5454 this .macroCalls = checkNotNull (ImmutableMap .copyOf (builder .macroCalls ));
5555 this .extensions = checkNotNull (builder .extensions .build ());
@@ -208,7 +208,7 @@ public static final class Builder {
208208
209209 private final CelCodePointArray codePoints ;
210210 private final List <Integer > lineOffsets ;
211- private final ImmutableMap . Builder <Long , Integer > positions ;
211+ private final Map <Long , Integer > positions ;
212212 private final Map <Long , CelExpr > macroCalls ;
213213 private final ImmutableSet .Builder <Extension > extensions ;
214214
@@ -221,7 +221,7 @@ private Builder() {
221221 private Builder (CelCodePointArray codePoints , List <Integer > lineOffsets ) {
222222 this .codePoints = checkNotNull (codePoints );
223223 this .lineOffsets = checkNotNull (lineOffsets );
224- this .positions = ImmutableMap . builder ();
224+ this .positions = new HashMap <> ();
225225 this .macroCalls = new HashMap <>();
226226 this .extensions = ImmutableSet .builder ();
227227 this .description = "" ;
@@ -261,6 +261,18 @@ public Builder addPositions(long exprId, int position) {
261261 return this ;
262262 }
263263
264+ @ CanIgnoreReturnValue
265+ public Builder clearPositions () {
266+ this .positions .clear ();
267+ return this ;
268+ }
269+
270+ @ CanIgnoreReturnValue
271+ public Builder removePositions (long exprId ) {
272+ this .positions .remove (exprId );
273+ return this ;
274+ }
275+
264276 @ CanIgnoreReturnValue
265277 public Builder addMacroCalls (long exprId , CelExpr expr ) {
266278 this .macroCalls .put (exprId , expr );
@@ -329,8 +341,8 @@ public Optional<CelSourceLocation> getOffsetLocation(int offset) {
329341 }
330342
331343 @ CheckReturnValue
332- public ImmutableMap <Long , Integer > getPositionsMap () {
333- return this .positions . buildOrThrow () ;
344+ public Map <Long , Integer > getPositionsMap () {
345+ return this .positions ;
334346 }
335347
336348 @ CheckReturnValue
0 commit comments