langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Module_attribute.java
author alanb
Fri, 10 Feb 2017 09:06:10 +0000
changeset 43767 9cff98a149cb
parent 42822 a84956e7ee4d
permissions -rw-r--r--
8173393: Module system implementation refresh (2/2017) Reviewed-by: mcimadamore, mchung, alanb Contributed-by: alan.bateman@oracle.com, mandy.chung@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/*
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     4
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    10
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    15
 * accompanied this code).
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    16
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    20
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    23
 * questions.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    24
 */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    25
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    26
package com.sun.tools.classfile;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    27
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    28
import java.io.IOException;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    29
42822
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
    30
import com.sun.tools.classfile.ConstantPool.CONSTANT_Module_info;
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
    31
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    32
/**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    33
 * See Jigsaw.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    34
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    35
 *  <p><b>This is NOT part of any supported API.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    36
 *  If you write code that depends on this, you do so at your own risk.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    37
 *  This code and its internal interfaces are subject to change or
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    38
 *  deletion without notice.</b>
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    39
 */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    40
public class Module_attribute extends Attribute {
43767
9cff98a149cb 8173393: Module system implementation refresh (2/2017)
alanb
parents: 42822
diff changeset
    41
    public static final int ACC_TRANSITIVE      =   0x20;
9cff98a149cb 8173393: Module system implementation refresh (2/2017)
alanb
parents: 42822
diff changeset
    42
    public static final int ACC_STATIC_PHASE    =   0x40;
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    43
    public static final int ACC_OPEN            =   0x20;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    44
    public static final int ACC_SYNTHETIC       = 0x1000;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    45
    public static final int ACC_MANDATED        = 0x8000;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    46
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    47
    Module_attribute(ClassReader cr, int name_index, int length) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    48
        super(name_index, length);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    49
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    50
        module_name = cr.readUnsignedShort();
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    51
        module_flags = cr.readUnsignedShort();
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    52
42822
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
    53
        module_version_index = cr.readUnsignedShort();
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
    54
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    55
        requires_count = cr.readUnsignedShort();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    56
        requires = new RequiresEntry[requires_count];
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    57
        for (int i = 0; i < requires_count; i++)
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    58
            requires[i] = new RequiresEntry(cr);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    59
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    60
        exports_count = cr.readUnsignedShort();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    61
        exports = new ExportsEntry[exports_count];
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    62
        for (int i = 0; i < exports_count; i++)
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    63
            exports[i] = new ExportsEntry(cr);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    64
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    65
        opens_count = cr.readUnsignedShort();
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    66
        opens = new OpensEntry[opens_count];
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    67
        for (int i = 0; i < opens_count; i++)
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    68
            opens[i] = new OpensEntry(cr);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    69
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    70
        uses_count = cr.readUnsignedShort();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    71
        uses_index = new int[uses_count];
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    72
        for (int i = 0; i < uses_count; i++)
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    73
            uses_index[i] = cr.readUnsignedShort();
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    74
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    75
        provides_count = cr.readUnsignedShort();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    76
        provides = new ProvidesEntry[provides_count];
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    77
        for (int i = 0; i < provides_count; i++)
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    78
            provides[i] = new ProvidesEntry(cr);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    79
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    80
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    81
    public Module_attribute(int name_index,
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    82
            int module_name,
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    83
            int module_flags,
42822
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
    84
            int module_version_index,
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    85
            RequiresEntry[] requires,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    86
            ExportsEntry[] exports,
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    87
            OpensEntry[] opens,
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    88
            int[] uses,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    89
            ProvidesEntry[] provides) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    90
        super(name_index, 2);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    91
        this.module_name = module_name;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    92
        this.module_flags = module_flags;
42822
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
    93
        this.module_version_index = module_version_index;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    94
        requires_count = requires.length;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    95
        this.requires = requires;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    96
        exports_count = exports.length;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    97
        this.exports = exports;
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    98
        opens_count = opens.length;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
    99
        this.opens = opens;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   100
        uses_count = uses.length;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   101
        this.uses_index = uses;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   102
        provides_count = provides.length;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   103
        this.provides = provides;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   104
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   105
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   106
    public String getUses(int index, ConstantPool constant_pool) throws ConstantPoolException {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   107
        int i = uses_index[index];
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   108
        return constant_pool.getClassInfo(i).getName();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   109
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   110
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   111
    @Override
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   112
    public <R, D> R accept(Visitor<R, D> visitor, D data) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   113
        return visitor.visitModule(this, data);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   114
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   115
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   116
    public final int module_name;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   117
    public final int module_flags;
42822
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
   118
    public final int module_version_index;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   119
    public final int requires_count;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   120
    public final RequiresEntry[] requires;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   121
    public final int exports_count;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   122
    public final ExportsEntry[] exports;
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   123
    public final int opens_count;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   124
    public final OpensEntry[] opens;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   125
    public final int uses_count;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   126
    public final int[] uses_index;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   127
    public final int provides_count;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   128
    public final ProvidesEntry[] provides;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   129
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   130
    public static class RequiresEntry {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   131
        RequiresEntry(ClassReader cr) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   132
            requires_index = cr.readUnsignedShort();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   133
            requires_flags = cr.readUnsignedShort();
42822
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
   134
            requires_version_index = cr.readUnsignedShort();
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   135
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   136
42822
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
   137
        public RequiresEntry(int index, int flags, int version_index) {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   138
            this.requires_index = index;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   139
            this.requires_flags = flags;
42822
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
   140
            this.requires_version_index = version_index;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   141
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   142
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   143
        public String getRequires(ConstantPool constant_pool) throws ConstantPoolException {
42822
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
   144
            CONSTANT_Module_info info = constant_pool.getModuleInfo(requires_index);
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
   145
            return info.getName();
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   146
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   147
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   148
        public static final int length = 4;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   149
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   150
        public final int requires_index;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   151
        public final int requires_flags;
42822
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 42407
diff changeset
   152
        public final int requires_version_index;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   153
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   154
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   155
    public static class ExportsEntry {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   156
        ExportsEntry(ClassReader cr) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   157
            exports_index = cr.readUnsignedShort();
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   158
            exports_flags = cr.readUnsignedShort();
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   159
            exports_to_count = cr.readUnsignedShort();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   160
            exports_to_index = new int[exports_to_count];
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   161
            for (int i = 0; i < exports_to_count; i++)
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   162
                exports_to_index[i] = cr.readUnsignedShort();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   163
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   164
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   165
        public ExportsEntry(int index, int flags, int[] to) {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   166
            this.exports_index = index;
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   167
            this.exports_flags = flags;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   168
            this.exports_to_count = to.length;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   169
            this.exports_to_index = to;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   170
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   171
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   172
        public int length() {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   173
            return 4 + 2 * exports_to_index.length;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   174
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   175
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   176
        public final int exports_index;
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   177
        public final int exports_flags;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   178
        public final int exports_to_count;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   179
        public final int[] exports_to_index;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   180
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   181
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   182
    public static class OpensEntry {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   183
        OpensEntry(ClassReader cr) throws IOException {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   184
            opens_index = cr.readUnsignedShort();
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   185
            opens_flags = cr.readUnsignedShort();
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   186
            opens_to_count = cr.readUnsignedShort();
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   187
            opens_to_index = new int[opens_to_count];
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   188
            for (int i = 0; i < opens_to_count; i++)
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   189
                opens_to_index[i] = cr.readUnsignedShort();
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   190
        }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   191
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   192
        public OpensEntry(int index, int flags, int[] to) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   193
            this.opens_index = index;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   194
            this.opens_flags = flags;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   195
            this.opens_to_count = to.length;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   196
            this.opens_to_index = to;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   197
        }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   198
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   199
        public int length() {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   200
            return 4 + 2 * opens_to_index.length;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   201
        }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   202
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   203
        public final int opens_index;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   204
        public final int opens_flags;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   205
        public final int opens_to_count;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   206
        public final int[] opens_to_index;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   207
    }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   208
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   209
    public static class ProvidesEntry {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   210
        ProvidesEntry(ClassReader cr) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   211
            provides_index = cr.readUnsignedShort();
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   212
            with_count = cr.readUnsignedShort();
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   213
            with_index = new int[with_count];
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   214
            for (int i = 0; i < with_count; i++)
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   215
                with_index[i] = cr.readUnsignedShort();
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   216
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   217
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   218
        public ProvidesEntry(int provides, int[] with) {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   219
            this.provides_index = provides;
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   220
            this.with_count = with.length;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   221
            this.with_index = with;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   222
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   223
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   224
        public static final int length = 4;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   225
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   226
        public final int provides_index;
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   227
        public final int with_count;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36526
diff changeset
   228
        public final int[] with_index;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   229
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   230
}