You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org> on 2011/04/01 21:15:05 UTC

[jira] [Created] (TAP5-1493) Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass

Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass
-----------------------------------------------------------------------------------------------------------------------------------------

                 Key: TAP5-1493
                 URL: https://issues.apache.org/jira/browse/TAP5-1493
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-core, tapestry-ioc
    Affects Versions: 5.2.5, 5.3.0
            Reporter: Howard M. Lewis Ship
            Priority: Critical


public abstract class AbstractFoo
{
 public abstract AbstractBar getBar();
}

public class Foo extends AbstractFoo
{
 public Bar getBar();
}


Here property bar is covariant; the subclass (Foo) changes the type of the return value (from AbstractBar to just Bar). Assuming that Bar is a subclass of AbstractBar, that's fine.

The bug is that in this circumstance, the PropertyConduitSource sees the type of
property "bar" of class Foo as AbstractBar, not Bar.

Interestingly, a little debugging showed that the getter method for property bar was "public AbstractBar Foo.getBar()" ... in other words, much like with Generics, covariant return types may be largely
a fiction of the compiler inserting the necessary casts in place.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (TAP5-1493) Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass

Posted by "Alexander Gavrilov (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13192314#comment-13192314 ] 

Alexander Gavrilov commented on TAP5-1493:
------------------------------------------

See java.lang.Method.isBridge()
Class should have two methods with the same name and with different return types. One of them should me marked as a bridge. http://stackoverflow.com/questions/289731/what-java-lang-reflect-method-isbridge-used-for Our task is to filter bridge method out and use bridged one 
                
> Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1493
>                 URL: https://issues.apache.org/jira/browse/TAP5-1493
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core, tapestry-ioc
>    Affects Versions: 5.2
>            Reporter: Howard M. Lewis Ship
>            Priority: Critical
>
> public abstract class AbstractFoo
> {
>  public abstract AbstractBar getBar();
> }
> public class Foo extends AbstractFoo
> {
>  public Bar getBar();
> }
> Here property bar is covariant; the subclass (Foo) changes the type of the return value (from AbstractBar to just Bar). Assuming that Bar is a subclass of AbstractBar, that's fine.
> The bug is that in this circumstance, the PropertyConduitSource sees the type of
> property "bar" of class Foo as AbstractBar, not Bar.
> Interestingly, a little debugging showed that the getter method for property bar was "public AbstractBar Foo.getBar()" ... in other words, much like with Generics, covariant return types may be largely
> a fiction of the compiler inserting the necessary casts in place.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1493) Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass

Posted by "Robert Zeigler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014949#comment-13014949 ] 

Robert Zeigler commented on TAP5-1493:
--------------------------------------

JVM 6u24, 64 bit.  But running on mac.

> Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1493
>                 URL: https://issues.apache.org/jira/browse/TAP5-1493
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core, tapestry-ioc
>    Affects Versions: 5.3.0, 5.2.5
>            Reporter: Howard M. Lewis Ship
>            Priority: Critical
>
> public abstract class AbstractFoo
> {
>  public abstract AbstractBar getBar();
> }
> public class Foo extends AbstractFoo
> {
>  public Bar getBar();
> }
> Here property bar is covariant; the subclass (Foo) changes the type of the return value (from AbstractBar to just Bar). Assuming that Bar is a subclass of AbstractBar, that's fine.
> The bug is that in this circumstance, the PropertyConduitSource sees the type of
> property "bar" of class Foo as AbstractBar, not Bar.
> Interestingly, a little debugging showed that the getter method for property bar was "public AbstractBar Foo.getBar()" ... in other words, much like with Generics, covariant return types may be largely
> a fiction of the compiler inserting the necessary casts in place.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (TAP5-1493) Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass

Posted by "I D (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014938#comment-13014938 ] 

I D commented on TAP5-1493:
---------------------------

This issue does not arise with JVM 6u24 running on Win7x64. Which version JVM are you running?

> Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1493
>                 URL: https://issues.apache.org/jira/browse/TAP5-1493
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core, tapestry-ioc
>    Affects Versions: 5.3.0, 5.2.5
>            Reporter: Howard M. Lewis Ship
>            Priority: Critical
>
> public abstract class AbstractFoo
> {
>  public abstract AbstractBar getBar();
> }
> public class Foo extends AbstractFoo
> {
>  public Bar getBar();
> }
> Here property bar is covariant; the subclass (Foo) changes the type of the return value (from AbstractBar to just Bar). Assuming that Bar is a subclass of AbstractBar, that's fine.
> The bug is that in this circumstance, the PropertyConduitSource sees the type of
> property "bar" of class Foo as AbstractBar, not Bar.
> Interestingly, a little debugging showed that the getter method for property bar was "public AbstractBar Foo.getBar()" ... in other words, much like with Generics, covariant return types may be largely
> a fiction of the compiler inserting the necessary casts in place.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (TAP5-1493) Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014797#comment-13014797 ] 

Howard M. Lewis Ship commented on TAP5-1493:
--------------------------------------------

Well, ASM doesn't think so:

// access flags 0x1
public getBar()Lmypackage/Bar;
 L0
  LINENUMBER 25 L0
  ALOAD 0
  GETFIELD mypackage/EditFoo.creation : Lmypackage/Foo;
  INVOKEVIRTUAL mypackage/Foo.getBar()Lmypackage/Bar;
  ARETURN
  MAXSTACK = 1
  MAXLOCALS = 1

That looks like a real getBar() method on class Foo that returns type Bar (not AbstractBar).

> Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1493
>                 URL: https://issues.apache.org/jira/browse/TAP5-1493
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core, tapestry-ioc
>    Affects Versions: 5.3.0, 5.2.5
>            Reporter: Howard M. Lewis Ship
>            Priority: Critical
>
> public abstract class AbstractFoo
> {
>  public abstract AbstractBar getBar();
> }
> public class Foo extends AbstractFoo
> {
>  public Bar getBar();
> }
> Here property bar is covariant; the subclass (Foo) changes the type of the return value (from AbstractBar to just Bar). Assuming that Bar is a subclass of AbstractBar, that's fine.
> The bug is that in this circumstance, the PropertyConduitSource sees the type of
> property "bar" of class Foo as AbstractBar, not Bar.
> Interestingly, a little debugging showed that the getter method for property bar was "public AbstractBar Foo.getBar()" ... in other words, much like with Generics, covariant return types may be largely
> a fiction of the compiler inserting the necessary casts in place.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (TAP5-1493) Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014797#comment-13014797 ] 

Howard M. Lewis Ship commented on TAP5-1493:
--------------------------------------------

Well, ASM doesn't think so:

// access flags 0x1
public getBar()Lmypackage/Bar;
 L0
  LINENUMBER 25 L0
  ALOAD 0
  GETFIELD mypackage/EditFoo.creation : Lmypackage/Foo;
  INVOKEVIRTUAL mypackage/Foo.getBar()Lmypackage/Bar;
  ARETURN
  MAXSTACK = 1
  MAXLOCALS = 1

That looks like a real getBar() method on class Foo that returns type Bar (not AbstractBar).

> Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1493
>                 URL: https://issues.apache.org/jira/browse/TAP5-1493
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core, tapestry-ioc
>    Affects Versions: 5.3.0, 5.2.5
>            Reporter: Howard M. Lewis Ship
>            Priority: Critical
>
> public abstract class AbstractFoo
> {
>  public abstract AbstractBar getBar();
> }
> public class Foo extends AbstractFoo
> {
>  public Bar getBar();
> }
> Here property bar is covariant; the subclass (Foo) changes the type of the return value (from AbstractBar to just Bar). Assuming that Bar is a subclass of AbstractBar, that's fine.
> The bug is that in this circumstance, the PropertyConduitSource sees the type of
> property "bar" of class Foo as AbstractBar, not Bar.
> Interestingly, a little debugging showed that the getter method for property bar was "public AbstractBar Foo.getBar()" ... in other words, much like with Generics, covariant return types may be largely
> a fiction of the compiler inserting the necessary casts in place.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (TAP5-1493) Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass

Posted by "Robert Zeigler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014813#comment-13014813 ] 

Robert Zeigler commented on TAP5-1493:
--------------------------------------

Just ran into exactly this problem this week. In my case:

interface Foo {}
interface Bar extends Foo{}

interface Baz {
   Foo getFoo();
}

interface Qux extends Baz {
   Bar getFoo();
}


class AbstractClass implements Baz {...}
class MyClass extends AbstractClass implements Qux {
   Bar getFoo();
}

Then property expressions that explicitly use MyClass as the root and attempt to access foo.barSpecificProperty were failing with "Foo doesn't have a property 'barSpecificProperty'".


> Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1493
>                 URL: https://issues.apache.org/jira/browse/TAP5-1493
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core, tapestry-ioc
>    Affects Versions: 5.3.0, 5.2.5
>            Reporter: Howard M. Lewis Ship
>            Priority: Critical
>
> public abstract class AbstractFoo
> {
>  public abstract AbstractBar getBar();
> }
> public class Foo extends AbstractFoo
> {
>  public Bar getBar();
> }
> Here property bar is covariant; the subclass (Foo) changes the type of the return value (from AbstractBar to just Bar). Assuming that Bar is a subclass of AbstractBar, that's fine.
> The bug is that in this circumstance, the PropertyConduitSource sees the type of
> property "bar" of class Foo as AbstractBar, not Bar.
> Interestingly, a little debugging showed that the getter method for property bar was "public AbstractBar Foo.getBar()" ... in other words, much like with Generics, covariant return types may be largely
> a fiction of the compiler inserting the necessary casts in place.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (TAP5-1493) Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass

Posted by "I D (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014938#comment-13014938 ] 

I D commented on TAP5-1493:
---------------------------

This issue does not arise with JVM 6u24 running on Win7x64. Which version JVM are you running?

> Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1493
>                 URL: https://issues.apache.org/jira/browse/TAP5-1493
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core, tapestry-ioc
>    Affects Versions: 5.3.0, 5.2.5
>            Reporter: Howard M. Lewis Ship
>            Priority: Critical
>
> public abstract class AbstractFoo
> {
>  public abstract AbstractBar getBar();
> }
> public class Foo extends AbstractFoo
> {
>  public Bar getBar();
> }
> Here property bar is covariant; the subclass (Foo) changes the type of the return value (from AbstractBar to just Bar). Assuming that Bar is a subclass of AbstractBar, that's fine.
> The bug is that in this circumstance, the PropertyConduitSource sees the type of
> property "bar" of class Foo as AbstractBar, not Bar.
> Interestingly, a little debugging showed that the getter method for property bar was "public AbstractBar Foo.getBar()" ... in other words, much like with Generics, covariant return types may be largely
> a fiction of the compiler inserting the necessary casts in place.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (TAP5-1493) Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass

Posted by "Robert Zeigler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014949#comment-13014949 ] 

Robert Zeigler commented on TAP5-1493:
--------------------------------------

JVM 6u24, 64 bit.  But running on mac.

> Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1493
>                 URL: https://issues.apache.org/jira/browse/TAP5-1493
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core, tapestry-ioc
>    Affects Versions: 5.3.0, 5.2.5
>            Reporter: Howard M. Lewis Ship
>            Priority: Critical
>
> public abstract class AbstractFoo
> {
>  public abstract AbstractBar getBar();
> }
> public class Foo extends AbstractFoo
> {
>  public Bar getBar();
> }
> Here property bar is covariant; the subclass (Foo) changes the type of the return value (from AbstractBar to just Bar). Assuming that Bar is a subclass of AbstractBar, that's fine.
> The bug is that in this circumstance, the PropertyConduitSource sees the type of
> property "bar" of class Foo as AbstractBar, not Bar.
> Interestingly, a little debugging showed that the getter method for property bar was "public AbstractBar Foo.getBar()" ... in other words, much like with Generics, covariant return types may be largely
> a fiction of the compiler inserting the necessary casts in place.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (TAP5-1493) Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass

Posted by "Robert Zeigler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014813#comment-13014813 ] 

Robert Zeigler commented on TAP5-1493:
--------------------------------------

Just ran into exactly this problem this week. In my case:

interface Foo {}
interface Bar extends Foo{}

interface Baz {
   Foo getFoo();
}

interface Qux extends Baz {
   Bar getFoo();
}


class AbstractClass implements Baz {...}
class MyClass extends AbstractClass implements Qux {
   Bar getFoo();
}

Then property expressions that explicitly use MyClass as the root and attempt to access foo.barSpecificProperty were failing with "Foo doesn't have a property 'barSpecificProperty'".


> Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1493
>                 URL: https://issues.apache.org/jira/browse/TAP5-1493
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core, tapestry-ioc
>    Affects Versions: 5.3.0, 5.2.5
>            Reporter: Howard M. Lewis Ship
>            Priority: Critical
>
> public abstract class AbstractFoo
> {
>  public abstract AbstractBar getBar();
> }
> public class Foo extends AbstractFoo
> {
>  public Bar getBar();
> }
> Here property bar is covariant; the subclass (Foo) changes the type of the return value (from AbstractBar to just Bar). Assuming that Bar is a subclass of AbstractBar, that's fine.
> The bug is that in this circumstance, the PropertyConduitSource sees the type of
> property "bar" of class Foo as AbstractBar, not Bar.
> Interestingly, a little debugging showed that the getter method for property bar was "public AbstractBar Foo.getBar()" ... in other words, much like with Generics, covariant return types may be largely
> a fiction of the compiler inserting the necessary casts in place.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (TAP5-1493) Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass

Posted by "Alexander Gavrilov (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13192314#comment-13192314 ] 

Alexander Gavrilov commented on TAP5-1493:
------------------------------------------

See java.lang.Method.isBridge()
Class should have two methods with the same name and with different return types. One of them should me marked as a bridge. http://stackoverflow.com/questions/289731/what-java-lang-reflect-method-isbridge-used-for Our task is to filter bridge method out and use bridged one 
                
> Property expressions on properties that are covariant on a base class use the type of the base class property, not the covariant subclass
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1493
>                 URL: https://issues.apache.org/jira/browse/TAP5-1493
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core, tapestry-ioc
>    Affects Versions: 5.2
>            Reporter: Howard M. Lewis Ship
>            Priority: Critical
>
> public abstract class AbstractFoo
> {
>  public abstract AbstractBar getBar();
> }
> public class Foo extends AbstractFoo
> {
>  public Bar getBar();
> }
> Here property bar is covariant; the subclass (Foo) changes the type of the return value (from AbstractBar to just Bar). Assuming that Bar is a subclass of AbstractBar, that's fine.
> The bug is that in this circumstance, the PropertyConduitSource sees the type of
> property "bar" of class Foo as AbstractBar, not Bar.
> Interestingly, a little debugging showed that the getter method for property bar was "public AbstractBar Foo.getBar()" ... in other words, much like with Generics, covariant return types may be largely
> a fiction of the compiler inserting the necessary casts in place.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira