src/share/classes/com/sun/tools/classfile/MethodParameters_attribute.java

Tue, 24 Dec 2013 09:17:37 -0800

author
ksrini
date
Tue, 24 Dec 2013 09:17:37 -0800
changeset 2227
998b10c43157
parent 1592
9345394ac8fe
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8029230: Update copyright year to match last edit in jdk8 langtools repository for 2013
Reviewed-by: ksrini
Contributed-by: steve.sides@oracle.com

jjg@1473 1 /*
ksrini@2227 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
jjg@1473 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jjg@1473 4 *
jjg@1473 5 * This code is free software; you can redistribute it and/or modify it
jjg@1473 6 * under the terms of the GNU General Public License version 2 only, as
jjg@1473 7 * published by the Free Software Foundation. Oracle designates this
jjg@1473 8 * particular file as subject to the "Classpath" exception as provided
jjg@1473 9 * by Oracle in the LICENSE file that accompanied this code.
jjg@1473 10 *
jjg@1473 11 * This code is distributed in the hope that it will be useful, but WITHOUT
jjg@1473 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jjg@1473 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jjg@1473 14 * version 2 for more details (a copy is included in the LICENSE file that
jjg@1473 15 * accompanied this code).
jjg@1473 16 *
jjg@1473 17 * You should have received a copy of the GNU General Public License version
jjg@1473 18 * 2 along with this work; if not, write to the Free Software Foundation,
jjg@1473 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jjg@1473 20 *
jjg@1473 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jjg@1473 22 * or visit www.oracle.com if you need additional information or have any
jjg@1473 23 * questions.
jjg@1473 24 */
jjg@1473 25
jjg@1473 26 package com.sun.tools.classfile;
jjg@1473 27
jjg@1473 28 import java.io.IOException;
jjg@1473 29
jjg@1473 30 /**
jjg@1473 31 * See JVMS, section 4.8.13.
jjg@1473 32 *
jjg@1473 33 * <p><b>This is NOT part of any supported API.
jjg@1473 34 * If you write code that depends on this, you do so at your own risk.
jjg@1473 35 * This code and its internal interfaces are subject to change or
jjg@1473 36 * deletion without notice.</b>
jjg@1473 37 */
jjg@1473 38 public class MethodParameters_attribute extends Attribute {
jjg@1473 39
jjg@1473 40 public final int method_parameter_table_length;
jjg@1473 41 public final Entry[] method_parameter_table;
jjg@1473 42
jjg@1473 43 MethodParameters_attribute(ClassReader cr,
jjg@1473 44 int name_index,
jjg@1473 45 int length)
jjg@1473 46 throws IOException {
jjg@1473 47 super(name_index, length);
jjg@1473 48
jjg@1473 49 method_parameter_table_length = cr.readUnsignedByte();
jjg@1473 50 method_parameter_table = new Entry[method_parameter_table_length];
jjg@1473 51 for (int i = 0; i < method_parameter_table_length; i++)
jjg@1473 52 method_parameter_table[i] = new Entry(cr);
jjg@1473 53 }
jjg@1473 54
jjg@1473 55 public MethodParameters_attribute(ConstantPool constant_pool,
jjg@1473 56 Entry[] method_parameter_table)
jjg@1473 57 throws ConstantPoolException {
jjg@1473 58 this(constant_pool.getUTF8Index(Attribute.MethodParameters),
jjg@1473 59 method_parameter_table);
jjg@1473 60 }
jjg@1473 61
jjg@1473 62 public MethodParameters_attribute(int name_index,
jjg@1473 63 Entry[] method_parameter_table) {
jjg@1473 64 super(name_index, 1 + method_parameter_table.length * Entry.length());
jjg@1473 65 this.method_parameter_table_length = method_parameter_table.length;
jjg@1473 66 this.method_parameter_table = method_parameter_table;
jjg@1473 67 }
jjg@1473 68
jjg@1473 69 public <R, D> R accept(Visitor<R, D> visitor, D data) {
jjg@1473 70 return visitor.visitMethodParameters(this, data);
jjg@1473 71 }
jjg@1473 72
jjg@1473 73 public static class Entry {
jjg@1473 74 Entry(ClassReader cr) throws IOException {
jjg@1473 75 name_index = cr.readUnsignedShort();
ksrini@1592 76 flags = cr.readUnsignedShort();
jjg@1473 77 }
jjg@1473 78
jjg@1473 79 public static int length() {
jjg@1473 80 return 6;
jjg@1473 81 }
jjg@1473 82
jjg@1473 83 public final int name_index;
jjg@1473 84 public final int flags;
jjg@1473 85 }
jjg@1473 86
jjg@1473 87 }

mercurial