jjg@1473: /* jjg@1473: * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. jjg@1473: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jjg@1473: * jjg@1473: * This code is free software; you can redistribute it and/or modify it jjg@1473: * under the terms of the GNU General Public License version 2 only, as jjg@1473: * published by the Free Software Foundation. Oracle designates this jjg@1473: * particular file as subject to the "Classpath" exception as provided jjg@1473: * by Oracle in the LICENSE file that accompanied this code. jjg@1473: * jjg@1473: * This code is distributed in the hope that it will be useful, but WITHOUT jjg@1473: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jjg@1473: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jjg@1473: * version 2 for more details (a copy is included in the LICENSE file that jjg@1473: * accompanied this code). jjg@1473: * jjg@1473: * You should have received a copy of the GNU General Public License version jjg@1473: * 2 along with this work; if not, write to the Free Software Foundation, jjg@1473: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jjg@1473: * jjg@1473: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jjg@1473: * or visit www.oracle.com if you need additional information or have any jjg@1473: * questions. jjg@1473: */ jjg@1473: jjg@1473: package com.sun.tools.classfile; jjg@1473: jjg@1473: import java.io.IOException; jjg@1473: jjg@1473: /** jjg@1473: * See JVMS, section 4.8.13. jjg@1473: * jjg@1473: *

This is NOT part of any supported API. jjg@1473: * If you write code that depends on this, you do so at your own risk. jjg@1473: * This code and its internal interfaces are subject to change or jjg@1473: * deletion without notice. jjg@1473: */ jjg@1473: public class MethodParameters_attribute extends Attribute { jjg@1473: jjg@1473: public final int method_parameter_table_length; jjg@1473: public final Entry[] method_parameter_table; jjg@1473: jjg@1473: MethodParameters_attribute(ClassReader cr, jjg@1473: int name_index, jjg@1473: int length) jjg@1473: throws IOException { jjg@1473: super(name_index, length); jjg@1473: jjg@1473: method_parameter_table_length = cr.readUnsignedByte(); jjg@1473: method_parameter_table = new Entry[method_parameter_table_length]; jjg@1473: for (int i = 0; i < method_parameter_table_length; i++) jjg@1473: method_parameter_table[i] = new Entry(cr); jjg@1473: } jjg@1473: jjg@1473: public MethodParameters_attribute(ConstantPool constant_pool, jjg@1473: Entry[] method_parameter_table) jjg@1473: throws ConstantPoolException { jjg@1473: this(constant_pool.getUTF8Index(Attribute.MethodParameters), jjg@1473: method_parameter_table); jjg@1473: } jjg@1473: jjg@1473: public MethodParameters_attribute(int name_index, jjg@1473: Entry[] method_parameter_table) { jjg@1473: super(name_index, 1 + method_parameter_table.length * Entry.length()); jjg@1473: this.method_parameter_table_length = method_parameter_table.length; jjg@1473: this.method_parameter_table = method_parameter_table; jjg@1473: } jjg@1473: jjg@1473: public R accept(Visitor visitor, D data) { jjg@1473: return visitor.visitMethodParameters(this, data); jjg@1473: } jjg@1473: jjg@1473: public static class Entry { jjg@1473: Entry(ClassReader cr) throws IOException { jjg@1473: name_index = cr.readUnsignedShort(); jjg@1473: flags = cr.readInt(); jjg@1473: } jjg@1473: jjg@1473: public static int length() { jjg@1473: return 6; jjg@1473: } jjg@1473: jjg@1473: public final int name_index; jjg@1473: public final int flags; jjg@1473: } jjg@1473: jjg@1473: }