Re: Odd behavior in InjectionPointProducer

2017-09-17 Thread John D. Ament
Ok, I was able to get a decent reproducer on this, wrote up my notes in
https://issues.apache.org/jira/browse/OWB-1216

John

On Mon, Sep 11, 2017 at 8:21 AM Mark Struberg 
wrote:

> Well, the IP resolving is always done against getTypes().
> But I think this is uninamously understood the same in all impls, isn't?
>
> The only discussion I remembered was around the getTypes() vs
> getBeanClass() for proxing. Thus my answers.
>
> Again: test would be cool, then we could help much faster.
>
> txs and LieGrue,
> strub
>
>
> > Am 11.09.2017 um 12:36 schrieb John D. Ament :
> >
> > So remember.  The question here is about injection point, not the bean
> > type.  Some of the problems described are deployment problems.  E.g. you
> > try to inject using a type that's forbidden because of @Typed, then that
> > should result in UnsatisfiedDependencies, at deployment time.
> >
> > On Mon, Sep 11, 2017 at 6:07 AM Arne Limburg <
> arne.limb...@openknowledge.de>
> > wrote:
> >
> >> Yes, that's interesting, you could get a proxy that directly extends
> >> Object. So you could invoke no method on that bean (except toString(),
> >> equals(...), hashCode(), ...)
> >>
> >>
> >> Does not seem to be usefull at all
> >>
> >> 
> >> Von: Mark Struberg 
> >> Gesendet: Montag, 11. September 2017 11:13:20
> >> An: openwebbeans-dev
> >> Betreff: Re: Odd behavior in InjectionPointProducer
> >>
> >> yes I'm also really sure it must get resolved as per the spec.
> >> The question is just which proxy you get once there is also a normal
> scope
> >> on the class
> >>
> >>
> >> @Named
> >> @Typed
> >> @ApplicationScoped
> >> public class MyBla extends SomeComplicatedThing implements
> AFewInterfaces {
> >> ...
> >> }
> >>
> >>
> >> LieGrue,
> >> strub
> >>
> >>> Am 11.09.2017 um 09:41 schrieb Arne Limburg <
> >> arne.limb...@openknowledge.de>:
> >>>
> >>> Quick look into the spec
> >> http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#name_resolution
> >>>
> >>> @Named
> >>>
> >>> @Typed()
> >>>
> >>> seems to be valid and the bean should be found by EL.
> >>>
> >>> 
> >>> Von: Romain Manni-Bucau 
> >>> Gesendet: Montag, 11. September 2017 09:31:38
> >>> An: openwebbeans-dev
> >>> Betreff: Re: Odd behavior in InjectionPointProducer
> >>>
> >>> Not sure it is 100% related but looks like a bean without types so not
> >> even
> >>> sure @Named should be "matchable" since you dont match types at all (we
> >>> often used @Typed = @Vetoed in CDI 1.0)
> >>>
> >>>
> >>> Romain Manni-Bucau
> >>> @rmannibucau  |  Blog
> >>>  | Old Blog
> >>>  | Github <
> >> https://github.com/rmannibucau> |
> >>> LinkedIn  | JavaEE Factory
> >>> 
> >>>
> >>> 2017-09-11 9:29 GMT+02:00 Mark Struberg :
> >>>
>  Btw, what I've seen quite a few times is the following:
> 
>  @Named
>  @Typed()
>  public class MyBla extends SomeComplicatedThing implements
> >> AFewInterfaces {
>  ...
>  }
> 
>  Means the @Typed got purely used to not have it picked up by type but
> >> only
>  via EL.
>  And in that case the proxy in Weld is most likely not working?
>  Is this a valid use case?
> 
>  LieGrue,
>  strub
> 
> > Am 11.09.2017 um 09:23 schrieb Romain Manni-Bucau <
> >> rmannibu...@gmail.com
> > :
> >
> > Surely the one to test:
> > https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/
>  main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/
>  DynamicInjectionPointTest.java
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau  |  Blog
> >  | Old Blog
> >  | Github   rmannibucau> |
> > LinkedIn  | JavaEE Factory
> > 
> >
> > 2017-09-11 9:20 GMT+02:00 Arne Limburg <
> arne.limb...@openknowledge.de
> >>> :
> >
> >> I'm with Mark here,
> >>
> >> InjectionPoint#getType() should return a ParameterizedType
> >> Instance
> >>
> >> So in the code below we simply should return parameterizedType I
> >> think.
> >>
> >> Would that pass the TCK? If yes, we definitely should file a TCK
> >> issue,
> >> there seems to be a test missing.
> >>
> >>
> >> Cheers,
> >>
> >> Arne
> >>
> >> 
> >> Von: Mark Struberg 
> >> Gesendet: Montag, 11. September 2017 09:04:41
> >> An: openwebbeans-dev
> >> Betreff: Re: Odd behavior in 

[jira] [Created] (OWB-1216) InjectionPoint.getType() returns wrong type for produced beans

2017-09-17 Thread John D. Ament (JIRA)
John D. Ament created OWB-1216:
--

 Summary: InjectionPoint.getType() returns wrong type for produced 
beans
 Key: OWB-1216
 URL: https://issues.apache.org/jira/browse/OWB-1216
 Project: OpenWebBeans
  Issue Type: Bug
Reporter: John D. Ament


Assuming I have a producer (same thing happens for a custom registered 3rd 
party bean, this is just easier to demonstrate):

{code}
public class MyProducer {
@Produces
@SomeQualifier
public String doProducer(InjectionPoint ip) {
return ip.getType().toString();
}
}
{code}

As well as the following injection point (with test):

{code}
@Inject
@SomeQualifier
private String myString;

@Test
public void shouldBeStringType() {
assertThat(myString).isEqualTo(String.class.toString());
}
{code}

The expectation is that the value of {{myString}} is {{java.lang.String}} but 
actually the value is the producer {{MyProducer}}.  We should be relying on the 
injection point's value, not the producer class.  It seems that it uses the 
value of {{getBeanClass}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)