Carsten Ziegeler created FELIX-4957:
---------------------------------------

             Summary: [DS][RFC-212] Various issues with field references
                 Key: FELIX-4957
                 URL: https://issues.apache.org/jira/browse/FELIX-4957
             Project: Felix
          Issue Type: Bug
          Components: Declarative Services (SCR)
            Reporter: Carsten Ziegeler
            Assignee: Carsten Ziegeler
             Fix For: scr-2.0.0


1. The DS spec states that non-volatile fields with dynamic references is an 
error. These fields must not be injected. See 112.3.8.1:

"For a dynamic reference, the field must be declared with the volatile modifier 
so that field value changes made by SCR are visible to other threads. If the 
field is not declared with the volatile modifier, SCR must log an error message 
with the Log Service, if present, and the field must not be modified."

2. When a field with a dynamic reference holds the service properties of the 
referenced service, the field must be modified then the referenced service's 
properties are changed.

See 112.3.8.1:

"For a dynamic reference with unary cardinality, SCR must set the field with 
initial bound service, if any, before the component instance is activated. When 
there is a new bound service or the service properties of the bound service are 
modified and the field holds service properties, SCR must replace the field 
value. "

3. When a component uses a static field reference holding properties for the 
referenced service and these service properties change, DS must reactivate the 
component to inject the updated service properties.

See 112.3.8.1:

"For a static reference, SCR must set the value of the field before the 
component instance is activat- ed and must not change the field while the 
component is active."

So the component must be reactivated to receive the updated service properties.

4. When a final field is used as a reference, DS must activate the component 
but not set the field value.

See 112.3.8.1:

"If the field is declared with the final modifier, SCR must log an error 
message with the Log Service, if present, and the field must not be modified."

5. If a field reference is optional and there is no bound service, DS must null 
the field.

See 112.3.8.1:

"If the reference has optional cardinality and there is no bound service, SCR 
must set the field value to null."



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to