Arne did it i think yes Le 2 juil. 2014 20:44, "Mark Struberg" <[email protected]> a écrit :
> Deleted this now and it seems another change already fixed the issue you > had. At least we have the exact same amount of tests failing like before > removing OwbAnnotated... And AlternativeMetadataTest now is all green as > well. > > LieGrue, > strub > > > On Wednesday, 2 July 2014, 21:38, Mark Struberg <[email protected]> wrote: > > > > > > > >I'm afraid I have to revert this commit. > > > >It breaks quite a few other tests. I also would like to avoid having code > which differentiates between OwbAnnotated and 3rd party annotated. We've > been there in owb-1.0.x and there was a good reason why we got rid of this > in owb-1.2.x > > > >Romain, do you still remember which test it was which caused you to add > this? Maybe there is another solution for the underlying problem. > > > >LieGrue, > >strub > > > > > > > >On Saturday, 28 June 2014, 18:58, "[email protected]" < > [email protected]> wrote: > > > > > >> > >> > >>Author: rmannibucau > >>Date: Sat Jun 28 16:58:29 2014 > >>New Revision: 1606380 > >> > >>URL: http://svn.apache.org/r1606380 > >>Log: > >>OWB-979 isOverridden in AnnotatedTypeImpl was not checking annotations, > note: we can still enhance the algo checking only CDI annotations > >> > >>Added: > >> > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/OwbAnnotated.java > >>Removed: > >> > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanAttributesImpl.java.cdi-1.1 > >>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/portable/AbstractAnnotated.java > >> > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java > >> openwebbeans/trunk/webbeans-tck/testng-dev.xml > >> > >>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=1606380&r1=1606379&r2=1606380&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 > Sat Jun 28 16:58:29 2014 > >>@@ -21,6 +21,7 @@ package org.apache.webbeans.component.cr > >>import java.lang.annotation.Annotation; > >>import java.lang.reflect.Method; > >>import java.lang.reflect.Type; > >>+import java.util.Collections; > >>import java.util.HashSet; > >>import java.util.Iterator; > >>import java.util.List; > >>@@ -28,8 +29,10 @@ import java.util.Set; > >> > >>import javax.enterprise.context.Dependent; > >>import javax.enterprise.context.NormalScope; > >>+import javax.enterprise.inject.Alternative; > >>import javax.enterprise.inject.Any; > >>import javax.enterprise.inject.Specializes; > >>+import javax.enterprise.inject.Stereotype; > >>import javax.enterprise.inject.spi.Annotated; > >>import javax.enterprise.inject.spi.AnnotatedField; > >>import javax.enterprise.inject.spi.AnnotatedMember; > >>@@ -50,10 +53,14 @@ import org.apache.webbeans.config.WebBea > >>import org.apache.webbeans.container.ExternalScope; > >>import org.apache.webbeans.exception.WebBeansConfigurationException; > >>import javax.enterprise.inject.spi.DefinitionException; > >>+ > >>+import org.apache.webbeans.inject.AlternativesManager; > >>import org.apache.webbeans.logger.WebBeansLoggerFacade; > >>+import org.apache.webbeans.portable.OwbAnnotated; > >>import org.apache.webbeans.util.AnnotationUtil; > >>import org.apache.webbeans.util.Asserts; > >>import org.apache.webbeans.util.ClassUtil; > >>+import org.apache.webbeans.util.GenericsUtil; > >>import org.apache.webbeans.util.WebBeansUtil; > >> > >>/** > >>@@ -130,15 +137,20 @@ public abstract class BeanAttributesBuil > >> } > >> else > >> { > >>- Set<Type> types = annotated.getTypeClosure(); > >>+ // if already computed then reuse it otherwise > >>+ Set<Type> types = OwbAnnotated.class.isInstance(annotated) ? > >>+ annotated.getTypeClosure() : > GenericsUtil.getTypeClosure(baseType, baseType); > >> this.types.addAll(types); > >> Set<String> ignored = > webBeansContext.getOpenWebBeansConfiguration().getIgnoredInterfaces(); > >>- for (Iterator<Type> i = this.types.iterator(); i.hasNext();) > >>+ if (!ignored.isEmpty()) > >> { > >>- Type t = i.next(); > >>- if (t instanceof Class && > ignored.contains(((Class<?>)t).getName())) > >>+ for (Iterator<Type> i = this.types.iterator(); > i.hasNext();) > >> { > >>- i.remove(); > >>+ Type t = i.next(); > >>+ if (t instanceof Class && > ignored.contains(((Class<?>)t).getName())) > >>+ { > >>+ i.remove(); > >>+ } > >> } > >> } > >> } > >>@@ -468,11 +480,42 @@ public abstract class BeanAttributesBuil > >> } > >> } > >> } > >>- > >>+ > >>+ // these alternatives can be not activated > >> protected void defineAlternative() > >> { > >>- alternative = false; > >>+ final AlternativesManager alternativesManager = > webBeansContext.getAlternativesManager(); > >>+ alternative = alternativesManager.isAlternative(getType(), > Collections.<Class<? extends Annotation>>emptySet()); > >>+ if (alternative) > >>+ { > >>+ alternative = true; > >>+ return; > >>+ } > >>+ > >>+ for (final Annotation a : annotated.getAnnotations()) > >>+ { > >>+ final Class<? extends Annotation> annotationType = > a.annotationType(); > >>+ if (annotationType == Alternative.class) > >>+ { > >>+ alternative = true; > >>+ return; > >>+ } > >>+ > >>+ if (annotationType.getAnnotation(Stereotype.class) != null) > >>+ { > >>+ for (final Annotation aa : > annotationType.getAnnotations()) > >>+ { > >>+ if (aa.annotationType() == Alternative.class) > >>+ { > >>+ alternative = true; > >>+ return; > >>+ } > >>+ } > >>+ } > >>+ } > >> } > >>+ > >>+ protected abstract Class<?> getType(); > >> > >> public static class BeanAttributesBuilderFactory > >> { > >>@@ -558,6 +601,12 @@ public abstract class BeanAttributesBuil > >> } > >> > >> @Override > >>+ protected Class<?> getType() > >>+ { > >>+ return annotated.getJavaClass(); > >>+ } > >>+ > >>+ @Override > >> protected AnnotatedType<? super C> getSuperAnnotated() > >> { > >> AnnotatedType<? super C> annotatedType = getAnnotated(); > >>@@ -585,6 +634,12 @@ public abstract class BeanAttributesBuil > >> } > >> > >> @Override > >>+ protected Class<?> getType() > >>+ { > >>+ return annotated.getJavaMember().getType(); > >>+ } > >>+ > >>+ @Override > >> protected void defineScope() > >> { > >> defineScope("Annotated producer field: " + > getAnnotated().getJavaMember() + "must declare default @Scope annotation"); > >>@@ -627,6 +682,12 @@ public abstract class BeanAttributesBuil > >> } > >> > >> @Override > >>+ protected Class<?> getType() > >>+ { > >>+ return annotated.getJavaMember().getReturnType(); > >>+ } > >>+ > >>+ @Override > >> protected void defineScope() > >> { > >> defineScope("Annotated producer method : " + > getAnnotated().getJavaMember() + "must declare default @Scope annotation"); > >> > >>Modified: > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotated.java > >>URL: > http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotated.java?rev=1606380&r1=1606379&r2=1606380&view=diff > > >>============================================================================== > >>--- > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotated.java > (original) > >>+++ > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotated.java > Sat Jun 28 16:58:29 2014 > >>@@ -26,7 +26,6 @@ import java.util.Iterator; > >>import java.util.Set; > >> > >>import javax.enterprise.inject.Typed; > >>-import javax.enterprise.inject.spi.Annotated; > >> > >>import org.apache.webbeans.config.WebBeansContext; > >>import org.apache.webbeans.exception.WebBeansConfigurationException; > >>@@ -39,7 +38,7 @@ import org.apache.webbeans.util.Generics > >> * > >> * @version $Rev$ $Date$ > >> */ > >>-abstract class AbstractAnnotated implements Annotated > >>+abstract class AbstractAnnotated implements OwbAnnotated > >>{ > >> /**Base type of an annotated element*/ > >> private final Type baseType; > >>@@ -157,12 +156,15 @@ abstract class AbstractAnnotated impleme > >> { > >> typeClosures = GenericsUtil.getTypeClosure(baseType, > getOwningClass()); > >> Set<String> ignoredInterfaces = > webBeansContext.getOpenWebBeansConfiguration().getIgnoredInterfaces(); > >>- for (Iterator<Type> i = typeClosures.iterator(); > i.hasNext(); ) > >>+ if (!ignoredInterfaces.isEmpty()) > >> { > >>- Type t = i.next(); > >>- if (t instanceof Class && > ignoredInterfaces.contains(((Class<?>)t).getName())) > >>+ for (Iterator<Type> i = typeClosures.iterator(); > i.hasNext(); ) > >> { > >>- i.remove(); > >>+ Type t = i.next(); > >>+ if (t instanceof Class && > ignoredInterfaces.contains(((Class<?>) t).getName())) > >>+ { > >>+ i.remove(); > >>+ } > >> } > >> } > >> > >> > >>Modified: > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java > >>URL: > http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java?rev=1606380&r1=1606379&r2=1606380&view=diff > > >>============================================================================== > >>--- > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java > (original) > >>+++ > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java > Sat Jun 28 16:58:29 2014 > >>@@ -29,10 +29,14 @@ import java.util.HashSet; > >>import java.util.List; > >>import java.util.Set; > >> > >>+import javax.annotation.PostConstruct; > >>+import javax.annotation.PreDestroy; > >>import javax.enterprise.inject.spi.AnnotatedConstructor; > >>import javax.enterprise.inject.spi.AnnotatedField; > >>import javax.enterprise.inject.spi.AnnotatedMethod; > >>import javax.enterprise.inject.spi.AnnotatedType; > >>+import javax.interceptor.AroundConstruct; > >>+import javax.interceptor.AroundInvoke; > >> > >>import org.apache.webbeans.config.WebBeansContext; > >>import org.apache.webbeans.util.ClassUtil; > >>@@ -262,7 +266,24 @@ class AnnotatedTypeImpl<X> > >> { > >> if > (ClassUtil.isOverridden(subclassMethod.getJavaMember(), > superclassMethod.getJavaMember())) > >> { > >>- return true; > >>+ final Set<Annotation> superAnnotations = > superclassMethod.getAnnotations(); > >>+ final Set<Annotation> subAnnotations = > subclassMethod.getAnnotations(); > >>+ // check that's not a deactivation of > interceptors/lifecycle > >>+ // before checking that's the exact same method > >>+ // TODO: same for EJBs? > >>+ for (final Annotation a : superAnnotations) > >>+ { > >>+ final Class<? extends Annotation> > annotationType = a.annotationType(); > >>+ if (annotationType == AroundConstruct.class || > annotationType == AroundInvoke.class > >>+ || annotationType == PostConstruct.class || > annotationType == PreDestroy.class) > >>+ { > >>+ if (!subAnnotations.contains(a)) > >>+ { > >>+ return true; > >>+ } > >>+ } > >>+ } > >>+ return subAnnotations.equals(superAnnotations); > >> } > >> } > >> return false; > >> > >>Added: > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/OwbAnnotated.java > >>URL: > http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/OwbAnnotated.java?rev=1606380&view=auto > > >>============================================================================== > >>--- > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/OwbAnnotated.java > (added) > >>+++ > openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/OwbAnnotated.java > Sat Jun 28 16:58:29 2014 > >>@@ -0,0 +1,25 @@ > >>+/* > >>+ * Licensed to the Apache Software Foundation (ASF) under one > >>+ * or more contributor license agreements. See the NOTICE file > >>+ * distributed with this work for additional information > >>+ * regarding copyright ownership. The ASF licenses this file > >>+ * to you under the Apache License, Version 2.0 (the > >>+ * "License"); you may not use this file except in compliance > >>+ * with the License. You may obtain a copy of the License at > >>+ * > >>+ * http://www.apache.org/licenses/LICENSE-2.0 > >>+ * > >>+ * Unless required by applicable law or agreed to in writing, > >>+ * software distributed under the License is distributed on an > >>+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >>+ * KIND, either express or implied. See the License for the > >>+ * specific language governing permissions and limitations > >>+ * under the License. > >>+ */ > >>+package org.apache.webbeans.portable; > >>+ > >>+import javax.enterprise.inject.spi.Annotated; > >>+ > >>+public interface OwbAnnotated extends Annotated > >>+{ > >>+} > >> > >>Modified: openwebbeans/trunk/webbeans-tck/testng-dev.xml > >>URL: > http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/testng-dev.xml?rev=1606380&r1=1606379&r2=1606380&view=diff > > >>============================================================================== > >>--- openwebbeans/trunk/webbeans-tck/testng-dev.xml (original) > >>+++ openwebbeans/trunk/webbeans-tck/testng-dev.xml Sat Jun 28 16:58:29 > 2014 > >>@@ -16,21 +16,10 @@ > >> License. > >>--> > >><suite name="JSR-346-TCK" verbose="2" configfailurepolicy="continue" > > >>- > >> <listeners> > >>- <!-- Required - avoid randomly mixed test method execution --> > >> <listener > class-name="org.jboss.cdi.tck.impl.testng.SingleTestClassMethodInterceptor"/> > >>- <!-- Optional - intended for debug purpose only --> > >>- <listener > class-name="org.jboss.cdi.tck.impl.testng.ConfigurationLoggingListener"/> > >> <listener > class-name="org.jboss.cdi.tck.impl.testng.ProgressLoggingTestListener"/> > >>- <!-- Optional - it's recommended to disable the default JUnit > XML reporter --> > >>- <listener class-name="org.testng.reporters.SuiteHTMLReporter"/> > >>- <listener class-name="org.testng.reporters.FailedReporter"/> > >>- <listener class-name="org.testng.reporters.XMLReporter"/> > >>- <listener class-name="org.testng.reporters.EmailableReporter"/> > >>- <listener class-name="org.testng.reporters.TestHTMLReporter"/> > >> </listeners> > >>- > >> <test name="JSR-346 TCK"> > >> <groups> > >> <run> > >>@@ -39,8 +28,7 @@ > >> </run> > >> </groups> > >> <classes> > >>- <class > >>- > name="org.jboss.cdi.tck.tests.lookup.clientProxy.unproxyable.finalMethod.StaticFinalMethodTest" > /> > >>+ <class > name="org.jboss.cdi.tck.tests.extensions.beanManager.beanAttributes.CreateBeanAttributesTest" > /> > >> </classes> > >> </test> > >></suite> > >> > >> > >> > >> > >> > > > >
