src/java.base/share/native/libjava/Module.c
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 45652 jdk/src/java.base/share/native/libjava/Module.c@33342314ce89
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/*
45652
33342314ce89 8181087: Module system implementation refresh (6/2017)
alanb
parents: 44545
diff changeset
     2
 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     4
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    10
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    15
 * accompanied this code).
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    16
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    20
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    23
 * questions.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    24
 */
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    25
#include <stdlib.h>
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    26
#include <string.h>
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    27
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    28
#include "jni.h"
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    29
#include "jni_util.h"
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    30
#include "jvm.h"
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    31
44545
83b611b88ac8 8177530: Module system implementation refresh (4/2017)
alanb
parents: 44359
diff changeset
    32
#include "java_lang_Module.h"
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    33
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    34
/*
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    35
 * Gets the UTF-8 chars for the string and translates '.' to '/'.  Does no
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    36
 * further validation, assumption being that both calling code in
44545
83b611b88ac8 8177530: Module system implementation refresh (4/2017)
alanb
parents: 44359
diff changeset
    37
 * java.lang.Module and VM will do deeper validation.
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    38
 */
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    39
static char*
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    40
GetInternalPackageName(JNIEnv *env, jstring pkg, char* buf, jsize buf_size)
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    41
{
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    42
    jsize len;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    43
    jsize unicode_len;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    44
    char* p;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    45
    char* utf_str;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    46
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    47
    len = (*env)->GetStringUTFLength(env, pkg);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    48
    unicode_len = (*env)->GetStringLength(env, pkg);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    49
    if (len >= buf_size) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    50
        utf_str = malloc(len + 1);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    51
        if (utf_str == NULL) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    52
            JNU_ThrowOutOfMemoryError(env, NULL);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    53
            return NULL;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    54
        }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    55
    } else {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    56
        utf_str = buf;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    57
    }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    58
    (*env)->GetStringUTFRegion(env, pkg, 0, unicode_len, utf_str);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    59
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    60
    p = utf_str;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    61
    while (*p != '\0') {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    62
        if (*p == '.') {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    63
            *p = '/';
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    64
        }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    65
        p++;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    66
    }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    67
    return utf_str;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    68
}
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    69
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    70
JNIEXPORT void JNICALL
44545
83b611b88ac8 8177530: Module system implementation refresh (4/2017)
alanb
parents: 44359
diff changeset
    71
Java_java_lang_Module_defineModule0(JNIEnv *env, jclass cls, jobject module,
42338
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36511
diff changeset
    72
                                            jboolean is_open, jstring version,
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 36511
diff changeset
    73
                                            jstring location, jobjectArray packages)
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    74
{
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    75
    char** pkgs = NULL;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    76
    jsize num_packages = (*env)->GetArrayLength(env, packages);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    77
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    78
    if (num_packages != 0 && (pkgs = calloc(num_packages, sizeof(char*))) == NULL) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    79
        JNU_ThrowOutOfMemoryError(env, NULL);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    80
        return;
44359
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 43532
diff changeset
    81
    } else if ((*env)->EnsureLocalCapacity(env, (jint)num_packages) == 0) {
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 43532
diff changeset
    82
        jboolean failed = JNI_FALSE;
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 43532
diff changeset
    83
        int idx;
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    84
        for (idx = 0; idx < num_packages; idx++) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    85
            jstring pkg = (*env)->GetObjectArrayElement(env, packages, idx);
44359
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 43532
diff changeset
    86
            char* name = GetInternalPackageName(env, pkg, NULL, 0);
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 43532
diff changeset
    87
            if (name != NULL) {
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 43532
diff changeset
    88
                pkgs[idx] = name;
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 43532
diff changeset
    89
            } else {
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 43532
diff changeset
    90
                failed = JNI_TRUE;
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    91
                break;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    92
            }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    93
        }
44359
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 43532
diff changeset
    94
        if (!failed) {
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    95
            JVM_DefineModule(env, module, is_open, version, location,
44359
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 43532
diff changeset
    96
                             (const char* const*)pkgs, num_packages);
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    97
        }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    98
    }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
    99
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   100
    if (num_packages > 0) {
44359
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 43532
diff changeset
   101
        int idx;
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   102
        for (idx = 0; idx < num_packages; idx++) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   103
            if (pkgs[idx] != NULL) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   104
                free(pkgs[idx]);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   105
            }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   106
        }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   107
        free(pkgs);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   108
    }
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   109
}
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   110
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   111
JNIEXPORT void JNICALL
44545
83b611b88ac8 8177530: Module system implementation refresh (4/2017)
alanb
parents: 44359
diff changeset
   112
Java_java_lang_Module_addReads0(JNIEnv *env, jclass cls, jobject from, jobject to)
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   113
{
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   114
    JVM_AddReadsModule(env, from, to);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   115
}
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   116
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   117
JNIEXPORT void JNICALL
44545
83b611b88ac8 8177530: Module system implementation refresh (4/2017)
alanb
parents: 44359
diff changeset
   118
Java_java_lang_Module_addExports0(JNIEnv *env, jclass cls, jobject from,
83b611b88ac8 8177530: Module system implementation refresh (4/2017)
alanb
parents: 44359
diff changeset
   119
                                  jstring pkg, jobject to)
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   120
{
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   121
    char buf[128];
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   122
    char* pkg_name;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   123
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   124
    if (pkg == NULL) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   125
        JNU_ThrowNullPointerException(env, "package is null");
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   126
        return;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   127
    }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   128
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   129
    pkg_name = GetInternalPackageName(env, pkg, buf, (jsize)sizeof(buf));
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   130
    if (pkg_name != NULL) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   131
        JVM_AddModuleExports(env, from, pkg_name, to);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   132
        if (pkg_name != buf) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   133
            free(pkg_name);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   134
        }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   135
    }
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   136
}
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   137
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   138
JNIEXPORT void JNICALL
44545
83b611b88ac8 8177530: Module system implementation refresh (4/2017)
alanb
parents: 44359
diff changeset
   139
Java_java_lang_Module_addExportsToAll0(JNIEnv *env, jclass cls, jobject from,
83b611b88ac8 8177530: Module system implementation refresh (4/2017)
alanb
parents: 44359
diff changeset
   140
                                       jstring pkg)
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   141
{
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   142
    char buf[128];
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   143
    char* pkg_name;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   144
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   145
    if (pkg == NULL) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   146
        JNU_ThrowNullPointerException(env, "package is null");
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   147
        return;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   148
    }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   149
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   150
    pkg_name = GetInternalPackageName(env, pkg, buf, (jsize)sizeof(buf));
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   151
    if (pkg_name != NULL) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   152
        JVM_AddModuleExportsToAll(env, from, pkg_name);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   153
        if (pkg_name != buf) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   154
            free(pkg_name);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   155
        }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   156
    }
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   157
}
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   158
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   159
JNIEXPORT void JNICALL
44545
83b611b88ac8 8177530: Module system implementation refresh (4/2017)
alanb
parents: 44359
diff changeset
   160
Java_java_lang_Module_addExportsToAllUnnamed0(JNIEnv *env, jclass cls,
83b611b88ac8 8177530: Module system implementation refresh (4/2017)
alanb
parents: 44359
diff changeset
   161
                                              jobject from, jstring pkg)
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   162
{
43532
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   163
    char buf[128];
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   164
    char* pkg_name;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   165
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   166
    if (pkg == NULL) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   167
        JNU_ThrowNullPointerException(env, "package is null");
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   168
        return;
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   169
    }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   170
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   171
    pkg_name = GetInternalPackageName(env, pkg, buf, (jsize)sizeof(buf));
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   172
    if (pkg_name != NULL) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   173
        JVM_AddModuleExportsToAllUnnamed(env, from, pkg_name);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   174
        if (pkg_name != buf) {
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   175
            free(pkg_name);
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   176
        }
5028c6b02af5 8171855: Move package name transformations during module bootstrap into native code
redestad
parents: 42338
diff changeset
   177
    }
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   178
}