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: 707612432
  • Loading branch information
lauraharker committed Dec 20, 2024
1 parent f465cd7 commit 697931f
Show file tree
Hide file tree
Showing 19 changed files with 0 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@

package com.google.javascript.jscomp.bundle;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;

/** A Transformer that caches output from a delegate transformer. */
@GwtIncompatible
public class CachedTransformer implements Source.Transformer {

private static final String DEFAULT_CACHE_SPEC = "maximumSize=10000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

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

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.Immutable;
import com.google.javascript.jscomp.CheckLevel;
Expand All @@ -42,7 +41,6 @@
* A source transformer base class. May also include a runtime that needs to
* be shipped with the final bundle.
*/
@GwtIncompatible
@Immutable
public abstract class CompilerBasedTransformer implements Source.Transformer {

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

package com.google.javascript.jscomp.bundle;

import com.google.common.annotations.GwtIncompatible;
import com.google.errorprone.annotations.Immutable;
import com.google.javascript.jscomp.CompilerOptions;
import com.google.javascript.jscomp.CompilerOptions.InstrumentOption;
Expand All @@ -27,7 +26,6 @@
/**
* A source transformer for instrmenting code for coverage data collection.
*/
@GwtIncompatible
@Immutable
public class CoverageInstrumenter extends CompilerBasedTransformer {

Expand Down
4 changes: 0 additions & 4 deletions src/com/google/javascript/jscomp/bundle/Source.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@


import com.google.auto.value.AutoValue;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableMap;
Expand All @@ -33,7 +32,6 @@

/** An abstract representation of a source file. */
@AutoValue
@GwtIncompatible
@Immutable
public abstract class Source {

Expand Down Expand Up @@ -94,7 +92,6 @@ public static Builder builder() {

/** Builder for Source instances. */
@AutoValue.Builder
@GwtIncompatible
public abstract static class Builder {
public abstract Builder setPath(Path path);
public abstract Builder setSourceMap(String sourceMap);
Expand Down Expand Up @@ -179,7 +176,6 @@ default Transformer compose(Transformer before) {
}

/** Essentially the same as Supplier, but wraps equals and hashCode. */
@GwtIncompatible
@Immutable
abstract static class Lazy<T> implements Supplier<T> {

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

package com.google.javascript.jscomp.bundle;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableList;
import com.google.javascript.jscomp.ErrorFormat;
import com.google.javascript.jscomp.JSError;
Expand All @@ -28,7 +27,6 @@
* An unchecked exception thrown when transpilation fails due to one or
* more errors in the input script.
*/
@GwtIncompatible
public class TranspilationException extends RuntimeException {

private final ImmutableList<JSError> errors;
Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/bundle/Transpiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@

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

import com.google.common.annotations.GwtIncompatible;
import com.google.errorprone.annotations.Immutable;
import java.util.Optional;

/**
* A source transformer for lowering JS language versions. May also include a runtime that needs to
* be shipped with the final bundle.
*/
@GwtIncompatible
@Immutable
public class Transpiler extends CompilerBasedTransformer {

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

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

import com.google.common.annotations.GwtIncompatible;
import com.google.javascript.jscomp.AbstractCompiler;
import com.google.javascript.jscomp.ControlFlowGraph;
import com.google.javascript.jscomp.NodeTraversal;
Expand All @@ -31,7 +30,6 @@
import java.util.Objects;

/** Instrument branch coverage for javascript. */
@GwtIncompatible("FileInstrumentationData")
public class BranchCoverageInstrumentationCallback extends NodeTraversal.AbstractCfgCallback {
private final AbstractCompiler compiler;
private final Map<String, FileInstrumentationData> instrumentationData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

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

import com.google.common.annotations.GwtIncompatible;
import com.google.javascript.jscomp.NodeTraversal;
import com.google.javascript.jscomp.NodeUtil;
import com.google.javascript.jscomp.instrumentation.CoverageInstrumentationPass.CoverageReach;
Expand All @@ -27,7 +26,6 @@
import java.util.Map;

/** This class implements a traversal to instrument an AST for code coverage. */
@GwtIncompatible("FileInstrumentationData")
class CoverageInstrumentationCallback implements NodeTraversal.Callback {

private final Map<String, FileInstrumentationData> instrumentationData;
Expand Down
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.errorprone.annotations.InlineMe;
import com.google.javascript.jscomp.AbstractCompiler;
import com.google.javascript.jscomp.CompilerOptions.InstrumentOption;
Expand All @@ -32,7 +31,6 @@
import java.util.Map;

/** This code implements the instrumentation pass over the AST (returned by JSCompiler). */
@GwtIncompatible("FileInstrumentationData")
public class CoverageInstrumentationPass implements CompilerPass {

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

package com.google.javascript.jscomp.instrumentation;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.primitives.UnsignedBytes;
Expand All @@ -29,7 +28,6 @@
* Holds instrumentation details related to a file, namely, the filename, the array name used in
* instrumentation, and the lines which were instrumented (in encoded form).
*/
@GwtIncompatible("com.google.common.primitives.UnsignedBytes")
class FileInstrumentationData {
private final BitSet instrumentedBits; // Instrumented lines, a bit per line
private final String arrayName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

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

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableMap;
import com.google.debugging.sourcemap.Base64VLQ;
import com.google.gson.Gson;
Expand All @@ -45,7 +44,6 @@
* it can be run on client browsers with the goal of better detecting dead code. The callback will
* instrument by pushing a string onto an array which identifies what piece of code was executed.
*/
@GwtIncompatible
final class ProductionCoverageInstrumentationCallback implements NodeTraversal.Callback {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.cache.CacheBuilder;
import java.util.function.Function;
import org.junit.Before;
Expand All @@ -31,7 +30,6 @@
import org.mockito.MockitoAnnotations;

/** Tests for {@link Source} and its nested classes. */
@GwtIncompatible
@RunWith(JUnit4.class)
public final class CachedTransformerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static org.mockito.Answers.RETURNS_SMART_NULLS;
import static org.mockito.Mockito.when;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.debugging.sourcemap.SourceMapConsumerV3;
Expand All @@ -36,7 +35,6 @@
import org.mockito.MockitoAnnotations;

/** Tests for {@link CoverageInstrumenter}. */
@GwtIncompatible
@RunWith(JUnit4.class)
public final class CoverageInstrumenterTest {

Expand Down
2 changes: 0 additions & 2 deletions test/com/google/javascript/jscomp/bundle/SourceTest.java
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 com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
Expand All @@ -29,7 +28,6 @@
import org.junit.runners.JUnit4;

/** Tests for {@link Source} and its nested classes. */
@GwtIncompatible
@RunWith(JUnit4.class)
public final class SourceTest {

Expand Down
2 changes: 0 additions & 2 deletions test/com/google/javascript/jscomp/bundle/TranspilerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static org.mockito.Answers.RETURNS_SMART_NULLS;
import static org.mockito.Mockito.when;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableList;
import com.google.javascript.jscomp.JSError;
import java.nio.file.Path;
Expand All @@ -32,7 +31,6 @@
import org.mockito.MockitoAnnotations;

/** Tests for {@link Transpiler}. */
@GwtIncompatible
@RunWith(JUnit4.class)
public final class TranspilerTest {

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.JSCompStrings.lines;
import static com.google.javascript.rhino.testing.NodeSubject.assertNode;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -1535,7 +1534,6 @@ public void testSuppressEs5StrictWarning() {
test(options, "/** @suppress{es5Strict} */ function f() { var arguments; }", "");
}

@GwtIncompatible // b/63595345
@Test
public void testBrokenNameSpace() {
CompilerOptions options = createCompilerOptions();
Expand Down Expand Up @@ -1727,7 +1725,6 @@ public void testGoogDefineClass4() {
// DefaultCodingConvention due to it throwing on methods such as extractIsModuleFile which is
// needed in {@link CompilerInput$DepsFinder#visitSubtree}. Disable this test in the JsVersion.
// TODO(tdeegan): DepsFinder should error out early if run with DefaultCodingConvention.
@GwtIncompatible
@Test
public void testES6UnusedClassesAreRemovedDefaultCodingConvention() {
testES6UnusedClassesAreRemoved(CodingConventions.getDefault());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static com.google.javascript.jscomp.base.JSCompStrings.lines;
import static com.google.javascript.rhino.testing.NodeSubject.assertNode;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableList;
import com.google.javascript.jscomp.CheckLevel;
import com.google.javascript.jscomp.ClosureCodingConvention;
Expand Down Expand Up @@ -542,7 +541,6 @@ public void testForwardDeclaredTypeInTemplate() {
"var x;var y");
}

@GwtIncompatible // b/63595345
@Test
public void testClosurePassOff() {
CompilerOptions options = createCompilerOptions();
Expand All @@ -551,7 +549,6 @@ public void testClosurePassOff() {
testSame(options, "goog.getCssName = function(x) {};" + "goog.getCssName('foo');");
}

@GwtIncompatible // b/63595345
@Test
public void testClosurePassOn() {
CompilerOptions options = createCompilerOptions();
Expand Down Expand Up @@ -993,7 +990,6 @@ public void testGoogModuleGet_notAllowedInGlobalScope() {
DiagnosticGroups.CLOSURE_DEP_METHOD_USAGE_CHECKS);
}

@GwtIncompatible // b/63595345
@Test
public void testProvideRequireSameFile() {
CompilerOptions options = createCompilerOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static com.google.javascript.rhino.testing.NodeSubject.assertNode;
import static org.junit.Assert.assertThrows;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -4294,7 +4293,6 @@ public void testNoSpuriousWarningsOnGeneratedTypedef() {
}

@Test
@GwtIncompatible("AbstractCommandLineRunner.getBuiltinExterns()")
public void testEs6ModuleEntryPoint() throws Exception {
ImmutableList<SourceFile> inputs =
ImmutableList.of(
Expand All @@ -4320,7 +4318,6 @@ public void testEs6ModuleEntryPoint() throws Exception {
}

@Test
@GwtIncompatible("AbstractCommandLineRunner.getBuiltinExterns()")
public void testEs6ModuleEntryPointWithSquareBracketsInFilename() throws Exception {
ImmutableList<SourceFile> inputs =
ImmutableList.of(
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.JSCompStrings.lines;
import static org.junit.Assert.assertThrows;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
Expand All @@ -37,7 +36,6 @@
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
@GwtIncompatible("FileInstrumentationData")
public final class ProductionCoverageInstrumentationPassIntegrationTest
extends IntegrationTestCase {

Expand Down

0 comments on commit 697931f

Please sign in to comment.