Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.jboss.cdi.tck.tests.definition.stereotype.broken.scopeConflict.transitive;

import jakarta.enterprise.context.RequestScoped;
import jakarta.enterprise.inject.Stereotype;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Stereotype
@Target({ TYPE, METHOD, FIELD })
@Retention(RUNTIME)
@FishStereotype
@RequestScoped
public @interface AnimalStereotype {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.jboss.cdi.tck.tests.definition.stereotype.broken.scopeConflict.transitive;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Stereotype;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Stereotype
@Target({ TYPE })
@Retention(RUNTIME)
@ApplicationScoped
public @interface FishStereotype {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.jboss.cdi.tck.tests.definition.stereotype.broken.scopeConflict.transitive;

/**
* This bean definition is invalid because it has two stereotypes (one directly, one transitively)
* that have different default scopes and the bean does not explictly define a scope to resolve the conflict.
*/
@AnimalStereotype
public class Scallop_Broken {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.jboss.cdi.tck.tests.definition.stereotype.broken.scopeConflict.transitive;

import jakarta.enterprise.inject.spi.DefinitionException;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.ShouldThrowException;
import org.jboss.cdi.tck.AbstractTest;
import org.jboss.cdi.tck.shrinkwrap.WebArchiveBuilder;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.test.audit.annotations.SpecAssertion;
import org.jboss.test.audit.annotations.SpecAssertions;
import org.jboss.test.audit.annotations.SpecVersion;
import org.testng.annotations.Test;

import static org.jboss.cdi.tck.cdi.Sections.DEFAULT_SCOPE;

@SpecVersion(spec = "cdi", version = "2.0")
public class TransitiveIncompatibleStereotypesTest extends AbstractTest {

@ShouldThrowException(DefinitionException.class)
@Deployment
public static WebArchive createTestArchive() {
return new WebArchiveBuilder().withTestClassPackage(TransitiveIncompatibleStereotypesTest.class).build();
}

@Test
@SpecAssertions({ @SpecAssertion(section = DEFAULT_SCOPE, id = "da") })
public void testMultipleTransitiveIncompatibleScopeStereotypes() {
}
}
4 changes: 2 additions & 2 deletions impl/src/main/resources/tck-audit-cdi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@
</assertion>

<assertion id="da">
<text>If there are two different stereotypes declared by the bean that declare different default scopes, then there is no default scope and the bean
must explicitly declare a scope. If it does not explicitly declare a scope, the container automatically
<text>If there are two different stereotypes present on the bean, directly, indirectly, or transitively, that declare different default scopes,
then there is no default scope and the bean must explicitly declare a scope. If it does not explicitly declare a scope, the container automatically
detects the problem and treats it as a definition error.
</text>
</assertion>
Expand Down