Set type_argument_index to zero for non-type argument type_path_kinds

as required by JVMS 4.7.20.2.

MOE_MIGRATED_REVID=137770084
diff --git a/java/com/google/turbine/bytecode/ClassFile.java b/java/com/google/turbine/bytecode/ClassFile.java
index 252ebe9..7cb70b6 100644
--- a/java/com/google/turbine/bytecode/ClassFile.java
+++ b/java/com/google/turbine/bytecode/ClassFile.java
@@ -646,22 +646,22 @@
 
       /** The root type_path_kind, used for initialization. */
       public static TypePath root() {
-        return new TypePath(-1, null, null);
+        return new TypePath(null, null);
       }
 
       /** Adds an array type_path_kind entry. */
       public TypePath array() {
-        return new TypePath(-1, Kind.ARRAY, this);
+        return new TypePath(Kind.ARRAY, this);
       }
 
       /** Adds a nested type type_path_kind entry. */
       public TypePath nested() {
-        return new TypePath(-1, Kind.NESTED, this);
+        return new TypePath(Kind.NESTED, this);
       }
 
       /** Adds a wildcard bound type_path_kind entry. */
       public TypePath wild() {
-        return new TypePath(-1, Kind.WILDCARD_BOUND, this);
+        return new TypePath(Kind.WILDCARD_BOUND, this);
       }
 
       /** Adds a type argument type_path_kind entry. */
@@ -687,6 +687,11 @@
       private final Kind kind;
       private final int index;
 
+      private TypePath(Kind kind, TypePath parent) {
+        // JVMS 4.7.20.2: type_argument_index is 0 if the bound kind is not TYPE_ARGUMENT
+        this(0, kind, parent);
+      }
+
       private TypePath(int index, Kind kind, TypePath parent) {
         this.index = index;
         this.kind = kind;
diff --git a/javatests/com/google/turbine/lower/LowerTest.java b/javatests/com/google/turbine/lower/LowerTest.java
index 50242f9..65f3dfb 100644
--- a/javatests/com/google/turbine/lower/LowerTest.java
+++ b/javatests/com/google/turbine/lower/LowerTest.java
@@ -51,8 +51,12 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.FieldVisitor;
 import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.TypePath;
 
 @RunWith(JUnit4.class)
 public class LowerTest {
@@ -282,4 +286,47 @@
                     "}",
                     ""));
   }
+
+  @Test
+  public void typePath() throws Exception {
+    BindingResult bound =
+        Binder.bind(
+            ImmutableList.of(
+                Parser.parse(
+                    Joiner.on('\n')
+                        .join(
+                            "import java.lang.annotation.ElementType;",
+                            "import java.lang.annotation.Target;",
+                            "import java.util.List;",
+                            "@Target({ElementType.TYPE_USE}) @interface Anno {}",
+                            "class Test {",
+                            "  public @Anno int[][] xs;",
+                            "}"))),
+            ImmutableList.of(),
+            BOOTCLASSPATH);
+    Map<String, byte[]> lowered = Lower.lowerAll(bound.units(), bound.classPathEnv()).bytes();
+    TypePath[] path = new TypePath[1];
+    new ClassReader(lowered.get("Test"))
+        .accept(
+            new ClassVisitor(Opcodes.ASM5) {
+              @Override
+              public FieldVisitor visitField(
+                  int access, String name, String desc, String signature, Object value) {
+                return new FieldVisitor(Opcodes.ASM5) {
+                  @Override
+                  public AnnotationVisitor visitTypeAnnotation(
+                      int typeRef, TypePath typePath, String desc, boolean visible) {
+                    path[0] = typePath;
+                    return null;
+                  };
+                };
+              }
+            },
+            0);
+    assertThat(path[0].getLength()).isEqualTo(2);
+    assertThat(path[0].getStep(0)).isEqualTo(TypePath.ARRAY_ELEMENT);
+    assertThat(path[0].getStepArgument(0)).isEqualTo(0);
+    assertThat(path[0].getStep(1)).isEqualTo(TypePath.ARRAY_ELEMENT);
+    assertThat(path[0].getStepArgument(1)).isEqualTo(0);
+  }
 }