Minor fixes to KeepScanner tool:
- use Guava to read zip entries
- Fix keep rules emitted for constructors
RELNOTES: None.

PiperOrigin-RevId: 188781547
GitOrigin-RevId: 8e038b04e068285ba02b7934a7df25803802daff
Change-Id: Ifc99978b041f9c1c97ff707aafac90c59187c6c8
diff --git a/java/com/google/devtools/build/android/desugar/scan/KeepScanner.java b/java/com/google/devtools/build/android/desugar/scan/KeepScanner.java
index 5892bf5..b347c7a 100644
--- a/java/com/google/devtools/build/android/desugar/scan/KeepScanner.java
+++ b/java/com/google/devtools/build/android/desugar/scan/KeepScanner.java
@@ -15,11 +15,11 @@
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
 import static java.nio.file.StandardOpenOption.CREATE;
 import static java.util.Comparator.comparing;
 
 import com.google.common.collect.ImmutableSet;
+import com.google.common.io.ByteStreams;
 import com.google.devtools.build.android.Converters.ExistingPathConverter;
 import com.google.devtools.build.android.Converters.PathConverter;
 import com.google.devtools.common.options.Option;
@@ -140,18 +140,20 @@
   private static byte[] readFully(ZipFile zip, ZipEntry entry) {
     byte[] result = new byte[(int) entry.getSize()];
     try (InputStream content = zip.getInputStream(entry)) {
-      checkState(content.read(result) == result.length);
-      checkState(content.read() == -1);
+      ByteStreams.readFully(content, result);
+      return result;
     } catch (IOException e) {
       throw new IOError(e);
     }
-    return result;
   }
 
   private static CharSequence toKeepDescriptor(KeepReference member) {
     StringBuilder result = new StringBuilder();
     if (member.isMethodReference()) {
-      result.append("*** ").append(member.name()).append("(");
+      if (!"<init>".equals(member.name())) {
+        result.append("*** ");
+      }
+      result.append(member.name()).append("(");
       // Ignore return type as it's unique in the source language
       boolean first = true;
       for (Type param : Type.getMethodType(member.desc()).getArgumentTypes()) {
diff --git a/test/java/com/google/devtools/build/android/desugar/scan/testdata_golden.txt b/test/java/com/google/devtools/build/android/desugar/scan/testdata_golden.txt
index e4509b4..35744ce 100644
--- a/test/java/com/google/devtools/build/android/desugar/scan/testdata_golden.txt
+++ b/test/java/com/google/devtools/build/android/desugar/scan/testdata_golden.txt
@@ -2,7 +2,7 @@
   *** println(java.lang.String);
 }
 -keep class java.lang.AssertionError {
-  *** <init>();
+  <init>();
 }
 -keep class java.lang.Class {
   *** cast(java.lang.Object);
@@ -11,7 +11,7 @@
 -keep class java.lang.IndexOutOfBoundsException {
 }
 -keep class java.lang.Object {
-  *** <init>();
+  <init>();
 }
 -keep class java.lang.String {
 }
@@ -21,8 +21,8 @@
 -keep class java.util.AbstractList {
 }
 -keep class java.util.ArrayList {
-  *** <init>();
-  *** <init>(int);
+  <init>();
+  <init>(int);
   *** add(java.lang.Object);
   *** get(int);
   *** iterator();
@@ -30,7 +30,7 @@
 -keep class java.util.Collection {
 }
 -keep class java.util.Date {
-  *** <init>(long);
+  <init>(long);
   *** getTime();
 }
 -keep class java.util.Iterator {