You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Patrick Pekczynski (JIRA)" <ji...@apache.org> on 2014/05/14 23:17:39 UTC

[jira] [Created] (TOMEE-1205) TomEE webprofile 1.6.0.1 and 1.6.0.2 breaks java subtyping

Patrick Pekczynski created TOMEE-1205:
-----------------------------------------

             Summary: TomEE webprofile 1.6.0.1 and 1.6.0.2 breaks java subtyping
                 Key: TOMEE-1205
                 URL: https://issues.apache.org/jira/browse/TOMEE-1205
             Project: TomEE
          Issue Type: Bug
    Affects Versions: 1.6.0.1, 1.6.0.2
         Environment: Windows 7 64 Bit

java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

1.6.0.1 webprofile
1.6.0.2 webprofile
            Reporter: Patrick Pekczynski
            Priority: Blocker


Since version 1.6.0.1 (including 1.6.0.2) (both webprofiles) in EL-expression on XHTML-pages one can no longer provide a 'subclass' as argument to a method with a method that takes a superclass as argument.

In 1.6.0 webprofile this worked without problems 

Consider 

a class 

@Named
@RequestScoped
public class Zoo {

    private List<Animal> animals;

    public Zoo() {
        this.animals = new ArrayList<>();
        this.animals.add(new Bird());
        this.animals.add(new Mammal());
    }

    public List<Animal> getAnimals() {
        return this.animals;
    }

    public String getName(Animal animal) {
        return animal.getName();
    }
}

and a hierarchy 
Bird extends Animal
Mammal extends Animal

when iterating over the list of animals [Bird, Mamal] on an XHTML page

calling zoo.getName(Bird) leads to an error stating

SEVERE: Servlet.service() for servlet [FacesServlet] in context with path [/animaltest] threw exception [java.lang.NoSuchMethodException: org.animal.Zoo$$OwbNormalScopeProxy0.getName(org.animal.Bird)] with root cause
java.lang.NoSuchMethodException: org.animal.Zoo$$OwbNormalScopeProxy0.getName(org.animal.Bird)
	at java.lang.Class.getMethod(Class.java:1624)
	at javax.el.BeanELResolver.invoke(BeanELResolver.java:394)
	at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:225)
	at org.apache.el.parser.AstValue.getValue(AstValue.java:173)
	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
	at org.apache.webbeans.el22.WrappedValueExpression.getValue(WrappedValueExpression.java:70)
	at org.apache.myfaces.view.facelets.el.ELText$ELTextVariable.writeText(ELText.java:219)

However the EL expression should be aware of the method Zoo.getName(Animal) that perfectly allows any subclass of Animal as an argument.

As this was working in 1.6.0 webprofile without problems I wonder what has changes if "only" security updates have been applied...

Would be great if you can have a look at this.
Thanks and best regards,
Patrick



--
This message was sent by Atlassian JIRA
(v6.2#6252)