Vamsavardhana Reddy (JIRA) wrote:
[ https://issues.apache.org/jira/browse/TUSCANY-2165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12585048#action_12585048 ]
Vamsavardhana Reddy commented on TUSCANY-2165:
----------------------------------------------
Java Component Implementation Specification v 1.0 lines 358 to 365:
358 1.2.7. Semantics of an Unannotated Implementation
359 The section defines the rules for determining properties and references for
a Java component
360 implementation that does not explicitly declare them using @Reference or
@Property.
361 In the absence of @Property and @Reference annotations, the properties and
references of a class are
362 defined according to the following rules:
363 1. Public setter methods that are not included in any interface specified
by an @Service annotation.
364 2. Protected setter methods
365 3. Public or protected fields unless there is a public or protected setter
method for the same name
Does this mean that if either an @Property or @Reference annotation is used in
the implementation, rest of the unannotated fields and setter methods should
simply be ignored? If yes, (which is the current implementation in tuscany) b4
and b5 in
org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.AServiceImpl
will never make into the componentType as references and there is no question
of injection. We will need AnotherAServiceImpl in which none of the fields and
setter methods are annotated so that b4 and b5 will be computed as references.
Am I missing anything?
I believe section 1.2.7 is about implementations with no annotations
at all. Therefore it does not apply if any annotations are present.
Simon
Java runtime should inject service references to field with common name in absence of @Reference
-------------------------------------------------------------------------------------------------
Key: TUSCANY-2165
URL: https://issues.apache.org/jira/browse/TUSCANY-2165
Project: Tuscany
Issue Type: Bug
Components: Java SCA Core Runtime
Affects Versions: Java-SCA-Next
Reporter: Kevin Williams
Assignee: Vamsavardhana Reddy
Priority: Minor
The Java Annotations&APIs specification Lines 1407, 1408, 1409, 1410 ...
* References may also be injected via public setter methods even when the
* "@Reference" annotation is not present. However, the "@Reference"
* annotation must be used in order to inject a reference onto a non public
* field. In the case where there is no "@Reference" annotation, the name of
* the reference is the same as the name of the field or setter.
The vTest:
org.apache.tuscany.sca.vtest.javaapi.ReferenceAnnotationTestCase.atReference2
demonstrates this issue
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]