Author: struberg
Date: Sat Mar 31 15:00:47 2012
New Revision: 1307821
URL: http://svn.apache.org/viewvc?rev=1307821&view=rev
Log:
OWB-662 remove unused methods and superfluous doPrivileged
We already do lots of unprivileged getDeclaredMethods calls.
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java?rev=1307821&r1=1307820&r2=1307821&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
Sat Mar 31 15:00:47 2012
@@ -39,7 +39,6 @@ import org.apache.webbeans.logger.WebBea
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.Asserts;
import org.apache.webbeans.util.ClassUtil;
-import org.apache.webbeans.util.SecurityUtil;
/**
* Decorator related utility class.
@@ -66,7 +65,7 @@ public final class DecoratorUtil
{
Asserts.assertNotNull(decoratorClazz, "Decorator class is null");
- Method[] methods =
SecurityUtil.doPrivilegedGetDeclaredMethods(decoratorClazz);
+ Method[] methods = decoratorClazz.getDeclaredMethods();
for(Method method : methods)
{
if(AnnotationUtil.hasMethodAnnotation(method, Produces.class))
@@ -111,7 +110,7 @@ public final class DecoratorUtil
throw new WebBeansConfigurationException("Bean : " +
bean.getReturnType().getName() + " can not be declared final, because it has
one or more decorators");
}
- Method[] methods =
SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
+ Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods)
{
int modifiers = method.getModifiers();
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java?rev=1307821&r1=1307820&r2=1307821&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
Sat Mar 31 15:00:47 2012
@@ -58,12 +58,6 @@ public final class EventUtil
}
}
- @Deprecated
- public static void checkEventBindings(Set<Annotation> annotations)
- {
-
WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(annotations);
- }
-
public static void checkEventBindings(WebBeansContext webBeansContext,
Annotation... annotations)
{
for(Annotation ann : annotations)
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=1307821&r1=1307820&r2=1307821&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
Sat Mar 31 15:00:47 2012
@@ -26,12 +26,9 @@ import javax.enterprise.inject.spi.Annot
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.util.Nonbinding;
import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -509,7 +506,7 @@ public final class AnnotationUtil
{
if (!method.isAccessible())
{
- doPrivilegedSetAccessible(method, true);
+ method.setAccessible(true);
}
return method.invoke(instance, EMPTY_OBJECT_ARRAY);
@@ -520,32 +517,6 @@ public final class AnnotationUtil
}
}
- private static Object doPrivilegedSetAccessible(AccessibleObject obj,
boolean flag)
- {
- AccessController.doPrivileged(new
PrivilegedActionForAccessibleObject(obj, flag));
- return null;
- }
-
- private static class PrivilegedActionForAccessibleObject implements
PrivilegedAction<Object>
- {
-
- private AccessibleObject object;
-
- private boolean flag;
-
- protected PrivilegedActionForAccessibleObject(AccessibleObject object,
boolean flag)
- {
- this.object = object;
- this.flag = flag;
- }
-
- public Object run()
- {
- object.setAccessible(flag);
- return null;
- }
- }
-
/**
* Return a List of all methods of the qualifier,
* which are not annotated with @Nonbinding.
@@ -555,8 +526,7 @@ public final class AnnotationUtil
private static List<Method> getBindingQualifierMethods(
Class<? extends Annotation> qualifierAnnotationType)
{
- Method[] qualifierMethods = SecurityUtil
- .doPrivilegedGetDeclaredMethods(qualifierAnnotationType);
+ Method[] qualifierMethods =
qualifierAnnotationType.getDeclaredMethods();
if (qualifierMethods.length > 0)
{