Skip to content

Commit babbc12

Browse files
committed
Clean up now unnecessary @GwtIncompatible from JSCompiler codebase
PiperOrigin-RevId: 707984275
1 parent d842229 commit babbc12

21 files changed

+1
-50
lines changed

src/com/google/javascript/jscomp/deps/DepsFileRegexParser.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import static com.google.common.collect.ImmutableList.toImmutableList;
2020
import static java.nio.charset.StandardCharsets.UTF_8;
2121

22-
import com.google.common.annotations.GwtIncompatible;
2322
import com.google.common.base.CharMatcher;
2423
import com.google.common.base.Function;
2524
import com.google.common.base.Functions;
@@ -44,7 +43,6 @@
4443
*
4544
* <p>See //javascript/closure/deps.js for an example file.
4645
*/
47-
@GwtIncompatible("java.util.regex")
4846
public final class DepsFileRegexParser extends JsFileLineParser {
4947
private static final Logger logger = Logger.getLogger(DepsFileRegexParser.class.getName());
5048

src/com/google/javascript/jscomp/deps/JsFileLineParser.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.javascript.jscomp.deps;
1818

19-
import com.google.common.annotations.GwtIncompatible;
2019
import com.google.common.base.CharMatcher;
2120
import com.google.javascript.jscomp.CheckLevel;
2221
import com.google.javascript.jscomp.DiagnosticType;
@@ -36,7 +35,6 @@
3635
* Base class for classes that parse JavaScript sources on a line-by-line basis. Strips comments
3736
* from files and records all parsing errors.
3837
*/
39-
@GwtIncompatible("java.io")
4038
public abstract class JsFileLineParser {
4139

4240
static final DiagnosticType PARSE_WARNING = DiagnosticType.warning(

src/com/google/javascript/jscomp/deps/JsFileRegexParser.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import static com.google.common.base.Preconditions.checkState;
2020

21-
import com.google.common.annotations.GwtIncompatible;
2221
import com.google.common.base.CharMatcher;
2322
import com.google.errorprone.annotations.CanIgnoreReturnValue;
2423
import com.google.javascript.jscomp.CheckLevel;
@@ -40,7 +39,6 @@
4039
* A parser that can extract dependency information from a .js file, including goog.require,
4140
* goog.provide, goog.module, import statements, and export statements.
4241
*/
43-
@GwtIncompatible("java.util.regex")
4442
public final class JsFileRegexParser extends JsFileLineParser {
4543

4644
private static final Logger logger = Logger.getLogger(JsFileRegexParser.class.getName());

src/com/google/javascript/jscomp/deps/ModuleLoader.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import static com.google.common.collect.Streams.stream;
2424
import static java.util.Comparator.naturalOrder;
2525

26-
import com.google.common.annotations.GwtIncompatible;
2726
import com.google.common.annotations.VisibleForTesting;
2827
import com.google.common.base.Function;
2928
import com.google.common.collect.ImmutableList;
@@ -379,7 +378,6 @@ public String apply(String path) {
379378
}
380379
},
381380

382-
@GwtIncompatible("Paths.get, Path.toAbsolutePath")
383381
ABSOLUTE {
384382
@Override
385383
public String apply(String path) {

src/com/google/javascript/jscomp/graph/UnionFind.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package com.google.javascript.jscomp.graph;
1717

18-
import com.google.common.annotations.GwtCompatible;
1918
import com.google.common.collect.ImmutableList;
2019
import com.google.common.collect.ImmutableSet;
2120
import com.google.errorprone.annotations.CanIgnoreReturnValue;
@@ -31,7 +30,6 @@
3130
*
3231
* @param <E> element type
3332
*/
34-
@GwtCompatible
3533
public interface UnionFind<E> {
3634

3735
/**

src/com/google/javascript/jscomp/instrumentation/reporter/ProductionInstrumentationReporter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import static java.nio.charset.StandardCharsets.UTF_8;
2020

21-
import com.google.common.annotations.GwtIncompatible;
2221
import com.google.common.collect.ImmutableList;
2322
import com.google.common.io.CharStreams;
2423
import com.google.gson.Gson;
@@ -41,7 +40,6 @@
4140
* instrumented production code. It will then take these inputs and generate a single JSON which
4241
* provides a detailed breakdown of each instrumentation point.
4342
*/
44-
@GwtIncompatible
4543
final class ProductionInstrumentationReporter {
4644

4745
@Option(

src/com/google/javascript/jscomp/instrumentation/reporter/ProfilingReport.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import static java.util.stream.Collectors.joining;
2020

21-
import com.google.common.annotations.GwtIncompatible;
2221
import com.google.common.collect.ImmutableList;
2322
import com.google.javascript.jscomp.instrumentation.reporter.proto.FileProfile;
2423
import com.google.javascript.jscomp.instrumentation.reporter.proto.InstrumentationPoint;
@@ -36,7 +35,6 @@
3635
* A class that maintains all information about the production instrumentation results which will be
3736
* converted to a JSON.
3837
*/
39-
@GwtIncompatible
4038
final class ProfilingReport {
4139

4240
/**

src/com/google/javascript/jscomp/resources/ResourceLoader.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import static java.nio.charset.StandardCharsets.UTF_8;
2020

21-
import com.google.common.annotations.GwtIncompatible;
2221
import com.google.common.collect.ImmutableMap;
2322
import com.google.common.io.CharStreams;
2423
import java.io.IOException;
@@ -27,7 +26,6 @@
2726
/**
2827
* Utility class that handles resource loading.
2928
*/
30-
@GwtIncompatible("getResource, java.io.InputStreamReader")
3129
public final class ResourceLoader {
3230
public static String loadTextResource(Class<?> clazz, String path) {
3331
try {

src/com/google/javascript/jscomp/serialization/ScriptNodeDeserializer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.javascript.jscomp.serialization;
1818

19-
import com.google.common.annotations.GwtIncompatible;
2019
import com.google.common.base.Optional;
2120
import com.google.common.collect.ImmutableList;
2221
import com.google.javascript.jscomp.SourceFile;
@@ -38,7 +37,6 @@
3837
* <p>This process depends on other information from the TypedAST format, but the output it limited
3938
* to only a single SCRIPT. The other deserialized content must be provided beforehand.
4039
*/
41-
@GwtIncompatible("protobuf.lite")
4240
final class ScriptNodeDeserializer {
4341

4442
private final SourceFile sourceFile;

src/com/google/javascript/jscomp/serialization/SerializeTypesToPointers.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import static com.google.javascript.jscomp.serialization.TypePointers.trimOffset;
2525
import static java.util.Comparator.naturalOrder;
2626

27-
import com.google.common.annotations.GwtIncompatible;
2827
import com.google.common.collect.ComparisonChain;
2928
import com.google.common.collect.ImmutableMap;
3029
import com.google.common.collect.ImmutableSortedSet;
@@ -52,7 +51,6 @@
5251
* Grab an integer TypePool pointer for each JSType on the AST and log information about the
5352
* pointers.
5453
*/
55-
@GwtIncompatible
5654
final class SerializeTypesToPointers {
5755

5856
private final AbstractCompiler compiler;

src/com/google/javascript/jscomp/serialization/TypedAstDeserializer.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static com.google.javascript.jscomp.base.JSCompObjects.identical;
2222

2323
import com.google.auto.value.AutoValue;
24-
import com.google.common.annotations.GwtIncompatible;
2524
import com.google.common.base.Optional;
2625
import com.google.common.collect.ImmutableList;
2726
import com.google.common.collect.ImmutableMap;
@@ -51,7 +50,6 @@
5150
import org.jspecify.annotations.Nullable;
5251

5352
/** Deserializes a list of TypedAst protos into the JSCompiler AST structure. */
54-
@GwtIncompatible("protobuf.lite")
5553
public final class TypedAstDeserializer {
5654

5755
private final Mode mode;
@@ -384,7 +382,6 @@ private static Supplier<Node> createStubWeakScriptNode(SourceFile file) {
384382
};
385383
}
386384

387-
@GwtIncompatible("ObjectInputStream")
388385
private static void deserializeTypedAsts(
389386
InputStream typedAstsStream,
390387
TypedAstDeserializer deserializer,

src/com/google/javascript/jscomp/serialization/TypedAstSerializer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static com.google.common.base.Preconditions.checkState;
2222
import static com.google.common.collect.ImmutableList.toImmutableList;
2323

24-
import com.google.common.annotations.GwtIncompatible;
2524
import com.google.common.collect.ImmutableSet;
2625
import com.google.common.collect.ImmutableSetMultimap;
2726
import com.google.javascript.jscomp.AbstractCompiler;
@@ -39,7 +38,6 @@
3938
import org.jspecify.annotations.Nullable;
4039

4140
/** Transforms a compiler AST into a serialized TypedAst object. */
42-
@GwtIncompatible("protobuf.lite")
4341
final class TypedAstSerializer {
4442

4543
private final AbstractCompiler compiler;

src/com/google/javascript/jscomp/testing/NoninjectingCompiler.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package com.google.javascript.jscomp.testing;
1717

18-
import com.google.common.annotations.GwtIncompatible;
1918
import com.google.common.collect.ImmutableSet;
2019
import com.google.javascript.jscomp.Compiler;
2120
import com.google.javascript.jscomp.ErrorManager;
@@ -48,7 +47,6 @@ public Node ensureLibraryInjected(String library, boolean force) {
4847
}
4948

5049
@Override
51-
@GwtIncompatible
5250
public final void saveState(OutputStream outputStream) throws IOException {
5351
ObjectOutputStream out = new ObjectOutputStream(outputStream);
5452
out.writeObject(injected);
@@ -59,7 +57,6 @@ public final void saveState(OutputStream outputStream) throws IOException {
5957

6058
@SuppressWarnings("unchecked")
6159
@Override
62-
@GwtIncompatible
6360
public final void restoreState(InputStream inputStream)
6461
throws IOException, ClassNotFoundException {
6562
ObjectInputStream in = new ObjectInputStream(inputStream);

test/com/google/debugging/sourcemap/SourceMapTestCase.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import static com.google.common.truth.Truth.assertThat;
2020
import static com.google.common.truth.Truth.assertWithMessage;
2121

22-
import com.google.common.annotations.GwtIncompatible;
2322
import com.google.common.base.Joiner;
2423
import com.google.common.collect.ImmutableList;
2524
import com.google.common.collect.ImmutableMap;
@@ -48,7 +47,6 @@ public abstract class SourceMapTestCase {
4847

4948
private static final Gson GSON = new Gson();
5049

51-
@GwtIncompatible
5250
private static final Type JSON_MAP_TYPE = (new TypeToken<Map<String, ?>>() {}).getType();
5351

5452
private boolean validateColumns = true;
@@ -94,12 +92,10 @@ public void setUp() {
9492
/**
9593
* Creates a source map for the given JS code and asserts it is equal to the expected golden map.
9694
*/
97-
@GwtIncompatible
9895
protected void checkSourceMap(String js, ImmutableMap<String, ?> expectedMap) throws IOException {
9996
checkSourceMap("testcode", js, expectedMap);
10097
}
10198

102-
@GwtIncompatible
10399
protected void checkSourceMap(String fileName, String js, ImmutableMap<String, ?> expectedMap)
104100
throws IOException {
105101
RunResult result = compile(js, fileName);

test/com/google/javascript/jscomp/CompilerTestCaseUtils.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@
1515
*/
1616
package com.google.javascript.jscomp;
1717

18-
import com.google.common.annotations.GwtIncompatible;
1918
import java.io.ByteArrayInputStream;
2019
import java.io.ByteArrayOutputStream;
2120
import java.util.List;
2221

2322
/** CompilerTestCase utilities that can be super sourced out for GWT/J2CL implementation. */
2423
public final class CompilerTestCaseUtils {
25-
@GwtIncompatible
2624
public static Compiler multistageSerializeAndDeserialize(
2725
CompilerTestCase testCase,
2826
Compiler compiler,
@@ -50,7 +48,6 @@ public static Compiler multistageSerializeAndDeserialize(
5048
return compiler;
5149
}
5250

53-
@GwtIncompatible
5451
public static void setDebugLogDirectoryOn(CompilerOptions options) {
5552
}
5653

test/com/google/javascript/jscomp/ConformanceAllowlisterTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import static com.google.common.truth.Truth.assertThat;
1919
import static com.google.javascript.jscomp.CompilerTestCase.lines;
2020

21-
import com.google.common.annotations.GwtIncompatible;
2221
import com.google.common.collect.ImmutableList;
2322
import com.google.common.collect.ImmutableMultimap;
2423
import com.google.javascript.rhino.Node;
@@ -27,7 +26,6 @@
2726
import org.junit.runner.RunWith;
2827
import org.junit.runners.JUnit4;
2928

30-
@GwtIncompatible("Conformance")
3129
@RunWith(JUnit4.class)
3230
public class ConformanceAllowlisterTest {
3331
@Test

test/com/google/javascript/jscomp/LocaleDataPassesTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.javascript.jscomp;
1818

19-
import com.google.common.annotations.GwtIncompatible;
2019
import com.google.javascript.jscomp.LocaleDataPasses.ProtectGoogLocale;
2120
import com.google.javascript.rhino.Node;
2221
import org.junit.Before;
@@ -25,7 +24,6 @@
2524
import org.junit.runners.JUnit4;
2625

2726
/** Test which checks that replacer works correctly. */
28-
@GwtIncompatible("Unnecessary")
2927
@RunWith(JUnit4.class)
3028
public final class LocaleDataPassesTest extends CompilerTestCase {
3129

test/com/google/javascript/jscomp/PeepholeReplaceKnownMethodsTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.javascript.jscomp;
1818

19-
import com.google.common.annotations.GwtIncompatible;
2019
import com.google.javascript.jscomp.CompilerOptions.LanguageMode;
2120
import org.junit.Before;
2221
import org.junit.Test;
@@ -543,7 +542,6 @@ public void testFoldMathFunctions_fround() {
543542
}
544543

545544
@Test
546-
@GwtIncompatible // TODO(b/155511629): Enable this test for J2CL
547545
public void testFoldMathFunctions_fround_j2cl() {
548546
foldSame("Math.fround(1.2)");
549547
}

test/com/google/javascript/jscomp/disambiguate/ColorGraphBuilderTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import static com.google.javascript.jscomp.disambiguate.ColorGraphBuilder.EdgeReason.ALGEBRAIC;
2323
import static com.google.javascript.jscomp.disambiguate.ColorGraphBuilder.EdgeReason.CAN_HOLD;
2424

25-
import com.google.common.annotations.GwtIncompatible;
2625
import com.google.common.base.Preconditions;
2726
import com.google.common.base.Supplier;
2827
import com.google.common.collect.ImmutableSet;
@@ -60,7 +59,7 @@
6059
@RunWith(JUnit4.class)
6160
public final class ColorGraphBuilderTest extends CompilerTestCase {
6261

63-
@Rule @GwtIncompatible public final TestName testName = new TestName();
62+
@Rule public final TestName testName = new TestName();
6463

6564
private final Compiler compiler = new Compiler();
6665

@@ -550,7 +549,6 @@ public void verifyResult_hasNoParallelEdges() {
550549
}
551550

552551
@After
553-
@GwtIncompatible
554552
public void renderResultGraph() {
555553
}
556554

test/com/google/javascript/jscomp/disambiguate/DisambiguatePropertiesTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static com.google.common.truth.Truth.assertThat;
2121
import static java.util.stream.Collectors.joining;
2222

23-
import com.google.common.annotations.GwtIncompatible;
2423
import com.google.common.collect.ImmutableList;
2524
import com.google.common.collect.ImmutableSet;
2625
import com.google.gson.Gson;
@@ -1280,7 +1279,6 @@ private void generateDiagnosticFiles() {
12801279
"}")));
12811280
}
12821281

1283-
@GwtIncompatible
12841282
private static String loadFile(Path path) {
12851283
try (Stream<String> lines = Files.lines(path)) {
12861284
return lines.collect(joining("\n"));
@@ -1289,7 +1287,6 @@ private static String loadFile(Path path) {
12891287
}
12901288
}
12911289

1292-
@GwtIncompatible
12931290
private ImmutableList<Path> debugLogFiles() {
12941291
try {
12951292
Path dir =

test/com/google/javascript/jscomp/serialization/SerializeTypedAstPassTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import static com.google.common.truth.extensions.proto.ProtoTruth.assertThat;
2323
import static java.util.stream.Collectors.joining;
2424

25-
import com.google.common.annotations.GwtIncompatible;
2625
import com.google.common.collect.ImmutableList;
2726
import com.google.common.collect.ImmutableSet;
2827
import com.google.gson.Gson;
@@ -556,7 +555,6 @@ private void generateDiagnosticFiles() {
556555
"const /** !Foo1 */ typeMismatch = new Foo0();"));
557556
}
558557

559-
@GwtIncompatible
560558
private static String loadFile(Path path) {
561559
try (Stream<String> lines = Files.lines(path)) {
562560
return lines.collect(joining("\n"));
@@ -565,7 +563,6 @@ private static String loadFile(Path path) {
565563
}
566564
}
567565

568-
@GwtIncompatible
569566
private ImmutableList<Path> debugLogFiles() {
570567
try {
571568
Path dir =

0 commit comments

Comments
 (0)