Skip to content

Commit

Permalink
Clean up now unnecessary @GwtIncompatible from JSCompiler codebase
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 707984275
  • Loading branch information
lauraharker committed Dec 20, 2024
1 parent d842229 commit babbc12
Show file tree
Hide file tree
Showing 21 changed files with 1 addition and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.nio.charset.StandardCharsets.UTF_8;

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

Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/deps/JsFileLineParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.javascript.jscomp.deps;

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

static final DiagnosticType PARSE_WARNING = DiagnosticType.warning(
Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/deps/JsFileRegexParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

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

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

private static final Logger logger = Logger.getLogger(JsFileRegexParser.class.getName());
Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/deps/ModuleLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static com.google.common.collect.Streams.stream;
import static java.util.Comparator.naturalOrder;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
Expand Down Expand Up @@ -379,7 +378,6 @@ public String apply(String path) {
}
},

@GwtIncompatible("Paths.get, Path.toAbsolutePath")
ABSOLUTE {
@Override
public String apply(String path) {
Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/graph/UnionFind.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package com.google.javascript.jscomp.graph;

import com.google.common.annotations.GwtCompatible;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
Expand All @@ -31,7 +30,6 @@
*
* @param <E> element type
*/
@GwtCompatible
public interface UnionFind<E> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

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

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

@Option(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

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

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableList;
import com.google.javascript.jscomp.instrumentation.reporter.proto.FileProfile;
import com.google.javascript.jscomp.instrumentation.reporter.proto.InstrumentationPoint;
Expand All @@ -36,7 +35,6 @@
* A class that maintains all information about the production instrumentation results which will be
* converted to a JSON.
*/
@GwtIncompatible
final class ProfilingReport {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

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

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.CharStreams;
import java.io.IOException;
Expand All @@ -27,7 +26,6 @@
/**
* Utility class that handles resource loading.
*/
@GwtIncompatible("getResource, java.io.InputStreamReader")
public final class ResourceLoader {
public static String loadTextResource(Class<?> clazz, String path) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.javascript.jscomp.serialization;

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

private final SourceFile sourceFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static com.google.javascript.jscomp.serialization.TypePointers.trimOffset;
import static java.util.Comparator.naturalOrder;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedSet;
Expand Down Expand Up @@ -52,7 +51,6 @@
* Grab an integer TypePool pointer for each JSType on the AST and log information about the
* pointers.
*/
@GwtIncompatible
final class SerializeTypesToPointers {

private final AbstractCompiler compiler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static com.google.javascript.jscomp.base.JSCompObjects.identical;

import com.google.auto.value.AutoValue;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -51,7 +50,6 @@
import org.jspecify.annotations.Nullable;

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

private final Mode mode;
Expand Down Expand Up @@ -384,7 +382,6 @@ private static Supplier<Node> createStubWeakScriptNode(SourceFile file) {
};
}

@GwtIncompatible("ObjectInputStream")
private static void deserializeTypedAsts(
InputStream typedAstsStream,
TypedAstDeserializer deserializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.ImmutableList.toImmutableList;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSetMultimap;
import com.google.javascript.jscomp.AbstractCompiler;
Expand All @@ -39,7 +38,6 @@
import org.jspecify.annotations.Nullable;

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

private final AbstractCompiler compiler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package com.google.javascript.jscomp.testing;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableSet;
import com.google.javascript.jscomp.Compiler;
import com.google.javascript.jscomp.ErrorManager;
Expand Down Expand Up @@ -48,7 +47,6 @@ public Node ensureLibraryInjected(String library, boolean force) {
}

@Override
@GwtIncompatible
public final void saveState(OutputStream outputStream) throws IOException {
ObjectOutputStream out = new ObjectOutputStream(outputStream);
out.writeObject(injected);
Expand All @@ -59,7 +57,6 @@ public final void saveState(OutputStream outputStream) throws IOException {

@SuppressWarnings("unchecked")
@Override
@GwtIncompatible
public final void restoreState(InputStream inputStream)
throws IOException, ClassNotFoundException {
ObjectInputStream in = new ObjectInputStream(inputStream);
Expand Down
4 changes: 0 additions & 4 deletions test/com/google/debugging/sourcemap/SourceMapTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -48,7 +47,6 @@ public abstract class SourceMapTestCase {

private static final Gson GSON = new Gson();

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

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

@GwtIncompatible
protected void checkSourceMap(String fileName, String js, ImmutableMap<String, ?> expectedMap)
throws IOException {
RunResult result = compile(js, fileName);
Expand Down
3 changes: 0 additions & 3 deletions test/com/google/javascript/jscomp/CompilerTestCaseUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
*/
package com.google.javascript.jscomp;

import com.google.common.annotations.GwtIncompatible;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.List;

/** CompilerTestCase utilities that can be super sourced out for GWT/J2CL implementation. */
public final class CompilerTestCaseUtils {
@GwtIncompatible
public static Compiler multistageSerializeAndDeserialize(
CompilerTestCase testCase,
Compiler compiler,
Expand Down Expand Up @@ -50,7 +48,6 @@ public static Compiler multistageSerializeAndDeserialize(
return compiler;
}

@GwtIncompatible
public static void setDebugLogDirectoryOn(CompilerOptions options) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.javascript.jscomp.CompilerTestCase.lines;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMultimap;
import com.google.javascript.rhino.Node;
Expand All @@ -27,7 +26,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@GwtIncompatible("Conformance")
@RunWith(JUnit4.class)
public class ConformanceAllowlisterTest {
@Test
Expand Down
2 changes: 0 additions & 2 deletions test/com/google/javascript/jscomp/LocaleDataPassesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.javascript.jscomp;

import com.google.common.annotations.GwtIncompatible;
import com.google.javascript.jscomp.LocaleDataPasses.ProtectGoogLocale;
import com.google.javascript.rhino.Node;
import org.junit.Before;
Expand All @@ -25,7 +24,6 @@
import org.junit.runners.JUnit4;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.javascript.jscomp;

import com.google.common.annotations.GwtIncompatible;
import com.google.javascript.jscomp.CompilerOptions.LanguageMode;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -543,7 +542,6 @@ public void testFoldMathFunctions_fround() {
}

@Test
@GwtIncompatible // TODO(b/155511629): Enable this test for J2CL
public void testFoldMathFunctions_fround_j2cl() {
foldSame("Math.fround(1.2)");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static com.google.javascript.jscomp.disambiguate.ColorGraphBuilder.EdgeReason.ALGEBRAIC;
import static com.google.javascript.jscomp.disambiguate.ColorGraphBuilder.EdgeReason.CAN_HOLD;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -60,7 +59,7 @@
@RunWith(JUnit4.class)
public final class ColorGraphBuilderTest extends CompilerTestCase {

@Rule @GwtIncompatible public final TestName testName = new TestName();
@Rule public final TestName testName = new TestName();

private final Compiler compiler = new Compiler();

Expand Down Expand Up @@ -550,7 +549,6 @@ public void verifyResult_hasNoParallelEdges() {
}

@After
@GwtIncompatible
public void renderResultGraph() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static com.google.common.truth.Truth.assertThat;
import static java.util.stream.Collectors.joining;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.gson.Gson;
Expand Down Expand Up @@ -1280,7 +1279,6 @@ private void generateDiagnosticFiles() {
"}")));
}

@GwtIncompatible
private static String loadFile(Path path) {
try (Stream<String> lines = Files.lines(path)) {
return lines.collect(joining("\n"));
Expand All @@ -1289,7 +1287,6 @@ private static String loadFile(Path path) {
}
}

@GwtIncompatible
private ImmutableList<Path> debugLogFiles() {
try {
Path dir =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static com.google.common.truth.extensions.proto.ProtoTruth.assertThat;
import static java.util.stream.Collectors.joining;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.gson.Gson;
Expand Down Expand Up @@ -556,7 +555,6 @@ private void generateDiagnosticFiles() {
"const /** !Foo1 */ typeMismatch = new Foo0();"));
}

@GwtIncompatible
private static String loadFile(Path path) {
try (Stream<String> lines = Files.lines(path)) {
return lines.collect(joining("\n"));
Expand All @@ -565,7 +563,6 @@ private static String loadFile(Path path) {
}
}

@GwtIncompatible
private ImmutableList<Path> debugLogFiles() {
try {
Path dir =
Expand Down

0 comments on commit babbc12

Please sign in to comment.