8178380: Module system implementation refresh (5/2017)
authoralanb
Thu, 04 May 2017 07:28:00 +0000
changeset 45041 f17345838471
parent 44822 2f24758e7ae0
child 45042 23c0d9bcaa53
8178380: Module system implementation refresh (5/2017) Reviewed-by: jjg, mchung
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleTarget_attribute.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java	Mon Apr 24 14:59:43 2017 -0700
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java	Thu May 04 07:28:00 2017 +0000
@@ -616,8 +616,7 @@
 
         @Override
         public Void visitModuleTarget(ModuleTarget_attribute attr, ClassOutputStream out) {
-            out.writeShort(attr.os_name_index);
-            out.writeShort(attr.os_arch_index);
+            out.writeShort(attr.target_platform_index);
             return null;
         }
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleTarget_attribute.java	Mon Apr 24 14:59:43 2017 -0700
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleTarget_attribute.java	Thu May 04 07:28:00 2017 +0000
@@ -38,8 +38,7 @@
 public class ModuleTarget_attribute extends Attribute {
     ModuleTarget_attribute(ClassReader cr, int name_index, int length) throws IOException {
         super(name_index, length);
-        os_name_index = cr.readUnsignedShort();
-        os_arch_index = cr.readUnsignedShort();
+        target_platform_index = cr.readUnsignedShort();
     }
 
     @Override
@@ -47,6 +46,5 @@
         return visitor.visitModuleTarget(this, data);
     }
 
-    public final int os_name_index;
-    public final int os_arch_index;
+    public final int target_platform_index;
 }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java	Mon Apr 24 14:59:43 2017 -0700
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java	Thu May 04 07:28:00 2017 +0000
@@ -668,33 +668,19 @@
     public Void visitModuleTarget(ModuleTarget_attribute attr, Void ignore) {
         println("ModuleTarget:");
         indent(+1);
-        print("os_name: #" + attr.os_name_index);
-        if (attr.os_name_index != 0) {
+        print("target_platform: #" + attr.target_platform_index);
+        if (attr.target_platform_index != 0) {
             tab();
-            print("// " + getOSName(attr));
-        }
-        println();
-        print("os_arch: #" + attr.os_arch_index);
-        if (attr.os_arch_index != 0) {
-            tab();
-            print("// " + getOSArch(attr));
+            print("// " + getTargetPlatform(attr));
         }
         println();
         indent(-1);
         return null;
     }
 
-    private String getOSName(ModuleTarget_attribute attr) {
+    private String getTargetPlatform(ModuleTarget_attribute attr) {
         try {
-            return constant_pool.getUTF8Value(attr.os_name_index);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
-    private String getOSArch(ModuleTarget_attribute attr) {
-        try {
-            return constant_pool.getUTF8Value(attr.os_arch_index);
+            return constant_pool.getUTF8Value(attr.target_platform_index);
         } catch (ConstantPoolException e) {
             return report(e);
         }