@@ -1065,9 +1065,7 @@ static MemorySegment ofAddress(long address) {
1065
1065
* @param byteSize the size (in bytes) of the returned native segment.
1066
1066
* @return a zero-length native segment with the given address and size.
1067
1067
* @throws IllegalArgumentException if {@code byteSize < 0}.
1068
- * @throws IllegalCallerException if access to this method occurs from a module {@code M} and the command line option
1069
- * {@code --enable-native-access} is specified, but does not mention the module name {@code M}, or
1070
- * {@code ALL-UNNAMED} in case {@code M} is an unnamed module.
1068
+ * @throws IllegalCallerException If the caller is in a module that does not have native access enabled.
1071
1069
*/
1072
1070
@ CallerSensitive
1073
1071
static MemorySegment ofAddress (long address , long byteSize ) {
@@ -1088,7 +1086,10 @@ static MemorySegment ofAddress(long address, long byteSize) {
1088
1086
* {@snippet lang = java:
1089
1087
* ofAddress(address, byteSize, scope, null);
1090
1088
*}
1091
- *
1089
+ * This method is <a href="package-summary.html#restricted"><em>restricted</em></a>.
1090
+ * Restricted methods are unsafe, and, if used incorrectly, their use might crash
1091
+ * the JVM or, worse, silently result in memory corruption. Thus, clients should refrain from depending on
1092
+ * restricted methods, and use safe and supported functionalities, where possible.
1092
1093
* @param address the returned segment's address.
1093
1094
* @param byteSize the desired size.
1094
1095
* @param scope the scope associated with the returned native segment.
@@ -1097,9 +1098,7 @@ static MemorySegment ofAddress(long address, long byteSize) {
1097
1098
* @throws IllegalStateException if {@code scope} is not {@linkplain SegmentScope#isAlive() alive}.
1098
1099
* @throws WrongThreadException if this method is called from a thread {@code T},
1099
1100
* such that {@code scope.isAccessibleBy(T) == false}.
1100
- * @throws IllegalCallerException if access to this method occurs from a module {@code M} and the command line option
1101
- * {@code --enable-native-access} is specified, but does not mention the module name {@code M}, or
1102
- * {@code ALL-UNNAMED} in case {@code M} is an unnamed module.
1101
+ * @throws IllegalCallerException If the caller is in a module that does not have native access enabled.
1103
1102
*/
1104
1103
@ CallerSensitive
1105
1104
@ ForceInline
@@ -1140,9 +1139,7 @@ static MemorySegment ofAddress(long address, long byteSize, SegmentScope scope)
1140
1139
* @throws IllegalStateException if {@code scope} is not {@linkplain SegmentScope#isAlive() alive}.
1141
1140
* @throws WrongThreadException if this method is called from a thread {@code T},
1142
1141
* such that {@code scope.isAccessibleBy(T) == false}.
1143
- * @throws IllegalCallerException if access to this method occurs from a module {@code M} and the command line option
1144
- * {@code --enable-native-access} is specified, but does not mention the module name {@code M}, or
1145
- * {@code ALL-UNNAMED} in case {@code M} is an unnamed module.
1142
+ * @throws IllegalCallerException If the caller is in a module that does not have native access enabled.
1146
1143
*/
1147
1144
@ CallerSensitive
1148
1145
static MemorySegment ofAddress (long address , long byteSize , SegmentScope scope , Runnable cleanupAction ) {
0 commit comments