8059631: Use of '#' to represent MethodHandle kind is confusing
authorjjg
Fri, 17 Jun 2016 17:53:00 -0700
changeset 39104 61c5b5f8fd8c
parent 39103 91a64ec5b970
child 39105 956490b8da9c
8059631: Use of '#' to represent MethodHandle kind is confusing Reviewed-by: jrose, mcimadamore
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConstantPool.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConstantPool.java	Fri Jun 17 17:40:01 2016 -0700
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConstantPool.java	Fri Jun 17 17:53:00 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,22 +119,20 @@
     public static final int CONSTANT_InvokeDynamic = 18;
 
     public static enum RefKind {
-        REF_getField(1, "getfield"),
-        REF_getStatic(2, "getstatic"),
-        REF_putField(3, "putfield"),
-        REF_putStatic(4, "putstatic"),
-        REF_invokeVirtual(5, "invokevirtual"),
-        REF_invokeStatic(6, "invokestatic"),
-        REF_invokeSpecial(7, "invokespecial"),
-        REF_newInvokeSpecial(8, "newinvokespecial"),
-        REF_invokeInterface(9, "invokeinterface");
+        REF_getField(1),
+        REF_getStatic(2),
+        REF_putField(3),
+        REF_putStatic(4),
+        REF_invokeVirtual(5),
+        REF_invokeStatic(6),
+        REF_invokeSpecial(7),
+        REF_newInvokeSpecial(8),
+        REF_invokeInterface(9);
 
         public final int tag;
-        public final String name;
 
-        RefKind(int tag, String name) {
+        RefKind(int tag) {
             this.tag = tag;
-            this.name = name;
         }
 
         static RefKind getRefkind(int tag) {
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java	Fri Jun 17 17:40:01 2016 -0700
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java	Fri Jun 17 17:53:00 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -124,7 +124,7 @@
             }
 
             public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
-                print("#" + info.reference_kind.tag + ":#" + info.reference_index);
+                print(info.reference_kind.tag + ":#" + info.reference_index);
                 tab();
                 println("// " + stringValue(info));
                 return 1;
@@ -326,7 +326,7 @@
 
         public String visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
             try {
-                return info.reference_kind.name + " " + stringValue(info.getCPRefInfo());
+                return info.reference_kind + " " + stringValue(info.getCPRefInfo());
             } catch (ConstantPoolException e) {
                 return report(e);
             }