[jira] Commented: (OWB-431) Generic Type Inheritance not resolved correctly

2010-07-29 Thread Gurkan Erdogdu (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12893644#action_12893644
 ] 

Gurkan Erdogdu commented on OWB-431:


Please look at spec section, 5.2.3

1- the required type parameter is an actual type, the bean type parameter is a 
type variable and the actual type is as-
signable to the upper bound, if any, of the type variable, or

2- the required type parameter and the bean type parameter are both type 
variables and the upper bound of the required
type parameter is assignable to the upper bound, if any, of the bean type 
parameter.

In above example : 

Bean Type Parameter   : T extends Bc
Actual Required Type Parameter : Dc

According to the 1), We check Dc is addignable to Bc, answer :  false 

Same for 2. 

Seems that code is correct.



 Generic Type Inheritance not resolved correctly
 ---

 Key: OWB-431
 URL: https://issues.apache.org/jira/browse/OWB-431
 Project: OpenWebBeans
  Issue Type: Bug
  Components: Injection and Lookup
Affects Versions: 1.0.0-alpha-1
 Environment: standard OWB configuration
Reporter: Bill Wigger
Assignee: Gurkan Erdogdu
Priority: Minor
 Fix For: 1.0.0-alpha-2

 Attachments: ClassUtilPatch.txt, ClassUtilPatch2.txt

   Original Estimate: 2h
  Remaining Estimate: 2h

 WebBean is defined as:
 @Named
 public class MethodTypeProduces1T extends Bc {
   @Produces @Dependent @Named(ProMethodParameterized3) ArrayListT 
 methodPT3() {
 and injected as:
 @Named
 @Dependent
 public class ProMethodTestGroup3A {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListDc pt3;
 
 with BC extending DC as follows:
 public class Bc extends Dc implements Fi {
 gives this error:
 Jul 28, 2010 9:26:51 AM org.apache.webbeans.config.BeansDeployer deploy
 SEVERE: 
 Throwable occurred: javax.enterprise.inject.UnsatisfiedResolutionException: 
 Api type [java.util.ArrayList] is not found with the qualifiers 
 [...@javax.inject.named(value=ProMethodParameterized3)] for injection into 
 Field Injection Point, field name :  pt3, Bean Owner : 
 [Name:proMethodTestGroup3A,WebBeans Type:MANAGED,API 
 Types:[com.ibm.jcdi.test.ProMethodTestGroup3A,java.lang.Object],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default,javax.inject.Named]]
   at 
 org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:121)
   at 
 org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:185)
   at 
 org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1025)
 injection should be checked/resolved here in 
 org.apache.webbeans.util.ClassUtil,  but this method returns false
 public static boolean checkRequiredTypeIsClassAndBeanTypeIsVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 {
 Class? clazzRequiredType = (Class?)requiredTypeArg;
 TypeVariable? tvBeanTypeArg = (TypeVariable?)beanTypeArg;
 Type tvBound = tvBeanTypeArg.getBounds()[0];
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzTvBound != Object.class)
 {
 if(!clazzTvBound.isAssignableFrom(clazzRequiredType))
 {
 return false;
 }
 }
 }
 return true;
 }
 But since clazzTvBound is Bc  and classRequiredType is Dc
 Bc.isAssignableFrom(Dc) returns false,  so the ! is true,  and the function 
 returns false.
 fix seems to simply go back to the old code in this routine, this code was 
 changeed on 4/28, and
 I can't see why is was changed.
 But the check needs to verify that the required class can be assigned from 
 the given bean class, as follows:
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzRequiredType.isAssignableFrom(clazzTvBound))
 {
 return true;
 }
 }
 return false;
 There is also a similar incorrect injection exception using the above 
 example, but with an injection of:
 public class TG4 T extends Dc {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListT ptT;
 I think the line of code in error here is in the method: 
 (same class as in the previous problem: org.apache.webbeans.util.ClassUtil)
 public static boolean checkBeanTypeAndRequiredIsTypeVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 where:
 if(clazzTvBeanBound.isAssignableFrom(clazzTvRequiredBound))
 should be replaced with:
 (clazzTvRequiredBound.isAssignableFrom(clazzTvBeanBound))

-- 
This message is automatically 

[jira] Commented: (OWB-431) Generic Type Inheritance not resolved correctly

2010-07-29 Thread Bill Wigger (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12893656#action_12893656
 ] 

Bill Wigger commented on OWB-431:
-

Bc  extends Dc.

Problem is the current code is checking  this:

claxxTvBound is Bc,  clazzRequiredType is Dc.

if(!clazzTvBound.isAssignableFrom(clazzRequiredType))
{
return false;
}   

so the means return false   if  the not  of   Bc.isAssignableFrom(Dc).
So  Bc is not assignable from Dc (since  Bc extends Dc),  so   that logic 
returns false, which gets inverted to true, and therefore the routine returns 
false.
But, since Bc (the bean type)  extends Dc (the required type),  it should have 
returned true.

 Generic Type Inheritance not resolved correctly
 ---

 Key: OWB-431
 URL: https://issues.apache.org/jira/browse/OWB-431
 Project: OpenWebBeans
  Issue Type: Bug
  Components: Injection and Lookup
Affects Versions: 1.0.0-alpha-1
 Environment: standard OWB configuration
Reporter: Bill Wigger
Assignee: Gurkan Erdogdu
Priority: Minor
 Fix For: 1.0.0-alpha-2

 Attachments: ClassUtilPatch.txt, ClassUtilPatch2.txt

   Original Estimate: 2h
  Remaining Estimate: 2h

 WebBean is defined as:
 @Named
 public class MethodTypeProduces1T extends Bc {
   @Produces @Dependent @Named(ProMethodParameterized3) ArrayListT 
 methodPT3() {
 and injected as:
 @Named
 @Dependent
 public class ProMethodTestGroup3A {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListDc pt3;
 
 with BC extending DC as follows:
 public class Bc extends Dc implements Fi {
 gives this error:
 Jul 28, 2010 9:26:51 AM org.apache.webbeans.config.BeansDeployer deploy
 SEVERE: 
 Throwable occurred: javax.enterprise.inject.UnsatisfiedResolutionException: 
 Api type [java.util.ArrayList] is not found with the qualifiers 
 [...@javax.inject.named(value=ProMethodParameterized3)] for injection into 
 Field Injection Point, field name :  pt3, Bean Owner : 
 [Name:proMethodTestGroup3A,WebBeans Type:MANAGED,API 
 Types:[com.ibm.jcdi.test.ProMethodTestGroup3A,java.lang.Object],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default,javax.inject.Named]]
   at 
 org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:121)
   at 
 org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:185)
   at 
 org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1025)
 injection should be checked/resolved here in 
 org.apache.webbeans.util.ClassUtil,  but this method returns false
 public static boolean checkRequiredTypeIsClassAndBeanTypeIsVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 {
 Class? clazzRequiredType = (Class?)requiredTypeArg;
 TypeVariable? tvBeanTypeArg = (TypeVariable?)beanTypeArg;
 Type tvBound = tvBeanTypeArg.getBounds()[0];
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzTvBound != Object.class)
 {
 if(!clazzTvBound.isAssignableFrom(clazzRequiredType))
 {
 return false;
 }
 }
 }
 return true;
 }
 But since clazzTvBound is Bc  and classRequiredType is Dc
 Bc.isAssignableFrom(Dc) returns false,  so the ! is true,  and the function 
 returns false.
 fix seems to simply go back to the old code in this routine, this code was 
 changeed on 4/28, and
 I can't see why is was changed.
 But the check needs to verify that the required class can be assigned from 
 the given bean class, as follows:
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzRequiredType.isAssignableFrom(clazzTvBound))
 {
 return true;
 }
 }
 return false;
 There is also a similar incorrect injection exception using the above 
 example, but with an injection of:
 public class TG4 T extends Dc {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListT ptT;
 I think the line of code in error here is in the method: 
 (same class as in the previous problem: org.apache.webbeans.util.ClassUtil)
 public static boolean checkBeanTypeAndRequiredIsTypeVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 where:
 if(clazzTvBeanBound.isAssignableFrom(clazzTvRequiredBound))
 should be replaced with:
 (clazzTvRequiredBound.isAssignableFrom(clazzTvBeanBound))

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the 

[jira] Commented: (OWB-431) Generic Type Inheritance not resolved correctly

2010-07-29 Thread Gurkan Erdogdu (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12893665#action_12893665
 ] 

Gurkan Erdogdu commented on OWB-431:


claxxTvBound is Bc, clazzRequiredType is Dc.

Spec. says that required type Dc must assignable to Bc, means that Bc must 
assignable from Dc, so the logic seems correct

 Generic Type Inheritance not resolved correctly
 ---

 Key: OWB-431
 URL: https://issues.apache.org/jira/browse/OWB-431
 Project: OpenWebBeans
  Issue Type: Bug
  Components: Injection and Lookup
Affects Versions: 1.0.0-alpha-1
 Environment: standard OWB configuration
Reporter: Bill Wigger
Assignee: Gurkan Erdogdu
Priority: Minor
 Fix For: 1.0.0-alpha-2

 Attachments: ClassUtilPatch.txt, ClassUtilPatch2.txt

   Original Estimate: 2h
  Remaining Estimate: 2h

 WebBean is defined as:
 @Named
 public class MethodTypeProduces1T extends Bc {
   @Produces @Dependent @Named(ProMethodParameterized3) ArrayListT 
 methodPT3() {
 and injected as:
 @Named
 @Dependent
 public class ProMethodTestGroup3A {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListDc pt3;
 
 with BC extending DC as follows:
 public class Bc extends Dc implements Fi {
 gives this error:
 Jul 28, 2010 9:26:51 AM org.apache.webbeans.config.BeansDeployer deploy
 SEVERE: 
 Throwable occurred: javax.enterprise.inject.UnsatisfiedResolutionException: 
 Api type [java.util.ArrayList] is not found with the qualifiers 
 [...@javax.inject.named(value=ProMethodParameterized3)] for injection into 
 Field Injection Point, field name :  pt3, Bean Owner : 
 [Name:proMethodTestGroup3A,WebBeans Type:MANAGED,API 
 Types:[com.ibm.jcdi.test.ProMethodTestGroup3A,java.lang.Object],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default,javax.inject.Named]]
   at 
 org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:121)
   at 
 org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:185)
   at 
 org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1025)
 injection should be checked/resolved here in 
 org.apache.webbeans.util.ClassUtil,  but this method returns false
 public static boolean checkRequiredTypeIsClassAndBeanTypeIsVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 {
 Class? clazzRequiredType = (Class?)requiredTypeArg;
 TypeVariable? tvBeanTypeArg = (TypeVariable?)beanTypeArg;
 Type tvBound = tvBeanTypeArg.getBounds()[0];
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzTvBound != Object.class)
 {
 if(!clazzTvBound.isAssignableFrom(clazzRequiredType))
 {
 return false;
 }
 }
 }
 return true;
 }
 But since clazzTvBound is Bc  and classRequiredType is Dc
 Bc.isAssignableFrom(Dc) returns false,  so the ! is true,  and the function 
 returns false.
 fix seems to simply go back to the old code in this routine, this code was 
 changeed on 4/28, and
 I can't see why is was changed.
 But the check needs to verify that the required class can be assigned from 
 the given bean class, as follows:
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzRequiredType.isAssignableFrom(clazzTvBound))
 {
 return true;
 }
 }
 return false;
 There is also a similar incorrect injection exception using the above 
 example, but with an injection of:
 public class TG4 T extends Dc {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListT ptT;
 I think the line of code in error here is in the method: 
 (same class as in the previous problem: org.apache.webbeans.util.ClassUtil)
 public static boolean checkBeanTypeAndRequiredIsTypeVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 where:
 if(clazzTvBeanBound.isAssignableFrom(clazzTvRequiredBound))
 should be replaced with:
 (clazzTvRequiredBound.isAssignableFrom(clazzTvBeanBound))

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OWB-431) Generic Type Inheritance not resolved correctly

2010-07-29 Thread Bill Wigger (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12893695#action_12893695
 ] 

Bill Wigger commented on OWB-431:
-

Spec:
A parameterized bean type is considered assignable to a parameterized required 
type if they have 
identical raw type and for each parameter:
... 
the required type parameter is an actual type, the bean type parameter is a 
type variable and the 
actual type is assignable to the upper bound, if any, of the type variable, 

notice in the spec how they use assignable to two different ways here.  Maybe 
it should have use 
the phrase assignable from in the second part.  But it seems the meaning 
would have to be 
that the required type has to be identical or a superclass of the bean type.  
This is because if the 
required type were a subclass of the bean type, then the injected bean type 
would not have methods 
in it that may be accessed by the required type.  

In java the routine:  x.isAssignableFrom(y)
is defined to return true if x is indentical to y, or x is a superclass of y.

therefore to conform to the spec, the proper test would be: 
if (requiredType.isAssignableFrom(beanType))  return true.  


 
At any rate,  right now the code listed at the top of this report gives an 
error, and it should not, since
the required type is a superclass of the bean type.

 Generic Type Inheritance not resolved correctly
 ---

 Key: OWB-431
 URL: https://issues.apache.org/jira/browse/OWB-431
 Project: OpenWebBeans
  Issue Type: Bug
  Components: Injection and Lookup
Affects Versions: 1.0.0-alpha-1
 Environment: standard OWB configuration
Reporter: Bill Wigger
Assignee: Gurkan Erdogdu
Priority: Minor
 Fix For: 1.0.0-alpha-2

 Attachments: ClassUtilPatch.txt, ClassUtilPatch2.txt

   Original Estimate: 2h
  Remaining Estimate: 2h

 WebBean is defined as:
 @Named
 public class MethodTypeProduces1T extends Bc {
   @Produces @Dependent @Named(ProMethodParameterized3) ArrayListT 
 methodPT3() {
 and injected as:
 @Named
 @Dependent
 public class ProMethodTestGroup3A {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListDc pt3;
 
 with BC extending DC as follows:
 public class Bc extends Dc implements Fi {
 gives this error:
 Jul 28, 2010 9:26:51 AM org.apache.webbeans.config.BeansDeployer deploy
 SEVERE: 
 Throwable occurred: javax.enterprise.inject.UnsatisfiedResolutionException: 
 Api type [java.util.ArrayList] is not found with the qualifiers 
 [...@javax.inject.named(value=ProMethodParameterized3)] for injection into 
 Field Injection Point, field name :  pt3, Bean Owner : 
 [Name:proMethodTestGroup3A,WebBeans Type:MANAGED,API 
 Types:[com.ibm.jcdi.test.ProMethodTestGroup3A,java.lang.Object],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default,javax.inject.Named]]
   at 
 org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:121)
   at 
 org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:185)
   at 
 org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1025)
 injection should be checked/resolved here in 
 org.apache.webbeans.util.ClassUtil,  but this method returns false
 public static boolean checkRequiredTypeIsClassAndBeanTypeIsVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 {
 Class? clazzRequiredType = (Class?)requiredTypeArg;
 TypeVariable? tvBeanTypeArg = (TypeVariable?)beanTypeArg;
 Type tvBound = tvBeanTypeArg.getBounds()[0];
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzTvBound != Object.class)
 {
 if(!clazzTvBound.isAssignableFrom(clazzRequiredType))
 {
 return false;
 }
 }
 }
 return true;
 }
 But since clazzTvBound is Bc  and classRequiredType is Dc
 Bc.isAssignableFrom(Dc) returns false,  so the ! is true,  and the function 
 returns false.
 fix seems to simply go back to the old code in this routine, this code was 
 changeed on 4/28, and
 I can't see why is was changed.
 But the check needs to verify that the required class can be assigned from 
 the given bean class, as follows:
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzRequiredType.isAssignableFrom(clazzTvBound))
 {
 return true;
 }
 }
 return false;
 

[jira] Commented: (OWB-431) Generic Type Inheritance not resolved correctly

2010-07-29 Thread Eric Covener (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12893717#action_12893717
 ] 

Eric Covener commented on OWB-431:
--

IMHO the spec could only have meant assignable from and not assignable to.  
That would stop us from inverting the two types in question in our comparison:


If a producer produces T extends Pet (upper bound of Pet)
... and Pet extends Animal
... and Dog extends Pet.


Consider injection points:

  @Inject @Default Dog d;
  @Inject @Default Animal a;


When the spec says actual type is assignable to the upper bound I think they 
MUST have intended
actual type is assignable _from_ the upper bound

I assume everyone agrees that the Animal injection is satisfiable (we can 
produce a Pet, which is an Animal) and the Dog injection is not satisfiable:

Since the spec says actual type (Dog or Animal) is assignable _to_ the upper 
bound (Pet) we reverse the arguments:

   if (!Pet.isAssignableFrom(Dog)) {  // wrong result, our code expects to call 
dog.bark() but we're just producing a Pet!  
return false;
   }

   if (!Pet.isAssignableFrom(Animal)) { // wrong result, Pet clearly fulfills 
the injection point of Animal
return false;
   }

But the real test for the injection point being satisfied should not be 
reversed:

   if (!Dog.isAssignableFrom(Pet)) { // we can't inject a pet into a field that 
wants a dog
return false;
   }

  if (!Animal.isAssignableFrom(Pet)) { // 
return false;
   }




 Generic Type Inheritance not resolved correctly
 ---

 Key: OWB-431
 URL: https://issues.apache.org/jira/browse/OWB-431
 Project: OpenWebBeans
  Issue Type: Bug
  Components: Injection and Lookup
Affects Versions: 1.0.0-alpha-1
 Environment: standard OWB configuration
Reporter: Bill Wigger
Assignee: Gurkan Erdogdu
Priority: Minor
 Fix For: 1.0.0-alpha-2

 Attachments: ClassUtilPatch.txt, ClassUtilPatch2.txt

   Original Estimate: 2h
  Remaining Estimate: 2h

 WebBean is defined as:
 @Named
 public class MethodTypeProduces1T extends Bc {
   @Produces @Dependent @Named(ProMethodParameterized3) ArrayListT 
 methodPT3() {
 and injected as:
 @Named
 @Dependent
 public class ProMethodTestGroup3A {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListDc pt3;
 
 with BC extending DC as follows:
 public class Bc extends Dc implements Fi {
 gives this error:
 Jul 28, 2010 9:26:51 AM org.apache.webbeans.config.BeansDeployer deploy
 SEVERE: 
 Throwable occurred: javax.enterprise.inject.UnsatisfiedResolutionException: 
 Api type [java.util.ArrayList] is not found with the qualifiers 
 [...@javax.inject.named(value=ProMethodParameterized3)] for injection into 
 Field Injection Point, field name :  pt3, Bean Owner : 
 [Name:proMethodTestGroup3A,WebBeans Type:MANAGED,API 
 Types:[com.ibm.jcdi.test.ProMethodTestGroup3A,java.lang.Object],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default,javax.inject.Named]]
   at 
 org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:121)
   at 
 org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:185)
   at 
 org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1025)
 injection should be checked/resolved here in 
 org.apache.webbeans.util.ClassUtil,  but this method returns false
 public static boolean checkRequiredTypeIsClassAndBeanTypeIsVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 {
 Class? clazzRequiredType = (Class?)requiredTypeArg;
 TypeVariable? tvBeanTypeArg = (TypeVariable?)beanTypeArg;
 Type tvBound = tvBeanTypeArg.getBounds()[0];
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzTvBound != Object.class)
 {
 if(!clazzTvBound.isAssignableFrom(clazzRequiredType))
 {
 return false;
 }
 }
 }
 return true;
 }
 But since clazzTvBound is Bc  and classRequiredType is Dc
 Bc.isAssignableFrom(Dc) returns false,  so the ! is true,  and the function 
 returns false.
 fix seems to simply go back to the old code in this routine, this code was 
 changeed on 4/28, and
 I can't see why is was changed.
 But the check needs to verify that the required class can be assigned from 
 the given bean class, as follows:
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzRequiredType.isAssignableFrom(clazzTvBound))
 {
 return true;
 } 

[jira] Commented: (OWB-431) Generic Type Inheritance not resolved correctly

2010-07-29 Thread Joe Bergmark (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12893731#action_12893731
 ] 

Joe Bergmark commented on OWB-431:
--

I agree with Eric's comment above.  It looks like the spec should have been 
worded more clearly (or correctly), but the logical behavior is pretty straight 
forward.

If there is some major concern that checking the injection points is assignable 
from the producer's upper bound, we could always test this same scenario on 
WELD to ensure the behavior matches what we believe to be correct.

 Generic Type Inheritance not resolved correctly
 ---

 Key: OWB-431
 URL: https://issues.apache.org/jira/browse/OWB-431
 Project: OpenWebBeans
  Issue Type: Bug
  Components: Injection and Lookup
Affects Versions: 1.0.0-alpha-1
 Environment: standard OWB configuration
Reporter: Bill Wigger
Assignee: Gurkan Erdogdu
Priority: Minor
 Fix For: 1.0.0-alpha-2

 Attachments: ClassUtilPatch.txt, ClassUtilPatch2.txt

   Original Estimate: 2h
  Remaining Estimate: 2h

 WebBean is defined as:
 @Named
 public class MethodTypeProduces1T extends Bc {
   @Produces @Dependent @Named(ProMethodParameterized3) ArrayListT 
 methodPT3() {
 and injected as:
 @Named
 @Dependent
 public class ProMethodTestGroup3A {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListDc pt3;
 
 with BC extending DC as follows:
 public class Bc extends Dc implements Fi {
 gives this error:
 Jul 28, 2010 9:26:51 AM org.apache.webbeans.config.BeansDeployer deploy
 SEVERE: 
 Throwable occurred: javax.enterprise.inject.UnsatisfiedResolutionException: 
 Api type [java.util.ArrayList] is not found with the qualifiers 
 [...@javax.inject.named(value=ProMethodParameterized3)] for injection into 
 Field Injection Point, field name :  pt3, Bean Owner : 
 [Name:proMethodTestGroup3A,WebBeans Type:MANAGED,API 
 Types:[com.ibm.jcdi.test.ProMethodTestGroup3A,java.lang.Object],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default,javax.inject.Named]]
   at 
 org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:121)
   at 
 org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:185)
   at 
 org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1025)
 injection should be checked/resolved here in 
 org.apache.webbeans.util.ClassUtil,  but this method returns false
 public static boolean checkRequiredTypeIsClassAndBeanTypeIsVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 {
 Class? clazzRequiredType = (Class?)requiredTypeArg;
 TypeVariable? tvBeanTypeArg = (TypeVariable?)beanTypeArg;
 Type tvBound = tvBeanTypeArg.getBounds()[0];
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzTvBound != Object.class)
 {
 if(!clazzTvBound.isAssignableFrom(clazzRequiredType))
 {
 return false;
 }
 }
 }
 return true;
 }
 But since clazzTvBound is Bc  and classRequiredType is Dc
 Bc.isAssignableFrom(Dc) returns false,  so the ! is true,  and the function 
 returns false.
 fix seems to simply go back to the old code in this routine, this code was 
 changeed on 4/28, and
 I can't see why is was changed.
 But the check needs to verify that the required class can be assigned from 
 the given bean class, as follows:
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzRequiredType.isAssignableFrom(clazzTvBound))
 {
 return true;
 }
 }
 return false;
 There is also a similar incorrect injection exception using the above 
 example, but with an injection of:
 public class TG4 T extends Dc {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListT ptT;
 I think the line of code in error here is in the method: 
 (same class as in the previous problem: org.apache.webbeans.util.ClassUtil)
 public static boolean checkBeanTypeAndRequiredIsTypeVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 where:
 if(clazzTvBeanBound.isAssignableFrom(clazzTvRequiredBound))
 should be replaced with:
 (clazzTvRequiredBound.isAssignableFrom(clazzTvBeanBound))

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OWB-431) Generic Type Inheritance not resolved correctly

2010-07-29 Thread Gurkan Erdogdu (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12893809#action_12893809
 ] 

Gurkan Erdogdu commented on OWB-431:


At first I thought with Eric and Bill but TCK has failed. 

@Inject Dog -- OK, because Dog extends Pet (Satisfy T)
@Inject Animal -- NOT OK because not very Animal is Pet (Does not satisfy T)

I think that spec is correct, T extends Pet means that sub-class of the Pet. 

For Bill example, T extends Bc  therefore injection point must be sub-class 
of Bc, but it injects super-class of Bc. If Dc has implemented as

Dc extends Bc,  then @Inject Dc works!

 Generic Type Inheritance not resolved correctly
 ---

 Key: OWB-431
 URL: https://issues.apache.org/jira/browse/OWB-431
 Project: OpenWebBeans
  Issue Type: Bug
  Components: Injection and Lookup
Affects Versions: 1.0.0-alpha-1
 Environment: standard OWB configuration
Reporter: Bill Wigger
Assignee: Gurkan Erdogdu
Priority: Minor
 Fix For: 1.0.0-alpha-2

 Attachments: ClassUtilPatch.txt, ClassUtilPatch2.txt

   Original Estimate: 2h
  Remaining Estimate: 2h

 WebBean is defined as:
 @Named
 public class MethodTypeProduces1T extends Bc {
   @Produces @Dependent @Named(ProMethodParameterized3) ArrayListT 
 methodPT3() {
 and injected as:
 @Named
 @Dependent
 public class ProMethodTestGroup3A {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListDc pt3;
 
 with BC extending DC as follows:
 public class Bc extends Dc implements Fi {
 gives this error:
 Jul 28, 2010 9:26:51 AM org.apache.webbeans.config.BeansDeployer deploy
 SEVERE: 
 Throwable occurred: javax.enterprise.inject.UnsatisfiedResolutionException: 
 Api type [java.util.ArrayList] is not found with the qualifiers 
 [...@javax.inject.named(value=ProMethodParameterized3)] for injection into 
 Field Injection Point, field name :  pt3, Bean Owner : 
 [Name:proMethodTestGroup3A,WebBeans Type:MANAGED,API 
 Types:[com.ibm.jcdi.test.ProMethodTestGroup3A,java.lang.Object],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default,javax.inject.Named]]
   at 
 org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:121)
   at 
 org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:185)
   at 
 org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1025)
 injection should be checked/resolved here in 
 org.apache.webbeans.util.ClassUtil,  but this method returns false
 public static boolean checkRequiredTypeIsClassAndBeanTypeIsVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 {
 Class? clazzRequiredType = (Class?)requiredTypeArg;
 TypeVariable? tvBeanTypeArg = (TypeVariable?)beanTypeArg;
 Type tvBound = tvBeanTypeArg.getBounds()[0];
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzTvBound != Object.class)
 {
 if(!clazzTvBound.isAssignableFrom(clazzRequiredType))
 {
 return false;
 }
 }
 }
 return true;
 }
 But since clazzTvBound is Bc  and classRequiredType is Dc
 Bc.isAssignableFrom(Dc) returns false,  so the ! is true,  and the function 
 returns false.
 fix seems to simply go back to the old code in this routine, this code was 
 changeed on 4/28, and
 I can't see why is was changed.
 But the check needs to verify that the required class can be assigned from 
 the given bean class, as follows:
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzRequiredType.isAssignableFrom(clazzTvBound))
 {
 return true;
 }
 }
 return false;
 There is also a similar incorrect injection exception using the above 
 example, but with an injection of:
 public class TG4 T extends Dc {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListT ptT;
 I think the line of code in error here is in the method: 
 (same class as in the previous problem: org.apache.webbeans.util.ClassUtil)
 public static boolean checkBeanTypeAndRequiredIsTypeVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 where:
 if(clazzTvBeanBound.isAssignableFrom(clazzTvRequiredBound))
 should be replaced with:
 (clazzTvRequiredBound.isAssignableFrom(clazzTvBeanBound))

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OWB-431) Generic Type Inheritance not resolved correctly

2010-07-29 Thread Joe Bergmark (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12893827#action_12893827
 ] 

Joe Bergmark commented on OWB-431:
--

I think I understand the confusion a bit now.  Generics have upper bounds and 
lower bounds.  The upper bound indicates that the type will all be subclasses.

T extends Pet is the upper bound, which says that all T's will extend Pet. (So 
it could be a Dog, or lets say Cat also extends Pet).

T super Pet is the lower bound, which says that all T's are either Pet or a 
superclass of Pet (Animal  Object likely).

It seems to me that if we are producing Type T extends Pet  that should be 
available for injection into:

@Inject Animal  // Because We know the upper bound, and we know that all Pets 
are animals so anything that comes out of that producer is at least a Pet or 
something more specific.

However it seems that it should not be available for injection into :

@Inject Dog  // Because all Pet's are not Dog, for example we could be 
producing a Cat which is perfectly valid for T extends Pet, but wouldn't 
satisfy the Dog injection point.

This appears to contradict the spec however, and the TCK tests the spec 
language.




 Generic Type Inheritance not resolved correctly
 ---

 Key: OWB-431
 URL: https://issues.apache.org/jira/browse/OWB-431
 Project: OpenWebBeans
  Issue Type: Bug
  Components: Injection and Lookup
Affects Versions: 1.0.0-alpha-1
 Environment: standard OWB configuration
Reporter: Bill Wigger
Assignee: Gurkan Erdogdu
Priority: Minor
 Fix For: 1.0.0-alpha-2

 Attachments: ClassUtilPatch.txt, ClassUtilPatch2.txt

   Original Estimate: 2h
  Remaining Estimate: 2h

 WebBean is defined as:
 @Named
 public class MethodTypeProduces1T extends Bc {
   @Produces @Dependent @Named(ProMethodParameterized3) ArrayListT 
 methodPT3() {
 and injected as:
 @Named
 @Dependent
 public class ProMethodTestGroup3A {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListDc pt3;
 
 with BC extending DC as follows:
 public class Bc extends Dc implements Fi {
 gives this error:
 Jul 28, 2010 9:26:51 AM org.apache.webbeans.config.BeansDeployer deploy
 SEVERE: 
 Throwable occurred: javax.enterprise.inject.UnsatisfiedResolutionException: 
 Api type [java.util.ArrayList] is not found with the qualifiers 
 [...@javax.inject.named(value=ProMethodParameterized3)] for injection into 
 Field Injection Point, field name :  pt3, Bean Owner : 
 [Name:proMethodTestGroup3A,WebBeans Type:MANAGED,API 
 Types:[com.ibm.jcdi.test.ProMethodTestGroup3A,java.lang.Object],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default,javax.inject.Named]]
   at 
 org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:121)
   at 
 org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:185)
   at 
 org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1025)
 injection should be checked/resolved here in 
 org.apache.webbeans.util.ClassUtil,  but this method returns false
 public static boolean checkRequiredTypeIsClassAndBeanTypeIsVariable(Type 
 beanTypeArg, Type requiredTypeArg)
 {
 Class? clazzRequiredType = (Class?)requiredTypeArg;
 TypeVariable? tvBeanTypeArg = (TypeVariable?)beanTypeArg;
 Type tvBound = tvBeanTypeArg.getBounds()[0];
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzTvBound != Object.class)
 {
 if(!clazzTvBound.isAssignableFrom(clazzRequiredType))
 {
 return false;
 }
 }
 }
 return true;
 }
 But since clazzTvBound is Bc  and classRequiredType is Dc
 Bc.isAssignableFrom(Dc) returns false,  so the ! is true,  and the function 
 returns false.
 fix seems to simply go back to the old code in this routine, this code was 
 changeed on 4/28, and
 I can't see why is was changed.
 But the check needs to verify that the required class can be assigned from 
 the given bean class, as follows:
 if(tvBound instanceof Class)
 {
 Class? clazzTvBound = (Class?)tvBound;
 if(clazzRequiredType.isAssignableFrom(clazzTvBound))
 {
 return true;
 }
 }
 return false;
 There is also a similar incorrect injection exception using the above 
 example, but with an injection of:
 public class TG4 T extends Dc {
   public @Inject @Dependent @Named(ProMethodParameterized3) 
 ArrayListT ptT;
 I think the line of code in error