[
https://issues.apache.org/jira/browse/FELIX-2353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869965#action_12869965
]
Clement Escoffier commented on FELIX-2353:
------------------------------------------
Hi,
The 'instanceof Nullable' pattern does not work on Smart Proxy. If you must do
this check, you can disable the proxy for one specific dependency with
proxy="false":
@Requires(optional=true, proxy=false)
private Bar bar;
BTW, Nullable are never injected for non optional dependency.
> Smart proxies conflicts with testing for Nullable instances
> -----------------------------------------------------------
>
> Key: FELIX-2353
> URL: https://issues.apache.org/jira/browse/FELIX-2353
> Project: Felix
> Issue Type: Bug
> Components: iPOJO
> Affects Versions: iPOJO-1.6.0
> Environment: OS: Fedora 11
> JVM: Sun JDK 1.6.0_18
> OSGi Framework: Equinox 3.5
> Reporter: Sebastien GRIMARD
>
> Smart proxies which were introduced in iPojo 1.6.0 break the "instanceOf
> Nullable" check.
> example :
> @Component
> public class Foo
> {
> @Required(optional=false)
> private Bar bar;
> @Validate
> public void validate()
> {
> if (bar instanceOf Nullable)
> {
> System.out.println("Nullable");
> }
> else
> {
> System.out.println("True implementation");
> }
> }
> }
> Using smart proxies only "True implementation" will ever be printed even if
> Bar has no implementation published.
> Workaround: disable smart proxies by setting ipojo.proxy to disabled
> priority: major since smart proxies are enabled by default
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.