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

Sat, 29 Dec 2012 17:33:17 -0800

author
jjg
date
Sat, 29 Dec 2012 17:33:17 -0800
changeset 1473
31780dd06ec7
parent 581
f2fdd52e4e87
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8004727: Add compiler support for parameter reflection
Reviewed-by: jjg
Contributed-by: eric.mccorkle@oracle.com

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

mercurial