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)" <de...@tapestry.apache.org> on 2007/09/02 19:29:19 UTC

[jira] Created: (TAPESTRY-1731) @Inject @Symbol does not work inside a component

@Inject @Symbol does not work inside a component
------------------------------------------------

                 Key: TAPESTRY-1731
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1731
             Project: Tapestry
          Issue Type: Bug
          Components: tapestry-core
    Affects Versions: 5.0.5
            Reporter: Howard M. Lewis Ship


This should work:

    @Inject
    @Symbol(WebConstants.DOCUMENT_ROOT_DIR)
    private String _documentRoot;

But the @Symbol is not recognized, so the injection is implemented as:

add method: private void _$write_documentRoot(java.lang.String $1)
throw new java.lang.RuntimeException("Field com.dtsoft.ws.web.pages.CreateOrder._documentRoot is read-only.");

add constructor: com.dtsoft.ws.web.pages.CreateOrder(org.apache.tapestry.internal.InternalComponentResources $1, com.dtsoft.ws.web.services.OrderDatabase $2)
{
  _$resources = $1;
_documentRoot = _$resources.getCompleteId();
  _database = $2;
  initializer();

}


This appears to be the same for @Inject @Value ... with a String type, the only thing that can be injected is the component id.



-- 
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-1731) @Inject @Symbol does not work inside a component

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

Howard M. Lewis Ship commented on TAPESTRY-1731:
------------------------------------------------

This is a nasty conflict between InjectWorker and InjectResourcesWorker.

InjectResourcesWorker comes first, sees the @Inject on type String and takes over, injecting the component id.

What it should do is (somehow) recognize the @Symbol (or @Value) annotation, and defer to InjectWorker.

Only if InjectWorker fails to perform an injection should InjectResourcesWorker be given a crack.  

However, if InjectWorker is scheduled first, then it will fail for common types such as ComponentResources.

This will require an API change to ObjectProvider, to allow it to NOT fail if no match may be found.

> @Inject @Symbol does not work inside a component
> ------------------------------------------------
>
>                 Key: TAPESTRY-1731
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1731
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.5
>            Reporter: Howard M. Lewis Ship
>            Assignee: Howard M. Lewis Ship
>
> This should work:
>     @Inject
>     @Symbol(WebConstants.DOCUMENT_ROOT_DIR)
>     private String _documentRoot;
> But the @Symbol is not recognized, so the injection is implemented as:
> add method: private void _$write_documentRoot(java.lang.String $1)
> throw new java.lang.RuntimeException("Field com.dtsoft.ws.web.pages.CreateOrder._documentRoot is read-only.");
> add constructor: com.dtsoft.ws.web.pages.CreateOrder(org.apache.tapestry.internal.InternalComponentResources $1, com.dtsoft.ws.web.services.OrderDatabase $2)
> {
>   _$resources = $1;
> _documentRoot = _$resources.getCompleteId();
>   _database = $2;
>   initializer();
> }
> This appears to be the same for @Inject @Value ... with a String type, the only thing that can be injected is the component id.

-- 
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-1731) @Inject @Symbol does not work inside a component

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

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

       Resolution: Fixed
    Fix Version/s: 5.0.6

> @Inject @Symbol does not work inside a component
> ------------------------------------------------
>
>                 Key: TAPESTRY-1731
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1731
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.5
>            Reporter: Howard M. Lewis Ship
>            Assignee: Howard M. Lewis Ship
>             Fix For: 5.0.6
>
>
> This should work:
>     @Inject
>     @Symbol(WebConstants.DOCUMENT_ROOT_DIR)
>     private String _documentRoot;
> But the @Symbol is not recognized, so the injection is implemented as:
> add method: private void _$write_documentRoot(java.lang.String $1)
> throw new java.lang.RuntimeException("Field com.dtsoft.ws.web.pages.CreateOrder._documentRoot is read-only.");
> add constructor: com.dtsoft.ws.web.pages.CreateOrder(org.apache.tapestry.internal.InternalComponentResources $1, com.dtsoft.ws.web.services.OrderDatabase $2)
> {
>   _$resources = $1;
> _documentRoot = _$resources.getCompleteId();
>   _database = $2;
>   initializer();
> }
> This appears to be the same for @Inject @Value ... with a String type, the only thing that can be injected is the component id.

-- 
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] Assigned: (TAPESTRY-1731) @Inject @Symbol does not work inside a component

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

Howard M. Lewis Ship reassigned TAPESTRY-1731:
----------------------------------------------

    Assignee: Howard M. Lewis Ship

> @Inject @Symbol does not work inside a component
> ------------------------------------------------
>
>                 Key: TAPESTRY-1731
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1731
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.5
>            Reporter: Howard M. Lewis Ship
>            Assignee: Howard M. Lewis Ship
>
> This should work:
>     @Inject
>     @Symbol(WebConstants.DOCUMENT_ROOT_DIR)
>     private String _documentRoot;
> But the @Symbol is not recognized, so the injection is implemented as:
> add method: private void _$write_documentRoot(java.lang.String $1)
> throw new java.lang.RuntimeException("Field com.dtsoft.ws.web.pages.CreateOrder._documentRoot is read-only.");
> add constructor: com.dtsoft.ws.web.pages.CreateOrder(org.apache.tapestry.internal.InternalComponentResources $1, com.dtsoft.ws.web.services.OrderDatabase $2)
> {
>   _$resources = $1;
> _documentRoot = _$resources.getCompleteId();
>   _database = $2;
>   initializer();
> }
> This appears to be the same for @Inject @Value ... with a String type, the only thing that can be injected is the component id.

-- 
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