Skip to content

Commit

Permalink
[release] Release without access controller dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Jun 19, 2021
1 parent b52f543 commit 08c7709
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* <b>Important</b>: This class's name is known to the Byte Buddy main application and must not be altered.
* </p>
* <p>
* <b>Note</b>: Byte Buddy does not execute code using an {@link java.security.AccessController}. If a security manager
* <b>Note</b>: Byte Buddy does not execute code using an {@code java.security.AccessController}. If a security manager
* is present, the user of this class is responsible for assuring any required privileges.
* </p>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ public ForInstrumentation(Instrumentation instrumentation, ClassLoader classLoad
*/
@AccessControllerPlugin.Enhance
private static <T> T doPrivileged(PrivilegedAction<T> action) {
return AccessController.doPrivileged(action); // action.run();
return action.run();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ public abstract class InvocationHandlerAdapter implements Implementation.Composa
private static final boolean CACHED = true;

/**
* Indicates that a lookup of a method constant should not be looked up using an {@link java.security.AccessController}.
* Indicates that a lookup of a method constant should not be looked up using an {@code java.security.AccessController}.
*/
private static final boolean UNPRIVILEGED = false;

/**
* Indicates that a lookup of a method constant should be looked up using an {@link java.security.AccessController}.
* Indicates that a lookup of a method constant should be looked up using an {@code java.security.AccessController}.
*/
private static final boolean PRIVILEGED = true;

Expand All @@ -96,7 +96,7 @@ public abstract class InvocationHandlerAdapter implements Implementation.Composa
protected final boolean cached;

/**
* Determines if the {@link java.lang.reflect.Method} instances are retrieved by using an {@link java.security.AccessController}.
* Determines if the {@link java.lang.reflect.Method} instances are retrieved by using an {@code java.security.AccessController}.
*/
protected final boolean privileged;

Expand All @@ -117,7 +117,7 @@ public abstract class InvocationHandlerAdapter implements Implementation.Composa
* @param fieldName The name of the field.
* @param cached Determines if the {@link java.lang.reflect.Method} instances that are handed to the
* intercepted methods are cached in {@code static} fields.
* @param privileged Determines if the {@link java.lang.reflect.Method} instances are retrieved by using an {@link java.security.AccessController}.
* @param privileged Determines if the {@link java.lang.reflect.Method} instances are retrieved by using an {@code java.security.AccessController}.
* @param returning Determines if this implementation is returning the result value or is dropping it.
* @param assigner The assigner to apply when defining this implementation.
*/
Expand Down Expand Up @@ -216,7 +216,7 @@ private List<StackManipulation> argumentValuesOf(MethodDescription instrumentedM
public abstract Implementation withAssigner(Assigner assigner);

/**
* Configures that the method constants supplied to the invocation handler adapter are resolved using an {@link java.security.AccessController}.
* Configures that the method constants supplied to the invocation handler adapter are resolved using an {@code java.security.AccessController}.
*
* @return This instrumentation with a privileged lookup configured.
*/
Expand Down Expand Up @@ -279,7 +279,8 @@ public interface AssignerConfigurable extends Implementation.Composable {
public interface WithoutPrivilegeConfiguration extends AssignerConfigurable {

/**
* Configures that the method constants supplied to the invocation handler adapter are resolved using an {@link java.security.AccessController}.
* Configures that the method constants supplied to the invocation handler adapter are resolved
* using an {@code java.security.AccessController}.
*
* @return This instrumentation with a privileged lookup configured.
*/
Expand Down Expand Up @@ -311,7 +312,7 @@ protected static class ForInstance extends InvocationHandlerAdapter implements W
* @param cached Determines if the {@link java.lang.reflect.Method} instances that are handed to the
* intercepted methods are cached in {@code static} fields.
* @param privileged Determines if the {@link java.lang.reflect.Method} instances are retrieved by
* using an {@link java.security.AccessController}.
* using an {@code java.security.AccessController}.
* @param returning Determines if this implementation is returning the result value or is dropping it.
* @param assigner The assigner to apply when defining this implementation.
* @param invocationHandler The invocation handler to which all method calls are delegated.
Expand Down Expand Up @@ -425,7 +426,7 @@ protected static class ForField extends InvocationHandlerAdapter implements With
* @param cached Determines if the {@link java.lang.reflect.Method} instances that are handed to the
* intercepted methods are cached in {@code static} fields.
* @param privileged Determines if the {@link java.lang.reflect.Method} instances are retrieved by using
* an {@link java.security.AccessController}.
* an {@code java.security.AccessController}.
* @param returning Determines if this implementation is returning the result value or is dropping it.
* @param assigner The assigner to apply when defining this implementation.
* @param fieldLocatorFactory The field locator factory to use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import static net.bytebuddy.matcher.ElementMatchers.named;

/**
* A {@link PrivilegedExceptionAction} to lookup a method constant using an {@link java.security.AccessController}.
* A {@link PrivilegedExceptionAction} to lookup a method constant using an {@code java.security.AccessController}.
*/
public enum PrivilegedMemberLookupAction implements AuxiliaryType {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
boolean cached() default true;

/**
* Indicates if the instance assigned to this parameter should be looked up using an {@link java.security.AccessController}.
* Indicates if the instance assigned to this parameter should be looked up using an {@code java.security.AccessController}.
*
* @return {@code true} if this method should be looked up using an {@link java.security.AccessController}.
* @return {@code true} if this method should be looked up using an {@code java.security.AccessController}.
*/
boolean privileged() default false;

Expand Down Expand Up @@ -240,7 +240,7 @@ protected static class DelegationMethod implements StackManipulation {
private final boolean cached;

/**
* {@code true} if the method should be looked up using an {@link java.security.AccessController}.
* {@code true} if the method should be looked up using an {@code java.security.AccessController}.
*/
private final boolean privileged;

Expand All @@ -249,7 +249,7 @@ protected static class DelegationMethod implements StackManipulation {
*
* @param specialMethodInvocation The special method invocation that represents the super method call.
* @param cached {@code true} if the method constant should be cached.
* @param privileged {@code true} if the method should be looked up using an {@link java.security.AccessController}.
* @param privileged {@code true} if the method should be looked up using an {@code java.security.AccessController}.
*/
protected DelegationMethod(Implementation.SpecialMethodInvocation specialMethodInvocation, boolean cached, boolean privileged) {
this.specialMethodInvocation = specialMethodInvocation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@
boolean cache() default true;

/**
* Determines if the method should be resolved by using an {@link java.security.AccessController} using the privileges of the generated class.
* Doing so requires the generation of an auxiliary class that implements {@link java.security.PrivilegedExceptionAction}.
* Determines if the method should be resolved by using an {@code java.security.AccessController} using the privileges of the generated class.
* Doing so requires the generation of an auxiliary class that implements {@code java.security.PrivilegedExceptionAction}.
*
* @return {@code true} if the class should be looked up using an {@link java.security.AccessController}.
* @return {@code true} if the class should be looked up using an {@code java.security.AccessController}.
*/
boolean privileged() default false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
boolean cached() default true;

/**
* Indicates if the instance assigned to this parameter should be looked up using an {@link java.security.AccessController}.
* Indicates if the instance assigned to this parameter should be looked up using an {@code java.security.AccessController}.
*
* @return {@code true} if this method should be looked up using an {@link java.security.AccessController}.
* @return {@code true} if this method should be looked up using an {@code java.security.AccessController}.
*/
boolean privileged() default false;

Expand Down Expand Up @@ -140,7 +140,7 @@ protected static class DelegationMethod implements StackManipulation {
private final boolean cached;

/**
* {@code true} if this method should be looked up using an {@link java.security.AccessController}.
* {@code true} if this method should be looked up using an {@code java.security.AccessController}.
*/
private final boolean privileged;

Expand All @@ -149,7 +149,7 @@ protected static class DelegationMethod implements StackManipulation {
*
* @param specialMethodInvocation The special method invocation that represents the super method call.
* @param cached {@code true} if the method constant should be cached.
* @param privileged {@code true} if this method should be looked up using an {@link java.security.AccessController}.
* @param privileged {@code true} if this method should be looked up using an {@code java.security.AccessController}.
*/
protected DelegationMethod(Implementation.SpecialMethodInvocation specialMethodInvocation, boolean cached, boolean privileged) {
this.specialMethodInvocation = specialMethodInvocation;
Expand Down

0 comments on commit 08c7709

Please sign in to comment.