changeset 52837:4aba8143588e lworld

8212800 : [lworld] Javac should not emit the ValueTypes attribute anymore.
author sadayapalam
date Tue, 20 Nov 2018 11:24:38 +0530
parents 60b15b8cbfd9
children 38ecd3c1c9ee
files src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java src/jdk.jdeps/share/classes/com/sun/tools/classfile/ValueTypes_attribute.java src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java test/jdk/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java test/langtools/lib/annotations/annotations/classfile/ClassfileInspector.java test/langtools/tools/javac/MethodParameters/AttributeVisitor.java test/langtools/tools/javac/valhalla/lworld-values/ValueTypesAttributeTest.java
diffstat 8 files changed, 0 insertions(+), 210 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java	Tue Nov 20 10:47:35 2018 +0530
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java	Tue Nov 20 11:24:38 2018 +0530
@@ -73,7 +73,6 @@
     public static final String StackMap                 = "StackMap";
     public static final String StackMapTable            = "StackMapTable";
     public static final String Synthetic                = "Synthetic";
-    public static final String ValueTypes               = "ValueTypes";
 
     public static class Factory {
         public Factory() {
@@ -148,7 +147,6 @@
             standardAttributes.put(StackMap,          StackMap_attribute.class);
             standardAttributes.put(StackMapTable,     StackMapTable_attribute.class);
             standardAttributes.put(Synthetic,         Synthetic_attribute.class);
-            standardAttributes.put(ValueTypes,        ValueTypes_attribute.class);
         }
 
         private Map<String,Class<? extends Attribute>> standardAttributes;
@@ -214,6 +212,5 @@
         R visitStackMap(StackMap_attribute attr, P p);
         R visitStackMapTable(StackMapTable_attribute attr, P p);
         R visitSynthetic(Synthetic_attribute attr, P p);
-        R visitValueTypes(ValueTypes_attribute attr, P p);
     }
 }
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java	Tue Nov 20 10:47:35 2018 +0530
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java	Tue Nov 20 11:24:38 2018 +0530
@@ -732,14 +732,6 @@
             return null;
         }
 
-        @Override
-        public Void visitValueTypes(ValueTypes_attribute attr, ClassOutputStream out) {
-            out.writeShort(attr.value_class_info_index.length);
-            for (int index: attr.value_class_info_index)
-                out.writeShort(index);
-            return null;
-        }
-
         protected void writeAccessFlags(AccessFlags flags, ClassOutputStream p) {
             sharedOut.writeShort(flags.flags);
         }
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ValueTypes_attribute.java	Tue Nov 20 10:47:35 2018 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2018, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class ValueTypes_attribute extends Attribute {
-    ValueTypes_attribute(ClassReader cr, int name_index, int length) throws IOException {
-        super(name_index, length);
-        number_of_classes = cr.readUnsignedShort();
-        value_class_info_index = new int[number_of_classes];
-        for (int i = 0; i < number_of_classes; i++)
-            value_class_info_index[i] = cr.readUnsignedShort();
-    }
-
-    public <R, D> R accept(Visitor<R, D> visitor, D data) {
-        return visitor.visitValueTypes(this, data);
-    }
-
-    public final int number_of_classes;
-    public final int value_class_info_index[];
-}
\ No newline at end of file
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java	Tue Nov 20 10:47:35 2018 +0530
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java	Tue Nov 20 11:24:38 2018 +0530
@@ -73,7 +73,6 @@
 
 import static com.sun.tools.classfile.AccessFlags.*;
 
-import com.sun.tools.classfile.ValueTypes_attribute;
 import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.StringUtils;
 
@@ -1009,27 +1008,6 @@
         return null;
     }
 
-    @Override
-    public Void visitValueTypes(ValueTypes_attribute attr, Void ignore) {
-        boolean first = true;
-        for (int index : attr.value_class_info_index) {
-            if (first) {
-                println("ValueTypes:");
-                indent(+1);
-                first = false;
-            }
-            print("#" + index);
-            print(";");
-            tab();
-            print("// value ");
-            constantWriter.write(index);
-            println();
-        }
-        if (!first)
-            indent(-1);
-        return null;
-    }
-
     static String getJavaName(String name) {
         return name.replace('/', '.');
     }
--- a/test/jdk/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java	Tue Nov 20 10:47:35 2018 +0530
+++ b/test/jdk/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java	Tue Nov 20 11:24:38 2018 +0530
@@ -110,7 +110,6 @@
 import com.sun.tools.classfile.Synthetic_attribute;
 import com.sun.tools.classfile.TypeAnnotation;
 import com.sun.tools.classfile.TypeAnnotation.Position;
-import com.sun.tools.classfile.ValueTypes_attribute;
 import static com.sun.tools.classfile.TypeAnnotation.TargetType.THROWS;
 import java.io.*;
 import java.util.*;
@@ -1143,18 +1142,6 @@
     }
 
     @Override
-    public Element visitValueTypes(ValueTypes_attribute vt, Element p) {
-        String name = x.getCpString(vt.attribute_name_index);
-        for (int index : vt.value_class_info_index) {
-            Element e = new Element(name);
-            e.setAttr("class", x.getCpString(index));
-            e.trimToSize();
-            p.add(e);
-        }
-        return null;
-    }
-
-    @Override
     public Element visitLineNumberTable(LineNumberTable_attribute lnt, Element p) {
         String name = x.getCpString(lnt.attribute_name_index);
         for (LineNumberTable_attribute.Entry e : lnt.line_number_table) {
--- a/test/langtools/lib/annotations/annotations/classfile/ClassfileInspector.java	Tue Nov 20 10:47:35 2018 +0530
+++ b/test/langtools/lib/annotations/annotations/classfile/ClassfileInspector.java	Tue Nov 20 11:24:38 2018 +0530
@@ -1362,10 +1362,6 @@
             return null;
         }
 
-        @Override
-        public Void visitValueTypes(ValueTypes_attribute attr, T p) {
-            return null;
-        }
     }
 
     private static final Attribute.Visitor<Void, ExpectedTypeAnnotation> typeAnnoMatcher
--- a/test/langtools/tools/javac/MethodParameters/AttributeVisitor.java	Tue Nov 20 10:47:35 2018 +0530
+++ b/test/langtools/tools/javac/MethodParameters/AttributeVisitor.java	Tue Nov 20 11:24:38 2018 +0530
@@ -64,5 +64,4 @@
     public R visitStackMap(StackMap_attribute attr, P p) { return null; }
     public R visitStackMapTable(StackMapTable_attribute attr, P p) { return null; }
     public R visitSynthetic(Synthetic_attribute attr, P p) { return null; }
-    public R visitValueTypes(ValueTypes_attribute attr, P p) { return null; }
 }
--- a/test/langtools/tools/javac/valhalla/lworld-values/ValueTypesAttributeTest.java	Tue Nov 20 10:47:35 2018 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2018, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary Check emission of ValueTypes attribute
- * @modules jdk.compiler/com.sun.tools.javac.util jdk.jdeps/com.sun.tools.javap
- * @compile MultiValues.java
- * @compile -g ValueTypesAttributeTest.java
- * @run main/othervm -Xverify:none -XX:+EnableValhalla ValueTypesAttributeTest
- * @modules jdk.compiler
- */
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.nio.file.Paths;
-
-public class ValueTypesAttributeTest {
-
-    static final value class X {
-        final V1 [] v1 = null; // field descriptor 
-        V2[] foo() {  // method descriptor encoding value type
-            return null;
-        }
-        void foo(V3 v3) { // method descriptor encoding value type
-        }
-        void foo(int x) {
-            V4 [] v4 = null; // local variable.
-        }
-        void goo() {
-            V5 [] v5 = null;
-            if (v5 == null) {
-               V6 [] v61 = null;  // stack map table.
-            } else {
-               V5 [] v52 = null;
-            }
-        }
-    }
-
-    public static void main(String[] args) {
-        new ValueTypesAttributeTest().run();
-    }
-
-    void run() {
-        String [] params = new String [] { "-v",
-                                            Paths.get(System.getProperty("test.classes"),
-                                                "ValueTypesAttributeTest$X.class").toString() };
-        runCheck(params, new String [] {
-
-         "ValueTypes:",
-         "#36;                                    // value class V4",
-         "#24;                                    // value class V2",
-         "#6;                                     // value class ValueTypesAttributeTest$X",
-         "#10;                                    // value class V1",
-         "#27;                                    // value class V3",
-         "#41;                                    // value class V5",
-           
-         }, new String [] {
-         });
-
-     }
-
-     void runCheck(String [] params, String [] expectedOut, String [] unexpectedOut) {
-        StringWriter s;
-        String out;
-
-        try (PrintWriter pw = new PrintWriter(s = new StringWriter())) {
-            com.sun.tools.javap.Main.run(params, pw);
-            out = s.toString();
-        }
-        int errors = 0;
-        for (String eo: expectedOut) {
-            if (!out.contains(eo)) {
-                System.err.println("Match not found for string: " + eo);
-                errors++;
-            }
-        }
-        for (String eo: unexpectedOut) {
-            if (out.contains(eo)) {
-                System.err.println("Unexpected output found for string: " + eo);
-                errors++;
-            }
-        }
-        if (errors > 0) {
-             throw new AssertionError("Unexpected javap output: " + out);
-        }
-    }
-}