[
https://issues.apache.org/jira/browse/TUSCANY-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12591997#action_12591997
]
Vamsavardhana Reddy commented on TUSCANY-2266:
----------------------------------------------
Looks like unannotated protected fields computed as properties also have the
same problem!!
PART-3:
Java Common Annotations and APIs - v1.0 - Sec 1.8.13:
1349 Properties may also be injected via public setter methods even when the
@Property annotation is not
1350 present. However, the @Property annotation must be used in order to inject
a property onto a non-public
1351 field. In the case where there is no @Property annotation, the name of the
property is the same as the
1352 name of the field or setter.
> Problem with protected field computed as a reference for an unannotated
> implementation
> --------------------------------------------------------------------------------------
>
> Key: TUSCANY-2266
> URL: https://issues.apache.org/jira/browse/TUSCANY-2266
> Project: Tuscany
> Issue Type: Bug
> Components: Java SCA Java Implementation Extension
> Affects Versions: Java-SCA-1.2
> Reporter: Vamsavardhana Reddy
>
> Looks like an unannotated protected field computed as reference in an
> unannotated java implementation can not get its value injected. The
> following is a query posted to the dev-list:
> ----------------
> PART-1:
> 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.
> This means a reference can not be injected onto a protected field without an
> @Reference annotation.
> PART-2:
> Java Component Implementation Specification - Section 1.2.7 line 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
> This means a protected field could end up as a reference in an unannotated
> implementation. But from PART-1 above, a reference can not be injected
> unless an @Reference annotation is present on a protected field!!! How will
> a protected field computed as a reference for an unannotated implementation
> get its value set?
> ----------------
> The issue has been raised in OASIS SCA Java TC (See
> http://www.oasis-open.org/apps/org/workgroup/sca-j/email/archives/200804/msg00041.html).
> This JIRA is created to track progress on resolution in Tuscany once the
> spec issue is resolved in OASIS TC.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.