Author: akazakov
Date: 2010-11-25 12:15:23 -0500 (Thu, 25 Nov 2010)
New Revision: 26943
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/ArrayProducer.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/InjectionPointBean_Broken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/NumberProducer.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/Number_Broken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestQualifier.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestScope.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestType.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java
Log:
https://jira.jboss.org/browse/JBIDE-6575 Added new tests for unproxyable bean types
validation rules (this validation has not been implemented yet).
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java 2010-11-25
16:39:46 UTC (rev 26942)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -41,6 +41,7 @@
defaultPreferences.put(CDIPreferences.MISSING_NONBINDING_IN_QUALIFIER_TYPE_MEMBER,
CDIPreferences.WARNING);
defaultPreferences.put(CDIPreferences.UNSATISFIED_INJECTION_POINTS,
CDIPreferences.WARNING);
defaultPreferences.put(CDIPreferences.AMBIGUOUS_INJECTION_POINTS,
CDIPreferences.WARNING);
+ defaultPreferences.put(CDIPreferences.UNPROXYABLE_BEAN_TYPE, CDIPreferences.WARNING);
defaultPreferences.put(CDIPreferences.INJECT_RESOLVES_TO_NULLABLE_BEAN,
CDIPreferences.WARNING);
defaultPreferences.put(CDIPreferences.INJECTED_DECORATOR, CDIPreferences.WARNING);
defaultPreferences.put(CDIPreferences.INJECTED_INTERCEPTOR, CDIPreferences.WARNING);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java 2010-11-25
16:39:46 UTC (rev 26942)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -47,6 +47,10 @@
// treats it as a deployment problem.
public static final String UNSATISFIED_INJECTION_POINTS =
INSTANCE.createSeverityOption("unsatisfiedInjectionPoints"); //$NON-NLS-1$
public static final String AMBIGUOUS_INJECTION_POINTS =
INSTANCE.createSeverityOption("ambiguousInjectionPoints"); //$NON-NLS-1$
+// 5.4.1. Unproxyable bean types
+// - If an injection point whose declared type cannot be proxied by the container
resolves to a bean with a normal scope,
+// the container automatically detects the problem and treats it as a deployment
problem.
+ public static final String UNPROXYABLE_BEAN_TYPE =
INSTANCE.createSeverityOption("unproxyableBeanType"); //$NON-NLS-1$
// - bean class or producer method or field specifies a @Typed annotation,
// and the value member specifies a class which does not correspond to a type
// in the unrestricted set of bean types of a bean (2.2.2)
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-11-25
16:39:46 UTC (rev 26942)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -27,6 +27,8 @@
public static String UNSATISFIED_INJECTION_POINTS;
public static String AMBIGUOUS_INJECTION_POINTS;
+ public static String UNPROXYABLE_BEAN_TYPE;
+
public static String ILLEGAL_TYPE_IN_TYPED_DECLARATION;
public static String ILLEGAL_TYPE_IN_TYPED_DECLARATION_IN_BEAN_CLASS;
public static String ILLEGAL_TYPE_IN_TYPED_DECLARATION_IN_PRODUCER_METHOD;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-11-25
16:39:46 UTC (rev 26942)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-11-25
17:15:23 UTC (rev 26943)
@@ -6,6 +6,7 @@
UNSATISFIED_INJECTION_POINTS=No bean is eligible for injection to the injection point
AMBIGUOUS_INJECTION_POINTS=Multiple beans are eligible for injection to the injection
point
+UNPROXYABLE_BEAN_TYPE=Injection point declares a type {0} that cannot be proxied by the
container resolves to a bean {1} with a normal scope [JSR-299 �5.4.1]
ILLEGAL_TYPE_IN_TYPED_DECLARATION=Bean specifies a @Typed annotation, and the value
member specifies a class which does not correspond to a type in the unrestricted set of
bean types of a bean [JSR-299 �2.2.2]
ILLEGAL_TYPE_IN_TYPED_DECLARATION_IN_BEAN_CLASS=Bean class specifies a @Typed annotation,
and the value member specifies a class which does not correspond to a type in the
unrestricted set of bean types of a bean [JSR-299 �2.2.2]
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-11-25
16:39:46 UTC (rev 26942)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -45,6 +45,7 @@
new String[][]{
{CDIPreferences.UNSATISFIED_INJECTION_POINTS,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_unsatisfiedInjectionPoints_label},
{CDIPreferences.AMBIGUOUS_INJECTION_POINTS,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_ambiguousInjectionPoints_label},
+// {CDIPreferences.UNPROXYABLE_BEAN_TYPE,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_unproxyableBeanType_label},
{CDIPreferences.ILLEGAL_TYPE_IN_TYPED_DECLARATION,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalTypeInTypedDeclaration_label},
{CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeHasWildcard_label},
{CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeIsVariable_label},
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java 2010-11-25
16:39:46 UTC (rev 26942)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -44,6 +44,7 @@
public static String CDIValidatorConfigurationBlock_section_type;
public static String
CDIValidatorConfigurationBlock_pb_unsatisfiedInjectionPoints_label;
public static String CDIValidatorConfigurationBlock_pb_ambiguousInjectionPoints_label;
+ public static String CDIValidatorConfigurationBlock_pb_unproxyableBeanType_label;
public static String
CDIValidatorConfigurationBlock_pb_illegalTypeInTypedDeclaration_label;
public static String
CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeHasWildcard_label;
public static String
CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeIsVariable_label;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties 2010-11-25
16:39:46 UTC (rev 26942)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties 2010-11-25
17:15:23 UTC (rev 26943)
@@ -33,6 +33,7 @@
CDIValidatorConfigurationBlock_section_type=Type
CDIValidatorConfigurationBlock_pb_unsatisfiedInjectionPoints_label=Unsatisfied
dependencies for injection point:
CDIValidatorConfigurationBlock_pb_ambiguousInjectionPoints_label=Ambiguous dependencies
for injection point:
+CDIValidatorConfigurationBlock_pb_unproxyableBeanType_label=Unproxyable bean type for
injection point:
CDIValidatorConfigurationBlock_pb_illegalTypeInTypedDeclaration_label=Illegal type in
@Typed:
CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeHasWildcard_label=Wildcard in
producer field type/method return type:
CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeIsVariable_label=Variable in
producer field type/method return type:
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/ArrayProducer.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/ArrayProducer.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/ArrayProducer.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -0,0 +1,17 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.unproxyable;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+public class ArrayProducer {
+
+ @Produces @RequestScoped
+ public TestType[] produce() {
+ return new TestType[0];
+ }
+
+ @Produces @TestQualifier @TestScope
+ public TestType[] produce2() {
+ return new TestType[0];
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/ArrayProducer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/InjectionPointBean_Broken.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/InjectionPointBean_Broken.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/InjectionPointBean_Broken.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.unproxyable;
+
+import javax.inject.Inject;
+
+public class InjectionPointBean_Broken {
+ @Inject TestType[] arrayBroken;
+ @Inject TestType arrayOk;
+ @Inject @TestQualifier TestType[] arrayBroken2;
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/InjectionPointBean_Broken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/NumberProducer.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/NumberProducer.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/NumberProducer.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -0,0 +1,29 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.unproxyable;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+class NumberProducer {
+
+ @Produces
+ @RequestScoped
+ @TestQualifier
+ public int produce() {
+ return 0;
+ }
+
+ @Produces
+ @RequestScoped
+ @TestQualifier
+ public long foo;
+
+ @Produces
+ @RequestScoped
+ @TestQualifier
+ public short foo2;
+
+ @Produces
+ @TestScope
+ @TestQualifier
+ public boolean foo3;
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/NumberProducer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/Number_Broken.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/Number_Broken.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/Number_Broken.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.unproxyable;
+
+import javax.inject.Inject;
+
+class Number_Broken {
+
+ @SuppressWarnings("unused")
+ @TestQualifier
+ @Inject private int numberBroken;
+
+ @SuppressWarnings("unused")
+ @TestQualifier
+ @Inject private long numberBroken2;
+
+ @SuppressWarnings("unused")
+ @TestQualifier
+ @Inject private Short numberOk;
+
+ @SuppressWarnings("unused")
+ @TestQualifier
+ @Inject private boolean numberOk1;
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/Number_Broken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestQualifier.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestQualifier.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestQualifier.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.unproxyable;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface TestQualifier {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestQualifier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestScope.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestScope.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestScope.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.unproxyable;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Scope;
+
+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;
+
+@Scope
+@Inherited
+@Target({ TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface TestScope {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestScope.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestType.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestType.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestType.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.unproxyable;
+
+public class TestType {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/TestType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java 2010-11-25
16:39:46 UTC (rev 26942)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java 2010-11-25
17:15:23 UTC (rev 26943)
@@ -11,6 +11,8 @@
package org.jboss.tools.cdi.core.test.tck.validation;
+import java.text.MessageFormat;
+
import org.eclipse.core.resources.IFile;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationMessages;
@@ -61,4 +63,74 @@
assertMarkerIsNotCreated(file, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN,
21);
assertMarkerIsNotCreated(file, CDIValidationMessages.INJECT_RESOLVES_TO_NULLABLE_BEAN,
22);
}
+
+ /**
+ * 5.4.1. Unproxyable bean types
+ * - Array types cannot be proxied by the container.
+ * - If an injection point whose declared type cannot be proxied by the container
resolves to a bean with a normal scope,
+ * the container automatically detects the problem and treats it as a deployment
problem.
+ *
+ * @throws Exception
+ */
+ public void _testInjectionPointWithArrayType() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/unproxyable/InjectionPointBean_Broken.java");
+ assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE, "TestType[]",
"ArrayProducer.produce()"), 6);
+ assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE, "TestType[]",
"ArrayProducer.produce2()"), 8);
+ assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE, "TestType",
"TestType"), 7);
+ }
+
+ /**
+ * 5.4.1. Unproxyable bean types
+ * - Primitive types cannot be proxied by the container.
+ * - If an injection point whose declared type cannot be proxied by the container
resolves to a bean with a normal scope,
+ * the container automatically detects the problem and treats it as a deployment
problem.
+ *
+ * @throws Exception
+ */
+ public void _testInjectionPointWithUnproxyableTypeWhichResolvesToNormalScopedBean()
throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/unproxyable/Number_Broken.java");
+ assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE, "int",
"NumberProducer.produce()"), 9);
+ assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE, "long",
"NumberProducer.foo"), 13);
+ assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE, "Short",
"NumberProducer.foo2"), 17);
+ assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE, "boolean",
"NumberProducer.foo3"), 21);
+ }
+
+ /**
+ * 5.4.1. Unproxyable bean types
+ * - Classes which don't have a non-private constructor with no parameters cannot
be proxied by the container.
+ * - If an injection point whose declared type cannot be proxied by the container
resolves to a bean with a normal scope,
+ * the container automatically detects the problem and treats it as a deployment
problem.
+ *
+ * @throws Exception
+ */
+ public void _testClassWithPrivateConstructor() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/clientProxy/unproxyable/privateConstructor/InjectionPointBean.java");
+ assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE,
"Unproxyable_Broken", "Unproxyable_Broken"), 23);
+ }
+
+ /**
+ * 5.4.1. Unproxyable bean types
+ * - Classes which are declared final cannot be proxied by the container.
+ * - If an injection point whose declared type cannot be proxied by the container
resolves to a bean with a normal scope,
+ * the container automatically detects the problem and treats it as a deployment
problem.
+ *
+ * @throws Exception
+ */
+ public void _testInjectionPointWhichResolvesToNormalScopedFinalBean() throws Exception
{
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/clientProxy/unproxyable/finalClass/FishFarm.java");
+ assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE, "Tuna_Broken",
"Tuna_Broken"), 24);
+ }
+
+ /**
+ * 5.4.1. Unproxyable bean types
+ * - Classes which have final methods cannot be proxied by the container.
+ * - If an injection point whose declared type cannot be proxied by the container
resolves to a bean with a normal scope,
+ * the container automatically detects the problem and treats it as a deployment
problem.
+ *
+ * @throws Exception
+ */
+ public void _testClassWithFinalMethodCannotBeProxied() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/clientProxy/unproxyable/finalMethod/FishFarm.java");
+ assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE, "Tuna_Broken",
"Tuna_Broken"), 23);
+ }
}
\ No newline at end of file