You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Priit Karu (JIRA)" <de...@tapestry.apache.org> on 2008/01/24 11:39:34 UTC

[jira] Created: (TAPESTRY-2079) Component class type is lost when it is passed outside Tapestry application pages or components package

Component class type is lost when it is passed outside Tapestry application pages or components package
-------------------------------------------------------------------------------------------------------

                 Key: TAPESTRY-2079
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2079
             Project: Tapestry
          Issue Type: Bug
          Components: Framework
    Affects Versions: 5.0
            Reporter: Priit Karu


I obtain component container inside one component (e.g. call ComponentResources.getContainer()) and when i check the class type inside the same component method everything is ok but when i decide to pass the same component to an utility class that do the same there it fails.

E.g. i have two methods inside my component class and the first one returns true, the second one false although the code should be the same for both (only different package/class):

public boolean isInsideTestContainerLocally(){
		Component comp = resources.getContainer();
		return (comp instanceof TestContainer); 
}
	
public boolean isInsideTestContainerWithCall(){
	Component comp = resources.getContainer();
	return Util.isInstanceOfTestContainer(comp);
}

----->>----Util class contains the method---->----
	public static boolean isInstanceOfTestContainer(Component _comp){
		return _comp instanceof TestContainer;
	}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2079) Component class type is lost when it is passed outside Tapestry application pages or components package

Posted by "Priit Karu (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12563448#action_12563448 ] 

Priit Karu commented on TAPESTRY-2079:
--------------------------------------

I'm still not sure if i was able to explain the problem in an understandable way above.

If i do <code>comp instanceof TestContainer</code> inside component class it works as expected. If i execute the same code inside utility class <code>comp instanceof TestContainer</code> it does not work anymore. <code>comp</code> is the same variable in both cases. Just the place (java package) where it is executed is different.

Is this really documented behavior somewhere?



> Component class type is lost when it is passed outside Tapestry application pages or components package
> -------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2079
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2079
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 5.0
>            Reporter: Priit Karu
>            Assignee: Howard M. Lewis Ship
>         Attachments: example.ZIP
>
>
> I obtain component container inside one component (e.g. call ComponentResources.getContainer()) and when i check the class type inside the same component method everything is ok but when i decide to pass the same component to an utility class that do the same there it fails.
> E.g. i have two methods inside my component class and the first one returns true, the second one false although the code should be the same for both (only different package/class):
> public boolean isInsideTestContainerLocally(){
> 		Component comp = resources.getContainer();
> 		return (comp instanceof TestContainer); 
> }
> 	
> public boolean isInsideTestContainerWithCall(){
> 	Component comp = resources.getContainer();
> 	return Util.isInstanceOfTestContainer(comp);
> }
> ----->>----Util class contains the method---->----
> 	public static boolean isInstanceOfTestContainer(Component _comp){
> 		return _comp instanceof TestContainer;
> 	}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2079) Component class type is lost when it is passed outside Tapestry application pages or components package

Posted by "Priit Karu (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12563443#action_12563443 ] 

Priit Karu commented on TAPESTRY-2079:
--------------------------------------

It is the other way around. My components call code that are in the utility classes (and pass some parameters from the components). 

How could i avoid code duplication if i can not pass classes from components to utility classes safely? Any ideas?

> Component class type is lost when it is passed outside Tapestry application pages or components package
> -------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2079
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2079
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 5.0
>            Reporter: Priit Karu
>            Assignee: Howard M. Lewis Ship
>         Attachments: example.ZIP
>
>
> I obtain component container inside one component (e.g. call ComponentResources.getContainer()) and when i check the class type inside the same component method everything is ok but when i decide to pass the same component to an utility class that do the same there it fails.
> E.g. i have two methods inside my component class and the first one returns true, the second one false although the code should be the same for both (only different package/class):
> public boolean isInsideTestContainerLocally(){
> 		Component comp = resources.getContainer();
> 		return (comp instanceof TestContainer); 
> }
> 	
> public boolean isInsideTestContainerWithCall(){
> 	Component comp = resources.getContainer();
> 	return Util.isInstanceOfTestContainer(comp);
> }
> ----->>----Util class contains the method---->----
> 	public static boolean isInstanceOfTestContainer(Component _comp){
> 		return _comp instanceof TestContainer;
> 	}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-2079) Component class type is lost when it is passed outside Tapestry application pages or components package

Posted by "Priit Karu (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2079?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Priit Karu updated TAPESTRY-2079:
---------------------------------

    Attachment: example.ZIP

Attached Maven2 example project that illustrates the problem. 

Just in case my wording was too confusing...

> Component class type is lost when it is passed outside Tapestry application pages or components package
> -------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2079
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2079
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 5.0
>            Reporter: Priit Karu
>         Attachments: example.ZIP
>
>
> I obtain component container inside one component (e.g. call ComponentResources.getContainer()) and when i check the class type inside the same component method everything is ok but when i decide to pass the same component to an utility class that do the same there it fails.
> E.g. i have two methods inside my component class and the first one returns true, the second one false although the code should be the same for both (only different package/class):
> public boolean isInsideTestContainerLocally(){
> 		Component comp = resources.getContainer();
> 		return (comp instanceof TestContainer); 
> }
> 	
> public boolean isInsideTestContainerWithCall(){
> 	Component comp = resources.getContainer();
> 	return Util.isInstanceOfTestContainer(comp);
> }
> ----->>----Util class contains the method---->----
> 	public static boolean isInstanceOfTestContainer(Component _comp){
> 		return _comp instanceof TestContainer;
> 	}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Closed: (TAPESTRY-2079) Component class type is lost when it is passed outside Tapestry application pages or components package

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2079?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship closed TAPESTRY-2079.
------------------------------------------

    Resolution: Invalid
      Assignee: Howard M. Lewis Ship

This is a known, documented and unavoidable side effect of the technology that supports dynamic class reloading and class transformation.

Define an interface for the methods that are relevant to you utility code and have the component class implement the interface.  Make sure the interface is not loaded by Tapestry's class loader, don't but it in the .pages, .components, .mixins or .base sub-directory.


> Component class type is lost when it is passed outside Tapestry application pages or components package
> -------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2079
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2079
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 5.0
>            Reporter: Priit Karu
>            Assignee: Howard M. Lewis Ship
>         Attachments: example.ZIP
>
>
> I obtain component container inside one component (e.g. call ComponentResources.getContainer()) and when i check the class type inside the same component method everything is ok but when i decide to pass the same component to an utility class that do the same there it fails.
> E.g. i have two methods inside my component class and the first one returns true, the second one false although the code should be the same for both (only different package/class):
> public boolean isInsideTestContainerLocally(){
> 		Component comp = resources.getContainer();
> 		return (comp instanceof TestContainer); 
> }
> 	
> public boolean isInsideTestContainerWithCall(){
> 	Component comp = resources.getContainer();
> 	return Util.isInstanceOfTestContainer(comp);
> }
> ----->>----Util class contains the method---->----
> 	public static boolean isInstanceOfTestContainer(Component _comp){
> 		return _comp instanceof TestContainer;
> 	}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org