Author: akazakov
Date: 2010-12-29 14:42:03 -0500 (Wed, 29 Dec 2010)
New Revision: 27804
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/BeanWithDefaultConsturctor.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
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/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java
Log:
https://issues.jboss.org/browse/JBIDE-8018
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-29
19:26:10 UTC (rev 27803)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-29
19:42:03 UTC (rev 27804)
@@ -1406,7 +1406,9 @@
} else {
IMethod[] methods = bean.getBeanClass().getMethods();
boolean hasDefaultConstructor = false;
+ boolean hasConstructor = false;
for (IMethod method : methods) {
+ hasConstructor = hasConstructor || method.isConstructor();
hasDefaultConstructor = hasDefaultConstructor || (method.isConstructor()
&& !Flags.isPrivate(method.getFlags()) &&
method.getParameterNames().length==0);
if(Flags.isFinal(method.getFlags())) {
// - Classes which have final methods cannot be proxied by the container.
@@ -1415,7 +1417,7 @@
break;
}
}
- if(!hasDefaultConstructor) {
+ if(!hasDefaultConstructor && hasConstructor) {
// - Classes which don't have a non-private constructor with no parameters
cannot be proxied by the container.
addError(MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE_WITH_NPC,
injection.getType().getSimpleName(), bean.getSimpleJavaName()),
CDIPreferences.UNPROXYABLE_BEAN_TYPE, reference, injection.getResource());
}
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-12-29
19:26:10 UTC (rev 27803)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-12-29
19:42:03 UTC (rev 27804)
@@ -10,9 +10,9 @@
AMBIGUOUS_INJECTION_POINTS=Multiple beans are eligible for injection to the injection
point [JSR-299 �5.2.1]
UNPROXYABLE_BEAN_ARRAY_TYPE=Injection point declares an array type {0} that cannot be
proxied by the container resolves to a bean {1} with a normal scope [JSR-299 �5.4.1]
UNPROXYABLE_BEAN_PRIMITIVE_TYPE=Injection point declares a primitive type {0} that cannot
be proxied by the container resolves to a bean {1} with a normal scope [JSR-299 �5.4.1]
-UNPROXYABLE_BEAN_TYPE_WITH_NPC=Injection point declares a class {0} with a non-private
constructor with no parameters (such a class cannot be proxied by the container) resolves
to a bean {1} with a normal scope [JSR-299 �5.4.1]
-UNPROXYABLE_BEAN_FINAL_TYPE=Injection point declares a final class {0} that cannot be
proxied by the container resolves to a bean {1} with a normal scope [JSR-299 �5.4.1]
-UNPROXYABLE_BEAN_TYPE_WITH_FM=Injection point declares a class {0} with final methods
(such a class cannot be proxied by the container) resolves to a bean {1} with a normal
scope [JSR-299 �5.4.1]
+UNPROXYABLE_BEAN_TYPE_WITH_NPC=Injection point whose declared type ({0} is a class with a
non-private constructor with no parameters) cannot be proxied by the container resolves to
a bean {1} with a normal scope [JSR-299 �5.4.1]
+UNPROXYABLE_BEAN_FINAL_TYPE=Injection point whose declared type ({0} is a final class)
cannot be proxied by the container resolves to a bean {1} with a normal scope [JSR-299
�5.4.1]
+UNPROXYABLE_BEAN_TYPE_WITH_FM=Injection point whose declared type ({0} is a class with
final methods) cannot be proxied by the container resolves to a bean {1} with a normal
scope [JSR-299 �5.4.1]
DECORATOR_RESOLVES_TO_FINAL_CLASS=Decorator must not be bound to a managed bean
implemented by a class {0} which is declared final [JSR-299 �8.3]
DECORATOR_RESOLVES_TO_FINAL_METHOD=Decorator matches a managed bean {0} with a
non-static, non-private, final method {1}, and the decorator also implements that method
[JSR-299 �8.3]
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/BeanWithDefaultConsturctor.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/BeanWithDefaultConsturctor.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/BeanWithDefaultConsturctor.java 2010-12-29
19:42:03 UTC (rev 27804)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.unproxyable;
+
+import javax.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class BeanWithDefaultConsturctor {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/BeanWithDefaultConsturctor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
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 2010-12-29
19:26:10 UTC (rev 27803)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/unproxyable/Number_Broken.java 2010-12-29
19:42:03 UTC (rev 27804)
@@ -19,4 +19,7 @@
@SuppressWarnings("unused")
@TestQualifier
@Inject private boolean numberOk1;
+
+ @SuppressWarnings("unused")
+ @Inject private BeanWithDefaultConsturctor numberOk2;
}
\ No newline at end of file
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-12-29
19:26:10 UTC (rev 27803)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java 2010-12-29
19:42:03 UTC (rev 27804)
@@ -159,6 +159,15 @@
}
/**
+ *
https://issues.jboss.org/browse/JBIDE-8018
+ * @throws Exception
+ */
+ public void testClassWithDefaultConstructor() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/unproxyable/Number_Broken.java");
+ assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE_WITH_NPC,
"BeanWithDefaultConsturctor", "BeanWithDefaultConsturctor"), 24);
+ }
+
+ /**
* 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,