Skip to content

Commit

Permalink
Use @Keep to hint to static analysis that a field is used reflectively
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 714261898
  • Loading branch information
cushon authored and Guice Team committed Jan 13, 2025
1 parent c5e7d93 commit 6fc6622
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/com/google/inject/internal/InternalContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.inject.internal;

import com.google.common.annotations.VisibleForTesting;
import com.google.errorprone.annotations.Keep;
import com.google.inject.spi.Dependency;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
Expand Down Expand Up @@ -47,8 +48,7 @@ static final class CircularFactoryIdFactory {
// The first factory id is 1 so that we never produce a circular factory id of 0.
// The tables below use 0 to represent an empty slot which is convenient since arrays are always
// zero initialized.
@SuppressWarnings({"FieldCanBeFinal", "unused"})
private int id = 1;
@Keep private int id = 1;

/** Returns the next circular factory id. */
int next() {
Expand Down

0 comments on commit 6fc6622

Please sign in to comment.