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?
What am I missing?
++Vamsi