GlueGen: src/junit/com/jogamp/common/util/TestUnsafeUtil.java Source File

GlueGen v2.6.0 GlueGen, Native Binding Generator for Java™ (public API).

TestUnsafeUtil.java
Go to the documentation of this file.
1/**
2 * Copyright 2025 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28
29package com.jogamp.common.util;
30
31import java.security.PrivilegedAction;
32
33import org.junit.Assert;
34import org.junit.BeforeClass;
35import org.junit.Test;
36
37import com.jogamp.common.os.Platform;
38import com.jogamp.junit.util.SingletonJunitCase;
39
40import org.junit.FixMethodOrder;
41import org.junit.runners.MethodSorters;
42
43@FixMethodOrder(MethodSorters.NAME_ASCENDING)
44public class TestUnsafeUtil extends SingletonJunitCase {
45
46 @BeforeClass
47 public static void init() {
48 Platform.initSingleton();
49 }
50
51 @Test
52 public void testWithoutIllegalAccessLogger00() {
53 if( ! UnsafeUtil.hasIllegalAccessLoggerAccess() ) {
54 return;
55 }
56 final Boolean res = UnsafeUtil.doWithoutIllegalAccessLogger(new PrivilegedAction<Boolean>() {
57 @Override
58 public Boolean run() {
59 return Boolean.TRUE;
60 }
61 });
62 Assert.assertEquals(Boolean.TRUE, res);
63 }
64
65 public static void main(final String args[]) {
66 final String tstname = TestUnsafeUtil.class.getName();
67 org.junit.runner.JUnitCore.main(tstname);
68 }
69
70}
com.jogamp.common.os.Platform
Utility class for querying platform specific properties.
Definition: Platform.java:58
com.jogamp.common.os.Platform.initSingleton
static void initSingleton()
kick off static initialization of platform property information and native gluegen_rt lib loading
Definition: Platform.java:359
com.jogamp.common.util.TestUnsafeUtil
Definition: TestUnsafeUtil.java:44
com.jogamp.common.util.TestUnsafeUtil.testWithoutIllegalAccessLogger00
void testWithoutIllegalAccessLogger00()
Definition: TestUnsafeUtil.java:52
com.jogamp.common.util.TestUnsafeUtil.init
static void init()
Definition: TestUnsafeUtil.java:47
com.jogamp.common.util.TestUnsafeUtil.main
static void main(final String args[])
Definition: TestUnsafeUtil.java:65
com.jogamp.common.util.UnsafeUtil
Utility methods allowing easy access to certain sun.misc.Unsafe functionality.
Definition: UnsafeUtil.java:44
com.jogamp.common.util.UnsafeUtil.hasIllegalAccessLoggerAccess
static boolean hasIllegalAccessLoggerAccess()
Returns true if access to jdk.internal.module.IllegalAcessLogger's logger field is available and has ...
Definition: UnsafeUtil.java:296
com.jogamp.common.util.UnsafeUtil.doWithoutIllegalAccessLogger
static< T > T doWithoutIllegalAccessLogger(final PrivilegedAction< T > action)
Issue the given user action while jdk.internal.module.IllegalAcessLogger's logger has been temporaril...
Definition: UnsafeUtil.java:311
com.jogamp.junit.util.SingletonJunitCase
Definition: SingletonJunitCase.java:39