Author: struberg
Date: Thu Jun 15 21:50:18 2017
New Revision: 1798884
URL: http://svn.apache.org/viewvc?rev=1798884&view=rev
Log:
OWB-1182 review isManagedBean criteria
TCK has some weird failure checks which need to blow up
in a very specific way...
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java?rev=1798884&r1=1798883&r2=1798884&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
Thu Jun 15 21:50:18 2017
@@ -19,7 +19,9 @@
package org.apache.webbeans.component.creation;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.HashSet;
@@ -202,7 +204,8 @@ public abstract class BeanAttributesBuil
/**
* {@inheritDoc}
*/
- protected void defineQualifiers()
+ protected void
+ defineQualifiers()
{
HashSet<Class<? extends Annotation>> qualifiedTypes = new
HashSet<Class<? extends Annotation>>();
if (annotated.isAnnotationPresent(Specializes.class))
@@ -469,10 +472,22 @@ public abstract class BeanAttributesBuil
scope = Dependent.class;
}
}
+ if (scope == null)
+ {
+ if (annotated instanceof AnnotatedType)
+ {
+ Constructor<Object> defaultCt =
webBeansContext.getWebBeansUtil().getNoArgConstructor(((AnnotatedType)
annotated).getJavaClass());
+ if (defaultCt != null &&
Modifier.isPrivate(defaultCt.getModifiers()))
+ {
+ // basically ignore this class by not adding a scope
+ return;
+ }
+ }
+ }
if (scope == null &&
- (!onlyScopedBeans ||
- annotated.getAnnotation(Interceptor.class) != null ||
- annotated.getAnnotation(Decorator.class) != null))
+ (!onlyScopedBeans ||
+ annotated.getAnnotation(Interceptor.class) != null ||
+ annotated.getAnnotation(Decorator.class) != null))
{
// only add a 'default' Dependent scope
// * if it's not in a bean-discovery-mode='scoped' module, or
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1798884&r1=1798883&r2=1798884&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Thu Jun 15 21:50:18 2017
@@ -398,9 +398,8 @@ public final class WebBeansUtil
Class<?> clazz = annotatedType.getJavaClass();
Constructor<?> defaultCt = getNoArgConstructor(clazz);
- if (defaultCt != null && !Modifier.isPrivate(defaultCt.getModifiers()))
+ if (defaultCt != null )
{
- // if we have an accessible default ct, then all is fine in any
case
return true;
}