fix a warning in PermissionManager

This commit is contained in:
Daniella / Tove 2024-06-08 13:55:32 +02:00
parent 37fe627477
commit 9998f9c4a3
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -45,7 +45,7 @@ public interface PermissionManager extends Cloneable {
return clazz.getName(); return clazz.getName();
try { try {
// Reset the name field so that it must be cached again // Reset the name field so that it must be cached again
Field nameField = clazz.getClass().getDeclaredField("name"); Field nameField = Class.class.getDeclaredField("name");
ReflectUtil.forceAccessible(nameField); ReflectUtil.forceAccessible(nameField);
nameField.set(clazz, null); nameField.set(clazz, null);
// name is clean, getName can now be used. // name is clean, getName can now be used.
@ -59,7 +59,7 @@ public interface PermissionManager extends Cloneable {
cache[idx] = false; cache[idx] = false;
try { try {
// Unable to reset the name field, invoking the native that gets the name directly // Unable to reset the name field, invoking the native that gets the name directly
Method initClassName = clazz.getClass().getDeclaredMethod("initClassName"); Method initClassName = Class.class.getDeclaredMethod("initClassName");
ReflectUtil.forceAccessible(initClassName); ReflectUtil.forceAccessible(initClassName);
return (String) initClassName.invoke(clazz); return (String) initClassName.invoke(clazz);
} }