Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/jcl/src/java.base/share/classes/java/lang/System.java
12513 views
1
/*[INCLUDE-IF Sidecar18-SE]*/
2
/*******************************************************************************
3
* Copyright (c) 1998, 2022 IBM Corp. and others
4
*
5
* This program and the accompanying materials are made available under
6
* the terms of the Eclipse Public License 2.0 which accompanies this
7
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
8
* or the Apache License, Version 2.0 which accompanies this distribution and
9
* is available at https://www.apache.org/licenses/LICENSE-2.0.
10
*
11
* This Source Code may also be made available under the following
12
* Secondary Licenses when the conditions for such availability set
13
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
14
* General Public License, version 2 with the GNU Classpath
15
* Exception [1] and GNU General Public License, version 2 with the
16
* OpenJDK Assembly Exception [2].
17
*
18
* [1] https://www.gnu.org/software/classpath/license.html
19
* [2] http://openjdk.java.net/legal/assembly-exception.html
20
*
21
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
22
*******************************************************************************/
23
package java.lang;
24
25
import java.io.*;
26
/*[IF Sidecar18-SE-OpenJ9 | JAVA_SPEC_VERSION >= 11]*/
27
import java.nio.charset.Charset;
28
/*[ENDIF] Sidecar18-SE-OpenJ9 | JAVA_SPEC_VERSION >= 11 */
29
import java.util.Map;
30
import java.util.Properties;
31
import java.util.PropertyPermission;
32
import java.security.*;
33
import java.lang.reflect.Method;
34
import java.lang.reflect.Constructor;
35
36
/*[IF Sidecar19-SE]*/
37
import jdk.internal.misc.Unsafe;
38
/*[IF JAVA_SPEC_VERSION >= 12]*/
39
import jdk.internal.access.SharedSecrets;
40
/*[ELSE] JAVA_SPEC_VERSION >= 12
41
import jdk.internal.misc.SharedSecrets;
42
/*[ENDIF] JAVA_SPEC_VERSION >= 12 */
43
import jdk.internal.misc.VM;
44
import java.lang.StackWalker.Option;
45
import jdk.internal.reflect.Reflection;
46
import jdk.internal.reflect.CallerSensitive;
47
import java.util.*;
48
import java.util.function.*;
49
/*[ELSE]
50
import sun.misc.Unsafe;
51
import sun.misc.SharedSecrets;
52
import sun.misc.VM;
53
import sun.reflect.CallerSensitive;
54
/*[ENDIF]*/
55
/*[IF Sidecar19-SE]*/
56
import com.ibm.gpu.spi.GPUAssist;
57
import com.ibm.gpu.spi.GPUAssistHolder;
58
/*[ENDIF] Sidecar19-SE */
59
/*[IF PLATFORM-mz31 | PLATFORM-mz64 | !Sidecar18-SE-OpenJ9]*/
60
import com.ibm.jvm.io.ConsolePrintStream;
61
/*[ENDIF] PLATFORM-mz31 | PLATFORM-mz64 | !Sidecar18-SE-OpenJ9 */
62
63
/**
64
* Class System provides a standard place for programs
65
* to find system related information. All System API
66
* is static.
67
*
68
* @author OTI
69
* @version initial
70
*/
71
public final class System {
72
73
// The standard input, output, and error streams.
74
// Typically, these are connected to the shell which
75
// ran the Java program.
76
/**
77
* Default input stream
78
*/
79
public static final InputStream in = null;
80
/**
81
* Default output stream
82
*/
83
public static final PrintStream out = null;
84
/**
85
* Default error output stream
86
*/
87
public static final PrintStream err = null;
88
/*[IF JAVA_SPEC_VERSION >= 17] */
89
// The initial err to print SecurityManager related warning messages
90
static PrintStream initialErr;
91
// Show only one setSecurityManager() warning message for each caller
92
private static Map<Class<?>, Object> setSMCallers;
93
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
94
95
/*[IF JAVA_SPEC_VERSION > 11] */
96
/**
97
* setSecurityManager() should throw UnsupportedOperationException
98
* if throwUOEFromSetSM is set to true.
99
*/
100
private static boolean throwUOEFromSetSM;
101
/*[ENDIF] JAVA_SPEC_VERSION > 11 */
102
103
//Get a ref to the Runtime instance for faster lookup
104
private static final Runtime RUNTIME = Runtime.getRuntime();
105
/**
106
* The System Properties table.
107
*/
108
private static Properties systemProperties;
109
110
/**
111
* The System default SecurityManager.
112
*/
113
private static SecurityManager security;
114
115
private static volatile Console console;
116
private static volatile boolean consoleInitialized;
117
118
private static String lineSeparator;
119
120
private static boolean propertiesInitialized;
121
122
private static String platformEncoding;
123
private static String fileEncoding;
124
private static String osEncoding;
125
126
private static final int sysPropID_PlatformEncoding = 1;
127
private static final int sysPropID_FileEncoding = 2;
128
private static final int sysPropID_OSEncoding = 3;
129
/*[IF JAVA_SPEC_VERSION >= 17]*/
130
private static final int sysPropID_OSVersion = 0;
131
private static final String sysPropOSVersion;
132
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
133
134
/*[IF JAVA_SPEC_VERSION >= 11]*/
135
private static boolean hasSetErrEncoding;
136
private static boolean hasSetOutEncoding;
137
private static String consoleDefaultEncoding;
138
/* The consoleDefaultCharset is different from the default console encoding when the encoding
139
* doesn't exist, or isn't available at startup. Some Charset's are not available in the
140
* java.base module and so are not used at startup.
141
*/
142
private static Charset consoleDefaultCharset;
143
/*[ENDIF] JAVA_SPEC_VERSION >= 11 */
144
145
/*[IF Sidecar19-SE]*/
146
static java.lang.ModuleLayer bootLayer;
147
/*[ENDIF]*/
148
149
// Initialize all the slots in System on first use.
150
static {
151
/* Get following system properties in clinit and make it available via static variables
152
* at early boot stage in which System is not fully initialized
153
* os.version, os.encoding, ibm.system.encoding/sun.jnu.encoding, file.encoding
154
*/
155
/*[IF JAVA_SPEC_VERSION >= 17]*/
156
sysPropOSVersion = getSysPropBeforePropertiesInitialized(sysPropID_OSVersion);
157
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
158
platformEncoding = getSysPropBeforePropertiesInitialized(sysPropID_PlatformEncoding);
159
String definedOSEncoding = getSysPropBeforePropertiesInitialized(sysPropID_OSEncoding);
160
/*[IF JAVA_SPEC_VERSION >= 18]*/
161
/* -Dfile.encoding=COMPAT is mapped to platform encoding within getSysPropBeforePropertiesInitialized.
162
* During early VM boot stage, JITHelpers hasn't been initialized yet, COMPACT_STRINGS related APIs
163
* might not work properly.
164
*/
165
/*[ENDIF] JAVA_SPEC_VERSION >= 18 */
166
String definedFileEncoding = getSysPropBeforePropertiesInitialized(sysPropID_FileEncoding);
167
if (definedFileEncoding != null) {
168
fileEncoding = definedFileEncoding;
169
// if file.encoding is defined, and os.encoding is not, use the detected
170
// platform encoding for os.encoding
171
if (definedOSEncoding == null) {
172
osEncoding = platformEncoding;
173
}
174
} else {
175
fileEncoding = platformEncoding;
176
}
177
// if os.encoding is not defined, file.encoding will be used
178
if (osEncoding == null) {
179
osEncoding = definedOSEncoding;
180
}
181
}
182
183
/*[IF JAVA_SPEC_VERSION >= 11]*/
184
/*
185
* Return the Charset of the primary or when fallback is true, the default console encoding,
186
* if different from the default console Charset.
187
*
188
* consoleDefaultCharset must be initialized before calling.
189
* consoleDefaultEncoding must be initialized before calling with fallback set to true.
190
*/
191
static Charset getCharset(String primary, boolean fallback) {
192
if (primary != null) {
193
try {
194
Charset newCharset = Charset.forName(primary);
195
if (newCharset.equals(consoleDefaultCharset)) {
196
return null;
197
} else {
198
return newCharset;
199
}
200
} catch (IllegalArgumentException e) {
201
// ignore unsupported or invalid encodings
202
}
203
}
204
if (fallback && (consoleDefaultEncoding != null)) {
205
try {
206
Charset newCharset = Charset.forName(consoleDefaultEncoding);
207
if (newCharset.equals(consoleDefaultCharset)) {
208
return null;
209
} else {
210
return newCharset;
211
}
212
} catch (IllegalArgumentException e) {
213
// ignore unsupported or invalid encodings
214
}
215
}
216
return null;
217
}
218
219
/*
220
* Return if sun.stderr.encoding was used.
221
*/
222
static boolean hasSetErrEncoding() {
223
return hasSetErrEncoding;
224
}
225
226
/*
227
* Return if sun.stdout.encoding was used.
228
*/
229
static boolean hasSetOutEncoding() {
230
return hasSetOutEncoding;
231
}
232
233
/*
234
* Return the appropriate System console using the requested Charset.
235
* If the Charset is null use the default console Charset.
236
*
237
* consoleDefaultCharset must be initialized before calling.
238
*/
239
static PrintStream createConsole(FileDescriptor desc, Charset charset) {
240
BufferedOutputStream bufStream = new BufferedOutputStream(new FileOutputStream(desc));
241
Charset consoleCharset = charset == null ? consoleDefaultCharset : charset;
242
/*[IF PLATFORM-mz31 | PLATFORM-mz64]*/
243
return ConsolePrintStream.localize(bufStream, true, consoleCharset);
244
/*[ELSE]*/
245
return new PrintStream(bufStream, true, consoleCharset);
246
/*[ENDIF] PLATFORM-mz31 | PLATFORM-mz64 */
247
}
248
/*[ELSE]*/
249
/*[IF Sidecar18-SE-OpenJ9]*/
250
/*
251
* Return the Charset name of the primary encoding, if different from the default.
252
*/
253
private static String getCharsetName(String primary, Charset defaultCharset) {
254
if (primary != null) {
255
try {
256
Charset newCharset = Charset.forName(primary);
257
if (newCharset.equals(defaultCharset)) {
258
return null;
259
} else {
260
return newCharset.name();
261
}
262
} catch (IllegalArgumentException e) {
263
// ignore unsupported or invalid encodings
264
}
265
}
266
return null;
267
}
268
269
/*
270
* Return the appropriate System console using the pre-validated encoding.
271
*/
272
private static PrintStream createConsole(FileDescriptor desc, String encoding) {
273
BufferedOutputStream bufStream = new BufferedOutputStream(new FileOutputStream(desc));
274
if (encoding == null) {
275
return new PrintStream(bufStream, true);
276
} else {
277
try {
278
return new PrintStream(bufStream, true, encoding);
279
} catch (UnsupportedEncodingException e) {
280
// not possible when the Charset name is validated first
281
throw new InternalError("For encoding " + encoding, e); //$NON-NLS-1$
282
}
283
}
284
}
285
/*[ELSE]*/
286
/*
287
* Return the appropriate System console.
288
*/
289
private static PrintStream createConsole(FileDescriptor desc) {
290
return ConsolePrintStream.localize(new BufferedOutputStream(new FileOutputStream(desc)), true);
291
}
292
/*[ENDIF] Sidecar18-SE-OpenJ9 */
293
/*[ENDIF] JAVA_SPEC_VERSION >= 11 */
294
295
static void afterClinitInitialization() {
296
/*[PR CMVC 189091] Perf: EnumSet.allOf() is slow */
297
/*[PR CMVC 191554] Provide access to ClassLoader methods to improve performance */
298
/* Multitenancy change: only initialize VMLangAccess once as it's non-isolated */
299
if (null == com.ibm.oti.vm.VM.getVMLangAccess()) {
300
com.ibm.oti.vm.VM.setVMLangAccess(new VMAccess());
301
}
302
303
// Fill in the properties from the VM information.
304
ensureProperties(true);
305
306
/*[PR CMVC 150472] sun.misc.SharedSecrets needs access to java.lang. */
307
SharedSecrets.setJavaLangAccess(new Access());
308
309
/*[IF JAVA_SPEC_VERSION >= 11]*/
310
initJCLPlatformEncoding();
311
/*[ENDIF] JAVA_SPEC_VERSION >= 11 */
312
313
/*[REM] Initialize the JITHelpers needed in J9VMInternals since the class can't do it itself */
314
try {
315
java.lang.reflect.Field f1 = J9VMInternals.class.getDeclaredField("jitHelpers"); //$NON-NLS-1$
316
java.lang.reflect.Field f2 = String.class.getDeclaredField("helpers"); //$NON-NLS-1$
317
318
Unsafe unsafe = Unsafe.getUnsafe();
319
320
unsafe.putObject(unsafe.staticFieldBase(f1), unsafe.staticFieldOffset(f1), com.ibm.jit.JITHelpers.getHelpers());
321
unsafe.putObject(unsafe.staticFieldBase(f2), unsafe.staticFieldOffset(f2), com.ibm.jit.JITHelpers.getHelpers());
322
} catch (NoSuchFieldException e) { }
323
324
/*[IF JAVA_SPEC_VERSION < 17]*/
325
/**
326
* When the System Property == true, then disable sharing (i.e. arraycopy the underlying value array) in
327
* String.substring(int) and String.substring(int, int) methods whenever offset is zero. Otherwise, enable
328
* sharing of the underlying value array.
329
*/
330
String enableSharingInSubstringWhenOffsetIsZeroProperty = internalGetProperties().getProperty("java.lang.string.substring.nocopy"); //$NON-NLS-1$
331
String.enableSharingInSubstringWhenOffsetIsZero = enableSharingInSubstringWhenOffsetIsZeroProperty == null || enableSharingInSubstringWhenOffsetIsZeroProperty.equalsIgnoreCase("false"); //$NON-NLS-1$
332
333
// Set up standard in, out, and err.
334
/*[PR CMVC 193070] - OTT:Java 8 Test_JITHelpers test_getSuperclass NoSuchMet*/
335
/*[PR JAZZ 58297] - continue with the rules defined by JAZZ 57070 - Build a Java 8 J9 JCL using the SIDECAR18 preprocessor configuration */
336
// Check the default encoding
337
/*[Bug 102075] J2SE Setting -Dfile.encoding=junk fails to run*/
338
/*[IF JAVA_SPEC_VERSION >= 11]*/
339
StringCoding.encode(String.LATIN1, new byte[1]);
340
/*[ELSE]*/
341
StringCoding.encode(new char[1], 0, 1);
342
/*[ENDIF] JAVA_SPEC_VERSION >= 11 */
343
/*[ENDIF] JAVA_SPEC_VERSION < 17 */
344
345
/*[IF Sidecar18-SE-OpenJ9]*/
346
Properties props = internalGetProperties();
347
/*[IF JAVA_SPEC_VERSION >= 11]*/
348
/*[IF JAVA_SPEC_VERSION >= 18]*/
349
consoleDefaultCharset = Charset.forName(props.getProperty("native.encoding"), sun.nio.cs.US_ASCII.INSTANCE);
350
/*[ELSE] JAVA_SPEC_VERSION >= 18 */
351
consoleDefaultCharset = Charset.defaultCharset();
352
/*[ENDIF] JAVA_SPEC_VERSION >= 18 */
353
/*[IF PLATFORM-mz31|PLATFORM-mz64]*/
354
try {
355
consoleDefaultEncoding = props.getProperty("console.encoding"); //$NON-NLS-1$
356
if (consoleDefaultEncoding == null) {
357
consoleDefaultEncoding = props.getProperty("ibm.system.encoding"); //$NON-NLS-1$
358
}
359
consoleDefaultCharset = Charset.forName(consoleDefaultEncoding); //$NON-NLS-1$
360
} catch (IllegalArgumentException e) {
361
// use the defaultCharset()
362
}
363
/*[ELSE] PLATFORM-mz31|PLATFORM-mz64 */
364
/*[IF JAVA_SPEC_VERSION >= 18]*/
365
consoleDefaultEncoding = props.getProperty("native.encoding"); //$NON-NLS-1$
366
/*[ELSE] JAVA_SPEC_VERSION >= 18 */
367
consoleDefaultEncoding = props.getProperty("file.encoding"); //$NON-NLS-1$
368
/*[ENDIF] JAVA_SPEC_VERSION >= 18 */
369
/*[ENDIF] PLATFORM-mz31|PLATFORM-mz64 */
370
/* consoleDefaultCharset must be initialized before calling getCharset() */
371
Charset stdoutCharset = getCharset(props.getProperty("sun.stdout.encoding"), false); //$NON-NLS-1$
372
Charset stderrCharset = getCharset(props.getProperty("sun.stderr.encoding"), false); //$NON-NLS-1$
373
/*[ELSE] JAVA_SPEC_VERSION >= 11 */
374
Charset consoleCharset = Charset.defaultCharset();
375
String stdoutCharset = getCharsetName(props.getProperty("sun.stdout.encoding"), consoleCharset); //$NON-NLS-1$
376
String stderrCharset = getCharsetName(props.getProperty("sun.stderr.encoding"), consoleCharset); //$NON-NLS-1$
377
/*[ENDIF] JAVA_SPEC_VERSION >= 11 */
378
/*[ENDIF] Sidecar18-SE-OpenJ9 */
379
380
/*[IF Sidecar18-SE-OpenJ9]*/
381
/*[IF JAVA_SPEC_VERSION >= 11]*/
382
if (stderrCharset != null) {
383
hasSetErrEncoding = true;
384
}
385
if (stdoutCharset != null) {
386
hasSetOutEncoding = true;
387
}
388
/* consoleDefaultCharset must be initialized before calling createConsole() */
389
/*[ENDIF] JAVA_SPEC_VERSION >= 11 */
390
/*[IF JAVA_SPEC_VERSION >= 17] */
391
initialErr = createConsole(FileDescriptor.err, stderrCharset);
392
setErr(initialErr);
393
/*[ELSE] JAVA_SPEC_VERSION >= 17 */
394
setErr(createConsole(FileDescriptor.err, stderrCharset));
395
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
396
setOut(createConsole(FileDescriptor.out, stdoutCharset));
397
/*[IF Sidecar19-SE_RAWPLUSJ9]*/
398
setIn(new BufferedInputStream(new FileInputStream(FileDescriptor.in)));
399
/*[ENDIF] Sidecar19-SE_RAWPLUSJ9 */
400
/*[ELSE]*/
401
/*[PR s66168] - ConsoleInputStream initialization may write to System.err */
402
/*[PR s73550, s74314] ConsolePrintStream incorrectly initialized */
403
setErr(createConsole(FileDescriptor.err));
404
setOut(createConsole(FileDescriptor.out));
405
/*[ENDIF] Sidecar18-SE-OpenJ9 */
406
407
/*[IF JAVA_SPEC_VERSION >= 17] */
408
setSMCallers = Collections.synchronizedMap(new WeakHashMap<>());
409
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
410
}
411
412
native static void startSNMPAgent();
413
414
static void completeInitialization() {
415
/*[IF !Sidecar19-SE_RAWPLUSJ9]*/
416
/*[IF !Sidecar18-SE-OpenJ9]*/
417
Class<?> systemInitialization = null;
418
Method hook;
419
try {
420
/*[PR 167854] - Please note the incorrect name of the class is correct - somewhere the spelling was wrong and we just need to use the incorrect spelling */
421
/*[IF Sidecar19-SE]*/
422
systemInitialization = Class.forName("com.ibm.utils.SystemIntialization"); //$NON-NLS-1$
423
/*[ELSE]*/
424
systemInitialization = Class.forName("com.ibm.misc.SystemIntialization"); //$NON-NLS-1$
425
/*[ENDIF]*/
426
} catch (ClassNotFoundException e) {
427
// Assume this is a raw configuration and suppress the exception
428
} catch (Exception e) {
429
throw new InternalError(e.toString());
430
}
431
try {
432
if (null != systemInitialization) {
433
hook = systemInitialization.getMethod("firstChanceHook"); //$NON-NLS-1$
434
hook.invoke(null);
435
}
436
} catch (Exception e) {
437
throw new InternalError(e.toString());
438
}
439
/*[ENDIF]*/ // Sidecar18-SE-OpenJ9
440
441
/*[IF (Sidecar18-SE-OpenJ9|Sidecar19-SE)&!(PLATFORM-mz31|PLATFORM-mz64)]*/
442
setIn(new BufferedInputStream(new FileInputStream(FileDescriptor.in)));
443
/*[ELSE]*/
444
/*[PR 100718] Initialize System.in after the main thread*/
445
setIn(com.ibm.jvm.io.ConsoleInputStream.localize(new BufferedInputStream(new FileInputStream(FileDescriptor.in))));
446
/*[ENDIF]*/ //Sidecar18-SE-OpenJ9|Sidecar19-SE
447
/*[ENDIF]*/ //!Sidecar19-SE_RAWPLUSJ9
448
449
/*[PR 102344] call Terminator.setup() after Thread init */
450
Terminator.setup();
451
452
/*[IF !Sidecar19-SE_RAWPLUSJ9&!Sidecar18-SE-OpenJ9]*/
453
try {
454
if (null != systemInitialization) {
455
hook = systemInitialization.getMethod("lastChanceHook"); //$NON-NLS-1$
456
hook.invoke(null);
457
}
458
} catch (Exception e) {
459
throw new InternalError(e.toString());
460
}
461
/*[ENDIF]*/ //!Sidecar19-SE_RAWPLUSJ9&!Sidecar18-SE-OpenJ9
462
}
463
464
/*[IF Sidecar19-SE]*/
465
static void initGPUAssist() {
466
Properties props = internalGetProperties();
467
468
if ((props.getProperty("com.ibm.gpu.enable") == null) //$NON-NLS-1$
469
&& (props.getProperty("com.ibm.gpu.enforce") == null) //$NON-NLS-1$
470
) {
471
/*
472
* The CUDA implementation of GPUAssist is not enabled by default:
473
* one of the above properties must be set.
474
*/
475
return;
476
}
477
478
PrivilegedAction<GPUAssist> finder = new PrivilegedAction<GPUAssist>() {
479
@Override
480
public GPUAssist run() {
481
ServiceLoader<GPUAssist.Provider> loaded = ServiceLoader.load(GPUAssist.Provider.class);
482
483
for (GPUAssist.Provider provider : loaded) {
484
GPUAssist assist = provider.getGPUAssist();
485
486
if (assist != null) {
487
return assist;
488
}
489
}
490
491
return GPUAssist.NONE;
492
}
493
};
494
495
GPUAssistHolder.instance = AccessController.doPrivileged(finder);
496
}
497
/*[ENDIF] Sidecar19-SE */
498
499
/**
500
* Sets the value of the static slot "in" in the receiver
501
* to the passed in argument.
502
*
503
* @param newIn the new value for in.
504
*/
505
public static void setIn(InputStream newIn) {
506
@SuppressWarnings("removal")
507
SecurityManager security = System.getSecurityManager();
508
if (security != null) {
509
security.checkPermission(com.ibm.oti.util.RuntimePermissions.permissionSetIO);
510
}
511
512
setFieldImpl("in", newIn); //$NON-NLS-1$
513
}
514
515
/**
516
* Sets the value of the static slot "out" in the receiver
517
* to the passed in argument.
518
*
519
* @param newOut the new value for out.
520
*/
521
public static void setOut(java.io.PrintStream newOut) {
522
@SuppressWarnings("removal")
523
SecurityManager security = System.getSecurityManager();
524
if (security != null) {
525
security.checkPermission(com.ibm.oti.util.RuntimePermissions.permissionSetIO);
526
}
527
setFieldImpl("out", newOut); //$NON-NLS-1$
528
}
529
530
/**
531
* Sets the value of the static slot "err" in the receiver
532
* to the passed in argument.
533
*
534
* @param newErr the new value for err.
535
*/
536
public static void setErr(java.io.PrintStream newErr) {
537
@SuppressWarnings("removal")
538
SecurityManager security = System.getSecurityManager();
539
if (security != null) {
540
security.checkPermission(com.ibm.oti.util.RuntimePermissions.permissionSetIO);
541
}
542
543
setFieldImpl("err", newErr); //$NON-NLS-1$
544
}
545
546
/**
547
* Prevents this class from being instantiated.
548
*/
549
private System() {
550
}
551
552
/**
553
* Copies the contents of <code>array1</code> starting at offset <code>start1</code>
554
* into <code>array2</code> starting at offset <code>start2</code> for
555
* <code>length</code> elements.
556
*
557
* @param array1 the array to copy out of
558
* @param start1 the starting index in array1
559
* @param array2 the array to copy into
560
* @param start2 the starting index in array2
561
* @param length the number of elements in the array to copy
562
*/
563
public static native void arraycopy(Object array1, int start1, Object array2, int start2, int length);
564
565
/**
566
* Private version of the arraycopy method used by the jit for reference arraycopies
567
*/
568
private static void arraycopy(Object[] A1, int offset1, Object[] A2, int offset2, int length) {
569
if (A1 == null || A2 == null) throw new NullPointerException();
570
if (offset1 >= 0 && offset2 >= 0 && length >= 0 &&
571
length <= A1.length - offset1 && length <= A2.length - offset2)
572
{
573
// Check if this is a forward or backwards arraycopy
574
if (A1 != A2 || offset1 > offset2 || offset1+length <= offset2) {
575
for (int i = 0; i < length; ++i) {
576
A2[offset2+i] = A1[offset1+i];
577
}
578
} else {
579
for (int i = length-1; i >= 0; --i) {
580
A2[offset2+i] = A1[offset1+i];
581
}
582
}
583
} else throw new ArrayIndexOutOfBoundsException();
584
}
585
586
587
/**
588
* Answers the current time expressed as milliseconds since
589
* the time 00:00:00 UTC on January 1, 1970.
590
*
591
* @return the time in milliseconds.
592
*/
593
public static native long currentTimeMillis();
594
595
/*[IF OpenJ9-RawBuild]*/
596
/* This is a JCL native required only by OpenJ9 raw build.
597
* OpenJ9 raw build is a combination of OpenJ9 and OpenJDK binaries without JCL patches within extension repo.
598
* Currently OpenJ9 depends on a JCL patch to initialize platform encoding which is not available to raw build.
599
* A workaround for raw build is to invoke this JCL native which initializes platform encoding.
600
* This workaround can be removed if that JCL patch is not required.
601
*/
602
private static native Properties initProperties(Properties props);
603
/*[ENDIF] OpenJ9-RawBuild */
604
605
/**
606
* If systemProperties is unset, then create a new one based on the values
607
* provided by the virtual machine.
608
*/
609
@SuppressWarnings("nls")
610
private static void ensureProperties(boolean isInitialization) {
611
/*[IF OpenJ9-RawBuild]*/
612
// invoke JCL native to initialize platform encoding
613
initProperties(new Properties());
614
/*[ENDIF] OpenJ9-RawBuild */
615
616
/*[IF JAVA_SPEC_VERSION >= 12]*/
617
Map<String, String> initializedProperties = new Hashtable<String, String>();
618
/*[ELSE] JAVA_SPEC_VERSION >= 12
619
Properties initializedProperties = new Properties();
620
/*[ENDIF] JAVA_SPEC_VERSION >= 12 */
621
622
/*[IF JAVA_SPEC_VERSION >= 17]*/
623
initializedProperties.put("os.version", sysPropOSVersion); //$NON-NLS-1$
624
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
625
626
if (osEncoding != null) {
627
initializedProperties.put("os.encoding", osEncoding); //$NON-NLS-1$
628
}
629
/*[PR The launcher apparently needs sun.jnu.encoding property or it does not work]*/
630
initializedProperties.put("ibm.system.encoding", platformEncoding); //$NON-NLS-1$
631
initializedProperties.put("sun.jnu.encoding", platformEncoding); //$NON-NLS-1$
632
initializedProperties.put("file.encoding.pkg", "sun.io"); //$NON-NLS-1$ //$NON-NLS-2$
633
/*[IF JAVA_SPEC_VERSION < 12]*/
634
/* System property java.specification.vendor is set via VersionProps.init(systemProperties) since JDK12 */
635
initializedProperties.put("java.specification.vendor", "Oracle Corporation"); //$NON-NLS-1$ //$NON-NLS-2$
636
/*[ENDIF] JAVA_SPEC_VERSION < 12 */
637
initializedProperties.put("java.specification.name", "Java Platform API Specification"); //$NON-NLS-1$ //$NON-NLS-2$
638
initializedProperties.put("com.ibm.oti.configuration", "scar"); //$NON-NLS-1$
639
640
/*[IF CRIU_SUPPORT]*/
641
initializedProperties.put("org.eclipse.openj9.criu.isCRIUCapable", "true"); //$NON-NLS-1$ //$NON-NLS-2$
642
/*[ENDIF] CRIU_SUPPORT*/
643
644
String[] list = getPropertyList();
645
for (int i = 0; i < list.length; i += 2) {
646
String key = list[i];
647
/*[PR 100209] getPropertyList should use fewer local refs */
648
if (key == null) {
649
break;
650
}
651
initializedProperties.put(key, list[i+1]);
652
}
653
initializedProperties.put("file.encoding", fileEncoding); //$NON-NLS-1$
654
655
/*[IF JAVA_SPEC_VERSION >= 17]*/
656
/* Set native.encoding after setting all the defined properties, it can't be modified by using -D on the command line */
657
initializedProperties.put("native.encoding", platformEncoding); //$NON-NLS-1$
658
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
659
660
/* java.lang.VersionProps.init() eventually calls into System.setProperty() where propertiesInitialized needs to be true */
661
propertiesInitialized = true;
662
663
/*[IF JAVA_SPEC_VERSION >= 12]*/
664
java.lang.VersionProps.init(initializedProperties);
665
/*[ELSE] JAVA_SPEC_VERSION >= 12
666
/* VersionProps.init requires systemProperties to be set */
667
systemProperties = initializedProperties;
668
669
/*[IF Sidecar19-SE]*/
670
java.lang.VersionProps.init();
671
/*[ELSE]
672
sun.misc.Version.init();
673
674
StringBuffer.initFromSystemProperties(systemProperties);
675
StringBuilder.initFromSystemProperties(systemProperties);
676
/*[ENDIF] Sidecar19-SE */
677
/*[ENDIF] JAVA_SPEC_VERSION >= 12 */
678
679
/*[IF JAVA_SPEC_VERSION >= 12]*/
680
String javaRuntimeVersion = initializedProperties.get("java.runtime.version"); //$NON-NLS-1$
681
/*[ELSE] JAVA_SPEC_VERSION >= 12
682
String javaRuntimeVersion = initializedProperties.getProperty("java.runtime.version"); //$NON-NLS-1$
683
/*[ENDIF] JAVA_SPEC_VERSION >= 12 */
684
if (null != javaRuntimeVersion) {
685
/*[IF JAVA_SPEC_VERSION >= 12]*/
686
String fullVersion = initializedProperties.get("java.fullversion"); //$NON-NLS-1$
687
/*[ELSE] JAVA_SPEC_VERSION >= 12
688
String fullVersion = initializedProperties.getProperty("java.fullversion"); //$NON-NLS-1$
689
/*[ENDIF] JAVA_SPEC_VERSION >= 12 */
690
if (null != fullVersion) {
691
initializedProperties.put("java.fullversion", (javaRuntimeVersion + "\n" + fullVersion)); //$NON-NLS-1$ //$NON-NLS-2$
692
}
693
rasInitializeVersion(javaRuntimeVersion);
694
}
695
696
/*[IF JAVA_SPEC_VERSION >= 12]*/
697
lineSeparator = initializedProperties.getOrDefault("line.separator", "\n"); //$NON-NLS-1$
698
/*[ELSE] JAVA_SPEC_VERSION >= 12
699
lineSeparator = initializedProperties.getProperty("line.separator", "\n"); //$NON-NLS-1$
700
/*[ENDIF] JAVA_SPEC_VERSION >= 12 */
701
702
if (isInitialization) {
703
/*[PR CMVC 179976] System.setProperties(null) throws IllegalStateException */
704
/*[IF JAVA_SPEC_VERSION >= 12]*/
705
VM.saveProperties(initializedProperties);
706
/*[ELSE] JAVA_SPEC_VERSION >= 12
707
VM.saveAndRemoveProperties(initializedProperties);
708
/*[ENDIF] JAVA_SPEC_VERSION >= 12 */
709
}
710
711
/* create systemProperties from properties Map */
712
/*[IF JAVA_SPEC_VERSION >= 12]*/
713
initializeSystemProperties(initializedProperties);
714
/*[ELSE] JAVA_SPEC_VERSION >= 12
715
systemProperties = initializedProperties;
716
/*[ENDIF] JAVA_SPEC_VERSION >= 12 */
717
718
/* Preload system property jdk.serialFilter to prevent later modification */
719
jdk.internal.util.StaticProperty.jdkSerialFilter();
720
}
721
722
/* Converts a Map<String, String> to a properties object.
723
*
724
* The system properties will be initialized as a Map<String, String> type to be compatible
725
* with jdk.internal.misc.VM and java.lang.VersionProps APIs.
726
*/
727
private static void initializeSystemProperties(Map<String, String> mapProperties) {
728
systemProperties = new Properties();
729
for (Map.Entry<String, String> property : mapProperties.entrySet()) {
730
systemProperties.put(property.getKey(), property.getValue());
731
}
732
}
733
734
private static native void rasInitializeVersion(String javaRuntimeVersion);
735
736
/**
737
* Causes the virtual machine to stop running, and the
738
* program to exit. If runFinalizersOnExit(true) has been
739
* invoked, then all finalizers will be run first.
740
*
741
* @param code the return code.
742
*
743
* @throws SecurityException if the running thread is not allowed to cause the vm to exit.
744
*
745
* @see SecurityManager#checkExit
746
*/
747
public static void exit(int code) {
748
RUNTIME.exit(code);
749
}
750
751
/**
752
* Indicate to the virtual machine that it would be a
753
* good time to collect available memory. Note that, this
754
* is a hint only.
755
*/
756
public static void gc() {
757
RUNTIME.gc();
758
}
759
760
/*[PR 127013] [JCL Desktop]VM throws runtime exception(no such method signature) when calling System.getenv() function (SPR MXZU76W5R5)*/
761
/**
762
* Returns an environment variable.
763
*
764
* @param var the name of the environment variable
765
* @return the value of the specified environment variable
766
*/
767
@SuppressWarnings("dep-ann")
768
public static String getenv(String var) {
769
if (var == null) throw new NullPointerException();
770
@SuppressWarnings("removal")
771
SecurityManager security = System.getSecurityManager();
772
if (security != null)
773
security.checkPermission(new RuntimePermission("getenv." + var)); //$NON-NLS-1$
774
775
return ProcessEnvironment.getenv(var);
776
}
777
778
/**
779
* Answers the system properties. Note that this is
780
* not a copy, so that changes made to the returned
781
* Properties object will be reflected in subsequent
782
* calls to {@code getProperty()} and {@code getProperties()}.
783
* <p>
784
* Security managers should restrict access to this
785
* API if possible.
786
*
787
* @return the system properties
788
*/
789
public static Properties getProperties() {
790
if (!propertiesInitialized) throw new Error("bootstrap error, system property access before init"); //$NON-NLS-1$
791
@SuppressWarnings("removal")
792
SecurityManager security = System.getSecurityManager();
793
if (security != null)
794
security.checkPropertiesAccess();
795
796
return systemProperties;
797
}
798
799
/**
800
* Answers the system properties without any security
801
* checks. This is used for access from within java.lang.
802
*
803
* @return the system properties
804
*/
805
static Properties internalGetProperties() {
806
if (!propertiesInitialized) throw new Error("bootstrap error, system property access before init"); //$NON-NLS-1$
807
808
return systemProperties;
809
}
810
/**
811
* Answers the value of a particular system property.
812
* Answers null if no such property exists.
813
* <p>
814
* The properties currently provided by the virtual
815
* machine are:
816
* <pre>
817
* file.separator
818
* java.class.path
819
* java.class.version
820
* java.home
821
/*[IF JAVA_SPEC_VERSION < 12]
822
* java.vendor
823
* java.vendor.url
824
/*[ENDIF] JAVA_SPEC_VERSION < 12
825
* java.version
826
* line.separator
827
* os.arch
828
* os.name
829
* os.version
830
* path.separator
831
* user.dir
832
* user.home
833
* user.name
834
* user.timezone
835
* </pre>
836
*
837
* @param prop the system property to look up
838
* @return the value of the specified system property, or null if the property doesn't exist
839
*/
840
@SuppressWarnings("nls")
841
public static String getProperty(String prop) {
842
return getProperty(prop, null);
843
}
844
845
/**
846
* Answers the value of a particular system property.
847
* If no such property is found, answers the defaultValue.
848
*
849
* @param prop the system property to look up
850
* @param defaultValue return value if system property is not found
851
* @return the value of the specified system property, or defaultValue if the property doesn't exist
852
*/
853
public static String getProperty(String prop, String defaultValue) {
854
if (prop.length() == 0) throw new IllegalArgumentException();
855
856
@SuppressWarnings("removal")
857
SecurityManager security = System.getSecurityManager();
858
if (security != null)
859
security.checkPropertyAccess(prop);
860
861
if (!propertiesInitialized
862
&& !prop.equals("com.ibm.IgnoreMalformedInput") //$NON-NLS-1$
863
&& !prop.equals("file.encoding.pkg") //$NON-NLS-1$
864
&& !prop.equals("sun.nio.cs.map") //$NON-NLS-1$
865
) {
866
/*[IF JAVA_SPEC_VERSION >= 17]*/
867
if (prop.equals("os.version")) { //$NON-NLS-1$
868
return sysPropOSVersion;
869
} else
870
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
871
if (prop.equals("os.encoding")) { //$NON-NLS-1$
872
return osEncoding;
873
} else if (prop.equals("ibm.system.encoding")) { //$NON-NLS-1$
874
return platformEncoding;
875
} else if (prop.equals("file.encoding")) { //$NON-NLS-1$
876
return fileEncoding;
877
}
878
throw new Error("bootstrap error, system property access before init: " + prop); //$NON-NLS-1$
879
}
880
881
return systemProperties.getProperty(prop, defaultValue);
882
}
883
884
/**
885
* Sets the value of a particular system property.
886
*
887
* @param prop the system property to change
888
* @param value the value to associate with prop
889
* @return the old value of the property, or null
890
*/
891
public static String setProperty(String prop, String value) {
892
if (!propertiesInitialized) throw new Error("bootstrap error, system property access before init: " + prop); //$NON-NLS-1$
893
894
/*[PR CMVC 80288] should check for empty key */
895
if (prop.length() == 0) throw new IllegalArgumentException();
896
897
@SuppressWarnings("removal")
898
SecurityManager security = System.getSecurityManager();
899
if (security != null)
900
security.checkPermission(
901
new PropertyPermission(prop, "write")); //$NON-NLS-1$
902
903
return (String)systemProperties.setProperty(prop, value);
904
}
905
906
/**
907
* Answers an array of Strings containing key..value pairs
908
* (in consecutive array elements) which represent the
909
* starting values for the system properties as provided
910
* by the virtual machine.
911
*
912
* @return the default values for the system properties.
913
*/
914
private static native String [] getPropertyList();
915
916
/*[IF JAVA_SPEC_VERSION >= 11]*/
917
/**
918
* Invoke JCL native to initialize platform encoding explicitly.
919
*/
920
private static native void initJCLPlatformEncoding();
921
/*[ENDIF] JAVA_SPEC_VERSION >= 11 */
922
923
/**
924
* Before propertiesInitialized is set to true,
925
* this returns the requested system property according to sysPropID:
926
* 0 - os.version
927
* 1 - platform encoding
928
* 2 - file.encoding
929
* 3 - os.encoding
930
* Reserved for future
931
*/
932
private static native String getSysPropBeforePropertiesInitialized(int sysPropID);
933
934
/**
935
* Answers the active security manager.
936
*
937
* @return the system security manager object.
938
*/
939
/*[IF (JAVA_SPEC_VERSION >= 17) & OPENJDK_METHODHANDLES] */
940
@Deprecated(since="17", forRemoval=true)
941
/*[ENDIF] (JAVA_SPEC_VERSION >= 17) & OPENJDK_METHODHANDLES */
942
public static SecurityManager getSecurityManager() {
943
return security;
944
}
945
946
/**
947
* Answers an integer hash code for the parameter.
948
* The hash code returned is the same one that would
949
* be returned by java.lang.Object.hashCode(), whether
950
* or not the object's class has overridden hashCode().
951
* The hash code for null is 0.
952
*
953
* @param anObject the object
954
* @return the hash code for the object
955
*
956
* @see java.lang.Object#hashCode
957
*/
958
public static int identityHashCode(Object anObject) {
959
if (anObject == null) {
960
return 0;
961
}
962
return J9VMInternals.fastIdentityHashCode(anObject);
963
}
964
965
/**
966
* Loads the specified file as a dynamic library.
967
*
968
* @param pathName the path of the file to be loaded
969
*/
970
@CallerSensitive
971
public static void load(String pathName) {
972
@SuppressWarnings("removal")
973
SecurityManager smngr = System.getSecurityManager();
974
if (smngr != null) {
975
smngr.checkLink(pathName);
976
}
977
/*[IF JAVA_SPEC_VERSION >= 15]*/
978
File fileName = new File(pathName);
979
if (fileName.isAbsolute()) {
980
ClassLoader.loadLibrary(getCallerClass(), fileName);
981
} else {
982
/*[MSG "K0648", "Not an absolute path: {0}"]*/
983
throw new UnsatisfiedLinkError(com.ibm.oti.util.Msg.getString("K0648", pathName));//$NON-NLS-1$
984
}
985
/*[ELSE]
986
ClassLoader.loadLibraryWithPath(pathName, ClassLoader.callerClassLoader(), null);
987
/*[ENDIF] JAVA_SPEC_VERSION >= 15 */
988
}
989
990
/**
991
* Loads and links the library specified by the argument.
992
*
993
* @param libName the name of the library to load
994
*
995
* @throws UnsatisfiedLinkError if the library could not be loaded
996
* @throws SecurityException if the library was not allowed to be loaded
997
*/
998
@CallerSensitive
999
public static void loadLibrary(String libName) {
1000
@SuppressWarnings("removal")
1001
SecurityManager smngr = System.getSecurityManager();
1002
if (smngr != null) {
1003
smngr.checkLink(libName);
1004
}
1005
/*[IF JAVA_SPEC_VERSION >= 15]*/
1006
ClassLoader.loadLibrary(getCallerClass(), libName);
1007
/*[ELSE]*/
1008
ClassLoader.loadLibraryWithClassLoader(libName, ClassLoader.callerClassLoader());
1009
/*[ENDIF] JAVA_SPEC_VERSION >= 15 */
1010
}
1011
1012
/**
1013
* Provides a hint to the virtual machine that it would
1014
* be useful to attempt to perform any outstanding
1015
* object finalizations.
1016
*/
1017
/*[IF JAVA_SPEC_VERSION >= 18] */
1018
@Deprecated(forRemoval=true, since="18")
1019
/*[ENDIF] JAVA_SPEC_VERSION >= 18 */
1020
public static void runFinalization() {
1021
RUNTIME.runFinalization();
1022
}
1023
1024
/*[IF JAVA_SPEC_VERSION < 11]*/
1025
/**
1026
* Ensure that, when the virtual machine is about to exit,
1027
* all objects are finalized. Note that all finalization
1028
* which occurs when the system is exiting is performed
1029
* after all running threads have been terminated.
1030
*
1031
* @param flag true means finalize all on exit.
1032
*
1033
* @deprecated This method is unsafe.
1034
*/
1035
@Deprecated
1036
public static void runFinalizersOnExit(boolean flag) {
1037
Runtime.runFinalizersOnExit(flag);
1038
}
1039
/*[ENDIF] JAVA_SPEC_VERSION < 11 */
1040
1041
/**
1042
* Sets the system properties. Note that the object which is passed in
1043
* is not copied, so that subsequent changes made to it will be reflected
1044
* in calls to {@code getProperty()} and {@code getProperties()}.
1045
* <p>
1046
* Security managers should restrict access to this
1047
* API if possible.
1048
*
1049
* @param p the properties to set
1050
*/
1051
public static void setProperties(Properties p) {
1052
@SuppressWarnings("removal")
1053
SecurityManager security = System.getSecurityManager();
1054
if (security != null)
1055
security.checkPropertiesAccess();
1056
if (p == null) {
1057
ensureProperties(false);
1058
} else {
1059
systemProperties = p;
1060
}
1061
}
1062
1063
static void initSecurityManager(ClassLoader applicationClassLoader) {
1064
String javaSecurityManager = internalGetProperties().getProperty("java.security.manager"); //$NON-NLS-1$
1065
/*[IF JAVA_SPEC_VERSION > 11]*/
1066
if ("allow".equals(javaSecurityManager)) {
1067
/* Do nothing. */
1068
} else if ("disallow".equals(javaSecurityManager) //$NON-NLS-1$
1069
/*[IF JAVA_SPEC_VERSION >= 18]*/
1070
|| (null == javaSecurityManager)
1071
/*[ENDIF] JAVA_SPEC_VERSION >= 18 */
1072
) {
1073
throwUOEFromSetSM = true;
1074
} else
1075
/*[ENDIF] JAVA_SPEC_VERSION > 11 */
1076
if (null != javaSecurityManager) {
1077
/*[IF JAVA_SPEC_VERSION >= 17]*/
1078
initialErr.println("WARNING: A command line option has enabled the Security Manager"); //$NON-NLS-1$
1079
initialErr.println("WARNING: The Security Manager is deprecated and will be removed in a future release"); //$NON-NLS-1$
1080
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
1081
if (javaSecurityManager.isEmpty() || "default".equals(javaSecurityManager)) { //$NON-NLS-1$
1082
setSecurityManager(new SecurityManager());
1083
} else {
1084
try {
1085
Constructor<?> constructor = Class.forName(javaSecurityManager, true, applicationClassLoader).getConstructor();
1086
constructor.setAccessible(true);
1087
setSecurityManager((SecurityManager)constructor.newInstance());
1088
} catch (Throwable e) {
1089
/*[MSG "K0631", "JVM can't set custom SecurityManager due to {0}"]*/
1090
throw new Error(com.ibm.oti.util.Msg.getString("K0631", e.toString()), e); //$NON-NLS-1$
1091
}
1092
}
1093
}
1094
}
1095
1096
/**
1097
* Sets the active security manager. Note that once
1098
* the security manager has been set, it can not be
1099
* changed. Attempts to do so will cause a security
1100
* exception.
1101
*
1102
* @param s the new security manager
1103
*
1104
* @throws SecurityException if the security manager has already been set and its checkPermission method doesn't allow it to be replaced.
1105
/*[IF JAVA_SPEC_VERSION >= 12]
1106
* @throws UnsupportedOperationException if s is non-null and a special token "disallow" has been set for system property "java.security.manager"
1107
* which indicates that a security manager is not allowed to be set dynamically.
1108
/*[ENDIF] JAVA_SPEC_VERSION >= 12
1109
*/
1110
/*[IF JAVA_SPEC_VERSION >= 17] */
1111
/*[IF OPENJDK_METHODHANDLES] */
1112
@Deprecated(since="17", forRemoval=true)
1113
/*[ENDIF] OPENJDK_METHODHANDLES */
1114
@CallerSensitive
1115
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
1116
public static void setSecurityManager(final SecurityManager s) {
1117
/*[PR 113606] security field could be modified by another Thread */
1118
@SuppressWarnings("removal")
1119
final SecurityManager currentSecurity = security;
1120
1121
/*[IF JAVA_SPEC_VERSION > 11]*/
1122
if (throwUOEFromSetSM) {
1123
/* The security manager is not allowed to be set dynamically. Return if the
1124
* argument is null. UnsupportedOperationException should only be thrown for
1125
* a non-null argument.
1126
*/
1127
if (s == null) {
1128
return;
1129
}
1130
/*[MSG "K0B00", "The Security Manager is deprecated and will be removed in a future release"]*/
1131
throw new UnsupportedOperationException(com.ibm.oti.util.Msg.getString("K0B00")); //$NON-NLS-1$
1132
}
1133
/*[ENDIF] JAVA_SPEC_VERSION > 11 */
1134
1135
/*[IF JAVA_SPEC_VERSION >= 17] */
1136
Class<?> callerClz = getCallerClass();
1137
if (setSMCallers.putIfAbsent(callerClz, Boolean.TRUE) == null) {
1138
String callerName = callerClz.getName();
1139
CodeSource cs = callerClz.getProtectionDomainInternal().getCodeSource();
1140
String codeSource = (cs == null) ? callerName : callerName + " (" + cs.getLocation() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
1141
initialErr.println("WARNING: A terminally deprecated method in java.lang.System has been called"); //$NON-NLS-1$
1142
initialErr.printf("WARNING: System::setSecurityManager has been called by %s" + lineSeparator(), codeSource); //$NON-NLS-1$
1143
initialErr.printf("WARNING: Please consider reporting this to the maintainers of %s" + lineSeparator(), callerName); //$NON-NLS-1$
1144
initialErr.println("WARNING: System::setSecurityManager will be removed in a future release"); //$NON-NLS-1$
1145
}
1146
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
1147
1148
if (s != null) {
1149
if (currentSecurity == null) {
1150
// only preload classes when current security manager is null
1151
// not adding an extra static field to preload only once
1152
try {
1153
/*[PR 95057] preload classes required for checkPackageAccess() */
1154
// Preload classes used for checkPackageAccess(),
1155
// otherwise we could go recursive
1156
s.checkPackageAccess("java.lang"); //$NON-NLS-1$
1157
} catch (Exception e) {
1158
// ignore any potential exceptions
1159
}
1160
}
1161
1162
try {
1163
/*[PR 97686] Preload the policy permission */
1164
AccessController.doPrivileged(new PrivilegedAction<Void>() {
1165
@Override
1166
public Void run() {
1167
if (currentSecurity == null) {
1168
// initialize external messages and
1169
// also load security sensitive classes
1170
com.ibm.oti.util.Msg.getString("K002c"); //$NON-NLS-1$
1171
}
1172
ProtectionDomain pd = s.getClass().getPDImpl();
1173
if (pd != null) {
1174
// initialize the protection domain, which may include preloading the
1175
// dynamic permissions from the policy before installing
1176
pd.implies(sun.security.util.SecurityConstants.ALL_PERMISSION);
1177
}
1178
return null;
1179
}});
1180
} catch (Exception e) {
1181
// ignore any potential exceptions
1182
}
1183
}
1184
if (currentSecurity != null) {
1185
currentSecurity.checkPermission(com.ibm.oti.util.RuntimePermissions.permissionSetSecurityManager);
1186
}
1187
security = s;
1188
}
1189
1190
/**
1191
* Answers the platform-specific filename for the shared
1192
* library named by the argument.
1193
*
1194
* @param userLibName the name of the library to look up.
1195
* @return the platform-specific filename for the library
1196
*/
1197
public static native String mapLibraryName(String userLibName);
1198
1199
/**
1200
* Sets the value of the named static field in the receiver
1201
* to the passed in argument.
1202
*
1203
* @param fieldName the name of the field to set, one of in, out, or err
1204
* @param stream the new value of the field
1205
*/
1206
private static native void setFieldImpl(String fieldName, Object stream);
1207
1208
@CallerSensitive
1209
static Class getCallerClass() {
1210
return Class.getStackClass(2);
1211
}
1212
1213
/**
1214
* Return the channel inherited by the invocation of the running vm. The channel is
1215
* obtained by calling SelectorProvider.inheritedChannel().
1216
*
1217
* @return the inherited channel or null
1218
*
1219
* @throws IOException if an IO error occurs getting the inherited channel
1220
*/
1221
public static java.nio.channels.Channel inheritedChannel() throws IOException {
1222
return java.nio.channels.spi.SelectorProvider.provider().inheritedChannel();
1223
}
1224
1225
/**
1226
* Returns the current tick count in nanoseconds. The tick count
1227
* only reflects elapsed time.
1228
*
1229
* @return the current nanosecond tick count, which may be negative
1230
*/
1231
public static native long nanoTime();
1232
1233
/**
1234
* Removes the property.
1235
*
1236
* @param prop the name of the property to remove
1237
* @return the value of the property removed
1238
*/
1239
public static String clearProperty(String prop) {
1240
if (!propertiesInitialized) throw new Error("bootstrap error, system property access before init: " + prop); //$NON-NLS-1$
1241
1242
if (prop.length() == 0) throw new IllegalArgumentException();
1243
@SuppressWarnings("removal")
1244
SecurityManager security = System.getSecurityManager();
1245
if (security != null)
1246
security.checkPermission(new PropertyPermission(prop, "write")); //$NON-NLS-1$
1247
return (String)systemProperties.remove(prop);
1248
}
1249
1250
/**
1251
* Returns all of the system environment variables in an unmodifiable Map.
1252
*
1253
* @return an unmodifiable Map containing all of the system environment variables.
1254
*/
1255
public static Map<String, String> getenv() {
1256
@SuppressWarnings("removal")
1257
SecurityManager security = System.getSecurityManager();
1258
if (security != null)
1259
security.checkPermission(new RuntimePermission("getenv.*")); //$NON-NLS-1$
1260
1261
return ProcessEnvironment.getenv();
1262
}
1263
1264
/**
1265
* Return the Console or null.
1266
*
1267
* @return the Console or null
1268
*/
1269
public static Console console() {
1270
/*[PR CMVC 114090] System.console does not return null in subprocess */
1271
/*[PR CMVC 114119] Console exists when stdin, stdout are redirected */
1272
if (consoleInitialized) return console;
1273
synchronized(System.class) {
1274
if (consoleInitialized) return console;
1275
console = SharedSecrets.getJavaIOAccess().console();
1276
consoleInitialized = true;
1277
}
1278
return console;
1279
}
1280
1281
/**
1282
* JIT Helper method
1283
*/
1284
private static void longMultiLeafArrayCopy(Object src, int srcPos,
1285
Object dest, int destPos, int length, int elementSize, int leafSize) {
1286
1287
// Check if this is a forward or backwards arraycopy
1288
boolean isFwd;
1289
if (src != dest || srcPos > destPos || srcPos+length <= destPos)
1290
isFwd = true;
1291
else
1292
isFwd = false;
1293
1294
int newSrcPos;
1295
int newDestPos;
1296
int numOfElemsPerLeaf = leafSize / elementSize;
1297
int srcLeafPos;
1298
int destLeafPos;
1299
int L1, L2, L3;
1300
int offset;
1301
1302
if (isFwd)
1303
{
1304
newSrcPos = srcPos;
1305
newDestPos = destPos;
1306
}
1307
else
1308
{
1309
newSrcPos = srcPos + length - 1;
1310
newDestPos = destPos + length - 1;
1311
}
1312
1313
srcLeafPos = newSrcPos % numOfElemsPerLeaf;
1314
destLeafPos = newDestPos % numOfElemsPerLeaf;
1315
if (srcLeafPos < destLeafPos)
1316
{
1317
if (isFwd)
1318
{
1319
// align dst to leaf boundary first
1320
L1 = numOfElemsPerLeaf - destLeafPos;
1321
L2 = numOfElemsPerLeaf - (srcLeafPos + L1);
1322
}
1323
else
1324
{
1325
L1 = srcLeafPos + 1;
1326
L2 = destLeafPos - srcLeafPos;
1327
}
1328
}
1329
else
1330
{
1331
if (isFwd)
1332
{
1333
// align src to leaf boundary first
1334
L1 = numOfElemsPerLeaf - srcLeafPos;
1335
L2 = numOfElemsPerLeaf - (destLeafPos + L1);
1336
}
1337
else
1338
{
1339
L1 = destLeafPos + 1;
1340
L2 = srcLeafPos - destLeafPos;
1341
}
1342
}
1343
1344
L3 = numOfElemsPerLeaf - L2;
1345
1346
// begin copying
1347
offset = isFwd ? 0 : L1 - 1;
1348
System.arraycopy(src, newSrcPos - offset, dest, newDestPos - offset, L1);
1349
newSrcPos = isFwd ? newSrcPos + L1 : newSrcPos - L1;
1350
newDestPos = isFwd ? newDestPos + L1 : newDestPos - L1;
1351
length -= L1;
1352
1353
// now one of newSrcPos and newDestPos is aligned on an arraylet
1354
// leaf boundary, so copies of L2 and L3 can be repeated until there
1355
// is less than a full leaf left to copy
1356
while (length >= numOfElemsPerLeaf) {
1357
offset = isFwd ? 0 : L2 - 1;
1358
System.arraycopy(src, newSrcPos - offset, dest, newDestPos - offset, L2);
1359
newSrcPos = isFwd ? newSrcPos + L2 : newSrcPos - L2;
1360
newDestPos = isFwd ? newDestPos + L2 : newDestPos - L2;
1361
1362
offset = isFwd ? 0 : L3 - 1;
1363
System.arraycopy(src, newSrcPos - offset, dest, newDestPos - offset, L3);
1364
newSrcPos = isFwd ? newSrcPos + L3 : newSrcPos - L3;
1365
newDestPos = isFwd ? newDestPos + L3 : newDestPos - L3;
1366
1367
length -= numOfElemsPerLeaf;
1368
}
1369
1370
// next L2 elements of each array must be on same leaf
1371
if (length > L2) {
1372
offset = isFwd ? 0 : L2 - 1;
1373
System.arraycopy(src, newSrcPos - offset, dest, newDestPos - offset, L2);
1374
newSrcPos = isFwd ? newSrcPos + L2 : newSrcPos - L2;
1375
newDestPos = isFwd ? newDestPos + L2 : newDestPos - L2;
1376
length -= L2;
1377
}
1378
1379
// whatever is left of each array must be on the same leaf
1380
if (length > 0) {
1381
offset = isFwd ? 0 : length - 1;
1382
System.arraycopy(src, newSrcPos - offset, dest, newDestPos - offset, length);
1383
}
1384
}
1385
1386
/**
1387
* JIT Helper method
1388
*/
1389
private static void simpleMultiLeafArrayCopy(Object src, int srcPos,
1390
Object dest, int destPos, int length, int elementSize, int leafSize)
1391
{
1392
int count = 0;
1393
1394
// Check if this is a forward or backwards arraycopy
1395
boolean isFwd;
1396
if (src != dest || srcPos > destPos || srcPos+length <= destPos)
1397
isFwd = true;
1398
else
1399
isFwd = false;
1400
1401
int newSrcPos;
1402
int newDestPos;
1403
int numOfElemsPerLeaf = leafSize / elementSize;
1404
int srcLeafPos;
1405
int destLeafPos;
1406
int iterLength;
1407
1408
if (isFwd)
1409
{
1410
newSrcPos = srcPos;
1411
newDestPos = destPos;
1412
}
1413
else
1414
{
1415
newSrcPos = srcPos + length - 1;
1416
newDestPos = destPos + length - 1;
1417
}
1418
1419
for (count = 0; count < length; count += iterLength)
1420
{
1421
srcLeafPos = (newSrcPos % numOfElemsPerLeaf);
1422
destLeafPos = newDestPos % numOfElemsPerLeaf;
1423
int offset;
1424
if ((isFwd && (srcLeafPos >= destLeafPos)) ||
1425
(!isFwd && (srcLeafPos < destLeafPos)))
1426
{
1427
if (isFwd)
1428
iterLength = numOfElemsPerLeaf - srcLeafPos;
1429
else
1430
iterLength = srcLeafPos + 1;
1431
}
1432
else
1433
{
1434
if (isFwd)
1435
iterLength = numOfElemsPerLeaf - destLeafPos;
1436
else
1437
iterLength = destLeafPos + 1;
1438
}
1439
1440
if (length - count < iterLength)
1441
iterLength = length - count;
1442
1443
if (isFwd)
1444
offset = 0;
1445
else
1446
offset = iterLength - 1;
1447
1448
System.arraycopy(src, newSrcPos - offset, dest, newDestPos - offset, iterLength);
1449
1450
if (isFwd)
1451
{
1452
newSrcPos += iterLength;
1453
newDestPos += iterLength;
1454
}
1455
else
1456
{
1457
newSrcPos -= iterLength;
1458
newDestPos -= iterLength;
1459
}
1460
}
1461
}
1462
1463
/**
1464
* JIT Helper method
1465
*/
1466
private static void multiLeafArrayCopy(Object src, int srcPos, Object dest,
1467
int destPos, int length, int elementSize, int leafSize) {
1468
int count = 0;
1469
1470
// Check if this is a forward or backwards arraycopy
1471
boolean isFwd;
1472
if (src != dest || srcPos > destPos || srcPos+length <= destPos)
1473
isFwd = true;
1474
else
1475
isFwd = false;
1476
1477
int newSrcPos;
1478
int newDestPos;
1479
int numOfElemsPerLeaf = leafSize / elementSize;
1480
int srcLeafPos;
1481
int destLeafPos;
1482
1483
if (isFwd)
1484
{
1485
newSrcPos = srcPos;
1486
newDestPos = destPos;
1487
}
1488
else
1489
{
1490
newSrcPos = srcPos + length - 1;
1491
newDestPos = destPos + length - 1;
1492
}
1493
1494
int iterLength1 = 0;
1495
int iterLength2 = 0;
1496
while (count < length)
1497
{
1498
srcLeafPos = (newSrcPos % numOfElemsPerLeaf);
1499
destLeafPos = (newDestPos % numOfElemsPerLeaf);
1500
1501
int firstPos, secondPos;
1502
1503
if ((isFwd && (srcLeafPos >= destLeafPos)) ||
1504
(!isFwd && (srcLeafPos < destLeafPos)))
1505
{
1506
firstPos = srcLeafPos;
1507
secondPos = newDestPos;
1508
}
1509
else
1510
{
1511
firstPos = destLeafPos;
1512
secondPos = newSrcPos;
1513
}
1514
1515
int offset = 0;
1516
if (isFwd)
1517
iterLength1 = numOfElemsPerLeaf - firstPos;
1518
else
1519
iterLength1 = firstPos + 1;
1520
1521
if (length - count < iterLength1)
1522
iterLength1 = length - count;
1523
1524
if (isFwd)
1525
iterLength2 = numOfElemsPerLeaf - ((secondPos + iterLength1) % numOfElemsPerLeaf);
1526
else
1527
{
1528
iterLength2 = ((secondPos - iterLength1) % numOfElemsPerLeaf) + 1;
1529
offset = iterLength1 - 1;
1530
}
1531
1532
if (length - count - iterLength1 < iterLength2)
1533
iterLength2 = length - count - iterLength1;
1534
1535
System.arraycopy(src, newSrcPos - offset, dest, newDestPos - offset, iterLength1);
1536
1537
offset = 0;
1538
if (isFwd)
1539
{
1540
newSrcPos += iterLength1;
1541
newDestPos += iterLength1;
1542
}
1543
else
1544
{
1545
newSrcPos -= iterLength1;
1546
newDestPos -= iterLength1;
1547
offset = iterLength2 - 1;
1548
}
1549
1550
if (iterLength2 <= 0) break;
1551
1552
System.arraycopy(src, newSrcPos - offset, dest, newDestPos - offset, iterLength2);
1553
1554
if (isFwd)
1555
{
1556
newSrcPos += iterLength2;
1557
newDestPos += iterLength2;
1558
}
1559
else
1560
{
1561
newSrcPos -= iterLength2;
1562
newDestPos -= iterLength2;
1563
}
1564
1565
count += iterLength1 + iterLength2;
1566
}
1567
}
1568
1569
1570
/**
1571
* Return platform specific line separator character(s).
1572
* Unix is \n while Windows is \r\n as per the prop set by the VM.
1573
*
1574
* @return platform specific line separator string
1575
*/
1576
// Refer to Jazz 30875
1577
public static String lineSeparator() {
1578
return lineSeparator;
1579
}
1580
1581
/*[IF Sidecar19-SE]*/
1582
/**
1583
* Return an instance of Logger.
1584
*
1585
* @param loggerName The name of the logger to return
1586
* @return An instance of the logger.
1587
* @throws NullPointerException if the loggerName is null
1588
*/
1589
@CallerSensitive
1590
public static Logger getLogger(String loggerName) {
1591
Objects.requireNonNull(loggerName);
1592
Class<?> caller = Reflection.getCallerClass();
1593
return jdk.internal.logger.LazyLoggers.getLogger(loggerName, caller.getModule());
1594
}
1595
1596
/**
1597
* Return an instance of Logger that is localized based on the ResourceBundle.
1598
*
1599
* @param loggerName The name of the logger to return
1600
* @param bundle The ResourceBundle to use for localization
1601
* @return An instance of the logger localized to 'bundle'
1602
* @throws NullPointerException if the loggerName or bundle is null
1603
*/
1604
@CallerSensitive
1605
public static Logger getLogger(String loggerName, ResourceBundle bundle) {
1606
Objects.requireNonNull(loggerName);
1607
Objects.requireNonNull(bundle);
1608
Class<?> caller = Reflection.getCallerClass();
1609
return LoggerFinder.getLoggerFinder().getLocalizedLogger(loggerName, bundle, caller.getModule());
1610
}
1611
1612
/**
1613
* The LoggerFinder service creates, manages and configures loggers
1614
* to the underlying framework it uses.
1615
*/
1616
public abstract static class LoggerFinder {
1617
private static volatile LoggerFinder loggerFinder;
1618
1619
/**
1620
* Checks needed runtime permissions
1621
*
1622
* @throws SecurityException if RuntimePermission("loggerFinder") is not allowed
1623
*/
1624
protected LoggerFinder() {
1625
verifyPermissions();
1626
}
1627
1628
/**
1629
* Returns a localizable instance of Logger for the given module
1630
*
1631
* @param loggerName The name of the logger
1632
* @param bundle A resource bundle; can be null
1633
* @param callerModule The module for which the logger is being requested
1634
* @return an instance of Logger
1635
* @throws NullPointerException if loggerName or callerModule is null
1636
* @throws SecurityException if RuntimePermission("loggerFinder") is not allowed
1637
*/
1638
public Logger getLocalizedLogger(String loggerName, ResourceBundle bundle, Module callerModule) {
1639
verifyPermissions();
1640
Objects.requireNonNull(loggerName);
1641
Objects.requireNonNull(callerModule);
1642
Logger logger = this.getLogger(loggerName, callerModule);
1643
Logger localizedLogger = new jdk.internal.logger.LocalizedLoggerWrapper(logger, bundle);
1644
return localizedLogger;
1645
}
1646
1647
/**
1648
* Returns an instance of Logger for the given module
1649
*
1650
* @param loggerName The name of the logger
1651
* @param callerModule The module for which the logger is being requested
1652
* @return a Logger suitable for use within the given module
1653
* @throws NullPointerException if loggerName or callerModule is null
1654
* @throws SecurityException if RuntimePermission("loggerFinder") is not allowed
1655
*/
1656
public abstract Logger getLogger(String loggerName, Module callerModule);
1657
1658
/**
1659
* Returns the LoggerFinder instance
1660
*
1661
* @return the LoggerFinder instance.
1662
* @throws SecurityException if RuntimePermission("loggerFinder") is not allowed
1663
*/
1664
public static LoggerFinder getLoggerFinder() {
1665
verifyPermissions();
1666
if (loggerFinder == null) {
1667
loggerFinder = AccessController.doPrivileged(
1668
(PrivilegedAction<LoggerFinder>) () -> jdk.internal.logger.LoggerFinderLoader.getLoggerFinder(),
1669
AccessController.getContext(),
1670
com.ibm.oti.util.RuntimePermissions.permissionLoggerFinder);
1671
}
1672
return loggerFinder;
1673
}
1674
1675
private static void verifyPermissions() {
1676
@SuppressWarnings("removal")
1677
SecurityManager securityManager = System.getSecurityManager();
1678
if (securityManager != null) {
1679
securityManager.checkPermission(com.ibm.oti.util.RuntimePermissions.permissionLoggerFinder);
1680
}
1681
}
1682
}
1683
1684
/**
1685
* Logger logs messages that will be routed to the underlying logging framework
1686
* that LoggerFinder uses.
1687
*/
1688
public interface Logger {
1689
/**
1690
* System loggers levels
1691
*/
1692
public enum Level {
1693
/**
1694
* Enable all logging level messages
1695
*/
1696
ALL(Integer.MIN_VALUE),
1697
/**
1698
* Enable TRACE level messages
1699
*/
1700
TRACE(400),
1701
/**
1702
* Enable DEBUG level messages
1703
*/
1704
DEBUG(500),
1705
/**
1706
* Enable INFO level messages
1707
*/
1708
INFO(800),
1709
/**
1710
* Enable WARNING level messages
1711
*/
1712
WARNING(900),
1713
/**
1714
* Enable ERROR level messages
1715
*/
1716
ERROR(1000),
1717
/**
1718
*
1719
* Disable logging
1720
*/
1721
OFF(Integer.MAX_VALUE);
1722
1723
final int severity;
1724
Level(int value) {
1725
severity = value;
1726
}
1727
1728
/**
1729
* Returns the name of this level
1730
*
1731
* @return name of this level
1732
*/
1733
public final java.lang.String getName() {
1734
return name();
1735
}
1736
1737
/**
1738
* Returns severity of this level
1739
*
1740
* @return severity of this level
1741
*/
1742
public final int getSeverity() {
1743
return severity;
1744
}
1745
}
1746
1747
/**
1748
* Returns the name of this logger
1749
*
1750
* @return the logger name
1751
*/
1752
public String getName();
1753
1754
/**
1755
* Checks if a message of the given level will be logged
1756
*
1757
* @param level The log message level
1758
* @return true if the given log message level is currently being logged
1759
* @throws NullPointerException if level is null
1760
*/
1761
public boolean isLoggable(Level level);
1762
1763
/**
1764
* Logs a message
1765
*
1766
* @param level The log message level
1767
* @param msg The log message
1768
* @throws NullPointerException if level is null
1769
*/
1770
public default void log(Level level, String msg) {
1771
Objects.requireNonNull(level);
1772
log(level, (ResourceBundle)null, msg, (Object[])null);
1773
}
1774
1775
/**
1776
* Logs a lazily supplied message
1777
*
1778
* @param level The log message level
1779
* @param supplier Supplier function that produces a message
1780
* @throws NullPointerException if level or supplier is null
1781
*/
1782
public default void log(Level level, Supplier<String> supplier) {
1783
Objects.requireNonNull(level);
1784
Objects.requireNonNull(supplier);
1785
if (isLoggable(level)) {
1786
log(level, (ResourceBundle)null, supplier.get(), (Object[])null);
1787
}
1788
}
1789
1790
/**
1791
* Logs a message produced from the give object
1792
*
1793
* @param level The log message level
1794
* @param value The object to log
1795
* @throws NullPointerException if level or value is null
1796
*/
1797
public default void log(Level level, Object value) {
1798
Objects.requireNonNull(level);
1799
Objects.requireNonNull(value);
1800
if (isLoggable(level)) {
1801
log(level, (ResourceBundle)null, value.toString(), (Object[])null);
1802
}
1803
}
1804
1805
/**
1806
* Log a message associated with a given throwable
1807
*
1808
* @param level The log message level
1809
* @param msg The log message
1810
* @param throwable Throwable associated with the log message
1811
* @throws NullPointerException if level is null
1812
*/
1813
public default void log(Level level, String msg, Throwable throwable) {
1814
Objects.requireNonNull(level);
1815
log(level, (ResourceBundle)null, msg, throwable);
1816
}
1817
1818
/**
1819
* Logs a lazily supplied message associated with a given throwable
1820
*
1821
* @param level The log message level
1822
* @param supplier Supplier function that produces a message
1823
* @param throwable Throwable associated with the log message
1824
* @throws NullPointerException if level or supplier is null
1825
*/
1826
public default void log(Level level, Supplier<String> supplier, Throwable throwable) {
1827
Objects.requireNonNull(level);
1828
Objects.requireNonNull(supplier);
1829
if (isLoggable(level)) {
1830
log(level, (ResourceBundle)null, supplier.get(), throwable);
1831
}
1832
}
1833
1834
/**
1835
* Logs a message with an optional list of parameters
1836
*
1837
* @param level The log message level
1838
* @param msg The log message
1839
* @param values Optional list of parameters
1840
* @throws NullPointerException if level is null
1841
*/
1842
public default void log(Level level, String msg, Object... values) {
1843
Objects.requireNonNull(level);
1844
log(level, (ResourceBundle)null, msg, values);
1845
}
1846
1847
/**
1848
* Logs a localized message associated with a given throwable
1849
*
1850
* @param level The log message level
1851
* @param bundle A resource bundle to localize msg
1852
* @param msg The log message
1853
* @param throwable Throwable associated with the log message
1854
* @throws NullPointerException if level is null
1855
*/
1856
public void log(Level level, ResourceBundle bundle, String msg, Throwable throwable);
1857
1858
/**
1859
* Logs a message with resource bundle and an optional list of parameters
1860
*
1861
* @param level The log message level
1862
* @param bundle A resource bundle to localize msg
1863
* @param msg The log message
1864
* @param values Optional list of parameters
1865
* @throws NullPointerException if level is null
1866
*/
1867
public void log(Level level, ResourceBundle bundle, String msg, Object... values);
1868
}
1869
/*[ENDIF]*/
1870
}
1871
1872