summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authornickl- <github@jigsoft.co.za>2017-10-27 08:12:07 +0200
committernickl- <github@jigsoft.co.za>2017-11-12 23:49:21 +0200
commitdf58ae940da38be8e08f35d72f7acb488545ef3b (patch)
tree36f118234e22eed84b2765b6c4ff328a2c1ac8ba /src/main
parent50dd54dc0552960c80aacded54a9ff7fe0f747f6 (diff)
downloadjavassist-df58ae940da38be8e08f35d72f7acb488545ef3b.tar.gz
javassist-df58ae940da38be8e08f35d72f7acb488545ef3b.zip
Some code comments to fill in gaps.
Diffstat (limited to 'src/main')
-rwxr-xr-xsrc/main/javassist/util/proxy/SecurityActions.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/javassist/util/proxy/SecurityActions.java b/src/main/javassist/util/proxy/SecurityActions.java
index 574073d0..acb89c8d 100755
--- a/src/main/javassist/util/proxy/SecurityActions.java
+++ b/src/main/javassist/util/proxy/SecurityActions.java
@@ -36,6 +36,18 @@ import javassist.bytecode.ClassFile;
class SecurityActions extends SecurityManager
{
public static final SecurityActions stack = new SecurityActions();
+ /**
+ * Since Java 9 abruptly removed <code>Reflection.getCallerClass()</code>
+ * in favour of <code>StackWalker</code> we are left having to find a
+ * solution for the older versions without upsetting the new compiler.
+ *
+ * The member scoped function <code>getClassContext()</code>
+ * available as a <code>SecurityManager</code> sibling remains
+ * functional across all versions, for now.
+ *
+ * @return represents the declaring class of the method that invoked
+ * the method that called this or idx 2 on the stack trace.
+ * @since 3.23 */
public Class<?> getCallerClass()
{
return getClassContext()[2];
@@ -207,6 +219,18 @@ class SecurityActions extends SecurityManager
throw new RuntimeException(e.getCause());
}
}
+ /**
+ * _The_ Notorious sun.misc.Unsafe in all its glory, but anonymous
+ * so as not to attract unwanted attention. Kept in two separate
+ * parts it manages to avoid detection from linker/compiler/general
+ * complainers and those. This functionality will vanish from the
+ * JDK soon but in the meantime it shouldn't be an obstacle.
+ *
+ * All exposed methods are cached in a dictionary with overloaded
+ * methods collected under their corresponding keys. Currently the
+ * implementation assumes there is only one, if you need find a
+ * need there will have to be a compare.
+ * @since 3.23 */
class TheUnsafe
{
final Class<?> unsafe;
@@ -243,6 +267,12 @@ class SecurityActions extends SecurityManager
return null;
}
}
+ /**
+ * Java 9 now complains about every privileged action regardless.
+ * Displaying warnings of "illegal usage" and then instructing users
+ * to go hassle the maintainers in order to have it fixed.
+ * Making it hush for now, see all fixed.
+ * @param tu theUnsafe that'll fix it */
static void disableWarning(TheUnsafe tu) {
try {
if (ClassFile.MAJOR_VERSION < ClassFile.JAVA_9)