Skip to content

Commit 8c58281

Browse files
committed
Clean up now unnecessary @GwtIncompatible from JSCompiler codebase
PiperOrigin-RevId: 707226989
1 parent a7ab5a0 commit 8c58281

35 files changed

+13
-235
lines changed

src/com/google/javascript/jscomp/AbstractCommandLineRunner.java

-109
Large diffs are not rendered by default.

src/com/google/javascript/jscomp/AllowlistWarningsGuard.java

-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import static com.google.common.base.Preconditions.checkNotNull;
2020
import static java.nio.charset.StandardCharsets.UTF_8;
2121

22-
import com.google.common.annotations.GwtIncompatible;
2322
import com.google.common.base.Joiner;
2423
import com.google.common.base.Splitter;
2524
import com.google.common.collect.ImmutableSet;
@@ -46,7 +45,6 @@
4645
* implementing the {@code level} function. Warnings are defined by the name of the JS file and the
4746
* first line of warnings description.
4847
*/
49-
@GwtIncompatible("java.io, java.util.regex")
5048
public class AllowlistWarningsGuard extends WarningsGuard {
5149
private static final Splitter LINE_SPLITTER = Splitter.on('\n');
5250

src/com/google/javascript/jscomp/CheckConformance.java

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import static com.google.common.collect.ImmutableList.toImmutableList;
2020

21-
import com.google.common.annotations.GwtIncompatible;
2221
import com.google.common.collect.HashMultimap;
2322
import com.google.common.collect.ImmutableList;
2423
import com.google.common.collect.ImmutableSet;
@@ -40,7 +39,6 @@
4039
* <p>Conformance violations are both reported as compiler errors, and are also reported separately
4140
* to the {cI gue@link ErrorManager}
4241
*/
43-
@GwtIncompatible("com.google.protobuf")
4442
public final class CheckConformance implements NodeTraversal.Callback, CompilerPass {
4543
static final DiagnosticType CONFORMANCE_ERROR =
4644
DiagnosticType.error("JSC_CONFORMANCE_ERROR", "Violation: {0}{1}{2}");

src/com/google/javascript/jscomp/CommandLineRunner.java

-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import static com.google.common.base.Preconditions.checkState;
2020
import static java.nio.charset.StandardCharsets.UTF_8;
2121

22-
import com.google.common.annotations.GwtIncompatible;
2322
import com.google.common.base.Ascii;
2423
import com.google.common.base.Joiner;
2524
import com.google.common.base.Splitter;
@@ -130,7 +129,6 @@
130129
*
131130
* This class is totally not thread-safe.
132131
*/
133-
@GwtIncompatible("Unnecessary")
134132
public class CommandLineRunner extends AbstractCommandLineRunner<Compiler, CompilerOptions> {
135133

136134
public static final String OUTPUT_MARKER = AbstractCommandLineRunner.OUTPUT_MARKER;

src/com/google/javascript/jscomp/Compiler.java

-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import static com.google.common.collect.ImmutableList.toImmutableList;
2323
import static java.nio.charset.StandardCharsets.UTF_8;
2424

25-
import com.google.common.annotations.GwtIncompatible;
2625
import com.google.common.annotations.VisibleForTesting;
2726
import com.google.common.base.Joiner;
2827
import com.google.common.base.Optional;
@@ -596,7 +595,6 @@ protected void reconcileOptionsWithGuards() {
596595
*
597596
* @param typedAstListStream a gzipped, binary-serialized TypedAst.List proto
598597
*/
599-
@GwtIncompatible
600598
public final void initWithTypedAstFilesystem(
601599
List<SourceFile> externs,
602600
List<SourceFile> sources,
@@ -621,7 +619,6 @@ public final void initWithTypedAstFilesystem(
621619
*
622620
* @param typedAstListStream a gzipped, binary-serialized TypedAst.List proto
623621
*/
624-
@GwtIncompatible
625622
public void initChunksWithTypedAstFilesystem(
626623
List<SourceFile> externs,
627624
List<JSChunk> chunks,
@@ -644,7 +641,6 @@ public void initChunksWithTypedAstFilesystem(
644641
this.mergeAndDeserializeTypedAsts(files, typedAstListStream, options);
645642
}
646643

647-
@GwtIncompatible
648644
private void mergeAndDeserializeTypedAsts(
649645
ImmutableSet<SourceFile> requiredInputFiles,
650646
InputStream typedAstListStream,
@@ -695,7 +691,6 @@ private void mergeAndDeserializeTypedAsts(
695691
}
696692

697693
@Override
698-
@GwtIncompatible
699694
public void initRuntimeLibraryTypedAsts(Optional<ColorPool.Builder> colorPoolBuilder) {
700695
checkState(this.runtimeLibraryTypedAsts == null);
701696

@@ -4179,7 +4174,6 @@ private static final ImmutableListMultimap<JSChunk, InputId> mapJSModulesToInput
41794174
return jsmoduleToInputId.build();
41804175
}
41814176

4182-
@GwtIncompatible("ObjectOutputStream")
41834177
public void saveState(OutputStream outputStream) throws IOException {
41844178
// Do not close the outputstream, caller is responsible for closing it.
41854179
runInCompilerThread(
@@ -4209,7 +4203,6 @@ protected CompilerState getCompilerState() {
42094203
return new CompilerState(this);
42104204
}
42114205

4212-
@GwtIncompatible("ClassNotFoundException")
42134206
public void restoreState(InputStream inputStream) throws IOException, ClassNotFoundException {
42144207
initWarningsGuard(options.getWarningsGuard());
42154208
maybeSetTracker();
@@ -4232,7 +4225,6 @@ public void restoreState(InputStream inputStream) throws IOException, ClassNotFo
42324225
}
42334226
}
42344227

4235-
@GwtIncompatible("ObjectInputStream")
42364228
// this method must be called from within a "compiler thread" with a larger stack
42374229
private void deserializeCompilerState(InputStream inputStream)
42384230
throws IOException, ClassNotFoundException {

src/com/google/javascript/jscomp/CompilerExecutor.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static com.google.common.base.Throwables.throwIfUnchecked;
2121
import static java.util.concurrent.TimeUnit.SECONDS;
2222

23-
import com.google.common.annotations.GwtIncompatible;
2423
import java.util.concurrent.Callable;
2524
import java.util.concurrent.ExecutionException;
2625
import java.util.concurrent.ExecutorService;
@@ -46,14 +45,13 @@ class CompilerExecutor {
4645
private int timeout = 0;
4746

4847
/**
49-
* Under JRE 1.6, the JS Compiler overflows the stack when running on some
50-
* large or complex JS code. When threads are available, we run all compile
51-
* jobs on a separate thread with a larger stack.
48+
* Under JRE 1.6, the JS Compiler overflows the stack when running on some large or complex JS
49+
* code. When threads are available, we run all compile jobs on a separate thread with a larger
50+
* stack.
5251
*
53-
* That way, we don't have to increase the stack size for *every* thread
54-
* (which is what -Xss does).
52+
* <p>That way, we don't have to increase the stack size for *every* thread (which is what -Xss
53+
* does).
5554
*/
56-
@GwtIncompatible("java.util.concurrent.ExecutorService")
5755
ExecutorService getExecutorService() {
5856
return getDefaultExecutorService();
5957
}

src/com/google/javascript/jscomp/CompilerOptions.java

-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static com.google.common.base.Preconditions.checkNotNull;
2121
import static com.google.common.base.Preconditions.checkState;
2222

23-
import com.google.common.annotations.GwtIncompatible;
2423
import com.google.common.annotations.VisibleForTesting;
2524
import com.google.common.base.Ascii;
2625
import com.google.common.base.MoreObjects;
@@ -2664,7 +2663,6 @@ public final ImmutableList<ConformanceConfig> getConformanceConfigs() {
26642663
*
26652664
* @deprecated See go/binary-level-conformance-deprecated.
26662665
*/
2667-
@GwtIncompatible("Conformance")
26682666
@Deprecated // See go/binary-level-conformance-deprecated.
26692667
public void setConformanceConfig(ConformanceConfig conformanceConfig) {
26702668
setConformanceConfigs(ImmutableList.of(conformanceConfig));
@@ -2675,7 +2673,6 @@ public void setConformanceConfig(ConformanceConfig conformanceConfig) {
26752673
*
26762674
* @deprecated See go/binary-level-conformance-deprecated.
26772675
*/
2678-
@GwtIncompatible("Conformance")
26792676
@Deprecated // See go/binary-level-conformance-deprecated.
26802677
public void setConformanceConfigs(List<ConformanceConfig> configs) {
26812678
this.conformanceConfigs = ImmutableList.copyOf(configs);
@@ -2748,13 +2745,11 @@ public void setChunkOutputType(ChunkOutputType chunkOutputType) {
27482745
}
27492746

27502747
/** Serializes compiler options to a stream. */
2751-
@GwtIncompatible("ObjectOutputStream")
27522748
public void serialize(OutputStream objectOutputStream) throws IOException {
27532749
new ObjectOutputStream(objectOutputStream).writeObject(this);
27542750
}
27552751

27562752
/** Deserializes compiler options from a stream. */
2757-
@GwtIncompatible("ObjectInputStream")
27582753
public static CompilerOptions deserialize(InputStream objectInputStream)
27592754
throws IOException, ClassNotFoundException {
27602755
return (CompilerOptions) new ObjectInputStream(objectInputStream).readObject();
@@ -3338,13 +3333,11 @@ public char[] getPropertyReservedNamingNonFirstChars() {
33383333
return reservedChars;
33393334
}
33403335

3341-
@GwtIncompatible("ObjectOutputStream")
33423336
private void writeObject(ObjectOutputStream out) throws IOException {
33433337
out.defaultWriteObject();
33443338
out.writeObject(outputCharset == null ? null : outputCharset.name());
33453339
}
33463340

3347-
@GwtIncompatible("ObjectInputStream")
33483341
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
33493342
in.defaultReadObject();
33503343
String outputCharsetName = (String) in.readObject();

src/com/google/javascript/jscomp/ConformanceAllowlister.java

-2
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@
1717

1818
import static com.google.common.collect.ImmutableSet.toImmutableSet;
1919

20-
import com.google.common.annotations.GwtIncompatible;
2120
import com.google.common.base.Optional;
2221
import com.google.common.collect.ImmutableList;
2322
import com.google.common.collect.ImmutableSet;
2423
import com.google.javascript.jscomp.Requirement.Severity;
2524
import com.google.javascript.rhino.Node;
2625

2726
/** Creates or updates conformance allowlist/whitelist entries. */
28-
@GwtIncompatible("Conformance")
2927
public class ConformanceAllowlister {
3028
private ConformanceAllowlister() {}
3129

src/com/google/javascript/jscomp/ConformanceRules.java

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static com.google.common.collect.ImmutableList.toImmutableList;
2222
import static com.google.common.collect.ImmutableSet.toImmutableSet;
2323

24-
import com.google.common.annotations.GwtIncompatible;
2524
import com.google.common.annotations.VisibleForTesting;
2625
import com.google.common.base.Ascii;
2726
import com.google.common.base.Joiner;
@@ -70,7 +69,6 @@
7069
* Standard conformance rules. See
7170
* third_party/java_src/jscomp/java/com/google/javascript/jscomp/conformance.proto
7271
*/
73-
@GwtIncompatible("java.lang.reflect, java.util.regex")
7472
public final class ConformanceRules {
7573

7674
private static final AllowList ALL_TS_ALLOWLIST = createTsAllowlist();

src/com/google/javascript/jscomp/DiagnosticGroups.java

-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import static com.google.javascript.jscomp.ProcessClosurePrimitives.CLOSURE_CALL_CANNOT_BE_ALIASED_ERROR;
2323
import static com.google.javascript.jscomp.ProcessClosurePrimitives.CLOSURE_CALL_CANNOT_BE_ALIASED_OUTSIDE_MODULE_ERROR;
2424

25-
import com.google.common.annotations.GwtIncompatible;
2625
import com.google.common.annotations.VisibleForTesting;
2726
import com.google.common.base.Preconditions;
2827
import com.google.common.collect.ImmutableMap;
@@ -449,11 +448,9 @@ public static DiagnosticGroup forName(String name) {
449448
public static final DiagnosticGroup EXTRA_REQUIRE =
450449
DiagnosticGroups.registerGroup("extraRequire", CheckExtraRequires.EXTRA_REQUIRE_WARNING);
451450

452-
@GwtIncompatible("JsMessage")
453451
public static final DiagnosticGroup DUPLICATE_MESSAGE =
454452
DiagnosticGroups.registerGroup("duplicateMessage", JsMessageVisitor.MESSAGE_DUPLICATE_KEY);
455453

456-
@GwtIncompatible("JsMessage")
457454
public static final DiagnosticGroup MESSAGE_DESCRIPTIONS =
458455
DiagnosticGroups.registerGroup(
459456
"msgDescriptions", JsMessageVisitor.MESSAGE_HAS_NO_DESCRIPTION);
@@ -462,7 +459,6 @@ public static DiagnosticGroup forName(String name) {
462459
* Warnings that only apply to people who use MSG_ to denote messages. Note that this doesn't
463460
* include warnings about proper use of goog.getMsg
464461
*/
465-
@GwtIncompatible("JsMessage")
466462
public static final DiagnosticGroup MSG_CONVENTIONS =
467463
DiagnosticGroups.registerGroup(
468464
"messageConventions", // undocumented
@@ -655,7 +651,6 @@ public static DiagnosticGroup forName(String name) {
655651
// OK to suppress.
656652
// For now, the only way to suppress a check at a granularity smaller than
657653
// the file level is by using a allowlist file.
658-
@GwtIncompatible("Conformance")
659654
public static final DiagnosticGroup CONFORMANCE_VIOLATIONS =
660655
DiagnosticGroups.registerGroup(
661656
"conformanceViolations",

src/com/google/javascript/jscomp/DiagnosticToSuppressionMapper.java

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import static com.google.common.collect.ImmutableSortedMap.toImmutableSortedMap;
1919
import static java.util.Comparator.naturalOrder;
2020

21-
import com.google.common.annotations.GwtIncompatible;
2221
import com.google.common.annotations.VisibleForTesting;
2322
import com.google.common.collect.ImmutableMap;
2423
import com.google.common.collect.ImmutableSortedMap;
@@ -29,7 +28,6 @@
2928
import java.util.Set;
3029

3130
/** Used to print a map from diagnostic id to suppression. */
32-
@GwtIncompatible
3331
public final class DiagnosticToSuppressionMapper {
3432

3533
enum OutputFormat {

src/com/google/javascript/jscomp/Es6RelativizeImportPaths.java

-2
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.NodeTraversal.AbstractPreOrderCallback;
2120
import com.google.javascript.jscomp.deps.ModuleLoader;
2221
import com.google.javascript.rhino.Node;
@@ -31,7 +30,6 @@
3130
* <p>Useful for servers that wish to preserve ES6 modules, meaning their paths need to be valid in
3231
* the browser.
3332
*/
34-
@GwtIncompatible("java.net.URI")
3533
public class Es6RelativizeImportPaths implements CompilerPass {
3634

3735
private final AbstractCompiler compiler;

src/com/google/javascript/jscomp/GoogleCodingConvention.java

+4-7
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.errorprone.annotations.Immutable;
2120
import com.google.javascript.rhino.Node;
2221
import com.google.javascript.rhino.StaticSourceFile;
@@ -168,14 +167,12 @@ public boolean isClassFactoryCall(Node callNode) {
168167
/**
169168
* {@inheritDoc}
170169
*
171-
* <p>In Google code, the package name of a source file is its file path.
172-
* Exceptions: if a source file's parent directory is "test", "tests", or
173-
* "testing", that directory is stripped from the package name.
174-
* If a file is generated, strip the "genfiles" prefix to try
175-
* to match the package of the generating file.
170+
* <p>In Google code, the package name of a source file is its file path. Exceptions: if a source
171+
* file's parent directory is "test", "tests", or "testing", that directory is stripped from the
172+
* package name. If a file is generated, strip the "genfiles" prefix to try to match the package
173+
* of the generating file.
176174
*/
177175
@Override
178-
@GwtIncompatible // TODO(tdeegan): Remove use of Matcher#group to make this fully GWT compatible.
179176
public String getPackageName(StaticSourceFile source) {
180177
String name = source.getName();
181178
Matcher genfilesMatcher = GENFILES_DIR.matcher(name);

src/com/google/javascript/jscomp/JSChunk.java

-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import static com.google.common.base.Preconditions.checkArgument;
2020
import static com.google.common.base.Preconditions.checkNotNull;
2121

22-
import com.google.common.annotations.GwtIncompatible;
2322
import com.google.common.base.Preconditions;
2423
import com.google.common.collect.ImmutableList;
2524
import com.google.common.collect.ImmutableMap;
@@ -327,7 +326,6 @@ public int getIndex() {
327326
return index;
328327
}
329328

330-
@GwtIncompatible("ObjectinputStream")
331329
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
332330
in.defaultReadObject();
333331
this.inputs = new LinkedHashMap<>();

src/com/google/javascript/jscomp/JSChunkGraph.java

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static java.lang.Math.max;
2222
import static java.lang.Math.min;
2323

24-
import com.google.common.annotations.GwtIncompatible;
2524
import com.google.common.annotations.VisibleForTesting;
2625
import com.google.common.base.Joiner;
2726
import com.google.common.base.Preconditions;
@@ -322,7 +321,6 @@ JSChunk getRootChunk() {
322321
*
323322
* @return List of chunk JSONObjects.
324323
*/
325-
@GwtIncompatible("com.google.gson")
326324
JsonArray toJson() {
327325
JsonArray chunks = new JsonArray();
328326
for (JSChunk chunk : getAllChunks()) {

src/com/google/javascript/jscomp/JSCompZipFileCache.java

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

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

20-
import com.google.common.annotations.GwtIncompatible;
2120
import com.google.common.cache.CacheBuilder;
2221
import com.google.common.cache.CacheLoader;
2322
import com.google.common.cache.LoadingCache;
@@ -38,7 +37,6 @@
3837
* a timestamp controlled caching which ensures we always read up-to-date zip while avoiding wasting
3938
* time by re-reading the zip for each entry.
4039
*/
41-
@GwtIncompatible("java.util.zip.ZipFile")
4240
final class JSCompZipFileCache {
4341

4442
/**

src/com/google/javascript/jscomp/JsMessage.java

-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import static java.nio.charset.StandardCharsets.UTF_8;
2323

2424
import com.google.auto.value.AutoValue;
25-
import com.google.common.annotations.GwtIncompatible;
2625
import com.google.common.base.CaseFormat;
2726
import com.google.common.collect.ImmutableList;
2827
import com.google.common.collect.ImmutableMap;
@@ -369,7 +368,6 @@ public String getString() {
369368
* <p>This implementation correctly processes unnamed messages and creates a key for them that
370369
* looks like {@code MSG_<fingerprint value>};.
371370
*/
372-
@GwtIncompatible("java.util.regex")
373371
public static final class Builder {
374372

375373
private @Nullable String key = null;

src/com/google/javascript/jscomp/JsMessageExtractor.java

-2
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.common.collect.ImmutableList;
2120
import java.util.ArrayList;
2221
import java.util.Collection;
@@ -38,7 +37,6 @@
3837
*
3938
* <p>This class enforces the policy that message variable names must be unique across all JS files.
4039
*/
41-
@GwtIncompatible("JsMessage.Builder")
4240
public final class JsMessageExtractor {
4341

4442
private final JsMessage.IdGenerator idGenerator;

0 commit comments

Comments
 (0)