@@ -0,0 +1,3036 @@
+package lucee.runtime.instrumentation;%0A/*%0Aimport java.lang.reflect.AccessibleObject;%0Aimport java.lang.reflect.Constructor;%0Aimport java.lang.reflect.Field;%0Aimport java.lang.reflect.Method;%0Aimport java.lang.reflect.Modifier;%0A%0Aimport jdk.internal.misc.Unsafe;%0Aimport jdk.internal.misc.VM;%0Aimport lucee.print;%0A*/%0Apublic class Test %7B%0A   /* private static Unsafe unsafe;%0A%09private static Field constructorModifiers;%0A%09private static long constructorModifiersOffset;%0A%09private static Field methodModifiers;%0A%09private static long methodModifiersOffset;%0A%09private static Field fieldModifiers;%0A%09private static long fieldModifiersOffset;%0A%09private static Method setAccessible;%0A%0A%09static%0A    %7B%0A%09%09try %7B%0A            Constructor%3CUnsafe%3E unsafeConstructor = Unsafe.class.getDeclaredConstructor();%0A            unsafeConstructor.setAccessible(true);%0A            unsafe = unsafeConstructor.newInstance();%0A            constructorModifiers = Constructor.class.getDeclaredField(%22modifiers%22);%0A            constructorModifiersOffset = unsafe.objectFieldOffset(constructorModifiers);%0A            methodModifiers = Method.class.getDeclaredField(%22modifiers%22);%0A            methodModifiersOffset = unsafe.objectFieldOffset(methodModifiers);%0A            fieldModifiers = Field.class.getDeclaredField(%22modifiers%22);%0A            fieldModifiersOffset = unsafe.objectFieldOffset(fieldModifiers);%0A            setAccessible = AccessibleObject.class.getDeclaredMethod(%22setAccessible0%22, boolean.class);%0A            setForceAccessible(setAccessible);%0A%09%09%7D%0A%09%09catch(Exception e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A    %7D*/%0A    /*private static boolean setForceAccessible(AccessibleObject accessibleObject)%0A    %7B%0A        try%0A        %7B%0A            if (accessibleObject instanceof Constructor)%0A            %7B%0A                Constructor%3C?%3E object = (Constructor%3C?%3E) accessibleObject;%0A                unsafe.getAndSetInt(object, constructorModifiersOffset, addPublicModifier(object.getModifiers()));%0A                return true;%0A            %7D%0A            if (accessibleObject instanceof Method)%0A            %7B%0A                Method object = (Method) accessibleObject;%0A                unsafe.getAndSetInt(object, methodModifiersOffset, addPublicModifier(object.getModifiers()));%0A                return true;%0A            %7D%0A            if (accessibleObject instanceof Field)%0A            %7B%0A                Field object = (Field) accessibleObject;%0A                unsafe.getAndSetInt(object, fieldModifiersOffset, addPublicModifier(object.getModifiers()));%0A                return true;%0A            %7D%0A            return false;%0A        %7D%0A        catch (Exception e)%0A        %7B%0A            e.printStackTrace();%0A            return false;%0A        %7D%0A    %7D%0A%0A    private static int addPublicModifier(int mod)%0A    %7B%0A        mod &= ~ (Modifier.PRIVATE);%0A        mod &= ~ (Modifier.PROTECTED);%0A        mod %7C= (Modifier.PUBLIC);%0A        return mod;%0A    %7D%0A    %0A    public static void main(String%5B%5D args) %7B%0A    %09//print.e(VM.getSystemProperties());%0A%09print.e(VM.getSavedProperty(%22jdk.attach.allowAttachSelf%22));%0A%09%7D*/%0A%7D%0A

add test code for "allowAttachSelf" issue