Merge
authortbell
Tue, 17 Nov 2009 10:35:52 -0800
changeset 4304 2edda439128d
parent 4301 526bc8ef342a (current diff)
parent 4303 d02eb60e87fd (diff)
child 4305 d59ac20b19ef
Merge
langtools/src/share/classes/com/sun/tools/classfile/ModuleExportTable_attribute.java
langtools/src/share/classes/com/sun/tools/classfile/ModuleMemberTable_attribute.java
langtools/src/share/classes/com/sun/tools/classfile/Module_attribute.java
--- a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java	Thu Nov 12 15:36:01 2009 -0800
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java	Tue Nov 17 10:35:52 2009 -0800
@@ -64,11 +64,6 @@
     public static final String StackMapTable            = "StackMapTable";
     public static final String Synthetic                = "Synthetic";
 
-    // JSR 277/294
-    public static final String Module                   = "Module";
-    public static final String ModuleExportTable        = "ModuleExportTable";
-    public static final String ModuleMemberTable        = "ModuleMemberTable";
-
     public static class Factory {
         public Factory() {
             // defer init of standardAttributeClasses until after options set up
@@ -78,10 +73,6 @@
             this.compat = compat;
         }
 
-        public void setJSR277(boolean jsr277) {
-            this.jsr277 = jsr277;
-        }
-
         public Attribute createAttribute(ClassReader cr, int name_index, byte[] data)
                 throws IOException {
             if (standardAttributes == null)
@@ -121,12 +112,6 @@
             standardAttributes.put(LocalVariableTable, LocalVariableTable_attribute.class);
             standardAttributes.put(LocalVariableTypeTable, LocalVariableTypeTable_attribute.class);
 
-            if (jsr277) {
-                standardAttributes.put(Module,            Module_attribute.class);
-                standardAttributes.put(ModuleExportTable, ModuleExportTable_attribute.class);
-                standardAttributes.put(ModuleMemberTable, ModuleMemberTable_attribute.class);
-            }
-
             if (!compat) { // old javap does not recognize recent attributes
                 standardAttributes.put(CompilationID, CompilationID_attribute.class);
                 standardAttributes.put(RuntimeInvisibleAnnotations, RuntimeInvisibleAnnotations_attribute.class);
@@ -148,7 +133,6 @@
 
         private Map<String,Class<? extends Attribute>> standardAttributes;
         private boolean compat; // don't support recent attrs in compatibility mode
-        private boolean jsr277; // support new jsr277 attrs
     }
 
     public static Attribute read(ClassReader cr) throws IOException {
@@ -201,9 +185,5 @@
         R visitStackMap(StackMap_attribute attr, P p);
         R visitStackMapTable(StackMapTable_attribute attr, P p);
         R visitSynthetic(Synthetic_attribute attr, P p);
-
-        R visitModule(Module_attribute attr, P p);
-        R visitModuleExportTable(ModuleExportTable_attribute attr, P p);
-        R visitModuleMemberTable(ModuleMemberTable_attribute attr, P p);
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Thu Nov 12 15:36:01 2009 -0800
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Tue Nov 17 10:35:52 2009 -0800
@@ -449,25 +449,6 @@
             out.writeShort(entry.index);
         }
 
-        public Void visitModule(Module_attribute attr, ClassOutputStream out) {
-            out.writeShort(attr.module_name);
-            return null;
-        }
-
-        public Void visitModuleExportTable(ModuleExportTable_attribute attr, ClassOutputStream out) {
-            out.writeShort(attr.export_type_table.length);
-            for (int i: attr.export_type_table)
-                out.writeShort(i);
-            return null;
-        }
-
-        public Void visitModuleMemberTable(ModuleMemberTable_attribute attr, ClassOutputStream out) {
-            out.writeShort(attr.package_member_table.length);
-            for (int i: attr.package_member_table)
-                out.writeShort(i);
-            return null;
-        }
-
         public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, ClassOutputStream out) {
             annotationWriter.write(attr.annotations, out);
             return null;
--- a/langtools/src/share/classes/com/sun/tools/classfile/ModuleExportTable_attribute.java	Thu Nov 12 15:36:01 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright 2007-2008 Sun Microsystems, Inc.  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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 277.
- *
- *  <p><b>This is NOT part of any API supported by Sun Microsystems.  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 ModuleExportTable_attribute extends Attribute {
-    ModuleExportTable_attribute(ClassReader cr, int name_index, int length) throws IOException {
-        super(name_index, length);
-        int export_type_length = cr.readUnsignedShort();
-        export_type_table = new int[export_type_length];
-        for (int i = 0; i < export_type_table.length; i++)
-            export_type_table[i] = cr.readUnsignedShort();
-    }
-
-    public ModuleExportTable_attribute(ConstantPool cp, int[] export_type_table)
-            throws ConstantPoolException {
-        this(cp.getUTF8Index(Attribute.ModuleExportTable), export_type_table);
-    }
-
-    public ModuleExportTable_attribute(int name_index, int[] export_type_table) {
-        super(name_index, 2 + 2 * export_type_table.length);
-        this.export_type_table = export_type_table;
-    }
-
-    public int getExportTypeCount() {
-        return export_type_table.length;
-    }
-
-    public String getExportTypeName(int index, ConstantPool constant_pool) throws ConstantPoolException {
-        return constant_pool.getUTF8Value(export_type_table[index]);
-    }
-
-    public <R, P> R accept(Visitor<R, P> visitor, P p) {
-        return visitor.visitModuleExportTable(this, p);
-    }
-
-    public final int[] export_type_table;
-}
--- a/langtools/src/share/classes/com/sun/tools/classfile/ModuleMemberTable_attribute.java	Thu Nov 12 15:36:01 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright 2007-2008 Sun Microsystems, Inc.  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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 277.
- *
- *  <p><b>This is NOT part of any API supported by Sun Microsystems.  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 ModuleMemberTable_attribute extends Attribute {
-    ModuleMemberTable_attribute(ClassReader cr, int name_index, int length) throws IOException {
-        super(name_index, length);
-        int package_member_length = cr.readUnsignedShort();
-        package_member_table = new int[package_member_length];
-        for (int i = 0; i < package_member_table.length; i++)
-            package_member_table[i] = cr.readUnsignedShort();
-    }
-
-    public ModuleMemberTable_attribute(ConstantPool cp, int[] package_member_table)
-            throws ConstantPoolException {
-        this(cp.getUTF8Index(Attribute.ModuleMemberTable), package_member_table);
-    }
-
-    public ModuleMemberTable_attribute(int name_index, int[] package_member_table) {
-        super(name_index, 2 + 2 * package_member_table.length);
-        this.package_member_table = package_member_table;
-    }
-
-    public int getPackageMemberCount() {
-        return package_member_table.length;
-    }
-
-    public String getPackageMemberName(int index, ConstantPool constant_pool) throws ConstantPoolException {
-        return constant_pool.getUTF8Value(package_member_table[index]);
-    }
-
-    public <R, P> R accept(Visitor<R, P> visitor, P p) {
-        return visitor.visitModuleMemberTable(this, p);
-    }
-
-    public final int[] package_member_table;
-}
--- a/langtools/src/share/classes/com/sun/tools/classfile/Module_attribute.java	Thu Nov 12 15:36:01 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright 2007-2008 Sun Microsystems, Inc.  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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 277.
- *
- *  <p><b>This is NOT part of any API supported by Sun Microsystems.  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 Module_attribute extends Attribute {
-    Module_attribute(ClassReader cr, int name_index, int length) throws IOException {
-        super(name_index, length);
-        module_name = cr.readUnsignedShort();
-    }
-
-    public Module_attribute(ConstantPool constant_pool, int module_name)
-            throws ConstantPoolException {
-        this(constant_pool.getUTF8Index(Attribute.Module), module_name);
-    }
-
-    public Module_attribute(int name_index, int module_name) {
-        super(name_index, 2);
-        this.module_name = module_name;
-    }
-
-    public String getModuleName(ConstantPool constant_pool) throws ConstantPoolException {
-        return constant_pool.getUTF8Value(module_name);
-    }
-
-    public <R, D> R accept(Visitor<R, D> visitor, D data) {
-        return visitor.visitModule(this, data);
-    }
-
-    public final int module_name;
-
-}
--- a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Thu Nov 12 15:36:01 2009 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Tue Nov 17 10:35:52 2009 -0800
@@ -45,9 +45,6 @@
 import com.sun.tools.classfile.LineNumberTable_attribute;
 import com.sun.tools.classfile.LocalVariableTable_attribute;
 import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
-import com.sun.tools.classfile.ModuleExportTable_attribute;
-import com.sun.tools.classfile.ModuleMemberTable_attribute;
-import com.sun.tools.classfile.Module_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
@@ -372,63 +369,6 @@
         return null;
     }
 
-    public Void visitModule(Module_attribute attr, Void ignore) {
-        print("Module: #" + attr.module_name);
-        tab();
-        println("// " + getModuleName(attr));
-        return null;
-    }
-
-    String getModuleName(Module_attribute attr) {
-        try {
-            return attr.getModuleName(constant_pool);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
-    public Void visitModuleExportTable(ModuleExportTable_attribute attr, Void ignore) {
-        println("ModuleExportTable:");
-        indent(+1);
-        println("Types: (" + attr.export_type_table.length + ")");
-        for (int i = 0; i < attr.export_type_table.length; i++) {
-            print("#" + attr.export_type_table[i]);
-            tab();
-            println("// " + getExportTypeName(attr, i));
-        }
-        indent(-1);
-        return null;
-    }
-
-    String getExportTypeName(ModuleExportTable_attribute attr, int index) {
-        try {
-            return attr.getExportTypeName(index, constant_pool);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
-    public Void visitModuleMemberTable(ModuleMemberTable_attribute attr, Void ignore) {
-        println("ModuleMemberTable:");
-        indent(+1);
-        println("Packages: (" + attr.package_member_table.length + ")");
-        for (int i = 0; i < attr.package_member_table.length; i++) {
-            print("#" + attr.package_member_table[i]);
-            tab();
-            println("// " + getPackageMemberName(attr, i));
-        }
-        indent(-1);
-        return null;
-    }
-
-    String getPackageMemberName(ModuleMemberTable_attribute attr, int index) {
-        try {
-            return attr.getPackageMemberName(index, constant_pool);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
     public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, Void ignore) {
         println("RuntimeVisibleAnnotations:");
         indent(+1);
--- a/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java	Thu Nov 12 15:36:01 2009 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java	Tue Nov 17 10:35:52 2009 -0800
@@ -236,12 +236,6 @@
             }
         },
 
-        new Option(false, "-XDjsr277") {
-            void process(JavapTask task, String opt, String arg) {
-                task.options.jsr277 = true;
-            }
-        },
-
         new Option(false, "-XDdetails") {
             void process(JavapTask task, String opt, String arg) {
                 task.options.details = EnumSet.allOf(InstructionDetailWriter.Kind.class);
@@ -586,7 +580,6 @@
         sourceWriter.setFileManager(fileManager);
 
         attributeFactory.setCompat(options.compat);
-        attributeFactory.setJSR277(options.jsr277);
 
         boolean ok = true;
 
--- a/langtools/src/share/classes/com/sun/tools/javap/Options.java	Thu Nov 12 15:36:01 2009 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javap/Options.java	Tue Nov 17 10:35:52 2009 -0800
@@ -90,5 +90,4 @@
     public int tabColumn = 40;    // column number for comments
 
     public boolean compat;             // bug-for-bug compatibility mode with old javap
-    public boolean jsr277;
 }