[
https://issues.apache.org/jira/browse/SLING-11860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Norman updated SLING-11860:
--------------------------------
Description:
Impacts both the activate/deactivate methods and the bind/unbind methods
The scenario where this happens is when the parent class has an
activate/deactivate/bind/unbind method with one set of arguments and the
subclass has an activate/deactivate/bind/unbind method with the same name but
with a different set of arguments.
For example, when the context.registerInjectActivateService(..) call is
invoked, it finds the activate(Map) method from the parent class and invokes
it and then returns instead of calling the more specific activate(Config)
methods from the subclass.
{code:java}
public class ParentComponent {
protected void activate(Map<String, Object> props) {
// this should not be invoked when activating SubComponent
}
}
@Component
@Designate(ocd=SubComponent.Config.class)
public class SubComponent extends ParentComponent {
@ObjectClassDefinition(name = "SubComponent Config")
public @interface Config {
@AttributeDefinition(name = "Prop One")
boolean prop1() default true;
}
@Activate
protected void activate(Config cfg) {
// should be invoked when activating
}
} {code}
was:
Impacts both the activate/deactivate methods and the bind/unbind methods
The scenario where this happens is when the parent class has an
activate/deactivate/bind/unbind method with one set of arguments and the
subclass has an activate/deactivate/bind/unbind method with the same name but
with a different set of arguments.
For example, when the context.registerInjectActivateService(..) call is
invoked, it finds the activate(Map) method from the parent class and invokes
it and then returns instead of calling the more specific activate(Config)
methods from the subclass.
{code:java}
public class ParentComponent {
protected void activate(Map<String, Object> props) {
// this should not be invoked when activating SubComponent
}
}
@Designate(ocd=SubComponent.Config.class)
public class SubComponent extends ParentComponent {
@ObjectClassDefinition(name = "SubComponent Config")
public @interface Config {
@AttributeDefinition(name = "Prop One")
boolean prop1() default true;
}
@Activate
protected void activate(Config cfg) {
// should be invoked when activating
}
} {code}
> OsgiServiceUtil may invoke the wrong method
> -------------------------------------------
>
> Key: SLING-11860
> URL: https://issues.apache.org/jira/browse/SLING-11860
> Project: Sling
> Issue Type: Bug
> Components: Testing
> Reporter: Eric Norman
> Assignee: Eric Norman
> Priority: Major
> Fix For: Testing OSGi Mock 3.3.8
>
>
> Impacts both the activate/deactivate methods and the bind/unbind methods
> The scenario where this happens is when the parent class has an
> activate/deactivate/bind/unbind method with one set of arguments and the
> subclass has an activate/deactivate/bind/unbind method with the same name but
> with a different set of arguments.
> For example, when the context.registerInjectActivateService(..) call is
> invoked, it finds the activate(Map) method from the parent class and invokes
> it and then returns instead of calling the more specific activate(Config)
> methods from the subclass.
> {code:java}
> public class ParentComponent {
> protected void activate(Map<String, Object> props) {
> // this should not be invoked when activating SubComponent
> }
> }
> @Component
> @Designate(ocd=SubComponent.Config.class)
> public class SubComponent extends ParentComponent {
> @ObjectClassDefinition(name = "SubComponent Config")
> public @interface Config {
> @AttributeDefinition(name = "Prop One")
> boolean prop1() default true;
> }
> @Activate
> protected void activate(Config cfg) {
> // should be invoked when activating
> }
> } {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)