aboutsummaryrefslogtreecommitdiff
path: root/javatests/com/google
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2022-12-05 21:11:42 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-12-05 21:11:42 +0000
commit210c7d017424c9cf50cdb5fda52ca31febc92a13 (patch)
tree0baa92251e9c2c2d2522d953021138893ae84133 /javatests/com/google
parent0a1bffd725f80e576b850263ee5ba54d7ecd7c58 (diff)
parent8742e9d19f14650ce3154e48a681476ea4c8fe1d (diff)
downloadturbine-210c7d017424c9cf50cdb5fda52ca31febc92a13.tar.gz
Merge remote-tracking branch 'aosp/upstream-main' into aosp/master am: 1317f29ad0 am: 8742e9d19fandroid-u-beta-1-gpl
Original change: https://android-review.googlesource.com/c/platform/external/turbine/+/2327873 Change-Id: Ied4766e3be049c753596ae8f2f221e2e1a59a7ab Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'javatests/com/google')
-rw-r--r--javatests/com/google/turbine/binder/bytecode/BytecodeBoundClassTest.java3
-rw-r--r--javatests/com/google/turbine/deps/TransitiveTest.java3
-rw-r--r--javatests/com/google/turbine/lower/LongStringIntegrationTest.java4
-rw-r--r--javatests/com/google/turbine/lower/LowerTest.java2
-rw-r--r--javatests/com/google/turbine/main/MainTest.java3
-rw-r--r--javatests/com/google/turbine/options/LanguageVersionTest.java4
-rw-r--r--javatests/com/google/turbine/parse/CommentParserTest.java15
-rw-r--r--javatests/com/google/turbine/parse/ParseErrorTest.java13
-rw-r--r--javatests/com/google/turbine/processing/AbstractTurbineTypesBiFunctionTest.java47
-rw-r--r--javatests/com/google/turbine/processing/AbstractTurbineTypesBiPredicateTest.java20
-rw-r--r--javatests/com/google/turbine/processing/AbstractTurbineTypesTest.java32
-rw-r--r--javatests/com/google/turbine/processing/TurbineFilerTest.java9
-rw-r--r--javatests/com/google/turbine/processing/TurbineTypesAsMemberOfTest.java76
-rw-r--r--javatests/com/google/turbine/testing/TestResources.java3
-rw-r--r--javatests/com/google/turbine/zip/ZipTest.java5
15 files changed, 184 insertions, 55 deletions
diff --git a/javatests/com/google/turbine/binder/bytecode/BytecodeBoundClassTest.java b/javatests/com/google/turbine/binder/bytecode/BytecodeBoundClassTest.java
index 65d973d..e2d54bd 100644
--- a/javatests/com/google/turbine/binder/bytecode/BytecodeBoundClassTest.java
+++ b/javatests/com/google/turbine/binder/bytecode/BytecodeBoundClassTest.java
@@ -24,7 +24,6 @@ import static com.google.turbine.testing.TestClassPaths.TURBINE_BOOTCLASSPATH;
import static java.util.Objects.requireNonNull;
import com.google.common.collect.Iterables;
-import com.google.common.io.ByteStreams;
import com.google.turbine.binder.bound.TurbineClassValue;
import com.google.turbine.binder.bound.TypeBoundClass;
import com.google.turbine.binder.bound.TypeBoundClass.FieldInfo;
@@ -195,7 +194,7 @@ public class BytecodeBoundClassTest {
private static byte[] toByteArrayOrDie(InputStream is) {
try {
- return ByteStreams.toByteArray(is);
+ return is.readAllBytes();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
diff --git a/javatests/com/google/turbine/deps/TransitiveTest.java b/javatests/com/google/turbine/deps/TransitiveTest.java
index f08e899..3829ddd 100644
--- a/javatests/com/google/turbine/deps/TransitiveTest.java
+++ b/javatests/com/google/turbine/deps/TransitiveTest.java
@@ -26,7 +26,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
-import com.google.common.io.ByteStreams;
import com.google.protobuf.ExtensionRegistry;
import com.google.turbine.bytecode.ClassFile;
import com.google.turbine.bytecode.ClassFile.InnerClass;
@@ -87,7 +86,7 @@ public class TransitiveTest {
Enumeration<JarEntry> entries = jf.entries();
while (entries.hasMoreElements()) {
JarEntry je = entries.nextElement();
- jarEntries.put(je.getName(), ByteStreams.toByteArray(jf.getInputStream(je)));
+ jarEntries.put(je.getName(), jf.getInputStream(je).readAllBytes());
}
}
return jarEntries;
diff --git a/javatests/com/google/turbine/lower/LongStringIntegrationTest.java b/javatests/com/google/turbine/lower/LongStringIntegrationTest.java
index a462b69..7bb61e5 100644
--- a/javatests/com/google/turbine/lower/LongStringIntegrationTest.java
+++ b/javatests/com/google/turbine/lower/LongStringIntegrationTest.java
@@ -44,7 +44,7 @@ public class LongStringIntegrationTest {
public void test() throws Exception {
Map<String, byte[]> output =
runTurbineWithStack(
- /* stackSize= */ 1,
+ /* stackSize= */ 100_000,
/* input= */ ImmutableMap.of("Test.java", source()),
/* classpath= */ ImmutableList.of());
@@ -70,7 +70,7 @@ public class LongStringIntegrationTest {
},
/* name= */ "turbine",
stackSize);
- t.run();
+ t.start();
t.join();
return output;
}
diff --git a/javatests/com/google/turbine/lower/LowerTest.java b/javatests/com/google/turbine/lower/LowerTest.java
index 6d3a6df..a6410db 100644
--- a/javatests/com/google/turbine/lower/LowerTest.java
+++ b/javatests/com/google/turbine/lower/LowerTest.java
@@ -312,7 +312,7 @@ public class LowerTest {
String attributeName = pool.utf8(reader.u2());
switch (attributeName) {
case "Signature":
- reader.u4(); // length
+ int unusedLength = reader.u4();
signature = pool.utf8(reader.u2());
break;
default:
diff --git a/javatests/com/google/turbine/main/MainTest.java b/javatests/com/google/turbine/main/MainTest.java
index 3504891..c894d9d 100644
--- a/javatests/com/google/turbine/main/MainTest.java
+++ b/javatests/com/google/turbine/main/MainTest.java
@@ -28,7 +28,6 @@ import static org.junit.Assert.assertThrows;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.common.io.ByteStreams;
import com.google.common.io.MoreFiles;
import com.google.protobuf.ExtensionRegistry;
import com.google.turbine.diag.TurbineError;
@@ -148,7 +147,7 @@ public class MainTest {
Enumeration<JarEntry> entries = jf.entries();
while (entries.hasMoreElements()) {
JarEntry je = entries.nextElement();
- data.put(je.getName(), ByteStreams.toByteArray(jf.getInputStream(je)));
+ data.put(je.getName(), jf.getInputStream(je).readAllBytes());
}
}
return data;
diff --git a/javatests/com/google/turbine/options/LanguageVersionTest.java b/javatests/com/google/turbine/options/LanguageVersionTest.java
index 601652c..a5b303d 100644
--- a/javatests/com/google/turbine/options/LanguageVersionTest.java
+++ b/javatests/com/google/turbine/options/LanguageVersionTest.java
@@ -140,8 +140,6 @@ public class LanguageVersionTest {
public void unsupportedSourceVersion() {
LanguageVersion languageVersion =
LanguageVersion.fromJavacopts(ImmutableList.of("-source", "9999"));
- IllegalArgumentException expected =
- assertThrows(IllegalArgumentException.class, languageVersion::sourceVersion);
- assertThat(expected).hasMessageThat().contains("invalid -source version:");
+ assertThat(languageVersion.sourceVersion()).isEqualTo(SourceVersion.latestSupported());
}
}
diff --git a/javatests/com/google/turbine/parse/CommentParserTest.java b/javatests/com/google/turbine/parse/CommentParserTest.java
index a2f84d5..d10d34d 100644
--- a/javatests/com/google/turbine/parse/CommentParserTest.java
+++ b/javatests/com/google/turbine/parse/CommentParserTest.java
@@ -58,6 +58,13 @@ public class CommentParserTest {
" * class C",
" */",
" class C {}",
+ " /** This is an enum. */",
+ " enum E {",
+ " /** This is H. */",
+ " H,",
+ " /** This is I. */",
+ " I",
+ " }",
"}\n"));
TyDecl decl = getOnlyElement(unit.decls());
assertThat(decl.javadoc()).isEqualTo(" hello world ");
@@ -68,11 +75,17 @@ public class CommentParserTest {
.collect(toImmutableMap(c -> c.name().value(), c -> c.javadoc())))
.containsExactly(
"A", "\n * This is\n * class A\n ",
- "C", "\n * This is\n * class C\n ");
+ "C", "\n * This is\n * class C\n ",
+ "E", " This is an enum. ");
TyDecl a = (TyDecl) decl.members().get(0);
MethDecl f = (MethDecl) a.members().get(0);
assertThat(f.javadoc()).isEqualTo(" This is a method ");
VarDecl g = (VarDecl) a.members().get(1);
assertThat(g.javadoc()).isEqualTo(" This is a field ");
+ TyDecl e = (TyDecl) decl.members().get(3);
+ VarDecl h = (VarDecl) e.members().get(0);
+ assertThat(h.javadoc()).isEqualTo(" This is H. ");
+ VarDecl i = (VarDecl) e.members().get(1);
+ assertThat(i.javadoc()).isEqualTo(" This is I. ");
}
}
diff --git a/javatests/com/google/turbine/parse/ParseErrorTest.java b/javatests/com/google/turbine/parse/ParseErrorTest.java
index 0187ce0..4a92648 100644
--- a/javatests/com/google/turbine/parse/ParseErrorTest.java
+++ b/javatests/com/google/turbine/parse/ParseErrorTest.java
@@ -320,6 +320,19 @@ public class ParseErrorTest {
" ^"));
}
+ @Test
+ public void annotationClassLiteral() {
+ String input = "@interface A { A value() default @Integer.class; }";
+ TurbineError e = assertThrows(TurbineError.class, () -> Parser.parse(input));
+ assertThat(e)
+ .hasMessageThat()
+ .isEqualTo(
+ lines(
+ "<>:1: error: unexpected token: ;",
+ "@interface A { A value() default @Integer.class; }",
+ " ^"));
+ }
+
private static String lines(String... lines) {
return Joiner.on(System.lineSeparator()).join(lines);
}
diff --git a/javatests/com/google/turbine/processing/AbstractTurbineTypesBiFunctionTest.java b/javatests/com/google/turbine/processing/AbstractTurbineTypesBiFunctionTest.java
new file mode 100644
index 0000000..e00673d
--- /dev/null
+++ b/javatests/com/google/turbine/processing/AbstractTurbineTypesBiFunctionTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.turbine.processing;
+
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.util.Types;
+
+/**
+ * A combo test for {@link TurbineTypes} that compares the behaviour of bifunctions like {@link
+ * Types#asMemberOf(DeclaredType, Element)} with javac's implementation.
+ */
+abstract class AbstractTurbineTypesBiFunctionTest<T> extends AbstractTurbineTypesTest {
+
+ final String testDescription;
+ final TypesBiFunctionInput javacInput;
+ final TypesBiFunctionInput turbineInput;
+
+ public AbstractTurbineTypesBiFunctionTest(
+ String testDescription, TypesBiFunctionInput javacInput, TypesBiFunctionInput turbineInput) {
+ this.testDescription = testDescription;
+ this.javacInput = javacInput;
+ this.turbineInput = turbineInput;
+ }
+
+ protected void test(String symbol, TypeBiFunction<T> predicate) {
+ assertWithMessage("%s = %s", javacInput.format(symbol), turbineInput.format(symbol))
+ .that(turbineInput.apply(predicate))
+ .isEqualTo(javacInput.apply(predicate));
+ }
+}
diff --git a/javatests/com/google/turbine/processing/AbstractTurbineTypesBiPredicateTest.java b/javatests/com/google/turbine/processing/AbstractTurbineTypesBiPredicateTest.java
index 6ea6e72..08891eb 100644
--- a/javatests/com/google/turbine/processing/AbstractTurbineTypesBiPredicateTest.java
+++ b/javatests/com/google/turbine/processing/AbstractTurbineTypesBiPredicateTest.java
@@ -16,8 +16,6 @@
package com.google.turbine.processing;
-import static com.google.common.truth.Truth.assertWithMessage;
-
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Types;
@@ -25,22 +23,10 @@ import javax.lang.model.util.Types;
* A combo test for {@link TurbineTypes} that compares the behaviour of bipredicates like {@link
* Types#isSubtype(TypeMirror, TypeMirror)} with javac's implementation.
*/
-abstract class AbstractTurbineTypesBiPredicateTest extends AbstractTurbineTypesTest {
-
- final String testDescription;
- final TypesBiFunctionInput javacInput;
- final TypesBiFunctionInput turbineInput;
-
+abstract class AbstractTurbineTypesBiPredicateTest
+ extends AbstractTurbineTypesBiFunctionTest<Boolean> {
public AbstractTurbineTypesBiPredicateTest(
String testDescription, TypesBiFunctionInput javacInput, TypesBiFunctionInput turbineInput) {
- this.testDescription = testDescription;
- this.javacInput = javacInput;
- this.turbineInput = turbineInput;
- }
-
- protected void test(String symbol, TypeBiPredicate predicate) {
- assertWithMessage("%s = %s", javacInput.format(symbol), turbineInput.format(symbol))
- .that(turbineInput.apply(predicate))
- .isEqualTo(javacInput.apply(predicate));
+ super(testDescription, javacInput, turbineInput);
}
}
diff --git a/javatests/com/google/turbine/processing/AbstractTurbineTypesTest.java b/javatests/com/google/turbine/processing/AbstractTurbineTypesTest.java
index 7d8d479..02df1ec 100644
--- a/javatests/com/google/turbine/processing/AbstractTurbineTypesTest.java
+++ b/javatests/com/google/turbine/processing/AbstractTurbineTypesTest.java
@@ -31,6 +31,7 @@ import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
+import com.google.common.collect.ObjectArrays;
import com.google.common.collect.Streams;
import com.google.turbine.binder.Binder;
import com.google.turbine.binder.Binder.BindingResult;
@@ -93,8 +94,8 @@ class AbstractTurbineTypesTest {
}
}
- protected interface TypeBiPredicate {
- boolean apply(Types types, TypeMirror a, TypeMirror b);
+ protected interface TypeBiFunction<T> {
+ T apply(Types types, TypeMirror a, TypeMirror b);
}
static class TypesBiFunctionInput {
@@ -108,8 +109,8 @@ class AbstractTurbineTypesTest {
this.rhs = rhs;
}
- boolean apply(TypeBiPredicate predicate) {
- return predicate.apply(types, lhs, rhs);
+ <T> T apply(TypeBiFunction<T> function) {
+ return function.apply(types, lhs, rhs);
}
String format(String symbol) {
@@ -232,18 +233,23 @@ class AbstractTurbineTypesTest {
"Float",
"Double",
},
- // type annotations
- {
- "@A List<@B Integer>",
- "@A List",
- "@A int @B []",
- "@A List<@A int @B []>",
- "Map.@A Entry<@B Integer, @C Number>",
- },
};
+
+ // type annotations
+ List<String> annotatedTypes = new ArrayList<>();
+ annotatedTypes.add("@A int @B []");
+ // The string representation of these types changed in JDK 19, see JDK-8281238
+ if (Runtime.version().feature() >= 19) {
+ annotatedTypes.add("@A List<@B Integer>");
+ annotatedTypes.add("@A List");
+ annotatedTypes.add("@A List<@A int @B []>");
+ annotatedTypes.add("Map.@A Entry<@B Integer, @C Number>");
+ }
+
List<String> files = new ArrayList<>();
AtomicInteger idx = new AtomicInteger();
- for (String[] group : types) {
+ for (String[] group :
+ ObjectArrays.<String[]>concat(annotatedTypes.toArray(new String[0]), types)) {
StringBuilder sb = new StringBuilder();
Joiner.on('\n')
.appendTo(
diff --git a/javatests/com/google/turbine/processing/TurbineFilerTest.java b/javatests/com/google/turbine/processing/TurbineFilerTest.java
index 83dcc70..96c325b 100644
--- a/javatests/com/google/turbine/processing/TurbineFilerTest.java
+++ b/javatests/com/google/turbine/processing/TurbineFilerTest.java
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertThrows;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
-import com.google.common.io.ByteStreams;
import com.google.common.io.CharStreams;
import com.google.turbine.diag.SourceFile;
import java.io.FileNotFoundException;
@@ -127,8 +126,7 @@ public class TurbineFilerTest {
Collection<SourceFile> unused = filer.finishRound();
FileObject output = filer.getResource(StandardLocation.SOURCE_OUTPUT, "com.foo", "Bar.java");
- assertThat(new String(ByteStreams.toByteArray(output.openInputStream()), UTF_8))
- .isEqualTo("hello");
+ assertThat(new String(output.openInputStream().readAllBytes(), UTF_8)).isEqualTo("hello");
assertThat(output.getCharContent(false).toString()).isEqualTo("hello");
assertThat(CharStreams.toString(output.openReader(true))).isEqualTo("hello");
}
@@ -142,8 +140,7 @@ public class TurbineFilerTest {
Collection<SourceFile> unused = filer.finishRound();
FileObject output = filer.getResource(StandardLocation.CLASS_OUTPUT, "com.foo", "Baz.class");
- assertThat(new String(ByteStreams.toByteArray(output.openInputStream()), UTF_8))
- .isEqualTo("goodbye");
+ assertThat(new String(output.openInputStream().readAllBytes(), UTF_8)).isEqualTo("goodbye");
assertThat(output.getCharContent(false).toString()).isEqualTo("goodbye");
assertThat(CharStreams.toString(output.openReader(true))).isEqualTo("goodbye");
}
@@ -153,7 +150,7 @@ public class TurbineFilerTest {
FileObject resource =
filer.getResource(StandardLocation.ANNOTATION_PROCESSOR_PATH, "META-INF", "MANIFEST.MF");
- assertThat(new String(ByteStreams.toByteArray(resource.openInputStream()), UTF_8))
+ assertThat(new String(resource.openInputStream().readAllBytes(), UTF_8))
.contains("Manifest-Version:");
assertThat(CharStreams.toString(resource.openReader(true))).contains("Manifest-Version:");
assertThat(resource.getCharContent(false).toString()).contains("Manifest-Version:");
diff --git a/javatests/com/google/turbine/processing/TurbineTypesAsMemberOfTest.java b/javatests/com/google/turbine/processing/TurbineTypesAsMemberOfTest.java
new file mode 100644
index 0000000..1a368c9
--- /dev/null
+++ b/javatests/com/google/turbine/processing/TurbineTypesAsMemberOfTest.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2022 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.turbine.processing;
+
+import static com.google.common.truth.TruthJUnit.assume;
+import static org.junit.Assert.assertThrows;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.TypeVariable;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class TurbineTypesAsMemberOfTest extends AbstractTurbineTypesBiFunctionTest<String> {
+
+ @Parameters(name = "{index}: {0}")
+ public static Iterable<Object[]> parameters() throws Exception {
+ return binaryParameters();
+ }
+
+ public TurbineTypesAsMemberOfTest(
+ String testDescription, TypesBiFunctionInput javacInput, TypesBiFunctionInput turbineInput) {
+ super(testDescription, javacInput, turbineInput);
+ }
+
+ @Test
+ public void asMemberOf() {
+ assume().that(javacInput.lhs.getKind()).isEqualTo(TypeKind.DECLARED);
+ assume().that(javacInput.rhs.getKind()).isAnyOf(TypeKind.TYPEVAR, TypeKind.DECLARED);
+
+ TypeBiFunction<String> predicate =
+ (types, lhs, rhs) -> types.asMemberOf((DeclaredType) lhs, element(rhs)).toString();
+
+ try {
+ String unused = javacInput.apply(predicate);
+ } catch (IllegalArgumentException e) {
+ assertThrows(
+ turbineInput.format("asMemberOf"),
+ IllegalArgumentException.class,
+ () -> turbineInput.apply(predicate));
+ return;
+ }
+
+ test("asMemberOf", predicate);
+ }
+
+ private static Element element(TypeMirror rhs) {
+ switch (rhs.getKind()) {
+ case TYPEVAR:
+ return ((TypeVariable) rhs).asElement();
+ case DECLARED:
+ return ((DeclaredType) rhs).asElement();
+ default:
+ throw new AssertionError(rhs.getKind());
+ }
+ }
+}
diff --git a/javatests/com/google/turbine/testing/TestResources.java b/javatests/com/google/turbine/testing/TestResources.java
index 86c7632..6c456ab 100644
--- a/javatests/com/google/turbine/testing/TestResources.java
+++ b/javatests/com/google/turbine/testing/TestResources.java
@@ -19,7 +19,6 @@ package com.google.turbine.testing;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Objects.requireNonNull;
-import com.google.common.io.ByteStreams;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
@@ -32,7 +31,7 @@ public final class TestResources {
public static byte[] getResourceBytes(Class<?> clazz, String resource) {
try (InputStream is = requireNonNull(clazz.getResourceAsStream(resource), resource)) {
- return ByteStreams.toByteArray(is);
+ return is.readAllBytes();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
diff --git a/javatests/com/google/turbine/zip/ZipTest.java b/javatests/com/google/turbine/zip/ZipTest.java
index 2b6636d..b64531a 100644
--- a/javatests/com/google/turbine/zip/ZipTest.java
+++ b/javatests/com/google/turbine/zip/ZipTest.java
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertThrows;
import com.google.common.collect.ImmutableMap;
import com.google.common.hash.Hashing;
-import com.google.common.io.ByteStreams;
import java.io.IOException;
import java.net.URI;
import java.nio.ByteBuffer;
@@ -116,9 +115,7 @@ public class ZipTest {
JarEntry je = entries.nextElement();
result.put(
je.getName(),
- Hashing.goodFastHash(128)
- .hashBytes(ByteStreams.toByteArray(jf.getInputStream(je)))
- .padToLong());
+ Hashing.goodFastHash(128).hashBytes(jf.getInputStream(je).readAllBytes()).padToLong());
}
}
return result;