Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
*/
package com.google.gwt.core.ext.linker;

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

import com.google.gwt.core.ext.Linker;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.thirdparty.guava.common.hash.Hashing;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Locale;

/**
Expand Down Expand Up @@ -109,7 +108,7 @@ protected final SyntheticArtifact emitInputStream(TreeLogger logger,
*/
protected final SyntheticArtifact emitString(TreeLogger logger, String what,
String partialPath) throws UnableToCompleteException {
return emitBytes(logger, what.getBytes(UTF_8), partialPath);
return emitBytes(logger, what.getBytes(StandardCharsets.UTF_8), partialPath);
}

/**
Expand All @@ -123,7 +122,7 @@ protected final SyntheticArtifact emitString(TreeLogger logger, String what,
*/
protected final SyntheticArtifact emitString(TreeLogger logger, String what,
String partialPath, long lastModified) throws UnableToCompleteException {
return emitBytes(logger, what.getBytes(UTF_8), partialPath, lastModified);
return emitBytes(logger, what.getBytes(StandardCharsets.UTF_8), partialPath, lastModified);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package com.google.gwt.core.ext.linker.impl;

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

import com.google.gwt.core.ext.LinkerContext;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
Expand All @@ -38,6 +36,7 @@
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -260,7 +259,7 @@ protected Collection<Artifact<?>> doEmitCompilation(TreeLogger logger,
for (int i = 1; i < js.length; i++) {
String s = generateDeferredFragment(logger, context, i, js[i], artifacts,
result);
byte[] bytes = s.getBytes(UTF_8);
byte[] bytes = s.getBytes(StandardCharsets.UTF_8);
toReturn.add(emitBytes(logger, bytes, FRAGMENT_SUBDIR + File.separator
+ result.getStrongName() + File.separator + i + FRAGMENT_EXTENSION));
}
Expand Down Expand Up @@ -386,7 +385,7 @@ protected byte[] generatePrimaryFragment(TreeLogger logger,
charsPerChunk(context, logger), getScriptChunkSeparator(logger, context), context);
String primaryFragmentString =
generatePrimaryFragmentString(logger, context, result, temp, js.length, artifacts);
return primaryFragmentString.getBytes(UTF_8);
return primaryFragmentString.getBytes(StandardCharsets.UTF_8);
}

protected String generatePrimaryFragmentString(TreeLogger logger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package com.google.gwt.core.ext.soyc.impl;

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

import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.dev.jjs.ast.JProgram;
import com.google.gwt.dev.jjs.ast.JRunAsync;
Expand All @@ -26,6 +24,7 @@
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.zip.GZIPOutputStream;

Expand All @@ -42,7 +41,8 @@ public static void recordSplitPoints(JProgram jprogram, OutputStream out, TreeLo
logger.branch(TreeLogger.TRACE, "Creating split point map file for the compile report");

try {
try (OutputStreamWriter writer = new OutputStreamWriter(new GZIPOutputStream(out), UTF_8);
try (OutputStreamWriter writer = new OutputStreamWriter(
new GZIPOutputStream(out), StandardCharsets.UTF_8);
PrintWriter pw = new PrintWriter(writer)) {
HtmlTextOutput htmlOut = new HtmlTextOutput(pw, false);
String curLine = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
*/
package com.google.gwt.dev.javac.testing.impl;

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

import com.google.gwt.dev.resource.Resource;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.atomic.AtomicLong;

/**
Expand Down Expand Up @@ -73,7 +72,7 @@ public String getString() {
@Override
public InputStream openContents() {
String s = getContent().toString();
return new ByteArrayInputStream(s.getBytes(UTF_8));
return new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
*/
package com.google.gwt.dev.jjs;

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

import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.linker.Artifact;
Expand Down Expand Up @@ -197,6 +195,7 @@
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.lang.management.ManagementFactory;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -1534,7 +1533,7 @@ public PermutationResultImpl(String[] jsFragments, Permutation permutation,
Hasher h = Hashing.murmur3_128().newHasher();
h.putInt(jsFragments.length);
for (int i = 0; i < jsFragments.length; ++i) {
bytes[i] = jsFragments[i].getBytes(UTF_8);
bytes[i] = jsFragments[i].getBytes(StandardCharsets.UTF_8);
h.putInt(bytes[i].length);
h.putBytes(bytes[i]);
}
Expand Down
7 changes: 3 additions & 4 deletions dev/core/src/com/google/gwt/dev/util/DiskCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package com.google.gwt.dev.util;

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

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
Expand All @@ -26,6 +24,7 @@
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.nio.charset.StandardCharsets;

/**
* A nifty class that lets you squirrel away data on the file system. Write
Expand Down Expand Up @@ -125,7 +124,7 @@ public <T> T readObject(long token, Class<T> type) {
* @return the String that was written
*/
public String readString(long token) {
return new String(readByteArray(token), UTF_8);
return new String(readByteArray(token), StandardCharsets.UTF_8);
}

/**
Expand Down Expand Up @@ -246,7 +245,7 @@ public long writeObject(Object object) {
* @return a token to retrieve the data later
*/
public long writeString(String str) {
return writeByteArray(str.getBytes(UTF_8));
return writeByteArray(str.getBytes(StandardCharsets.UTF_8));
}

/**
Expand Down
8 changes: 4 additions & 4 deletions dev/core/src/com/google/gwt/dev/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package com.google.gwt.dev.util;

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

import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.dev.util.log.speedtracer.CompilerEventType;
Expand Down Expand Up @@ -808,7 +806,8 @@ public static boolean writeStringAsFile(File file, String string) {
// No need to check mkdirs result because an IOException will occur anyway
file.getParentFile().mkdirs();
try (FileOutputStream stream = new FileOutputStream(file);
BufferedWriter buffered = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) {
BufferedWriter buffered = new BufferedWriter(
new OutputStreamWriter(stream, StandardCharsets.UTF_8))) {
buffered.write(string);
} catch (IOException e) {
return false;
Expand All @@ -824,7 +823,8 @@ public static void writeStringAsFile(TreeLogger logger, File file,
// No need to check mkdirs result because an IOException will occur anyway
file.getParentFile().mkdirs();
try (FileOutputStream stream = new FileOutputStream(file);
BufferedWriter buffered = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) {
BufferedWriter buffered = new BufferedWriter(
new OutputStreamWriter(stream, StandardCharsets.UTF_8))) {
buffered.write(string);
} catch (IOException e) {
logger.log(TreeLogger.ERROR, "Unable to write file: " + file.getAbsolutePath(), e);
Expand Down
5 changes: 2 additions & 3 deletions dev/core/test/com/google/gwt/dev/cfg/MockModuleDef.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
*/
package com.google.gwt.dev.cfg;

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

import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.dev.javac.testing.impl.MockResourceOracle;
import com.google.gwt.dev.resource.Resource;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;

/**
* Mock for {@link ModuleDef}.
Expand All @@ -48,7 +47,7 @@ public String getPath() {

@Override
public InputStream openContents() {
return new ByteArrayInputStream("w00t!".getBytes(UTF_8));
return new ByteArrayInputStream("w00t!".getBytes(StandardCharsets.UTF_8));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package com.google.gwt.dev.javac;

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

import com.google.gwt.dev.jjs.SourceOrigin;
import com.google.gwt.dev.jjs.ast.JClassType;
import com.google.gwt.dev.jjs.ast.JDeclaredType;
Expand All @@ -25,6 +23,7 @@

import org.eclipse.jdt.core.compiler.CategorizedProblem;

import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -58,7 +57,7 @@ public MockCompilationUnit(String typeName, String source, String resourceLocati
@Override
public CachedCompilationUnit asCachedCompilationUnit() {
DiskCache diskCache = DiskCache.INSTANCE;
long astToken = diskCache.writeByteArray("Dummy AST data".getBytes(UTF_8));
long astToken = diskCache.writeByteArray("Dummy AST data".getBytes(StandardCharsets.UTF_8));
return new CachedCompilationUnit(this, astToken);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package com.google.gwt.resources.rebind.context;

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

import com.google.gwt.core.ext.GeneratorContext;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
Expand All @@ -27,6 +25,7 @@
import com.google.gwt.thirdparty.guava.common.hash.HashCode;
import com.google.gwt.thirdparty.guava.common.hash.Hashing;

import java.nio.charset.StandardCharsets;
import java.util.Locale;

/**
Expand Down Expand Up @@ -79,7 +78,8 @@ protected void doAddFieldsAndRequirements(TreeLogger logger,
protected void doCreateBundleForPermutation(TreeLogger logger,
GeneratorContext generatorContext, FieldsImpl fields,
String generatedSimpleSourceName) throws UnableToCompleteException {
HashCode hash = Hashing.murmur3_128().hashString(generatedSimpleSourceName, UTF_8);
HashCode hash = Hashing.murmur3_128().hashString(generatedSimpleSourceName,
StandardCharsets.UTF_8);
String partialPath = hash.toString().toUpperCase(Locale.ROOT) + BUNDLE_EXTENSION;
resourceContext.setPartialPath(partialPath);
fields.setInitializer(bundleBaseIdent,
Expand Down
12 changes: 3 additions & 9 deletions user/src/com/google/gwt/resources/rg/CssResourceGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package com.google.gwt.resources.rg;

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

import com.google.gwt.core.ext.BadPropertyValueException;
import com.google.gwt.core.ext.ConfigurationProperty;
import com.google.gwt.core.ext.Generator;
Expand Down Expand Up @@ -82,6 +80,7 @@
import java.io.OutputStreamWriter;
import java.io.Serializable;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
Expand Down Expand Up @@ -226,7 +225,7 @@ static String computeObfuscatedClassName(String classPrefix,
String conflict = stringStartsWithAny(obfuscatedClassName, reservedPrefixes);
while (conflict != null) {
Adler32 hash = new Adler32();
hash.update(conflict.getBytes(UTF_8));
hash.update(conflict.getBytes(StandardCharsets.UTF_8));
/*
* Compute a new prefix for the identifier to mask the prefix and add the
* reserved identifier character to prevent conflicts with makeIdent().
Expand Down Expand Up @@ -745,7 +744,7 @@ private String computeClassPrefix(String classPrefix,
Adler32 checksum = new Adler32();
for (JClassType type : cssResourceSubtypes) {
String s = type.getQualifiedSourceName();
checksum.update(s.getBytes(UTF_8));
checksum.update(s.getBytes(StandardCharsets.UTF_8));
}

final int seed = Math.abs((int) checksum.getValue());
Expand Down Expand Up @@ -1027,11 +1026,6 @@ protected String getCssExpression(TreeLogger logger, ResourceContext context,
/**
* Create a Java expression that evaluates to the string representation of the
* stylesheet resource.
*
* @param actualReplacements An out parameter that will be populated by the
* obfuscated class names that should be used for the particular
* instance of the CssResource, based on any substitution
* modifications encoded in the source CSS file
*/
private String makeExpression(TreeLogger logger, ResourceContext context,
CssStylesheet sheet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package com.google.gwt.resources.rg;

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

import com.google.gwt.core.ext.BadPropertyValueException;
import com.google.gwt.core.ext.ConfigurationProperty;
import com.google.gwt.core.ext.Generator;
Expand Down Expand Up @@ -114,7 +112,8 @@ public void createFields(TreeLogger logger, ResourceContext context,

urlExpression = context.deploy(
context.getClientBundleType().getQualifiedSourceName().replace('.', '_')
+ "_jsonbundle.txt", "text/plain", wrappedData.toString().getBytes(UTF_8), true);
+ "_jsonbundle.txt", "text/plain",
wrappedData.toString().getBytes(StandardCharsets.UTF_8), true);

TypeOracle typeOracle = context.getGeneratorContext().getTypeOracle();
JClassType stringType = typeOracle.findType(String.class.getName());
Expand Down
Loading