46 // * Module_name is syntactically bad |
46 // * Module_name is syntactically bad |
47 // * Packages contains an illegal package name |
47 // * Packages contains an illegal package name |
48 // * Packages contains a duplicate package name |
48 // * Packages contains a duplicate package name |
49 // * A package already exists in another module for this class loader |
49 // * A package already exists in another module for this class loader |
50 // * Module is an unnamed module |
50 // * Module is an unnamed module |
|
51 // * num_packages is negative |
|
52 // * num_packages is non-zero when packages is null |
51 // NullPointerExceptions are thrown if module is null. |
53 // NullPointerExceptions are thrown if module is null. |
52 static void define_module(jobject module, jstring version, |
54 static void define_module(jobject module, jstring version, |
53 jstring location, jobjectArray packages, TRAPS); |
55 jstring location, const char* const* packages, |
|
56 jsize num_packages, TRAPS); |
54 |
57 |
55 // Provides the java.lang.reflect.Module for the unnamed module defined |
58 // Provides the java.lang.reflect.Module for the unnamed module defined |
56 // to the boot loader. |
59 // to the boot loader. |
57 // |
60 // |
58 // IllegalArgumentExceptions are thrown for the following : |
61 // IllegalArgumentExceptions are thrown for the following : |
70 // * Module from_module does not exist |
73 // * Module from_module does not exist |
71 // * Module to_module is not null and does not exist |
74 // * Module to_module is not null and does not exist |
72 // * Package is not syntactically correct |
75 // * Package is not syntactically correct |
73 // * Package is not defined for from_module's class loader |
76 // * Package is not defined for from_module's class loader |
74 // * Package is not in module from_module. |
77 // * Package is not in module from_module. |
75 static void add_module_exports(jobject from_module, jstring package, jobject to_module, TRAPS); |
78 static void add_module_exports(jobject from_module, const char* package, jobject to_module, TRAPS); |
76 |
79 |
77 // This does a qualified export of package in module from_module to module |
80 // This does a qualified export of package in module from_module to module |
78 // to_module. The format for the package name must use "/' not ".". |
81 // to_module. The format for the package name must use "/' not ".". |
79 // |
82 // |
80 // Error conditions causing IlegalArgumentException to be throw : |
83 // Error conditions causing IlegalArgumentException to be throw : |
81 // * Module from_module does not exist |
84 // * Module from_module does not exist |
82 // * Module to_module does not exist |
85 // * Module to_module does not exist |
83 // * Package is not syntactically correct |
86 // * Package is not syntactically correct |
84 // * Package is not defined for from_module's class loader |
87 // * Package is not defined for from_module's class loader |
85 // * Package is not in module from_module. |
88 // * Package is not in module from_module. |
86 static void add_module_exports_qualified(jobject from_module, jstring package, jobject to_module, TRAPS); |
89 static void add_module_exports_qualified(jobject from_module, const char* package, jobject to_module, TRAPS); |
87 |
90 |
88 // add_reads_module adds module to_module to the list of modules that from_module |
91 // add_reads_module adds module to_module to the list of modules that from_module |
89 // can read. If from_module is the same as to_module then this is a no-op. |
92 // can read. If from_module is the same as to_module then this is a no-op. |
90 // If to_module is null then from_module is marked as a loose module (meaning that |
93 // If to_module is null then from_module is marked as a loose module (meaning that |
91 // from_module can read all current and future unnamed modules). |
94 // from_module can read all current and future unnamed modules). |
100 // Returns NULL if the class loader has not loaded any classes in the package. |
103 // Returns NULL if the class loader has not loaded any classes in the package. |
101 // The package should contain /'s, not .'s, as in java/lang, not java.lang. |
104 // The package should contain /'s, not .'s, as in java/lang, not java.lang. |
102 // NullPointerException is thrown if package is null. |
105 // NullPointerException is thrown if package is null. |
103 // IllegalArgumentException is thrown if loader is neither null nor a subtype of |
106 // IllegalArgumentException is thrown if loader is neither null nor a subtype of |
104 // java/lang/ClassLoader. |
107 // java/lang/ClassLoader. |
105 static jobject get_module_by_package_name(jobject loader, jstring package, TRAPS); |
108 static jobject get_module_by_package_name(jobject loader, const char* package, TRAPS); |
106 static jobject get_named_module(Handle h_loader, const char* package, TRAPS); |
109 static jobject get_named_module(Handle h_loader, const char* package, TRAPS); |
107 |
110 |
108 // If package is defined by loader, return the |
111 // If package is defined by loader, return the |
109 // java.lang.reflect.Module object for the module in which the package is defined. |
112 // java.lang.reflect.Module object for the module in which the package is defined. |
110 // Returns NULL if package is invalid or not defined by loader. |
113 // Returns NULL if package is invalid or not defined by loader. |
114 // It throws IllegalArgumentException if: |
117 // It throws IllegalArgumentException if: |
115 // * Module is bad |
118 // * Module is bad |
116 // * Module is unnamed |
119 // * Module is unnamed |
117 // * Package is not syntactically correct |
120 // * Package is not syntactically correct |
118 // * Package is already defined for module's class loader. |
121 // * Package is already defined for module's class loader. |
119 static void add_module_package(jobject module, jstring package, TRAPS); |
122 static void add_module_package(jobject module, const char* package, TRAPS); |
120 |
123 |
121 // Marks the specified package as exported to all unnamed modules. |
124 // Marks the specified package as exported to all unnamed modules. |
122 // If either module or package is null then NullPointerException is thrown. |
125 // If either module or package is null then NullPointerException is thrown. |
123 // If module or package is bad, or module is unnamed, or package is not in |
126 // If module or package is bad, or module is unnamed, or package is not in |
124 // module then IllegalArgumentException is thrown. |
127 // module then IllegalArgumentException is thrown. |
125 static void add_module_exports_to_all_unnamed(jobject module, jstring package, TRAPS); |
128 static void add_module_exports_to_all_unnamed(jobject module, const char* package, TRAPS); |
126 |
129 |
127 // Return TRUE if package_name is syntactically valid, false otherwise. |
130 // Return TRUE if package_name is syntactically valid, false otherwise. |
128 static bool verify_package_name(char *package_name); |
131 static bool verify_package_name(const char *package_name); |
129 |
132 |
130 // Return TRUE iff package is defined by loader |
133 // Return TRUE iff package is defined by loader |
131 static bool is_package_defined(Symbol* package_name, Handle h_loader, TRAPS); |
134 static bool is_package_defined(Symbol* package_name, Handle h_loader, TRAPS); |
132 }; |
135 }; |
133 |
136 |