[jira] [Commented] (OWB-1416) Possible misintepretation of spec regarding Unproxyable bean types

2022-11-02 Thread Alexander Larsen (Jira)


[ 
https://issues.apache.org/jira/browse/OWB-1416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17628121#comment-17628121
 ] 

Alexander Larsen commented on OWB-1416:
---

A toggle would indeed work. I can not promise a PR in the immediate future, but 
I might take a look at it if I can find time to do it.

I suspect it would at least be somewhat intrusive, since I'm guessing it would 
need to move validations from per managed bean to injection points, and also 
some changes on how proxies for contextual references are created - but I have 
not looked at the code.

In any case, it's interesting to know that OWB might be open to support this 
functionality - that is the first step towards a PR :)

> Possible misintepretation of spec regarding Unproxyable bean types
> --
>
> Key: OWB-1416
> URL: https://issues.apache.org/jira/browse/OWB-1416
> Project: OpenWebBeans
>  Issue Type: Bug
>Reporter: Alexander Larsen
>Priority: Major
>
> OWB seems to throw an exception for all unproxyable normal scoped beans. I 
> think that this might be incorrect.
> The 
> [specification|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#unproxyable] 
> says the "A bean type must be proxyable if an injection point resolves to a 
> bean", not that all the types of the bean must be proxyable. In other words, 
> as long as the bean is a legal bean, and all injection point resolving to 
> this bean is a proxyable type - no exception should be thrown.
> In the part about [contextual 
> references|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#contextual_reference],
>  there is further indications that unproxyable types should be allowed in the 
> set of types for the bean. It's only when you try to get a reference(injected 
> or by bean manager) to an unproxyable type, and the bean must be proxied 
> (normal scoped, intercepted or decorated) an exception should thrown.
> Also, the [Weld user guide suggests introducing an interface as a solution to 
> having an unproxyable 
> bean|https://docs.jboss.org/weld/reference/latest/en-US/html_single/#_client_proxies].
> The current OWB implementation makes a pattern of having an interface and 
> (one or more) implementation class with final fields/methods somewhat 
> difficult :)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OWB-1416) Possible misintepretation of spec regarding Unproxyable bean types

2022-11-02 Thread Romain Manni-Bucau (Jira)


[ 
https://issues.apache.org/jira/browse/OWB-1416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627686#comment-17627686
 ] 

Romain Manni-Bucau commented on OWB-1416:
-

What about doing a pr to fix it? If not too intrusive a toggle can be a good 
compromise no?

> Possible misintepretation of spec regarding Unproxyable bean types
> --
>
> Key: OWB-1416
> URL: https://issues.apache.org/jira/browse/OWB-1416
> Project: OpenWebBeans
>  Issue Type: Bug
>Reporter: Alexander Larsen
>Priority: Major
>
> OWB seems to throw an exception for all unproxyable normal scoped beans. I 
> think that this might be incorrect.
> The 
> [specification|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#unproxyable] 
> says the "A bean type must be proxyable if an injection point resolves to a 
> bean", not that all the types of the bean must be proxyable. In other words, 
> as long as the bean is a legal bean, and all injection point resolving to 
> this bean is a proxyable type - no exception should be thrown.
> In the part about [contextual 
> references|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#contextual_reference],
>  there is further indications that unproxyable types should be allowed in the 
> set of types for the bean. It's only when you try to get a reference(injected 
> or by bean manager) to an unproxyable type, and the bean must be proxied 
> (normal scoped, intercepted or decorated) an exception should thrown.
> Also, the [Weld user guide suggests introducing an interface as a solution to 
> having an unproxyable 
> bean|https://docs.jboss.org/weld/reference/latest/en-US/html_single/#_client_proxies].
> The current OWB implementation makes a pattern of having an interface and 
> (one or more) implementation class with final fields/methods somewhat 
> difficult :)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OWB-1416) Possible misintepretation of spec regarding Unproxyable bean types

2022-11-02 Thread Alexander Larsen (Jira)


[ 
https://issues.apache.org/jira/browse/OWB-1416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627676#comment-17627676
 ] 

Alexander Larsen commented on OWB-1416:
---

OK. I still think this should be reconsidered ;-)

Even though the work arounds are easy - it's kind of "boilerplatey" 
(producer-method), or even outright ugly (introducing "invalid" constructors, 
"unfinalizing" things).

Anyways, thanks for your patience and rapid replies!

> Possible misintepretation of spec regarding Unproxyable bean types
> --
>
> Key: OWB-1416
> URL: https://issues.apache.org/jira/browse/OWB-1416
> Project: OpenWebBeans
>  Issue Type: Bug
>Reporter: Alexander Larsen
>Priority: Major
>
> OWB seems to throw an exception for all unproxyable normal scoped beans. I 
> think that this might be incorrect.
> The 
> [specification|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#unproxyable] 
> says the "A bean type must be proxyable if an injection point resolves to a 
> bean", not that all the types of the bean must be proxyable. In other words, 
> as long as the bean is a legal bean, and all injection point resolving to 
> this bean is a proxyable type - no exception should be thrown.
> In the part about [contextual 
> references|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#contextual_reference],
>  there is further indications that unproxyable types should be allowed in the 
> set of types for the bean. It's only when you try to get a reference(injected 
> or by bean manager) to an unproxyable type, and the bean must be proxied 
> (normal scoped, intercepted or decorated) an exception should thrown.
> Also, the [Weld user guide suggests introducing an interface as a solution to 
> having an unproxyable 
> bean|https://docs.jboss.org/weld/reference/latest/en-US/html_single/#_client_proxies].
> The current OWB implementation makes a pattern of having an interface and 
> (one or more) implementation class with final fields/methods somewhat 
> difficult :)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OWB-1416) Possible misintepretation of spec regarding Unproxyable bean types

2022-11-02 Thread Romain Manni-Bucau (Jira)


[ 
https://issues.apache.org/jira/browse/OWB-1416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627658#comment-17627658
 ] 

Romain Manni-Bucau commented on OWB-1416:
-

Maybe but this quote also does not bring any requirements (compared to other 
parts) so sounds like an useless sentence in current form, I agree.

Both options have pitfalls - not the same indeed ;) - so think our current 
state is likely the safer whereas relaxing it can be convenient in some cases 
it will break others so not sure it is worth the effort being said there are 
solution to handle the case you reference cleanly already, so quite mitigated 
for now.

> Possible misintepretation of spec regarding Unproxyable bean types
> --
>
> Key: OWB-1416
> URL: https://issues.apache.org/jira/browse/OWB-1416
> Project: OpenWebBeans
>  Issue Type: Bug
>Reporter: Alexander Larsen
>Priority: Major
>
> OWB seems to throw an exception for all unproxyable normal scoped beans. I 
> think that this might be incorrect.
> The 
> [specification|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#unproxyable] 
> says the "A bean type must be proxyable if an injection point resolves to a 
> bean", not that all the types of the bean must be proxyable. In other words, 
> as long as the bean is a legal bean, and all injection point resolving to 
> this bean is a proxyable type - no exception should be thrown.
> In the part about [contextual 
> references|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#contextual_reference],
>  there is further indications that unproxyable types should be allowed in the 
> set of types for the bean. It's only when you try to get a reference(injected 
> or by bean manager) to an unproxyable type, and the bean must be proxied 
> (normal scoped, intercepted or decorated) an exception should thrown.
> Also, the [Weld user guide suggests introducing an interface as a solution to 
> having an unproxyable 
> bean|https://docs.jboss.org/weld/reference/latest/en-US/html_single/#_client_proxies].
> The current OWB implementation makes a pattern of having an interface and 
> (one or more) implementation class with final fields/methods somewhat 
> difficult :)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OWB-1416) Possible misintepretation of spec regarding Unproxyable bean types

2022-11-02 Thread Alexander Larsen (Jira)


[ 
https://issues.apache.org/jira/browse/OWB-1416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627641#comment-17627641
 ] 

Alexander Larsen commented on OWB-1416:
---

The proxy only needs to implement all types of the bean, if one assumes the 
same proxy will be returned regardless of the type parameter given to 
{{getReference}}. I read "by any client proxy that is returned" to mean, iff 
the method return (with no exception) then the proxy implements the type given 
as parameter.

Actually the part about [contextual 
references|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#contextual_reference]
 clearly states
{quote} A contextual reference implements the given bean type and all bean 
types of the bean which are Java interfaces. A contextual reference is not, in 
general, required to implement all concrete bean types of the bean.{quote} I 
can not see any reason for this statment, except for handling this exact case.



> Possible misintepretation of spec regarding Unproxyable bean types
> --
>
> Key: OWB-1416
> URL: https://issues.apache.org/jira/browse/OWB-1416
> Project: OpenWebBeans
>  Issue Type: Bug
>Reporter: Alexander Larsen
>Priority: Major
>
> OWB seems to throw an exception for all unproxyable normal scoped beans. I 
> think that this might be incorrect.
> The 
> [specification|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#unproxyable] 
> says the "A bean type must be proxyable if an injection point resolves to a 
> bean", not that all the types of the bean must be proxyable. In other words, 
> as long as the bean is a legal bean, and all injection point resolving to 
> this bean is a proxyable type - no exception should be thrown.
> In the part about [contextual 
> references|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#contextual_reference],
>  there is further indications that unproxyable types should be allowed in the 
> set of types for the bean. It's only when you try to get a reference(injected 
> or by bean manager) to an unproxyable type, and the bean must be proxied 
> (normal scoped, intercepted or decorated) an exception should thrown.
> Also, the [Weld user guide suggests introducing an interface as a solution to 
> having an unproxyable 
> bean|https://docs.jboss.org/weld/reference/latest/en-US/html_single/#_client_proxies].
> The current OWB implementation makes a pattern of having an interface and 
> (one or more) implementation class with final fields/methods somewhat 
> difficult :)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OWB-1416) Possible misintepretation of spec regarding Unproxyable bean types

2022-11-02 Thread Romain Manni-Bucau (Jira)


[ 
https://issues.apache.org/jira/browse/OWB-1416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627615#comment-17627615
 ] 

Romain Manni-Bucau commented on OWB-1416:
-

Well yes and no, `getReference` is a good example of the previous point: "by 
any client proxy that is returned" so it must impl any bean type cause you 
don't know with which value it will be called - keep in mind it can be dynamic 
using reflection too - so to respect the spec (tck+pdf+javadoc) you must impl 
it as OWB did. Agree it can not be the most convenient but weld ecosystem is 
also know to not respect the spec everywhere (bypassing proxies for app scoped 
injections in some cases for ex - it is a good optimization by itself but which 
breaks other parts of the spec for ex) so not sure it is a good reference for 
this particular point.

> Possible misintepretation of spec regarding Unproxyable bean types
> --
>
> Key: OWB-1416
> URL: https://issues.apache.org/jira/browse/OWB-1416
> Project: OpenWebBeans
>  Issue Type: Bug
>Reporter: Alexander Larsen
>Priority: Major
>
> OWB seems to throw an exception for all unproxyable normal scoped beans. I 
> think that this might be incorrect.
> The 
> [specification|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#unproxyable] 
> says the "A bean type must be proxyable if an injection point resolves to a 
> bean", not that all the types of the bean must be proxyable. In other words, 
> as long as the bean is a legal bean, and all injection point resolving to 
> this bean is a proxyable type - no exception should be thrown.
> In the part about [contextual 
> references|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#contextual_reference],
>  there is further indications that unproxyable types should be allowed in the 
> set of types for the bean. It's only when you try to get a reference(injected 
> or by bean manager) to an unproxyable type, and the bean must be proxied 
> (normal scoped, intercepted or decorated) an exception should thrown.
> Also, the [Weld user guide suggests introducing an interface as a solution to 
> having an unproxyable 
> bean|https://docs.jboss.org/weld/reference/latest/en-US/html_single/#_client_proxies].
> The current OWB implementation makes a pattern of having an interface and 
> (one or more) implementation class with final fields/methods somewhat 
> difficult :)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OWB-1416) Possible misintepretation of spec regarding Unproxyable bean types

2022-11-02 Thread Alexander Larsen (Jira)


[ 
https://issues.apache.org/jira/browse/OWB-1416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627601#comment-17627601
 ] 

Alexander Larsen commented on OWB-1416:
---

This is what i think might be the misinterpretation of the spec. I can not see 
any places where it says the proxied interface must be a subclass of the impl, 
i actually think the spec indicates the opposite(although vaugely) as I tried 
to describe in the ticket description. But I have only read the spec, not 
looked at the TCK.

I've seen some old mailing list conversations about this problem, which refers 
to this part of the spec
{quote}
A bean type must be proxyable if an injection point resolves to a bean:
- that requires a client proxy, or
- that has an associated decorator, or
- that has a bound interceptor.

Otherwise, the container automatically detects the problem, and treats it as a 
deployment problem.
{quote}
the part that is missed here is the bean type *injected* must be proxyable, not 
all types of the bean.

Isn't the point of having an type argument on {{BeanManager.getReference}} is 
to indicate what the proxy must implement?

> Possible misintepretation of spec regarding Unproxyable bean types
> --
>
> Key: OWB-1416
> URL: https://issues.apache.org/jira/browse/OWB-1416
> Project: OpenWebBeans
>  Issue Type: Bug
>Reporter: Alexander Larsen
>Priority: Major
>
> OWB seems to throw an exception for all unproxyable normal scoped beans. I 
> think that this might be incorrect.
> The 
> [specification|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#unproxyable] 
> says the "A bean type must be proxyable if an injection point resolves to a 
> bean", not that all the types of the bean must be proxyable. In other words, 
> as long as the bean is a legal bean, and all injection point resolving to 
> this bean is a proxyable type - no exception should be thrown.
> In the part about [contextual 
> references|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#contextual_reference],
>  there is further indications that unproxyable types should be allowed in the 
> set of types for the bean. It's only when you try to get a reference(injected 
> or by bean manager) to an unproxyable type, and the bean must be proxied 
> (normal scoped, intercepted or decorated) an exception should thrown.
> Also, the [Weld user guide suggests introducing an interface as a solution to 
> having an unproxyable 
> bean|https://docs.jboss.org/weld/reference/latest/en-US/html_single/#_client_proxies].
> The current OWB implementation makes a pattern of having an interface and 
> (one or more) implementation class with final fields/methods somewhat 
> difficult :)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OWB-1416) Possible misintepretation of spec regarding Unproxyable bean types

2022-11-02 Thread Romain Manni-Bucau (Jira)


[ 
https://issues.apache.org/jira/browse/OWB-1416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627582#comment-17627582
 ] 

Romain Manni-Bucau commented on OWB-1416:
-

Hmm, for a managed bean (= plain class, not a producer) it is an issue since 
the proxy must be a subclass of the impl, not the typed so this must fail by 
spec AFAIK. I know weld worked it around but it is not 100% spec compliant 
IIRC. The solution would be to use a producer for the bean, this should work 
(use @Vetoed on the class and replace it by a producer which type it 
accordingly).

> Possible misintepretation of spec regarding Unproxyable bean types
> --
>
> Key: OWB-1416
> URL: https://issues.apache.org/jira/browse/OWB-1416
> Project: OpenWebBeans
>  Issue Type: Bug
>Reporter: Alexander Larsen
>Priority: Major
>
> OWB seems to throw an exception for all unproxyable normal scoped beans. I 
> think that this might be incorrect.
> The 
> [specification|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#unproxyable] 
> says the "A bean type must be proxyable if an injection point resolves to a 
> bean", not that all the types of the bean must be proxyable. In other words, 
> as long as the bean is a legal bean, and all injection point resolving to 
> this bean is a proxyable type - no exception should be thrown.
> In the part about [contextual 
> references|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#contextual_reference],
>  there is further indications that unproxyable types should be allowed in the 
> set of types for the bean. It's only when you try to get a reference(injected 
> or by bean manager) to an unproxyable type, and the bean must be proxied 
> (normal scoped, intercepted or decorated) an exception should thrown.
> Also, the [Weld user guide suggests introducing an interface as a solution to 
> having an unproxyable 
> bean|https://docs.jboss.org/weld/reference/latest/en-US/html_single/#_client_proxies].
> The current OWB implementation makes a pattern of having an interface and 
> (one or more) implementation class with final fields/methods somewhat 
> difficult :)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OWB-1416) Possible misintepretation of spec regarding Unproxyable bean types

2022-11-02 Thread Alexander Larsen (Jira)


[ 
https://issues.apache.org/jira/browse/OWB-1416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627549#comment-17627549
 ] 

Alexander Larsen commented on OWB-1416:
---

Thanks for the rapid reply!

I'm not sure i entirely understand the answer. A bean has a set of types, and 
the default set of types include all the implemented types of a (managed) bean. 
This set of types can be restricted with {{@Typed}}, but this does not solve 
the problem for OWB anyways, since the deployment validation service will stil 
throw Unproxyable-exception, even though if the bean is annotated with 
{{@Typed(SomeInterface.class)}}

Example that currently isn't working with OWB:

{code:java}
public interface FooService {
int getFoo();
}
{code}

{code:java}
@ApplicationScoped
//@Typed(FooService.class) makes no difference, still getting 
Unproxiable-exception
class FooServiceImpl implements FooService {
private final BeanManager bm;  // example dependency

@Inject
FooServiceImpl(BeanManager bm) {
this.bm = bm;
}

public final int getFoo() { return 42; }
}
{code}

{code:java}
@ApplicationScoped
public class SomeConsumerBean {
@Inject
private FooService fooService;
}
{code}

There should not be a problem injecting a {{FooService}}-proxy in the consumer 
bean, since this proxy does not need to subclass/implement {{FooServiceImpl}}

> Possible misintepretation of spec regarding Unproxyable bean types
> --
>
> Key: OWB-1416
> URL: https://issues.apache.org/jira/browse/OWB-1416
> Project: OpenWebBeans
>  Issue Type: Bug
>Reporter: Alexander Larsen
>Priority: Major
>
> OWB seems to throw an exception for all unproxyable normal scoped beans. I 
> think that this might be incorrect.
> The 
> [specification|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#unproxyable] 
> says the "A bean type must be proxyable if an injection point resolves to a 
> bean", not that all the types of the bean must be proxyable. In other words, 
> as long as the bean is a legal bean, and all injection point resolving to 
> this bean is a proxyable type - no exception should be thrown.
> In the part about [contextual 
> references|https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#contextual_reference],
>  there is further indications that unproxyable types should be allowed in the 
> set of types for the bean. It's only when you try to get a reference(injected 
> or by bean manager) to an unproxyable type, and the bean must be proxied 
> (normal scoped, intercepted or decorated) an exception should thrown.
> Also, the [Weld user guide suggests introducing an interface as a solution to 
> having an unproxyable 
> bean|https://docs.jboss.org/weld/reference/latest/en-US/html_single/#_client_proxies].
> The current OWB implementation makes a pattern of having an interface and 
> (one or more) implementation class with final fields/methods somewhat 
> difficult :)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)