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: 707226989
  • Loading branch information
lauraharker committed Dec 20, 2024
1 parent a7ab5a0 commit 8c58281
Show file tree
Hide file tree
Showing 35 changed files with 13 additions and 235 deletions.
109 changes: 0 additions & 109 deletions src/com/google/javascript/jscomp/AbstractCommandLineRunner.java

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/AllowlistWarningsGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static java.nio.charset.StandardCharsets.UTF_8;

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

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

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

import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
Expand All @@ -40,7 +39,6 @@
* <p>Conformance violations are both reported as compiler errors, and are also reported separately
* to the {cI gue@link ErrorManager}
*/
@GwtIncompatible("com.google.protobuf")
public final class CheckConformance implements NodeTraversal.Callback, CompilerPass {
static final DiagnosticType CONFORMANCE_ERROR =
DiagnosticType.error("JSC_CONFORMANCE_ERROR", "Violation: {0}{1}{2}");
Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/CommandLineRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static com.google.common.base.Preconditions.checkState;
import static java.nio.charset.StandardCharsets.UTF_8;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Ascii;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
Expand Down Expand Up @@ -130,7 +129,6 @@
*
* This class is totally not thread-safe.
*/
@GwtIncompatible("Unnecessary")
public class CommandLineRunner extends AbstractCommandLineRunner<Compiler, CompilerOptions> {

public static final String OUTPUT_MARKER = AbstractCommandLineRunner.OUTPUT_MARKER;
Expand Down
8 changes: 0 additions & 8 deletions src/com/google/javascript/jscomp/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.base.Optional;
Expand Down Expand Up @@ -596,7 +595,6 @@ protected void reconcileOptionsWithGuards() {
*
* @param typedAstListStream a gzipped, binary-serialized TypedAst.List proto
*/
@GwtIncompatible
public final void initWithTypedAstFilesystem(
List<SourceFile> externs,
List<SourceFile> sources,
Expand All @@ -621,7 +619,6 @@ public final void initWithTypedAstFilesystem(
*
* @param typedAstListStream a gzipped, binary-serialized TypedAst.List proto
*/
@GwtIncompatible
public void initChunksWithTypedAstFilesystem(
List<SourceFile> externs,
List<JSChunk> chunks,
Expand All @@ -644,7 +641,6 @@ public void initChunksWithTypedAstFilesystem(
this.mergeAndDeserializeTypedAsts(files, typedAstListStream, options);
}

@GwtIncompatible
private void mergeAndDeserializeTypedAsts(
ImmutableSet<SourceFile> requiredInputFiles,
InputStream typedAstListStream,
Expand Down Expand Up @@ -695,7 +691,6 @@ private void mergeAndDeserializeTypedAsts(
}

@Override
@GwtIncompatible
public void initRuntimeLibraryTypedAsts(Optional<ColorPool.Builder> colorPoolBuilder) {
checkState(this.runtimeLibraryTypedAsts == null);

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

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

@GwtIncompatible("ClassNotFoundException")
public void restoreState(InputStream inputStream) throws IOException, ClassNotFoundException {
initWarningsGuard(options.getWarningsGuard());
maybeSetTracker();
Expand All @@ -4232,7 +4225,6 @@ public void restoreState(InputStream inputStream) throws IOException, ClassNotFo
}
}

@GwtIncompatible("ObjectInputStream")
// this method must be called from within a "compiler thread" with a larger stack
private void deserializeCompilerState(InputStream inputStream)
throws IOException, ClassNotFoundException {
Expand Down
12 changes: 5 additions & 7 deletions src/com/google/javascript/jscomp/CompilerExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static com.google.common.base.Throwables.throwIfUnchecked;
import static java.util.concurrent.TimeUnit.SECONDS;

import com.google.common.annotations.GwtIncompatible;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
Expand All @@ -46,14 +45,13 @@ class CompilerExecutor {
private int timeout = 0;

/**
* Under JRE 1.6, the JS Compiler overflows the stack when running on some
* large or complex JS code. When threads are available, we run all compile
* jobs on a separate thread with a larger stack.
* Under JRE 1.6, the JS Compiler overflows the stack when running on some large or complex JS
* code. When threads are available, we run all compile jobs on a separate thread with a larger
* stack.
*
* That way, we don't have to increase the stack size for *every* thread
* (which is what -Xss does).
* <p>That way, we don't have to increase the stack size for *every* thread (which is what -Xss
* does).
*/
@GwtIncompatible("java.util.concurrent.ExecutorService")
ExecutorService getExecutorService() {
return getDefaultExecutorService();
}
Expand Down
7 changes: 0 additions & 7 deletions src/com/google/javascript/jscomp/CompilerOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Ascii;
import com.google.common.base.MoreObjects;
Expand Down Expand Up @@ -2664,7 +2663,6 @@ public final ImmutableList<ConformanceConfig> getConformanceConfigs() {
*
* @deprecated See go/binary-level-conformance-deprecated.
*/
@GwtIncompatible("Conformance")
@Deprecated // See go/binary-level-conformance-deprecated.
public void setConformanceConfig(ConformanceConfig conformanceConfig) {
setConformanceConfigs(ImmutableList.of(conformanceConfig));
Expand All @@ -2675,7 +2673,6 @@ public void setConformanceConfig(ConformanceConfig conformanceConfig) {
*
* @deprecated See go/binary-level-conformance-deprecated.
*/
@GwtIncompatible("Conformance")
@Deprecated // See go/binary-level-conformance-deprecated.
public void setConformanceConfigs(List<ConformanceConfig> configs) {
this.conformanceConfigs = ImmutableList.copyOf(configs);
Expand Down Expand Up @@ -2748,13 +2745,11 @@ public void setChunkOutputType(ChunkOutputType chunkOutputType) {
}

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

/** Deserializes compiler options from a stream. */
@GwtIncompatible("ObjectInputStream")
public static CompilerOptions deserialize(InputStream objectInputStream)
throws IOException, ClassNotFoundException {
return (CompilerOptions) new ObjectInputStream(objectInputStream).readObject();
Expand Down Expand Up @@ -3338,13 +3333,11 @@ public char[] getPropertyReservedNamingNonFirstChars() {
return reservedChars;
}

@GwtIncompatible("ObjectOutputStream")
private void writeObject(ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(outputCharset == null ? null : outputCharset.name());
}

@GwtIncompatible("ObjectInputStream")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
String outputCharsetName = (String) in.readObject();
Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/ConformanceAllowlister.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@

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

import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.javascript.jscomp.Requirement.Severity;
import com.google.javascript.rhino.Node;

/** Creates or updates conformance allowlist/whitelist entries. */
@GwtIncompatible("Conformance")
public class ConformanceAllowlister {
private ConformanceAllowlister() {}

Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/ConformanceRules.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.ImmutableSet.toImmutableSet;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Ascii;
import com.google.common.base.Joiner;
Expand Down Expand Up @@ -70,7 +69,6 @@
* Standard conformance rules. See
* third_party/java_src/jscomp/java/com/google/javascript/jscomp/conformance.proto
*/
@GwtIncompatible("java.lang.reflect, java.util.regex")
public final class ConformanceRules {

private static final AllowList ALL_TS_ALLOWLIST = createTsAllowlist();
Expand Down
5 changes: 0 additions & 5 deletions src/com/google/javascript/jscomp/DiagnosticGroups.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static com.google.javascript.jscomp.ProcessClosurePrimitives.CLOSURE_CALL_CANNOT_BE_ALIASED_ERROR;
import static com.google.javascript.jscomp.ProcessClosurePrimitives.CLOSURE_CALL_CANNOT_BE_ALIASED_OUTSIDE_MODULE_ERROR;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -449,11 +448,9 @@ public static DiagnosticGroup forName(String name) {
public static final DiagnosticGroup EXTRA_REQUIRE =
DiagnosticGroups.registerGroup("extraRequire", CheckExtraRequires.EXTRA_REQUIRE_WARNING);

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

@GwtIncompatible("JsMessage")
public static final DiagnosticGroup MESSAGE_DESCRIPTIONS =
DiagnosticGroups.registerGroup(
"msgDescriptions", JsMessageVisitor.MESSAGE_HAS_NO_DESCRIPTION);
Expand All @@ -462,7 +459,6 @@ public static DiagnosticGroup forName(String name) {
* Warnings that only apply to people who use MSG_ to denote messages. Note that this doesn't
* include warnings about proper use of goog.getMsg
*/
@GwtIncompatible("JsMessage")
public static final DiagnosticGroup MSG_CONVENTIONS =
DiagnosticGroups.registerGroup(
"messageConventions", // undocumented
Expand Down Expand Up @@ -655,7 +651,6 @@ public static DiagnosticGroup forName(String name) {
// OK to suppress.
// For now, the only way to suppress a check at a granularity smaller than
// the file level is by using a allowlist file.
@GwtIncompatible("Conformance")
public static final DiagnosticGroup CONFORMANCE_VIOLATIONS =
DiagnosticGroups.registerGroup(
"conformanceViolations",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static com.google.common.collect.ImmutableSortedMap.toImmutableSortedMap;
import static java.util.Comparator.naturalOrder;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedMap;
Expand All @@ -29,7 +28,6 @@
import java.util.Set;

/** Used to print a map from diagnostic id to suppression. */
@GwtIncompatible
public final class DiagnosticToSuppressionMapper {

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

private final AbstractCompiler compiler;
Expand Down
11 changes: 4 additions & 7 deletions src/com/google/javascript/jscomp/GoogleCodingConvention.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.errorprone.annotations.Immutable;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.StaticSourceFile;
Expand Down Expand Up @@ -168,14 +167,12 @@ public boolean isClassFactoryCall(Node callNode) {
/**
* {@inheritDoc}
*
* <p>In Google code, the package name of a source file is its file path.
* Exceptions: if a source file's parent directory is "test", "tests", or
* "testing", that directory is stripped from the package name.
* If a file is generated, strip the "genfiles" prefix to try
* to match the package of the generating file.
* <p>In Google code, the package name of a source file is its file path. Exceptions: if a source
* file's parent directory is "test", "tests", or "testing", that directory is stripped from the
* package name. If a file is generated, strip the "genfiles" prefix to try to match the package
* of the generating file.
*/
@Override
@GwtIncompatible // TODO(tdeegan): Remove use of Matcher#group to make this fully GWT compatible.
public String getPackageName(StaticSourceFile source) {
String name = source.getName();
Matcher genfilesMatcher = GENFILES_DIR.matcher(name);
Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/JSChunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -327,7 +326,6 @@ public int getIndex() {
return index;
}

@GwtIncompatible("ObjectinputStream")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
this.inputs = new LinkedHashMap<>();
Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/JSChunkGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static java.lang.Math.max;
import static java.lang.Math.min;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
Expand Down Expand Up @@ -322,7 +321,6 @@ JSChunk getRootChunk() {
*
* @return List of chunk JSONObjects.
*/
@GwtIncompatible("com.google.gson")
JsonArray toJson() {
JsonArray chunks = new JsonArray();
for (JSChunk chunk : getAllChunks()) {
Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/JSCompZipFileCache.java
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.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
Expand All @@ -38,7 +37,6 @@
* a timestamp controlled caching which ensures we always read up-to-date zip while avoiding wasting
* time by re-reading the zip for each entry.
*/
@GwtIncompatible("java.util.zip.ZipFile")
final class JSCompZipFileCache {

/**
Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/JsMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static java.nio.charset.StandardCharsets.UTF_8;

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

private @Nullable String key = null;
Expand Down
2 changes: 0 additions & 2 deletions src/com/google/javascript/jscomp/JsMessageExtractor.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.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -38,7 +37,6 @@
*
* <p>This class enforces the policy that message variable names must be unique across all JS files.
*/
@GwtIncompatible("JsMessage.Builder")
public final class JsMessageExtractor {

private final JsMessage.IdGenerator idGenerator;
Expand Down
Loading

0 comments on commit 8c58281

Please sign in to comment.