You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Philip Lopez (JIRA)" <ji...@apache.org> on 2009/11/12 14:16:39 UTC
[jira] Created: (TAP5-927) Cannot use Scala for Tapestry IOC
Modules
Cannot use Scala for Tapestry IOC Modules
-----------------------------------------
Key: TAP5-927
URL: https://issues.apache.org/jira/browse/TAP5-927
Project: Tapestry 5
Issue Type: Improvement
Components: tapestry-ioc
Affects Versions: 5.1.0.5
Reporter: Philip Lopez
Scala (as of 2.7.7) adds a public method $tag() to classes. It's not particularly pretty (and $tag() is apparently deprecated) but it's there. (See http://programming-scala.labs.oreilly.com/ch14.html#CommandLineToolDecompilers)
The (new, in 5.1.0.x) checks in org.apache.tapestry5.ioc.internal.DefaultModuleDefImp mean that a module implemented in Scala throws an exception on load:
java.lang.RuntimeException: Module class <MODULE_NAME> contains unrecognized public methods: public static final int <MODULE_NAME>.$tag() throws java.rmi.RemoteException.
It would be nice to have a way to work around this so that Scala could be used with Tapestry IOC 5.1.0.x (including Modules). One generic approach may be to have an @IgnoredPublicMethods annotation applicable to Module classes that took an array of Strings that named methods that should also be removed from the "methods" set before checking whether there are superfluous public methods. Of course, there's always the hard-code exception too (ugly but a lot less "investment" for this pesky incompatibility).
As an example, the following article describes Scala and Tapestry: http://fanf42.blogspot.com/2009/02/tapestry-5-scala-view-article-in-html.html. If you checkout the git project and update the Tapestry release version to 5.1.0.5, you'll see it fail, where in 5.0.x it worked.
The relevant code is:
109 // Want to verify that every public method is meaningful to Tapestry IoC. Remaining methods might
110 // have typos, i.e., "createFoo" that should be "buildFoo".
111
112 Set<Method> methods = CollectionFactory.newSet(moduleClass.getMethods());
113
114 methods.removeAll(OBJECT_METHODS);
115
116 boolean modulePreventsServiceDecoration = moduleClass.getAnnotation(PreventServiceDecoration.class) != null;
117
118 grind(methods, modulePreventsServiceDecoration);
119 bind(methods, modulePreventsServiceDecoration);
120
121 if (methods.isEmpty()) return;
122
123 throw new RuntimeException(String.format("Module class %s contains unrecognized public methods: %s.",
124 moduleClass.getName(),
125 InternalUtils.joinSorted(methods)));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (TAP5-927) Cannot use Scala for Tapestry IOC
Modules
Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-927?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard M. Lewis Ship reassigned TAP5-927:
-----------------------------------------
Assignee: Howard M. Lewis Ship
> Cannot use Scala for Tapestry IOC Modules
> -----------------------------------------
>
> Key: TAP5-927
> URL: https://issues.apache.org/jira/browse/TAP5-927
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-ioc
> Affects Versions: 5.1.0.5
> Reporter: Philip Lopez
> Assignee: Howard M. Lewis Ship
> Priority: Minor
>
> Scala (as of 2.7.7) adds a public method $tag() to classes. It's not particularly pretty (and $tag() is apparently deprecated) but it's there. (See http://programming-scala.labs.oreilly.com/ch14.html#CommandLineToolDecompilers)
> The (new, in 5.1.0.x) checks in org.apache.tapestry5.ioc.internal.DefaultModuleDefImp mean that a module implemented in Scala throws an exception on load:
> java.lang.RuntimeException: Module class <MODULE_NAME> contains unrecognized public methods: public static final int <MODULE_NAME>.$tag() throws java.rmi.RemoteException.
> It would be nice to have a way to work around this so that Scala could be used with Tapestry IOC 5.1.0.x (including Modules). One generic approach may be to have an @IgnoredPublicMethods annotation applicable to Module classes that took an array of Strings that named methods that should also be removed from the "methods" set before checking whether there are superfluous public methods. Of course, there's always the hard-code exception too (ugly but a lot less "investment" for this pesky incompatibility).
> As an example, the following article describes Scala and Tapestry: http://fanf42.blogspot.com/2009/02/tapestry-5-scala-view-article-in-html.html. If you checkout the git project and update the Tapestry release version to 5.1.0.5, you'll see it fail, where in 5.0.x it worked.
> The relevant code is:
> 109 // Want to verify that every public method is meaningful to Tapestry IoC. Remaining methods might
> 110 // have typos, i.e., "createFoo" that should be "buildFoo".
> 111
> 112 Set<Method> methods = CollectionFactory.newSet(moduleClass.getMethods());
> 113
> 114 methods.removeAll(OBJECT_METHODS);
> 115
> 116 boolean modulePreventsServiceDecoration = moduleClass.getAnnotation(PreventServiceDecoration.class) != null;
> 117
> 118 grind(methods, modulePreventsServiceDecoration);
> 119 bind(methods, modulePreventsServiceDecoration);
> 120
> 121 if (methods.isEmpty()) return;
> 122
> 123 throw new RuntimeException(String.format("Module class %s contains unrecognized public methods: %s.",
> 124 moduleClass.getName(),
> 125 InternalUtils.joinSorted(methods)));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (TAP5-927) Cannot use Scala for Tapestry IOC
Modules
Posted by "Philip Lopez (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-927?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Philip Lopez updated TAP5-927:
------------------------------
Priority: Minor (was: Major)
changed priority to minor: workaround is to use Tapestry 5.0.x or to avoid Scala for modules.
> Cannot use Scala for Tapestry IOC Modules
> -----------------------------------------
>
> Key: TAP5-927
> URL: https://issues.apache.org/jira/browse/TAP5-927
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-ioc
> Affects Versions: 5.1.0.5
> Reporter: Philip Lopez
> Priority: Minor
>
> Scala (as of 2.7.7) adds a public method $tag() to classes. It's not particularly pretty (and $tag() is apparently deprecated) but it's there. (See http://programming-scala.labs.oreilly.com/ch14.html#CommandLineToolDecompilers)
> The (new, in 5.1.0.x) checks in org.apache.tapestry5.ioc.internal.DefaultModuleDefImp mean that a module implemented in Scala throws an exception on load:
> java.lang.RuntimeException: Module class <MODULE_NAME> contains unrecognized public methods: public static final int <MODULE_NAME>.$tag() throws java.rmi.RemoteException.
> It would be nice to have a way to work around this so that Scala could be used with Tapestry IOC 5.1.0.x (including Modules). One generic approach may be to have an @IgnoredPublicMethods annotation applicable to Module classes that took an array of Strings that named methods that should also be removed from the "methods" set before checking whether there are superfluous public methods. Of course, there's always the hard-code exception too (ugly but a lot less "investment" for this pesky incompatibility).
> As an example, the following article describes Scala and Tapestry: http://fanf42.blogspot.com/2009/02/tapestry-5-scala-view-article-in-html.html. If you checkout the git project and update the Tapestry release version to 5.1.0.5, you'll see it fail, where in 5.0.x it worked.
> The relevant code is:
> 109 // Want to verify that every public method is meaningful to Tapestry IoC. Remaining methods might
> 110 // have typos, i.e., "createFoo" that should be "buildFoo".
> 111
> 112 Set<Method> methods = CollectionFactory.newSet(moduleClass.getMethods());
> 113
> 114 methods.removeAll(OBJECT_METHODS);
> 115
> 116 boolean modulePreventsServiceDecoration = moduleClass.getAnnotation(PreventServiceDecoration.class) != null;
> 117
> 118 grind(methods, modulePreventsServiceDecoration);
> 119 bind(methods, modulePreventsServiceDecoration);
> 120
> 121 if (methods.isEmpty()) return;
> 122
> 123 throw new RuntimeException(String.format("Module class %s contains unrecognized public methods: %s.",
> 124 moduleClass.getName(),
> 125 InternalUtils.joinSorted(methods)));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TAP5-927) Cannot use Scala for Tapestry IOC
Modules
Posted by "Martin Kneissl (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12797198#action_12797198 ]
Martin Kneissl commented on TAP5-927:
-------------------------------------
Unfortunately the $tag() method seems not to be marked as synthetic by the Scala compiler. The removal of synthetic methods from module definitions will not remove the $tag() method. Explicit code is required.
> Cannot use Scala for Tapestry IOC Modules
> -----------------------------------------
>
> Key: TAP5-927
> URL: https://issues.apache.org/jira/browse/TAP5-927
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-ioc
> Affects Versions: 5.1.0.5
> Reporter: Philip Lopez
> Assignee: Howard M. Lewis Ship
> Priority: Minor
>
> Scala (as of 2.7.7) adds a public method $tag() to classes. It's not particularly pretty (and $tag() is apparently deprecated) but it's there. (See http://programming-scala.labs.oreilly.com/ch14.html#CommandLineToolDecompilers)
> The (new, in 5.1.0.x) checks in org.apache.tapestry5.ioc.internal.DefaultModuleDefImp mean that a module implemented in Scala throws an exception on load:
> java.lang.RuntimeException: Module class <MODULE_NAME> contains unrecognized public methods: public static final int <MODULE_NAME>.$tag() throws java.rmi.RemoteException.
> It would be nice to have a way to work around this so that Scala could be used with Tapestry IOC 5.1.0.x (including Modules). One generic approach may be to have an @IgnoredPublicMethods annotation applicable to Module classes that took an array of Strings that named methods that should also be removed from the "methods" set before checking whether there are superfluous public methods. Of course, there's always the hard-code exception too (ugly but a lot less "investment" for this pesky incompatibility).
> As an example, the following article describes Scala and Tapestry: http://fanf42.blogspot.com/2009/02/tapestry-5-scala-view-article-in-html.html. If you checkout the git project and update the Tapestry release version to 5.1.0.5, you'll see it fail, where in 5.0.x it worked.
> The relevant code is:
> 109 // Want to verify that every public method is meaningful to Tapestry IoC. Remaining methods might
> 110 // have typos, i.e., "createFoo" that should be "buildFoo".
> 111
> 112 Set<Method> methods = CollectionFactory.newSet(moduleClass.getMethods());
> 113
> 114 methods.removeAll(OBJECT_METHODS);
> 115
> 116 boolean modulePreventsServiceDecoration = moduleClass.getAnnotation(PreventServiceDecoration.class) != null;
> 117
> 118 grind(methods, modulePreventsServiceDecoration);
> 119 bind(methods, modulePreventsServiceDecoration);
> 120
> 121 if (methods.isEmpty()) return;
> 122
> 123 throw new RuntimeException(String.format("Module class %s contains unrecognized public methods: %s.",
> 124 moduleClass.getName(),
> 125 InternalUtils.joinSorted(methods)));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TAP5-927) Cannot use Scala for Tapestry IOC
Modules
Posted by "Martin Kneissl (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12797198#action_12797198 ]
Martin Kneissl commented on TAP5-927:
-------------------------------------
Unfortunately the $tag() method seems not to be marked as synthetic by the Scala compiler. The removal of synthetic methods from module definitions will not remove the $tag() method. Explicit code is required.
> Cannot use Scala for Tapestry IOC Modules
> -----------------------------------------
>
> Key: TAP5-927
> URL: https://issues.apache.org/jira/browse/TAP5-927
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-ioc
> Affects Versions: 5.1.0.5
> Reporter: Philip Lopez
> Assignee: Howard M. Lewis Ship
> Priority: Minor
>
> Scala (as of 2.7.7) adds a public method $tag() to classes. It's not particularly pretty (and $tag() is apparently deprecated) but it's there. (See http://programming-scala.labs.oreilly.com/ch14.html#CommandLineToolDecompilers)
> The (new, in 5.1.0.x) checks in org.apache.tapestry5.ioc.internal.DefaultModuleDefImp mean that a module implemented in Scala throws an exception on load:
> java.lang.RuntimeException: Module class <MODULE_NAME> contains unrecognized public methods: public static final int <MODULE_NAME>.$tag() throws java.rmi.RemoteException.
> It would be nice to have a way to work around this so that Scala could be used with Tapestry IOC 5.1.0.x (including Modules). One generic approach may be to have an @IgnoredPublicMethods annotation applicable to Module classes that took an array of Strings that named methods that should also be removed from the "methods" set before checking whether there are superfluous public methods. Of course, there's always the hard-code exception too (ugly but a lot less "investment" for this pesky incompatibility).
> As an example, the following article describes Scala and Tapestry: http://fanf42.blogspot.com/2009/02/tapestry-5-scala-view-article-in-html.html. If you checkout the git project and update the Tapestry release version to 5.1.0.5, you'll see it fail, where in 5.0.x it worked.
> The relevant code is:
> 109 // Want to verify that every public method is meaningful to Tapestry IoC. Remaining methods might
> 110 // have typos, i.e., "createFoo" that should be "buildFoo".
> 111
> 112 Set<Method> methods = CollectionFactory.newSet(moduleClass.getMethods());
> 113
> 114 methods.removeAll(OBJECT_METHODS);
> 115
> 116 boolean modulePreventsServiceDecoration = moduleClass.getAnnotation(PreventServiceDecoration.class) != null;
> 117
> 118 grind(methods, modulePreventsServiceDecoration);
> 119 bind(methods, modulePreventsServiceDecoration);
> 120
> 121 if (methods.isEmpty()) return;
> 122
> 123 throw new RuntimeException(String.format("Module class %s contains unrecognized public methods: %s.",
> 124 moduleClass.getName(),
> 125 InternalUtils.joinSorted(methods)));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (TAP5-927) Cannot use Scala for Tapestry IOC
Modules
Posted by "Philip Lopez (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-927?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Philip Lopez updated TAP5-927:
------------------------------
Priority: Minor (was: Major)
changed priority to minor: workaround is to use Tapestry 5.0.x or to avoid Scala for modules.
> Cannot use Scala for Tapestry IOC Modules
> -----------------------------------------
>
> Key: TAP5-927
> URL: https://issues.apache.org/jira/browse/TAP5-927
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-ioc
> Affects Versions: 5.1.0.5
> Reporter: Philip Lopez
> Priority: Minor
>
> Scala (as of 2.7.7) adds a public method $tag() to classes. It's not particularly pretty (and $tag() is apparently deprecated) but it's there. (See http://programming-scala.labs.oreilly.com/ch14.html#CommandLineToolDecompilers)
> The (new, in 5.1.0.x) checks in org.apache.tapestry5.ioc.internal.DefaultModuleDefImp mean that a module implemented in Scala throws an exception on load:
> java.lang.RuntimeException: Module class <MODULE_NAME> contains unrecognized public methods: public static final int <MODULE_NAME>.$tag() throws java.rmi.RemoteException.
> It would be nice to have a way to work around this so that Scala could be used with Tapestry IOC 5.1.0.x (including Modules). One generic approach may be to have an @IgnoredPublicMethods annotation applicable to Module classes that took an array of Strings that named methods that should also be removed from the "methods" set before checking whether there are superfluous public methods. Of course, there's always the hard-code exception too (ugly but a lot less "investment" for this pesky incompatibility).
> As an example, the following article describes Scala and Tapestry: http://fanf42.blogspot.com/2009/02/tapestry-5-scala-view-article-in-html.html. If you checkout the git project and update the Tapestry release version to 5.1.0.5, you'll see it fail, where in 5.0.x it worked.
> The relevant code is:
> 109 // Want to verify that every public method is meaningful to Tapestry IoC. Remaining methods might
> 110 // have typos, i.e., "createFoo" that should be "buildFoo".
> 111
> 112 Set<Method> methods = CollectionFactory.newSet(moduleClass.getMethods());
> 113
> 114 methods.removeAll(OBJECT_METHODS);
> 115
> 116 boolean modulePreventsServiceDecoration = moduleClass.getAnnotation(PreventServiceDecoration.class) != null;
> 117
> 118 grind(methods, modulePreventsServiceDecoration);
> 119 bind(methods, modulePreventsServiceDecoration);
> 120
> 121 if (methods.isEmpty()) return;
> 122
> 123 throw new RuntimeException(String.format("Module class %s contains unrecognized public methods: %s.",
> 124 moduleClass.getName(),
> 125 InternalUtils.joinSorted(methods)));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TAP5-927) Cannot use Scala for Tapestry IOC
Modules
Posted by "Peter Niederwieser (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783445#action_12783445 ]
Peter Niederwieser commented on TAP5-927:
-----------------------------------------
Probably this could be solved just like http://issues.apache.org/jira/browse/TAP5-839 by ignoring public synthetic methods in module classes.
> Cannot use Scala for Tapestry IOC Modules
> -----------------------------------------
>
> Key: TAP5-927
> URL: https://issues.apache.org/jira/browse/TAP5-927
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-ioc
> Affects Versions: 5.1.0.5
> Reporter: Philip Lopez
> Priority: Minor
>
> Scala (as of 2.7.7) adds a public method $tag() to classes. It's not particularly pretty (and $tag() is apparently deprecated) but it's there. (See http://programming-scala.labs.oreilly.com/ch14.html#CommandLineToolDecompilers)
> The (new, in 5.1.0.x) checks in org.apache.tapestry5.ioc.internal.DefaultModuleDefImp mean that a module implemented in Scala throws an exception on load:
> java.lang.RuntimeException: Module class <MODULE_NAME> contains unrecognized public methods: public static final int <MODULE_NAME>.$tag() throws java.rmi.RemoteException.
> It would be nice to have a way to work around this so that Scala could be used with Tapestry IOC 5.1.0.x (including Modules). One generic approach may be to have an @IgnoredPublicMethods annotation applicable to Module classes that took an array of Strings that named methods that should also be removed from the "methods" set before checking whether there are superfluous public methods. Of course, there's always the hard-code exception too (ugly but a lot less "investment" for this pesky incompatibility).
> As an example, the following article describes Scala and Tapestry: http://fanf42.blogspot.com/2009/02/tapestry-5-scala-view-article-in-html.html. If you checkout the git project and update the Tapestry release version to 5.1.0.5, you'll see it fail, where in 5.0.x it worked.
> The relevant code is:
> 109 // Want to verify that every public method is meaningful to Tapestry IoC. Remaining methods might
> 110 // have typos, i.e., "createFoo" that should be "buildFoo".
> 111
> 112 Set<Method> methods = CollectionFactory.newSet(moduleClass.getMethods());
> 113
> 114 methods.removeAll(OBJECT_METHODS);
> 115
> 116 boolean modulePreventsServiceDecoration = moduleClass.getAnnotation(PreventServiceDecoration.class) != null;
> 117
> 118 grind(methods, modulePreventsServiceDecoration);
> 119 bind(methods, modulePreventsServiceDecoration);
> 120
> 121 if (methods.isEmpty()) return;
> 122
> 123 throw new RuntimeException(String.format("Module class %s contains unrecognized public methods: %s.",
> 124 moduleClass.getName(),
> 125 InternalUtils.joinSorted(methods)));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (TAP5-927) Cannot use Scala for Tapestry IOC Modules
Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-927?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard M. Lewis Ship closed TAP5-927.
-------------------------------------
Resolution: Fixed
Fix Version/s: 5.2.0
Any method who names starts with '$' is now ignored.
> Cannot use Scala for Tapestry IOC Modules
> -----------------------------------------
>
> Key: TAP5-927
> URL: https://issues.apache.org/jira/browse/TAP5-927
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-ioc
> Affects Versions: 5.1.0.5
> Reporter: Philip Lopez
> Assignee: Howard M. Lewis Ship
> Priority: Minor
> Fix For: 5.2.0
>
>
> Scala (as of 2.7.7) adds a public method $tag() to classes. It's not particularly pretty (and $tag() is apparently deprecated) but it's there. (See http://programming-scala.labs.oreilly.com/ch14.html#CommandLineToolDecompilers)
> The (new, in 5.1.0.x) checks in org.apache.tapestry5.ioc.internal.DefaultModuleDefImp mean that a module implemented in Scala throws an exception on load:
> java.lang.RuntimeException: Module class <MODULE_NAME> contains unrecognized public methods: public static final int <MODULE_NAME>.$tag() throws java.rmi.RemoteException.
> It would be nice to have a way to work around this so that Scala could be used with Tapestry IOC 5.1.0.x (including Modules). One generic approach may be to have an @IgnoredPublicMethods annotation applicable to Module classes that took an array of Strings that named methods that should also be removed from the "methods" set before checking whether there are superfluous public methods. Of course, there's always the hard-code exception too (ugly but a lot less "investment" for this pesky incompatibility).
> As an example, the following article describes Scala and Tapestry: http://fanf42.blogspot.com/2009/02/tapestry-5-scala-view-article-in-html.html. If you checkout the git project and update the Tapestry release version to 5.1.0.5, you'll see it fail, where in 5.0.x it worked.
> The relevant code is:
> 109 // Want to verify that every public method is meaningful to Tapestry IoC. Remaining methods might
> 110 // have typos, i.e., "createFoo" that should be "buildFoo".
> 111
> 112 Set<Method> methods = CollectionFactory.newSet(moduleClass.getMethods());
> 113
> 114 methods.removeAll(OBJECT_METHODS);
> 115
> 116 boolean modulePreventsServiceDecoration = moduleClass.getAnnotation(PreventServiceDecoration.class) != null;
> 117
> 118 grind(methods, modulePreventsServiceDecoration);
> 119 bind(methods, modulePreventsServiceDecoration);
> 120
> 121 if (methods.isEmpty()) return;
> 122
> 123 throw new RuntimeException(String.format("Module class %s contains unrecognized public methods: %s.",
> 124 moduleClass.getName(),
> 125 InternalUtils.joinSorted(methods)));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (TAP5-927) Cannot use Scala for Tapestry IOC Modules
Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-927?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard M. Lewis Ship closed TAP5-927.
-------------------------------------
Resolution: Fixed
Fix Version/s: 5.2.0
Any method who names starts with '$' is now ignored.
> Cannot use Scala for Tapestry IOC Modules
> -----------------------------------------
>
> Key: TAP5-927
> URL: https://issues.apache.org/jira/browse/TAP5-927
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-ioc
> Affects Versions: 5.1.0.5
> Reporter: Philip Lopez
> Assignee: Howard M. Lewis Ship
> Priority: Minor
> Fix For: 5.2.0
>
>
> Scala (as of 2.7.7) adds a public method $tag() to classes. It's not particularly pretty (and $tag() is apparently deprecated) but it's there. (See http://programming-scala.labs.oreilly.com/ch14.html#CommandLineToolDecompilers)
> The (new, in 5.1.0.x) checks in org.apache.tapestry5.ioc.internal.DefaultModuleDefImp mean that a module implemented in Scala throws an exception on load:
> java.lang.RuntimeException: Module class <MODULE_NAME> contains unrecognized public methods: public static final int <MODULE_NAME>.$tag() throws java.rmi.RemoteException.
> It would be nice to have a way to work around this so that Scala could be used with Tapestry IOC 5.1.0.x (including Modules). One generic approach may be to have an @IgnoredPublicMethods annotation applicable to Module classes that took an array of Strings that named methods that should also be removed from the "methods" set before checking whether there are superfluous public methods. Of course, there's always the hard-code exception too (ugly but a lot less "investment" for this pesky incompatibility).
> As an example, the following article describes Scala and Tapestry: http://fanf42.blogspot.com/2009/02/tapestry-5-scala-view-article-in-html.html. If you checkout the git project and update the Tapestry release version to 5.1.0.5, you'll see it fail, where in 5.0.x it worked.
> The relevant code is:
> 109 // Want to verify that every public method is meaningful to Tapestry IoC. Remaining methods might
> 110 // have typos, i.e., "createFoo" that should be "buildFoo".
> 111
> 112 Set<Method> methods = CollectionFactory.newSet(moduleClass.getMethods());
> 113
> 114 methods.removeAll(OBJECT_METHODS);
> 115
> 116 boolean modulePreventsServiceDecoration = moduleClass.getAnnotation(PreventServiceDecoration.class) != null;
> 117
> 118 grind(methods, modulePreventsServiceDecoration);
> 119 bind(methods, modulePreventsServiceDecoration);
> 120
> 121 if (methods.isEmpty()) return;
> 122
> 123 throw new RuntimeException(String.format("Module class %s contains unrecognized public methods: %s.",
> 124 moduleClass.getName(),
> 125 InternalUtils.joinSorted(methods)));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (TAP5-927) Cannot use Scala for Tapestry IOC
Modules
Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-927?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard M. Lewis Ship reassigned TAP5-927:
-----------------------------------------
Assignee: Howard M. Lewis Ship
> Cannot use Scala for Tapestry IOC Modules
> -----------------------------------------
>
> Key: TAP5-927
> URL: https://issues.apache.org/jira/browse/TAP5-927
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-ioc
> Affects Versions: 5.1.0.5
> Reporter: Philip Lopez
> Assignee: Howard M. Lewis Ship
> Priority: Minor
>
> Scala (as of 2.7.7) adds a public method $tag() to classes. It's not particularly pretty (and $tag() is apparently deprecated) but it's there. (See http://programming-scala.labs.oreilly.com/ch14.html#CommandLineToolDecompilers)
> The (new, in 5.1.0.x) checks in org.apache.tapestry5.ioc.internal.DefaultModuleDefImp mean that a module implemented in Scala throws an exception on load:
> java.lang.RuntimeException: Module class <MODULE_NAME> contains unrecognized public methods: public static final int <MODULE_NAME>.$tag() throws java.rmi.RemoteException.
> It would be nice to have a way to work around this so that Scala could be used with Tapestry IOC 5.1.0.x (including Modules). One generic approach may be to have an @IgnoredPublicMethods annotation applicable to Module classes that took an array of Strings that named methods that should also be removed from the "methods" set before checking whether there are superfluous public methods. Of course, there's always the hard-code exception too (ugly but a lot less "investment" for this pesky incompatibility).
> As an example, the following article describes Scala and Tapestry: http://fanf42.blogspot.com/2009/02/tapestry-5-scala-view-article-in-html.html. If you checkout the git project and update the Tapestry release version to 5.1.0.5, you'll see it fail, where in 5.0.x it worked.
> The relevant code is:
> 109 // Want to verify that every public method is meaningful to Tapestry IoC. Remaining methods might
> 110 // have typos, i.e., "createFoo" that should be "buildFoo".
> 111
> 112 Set<Method> methods = CollectionFactory.newSet(moduleClass.getMethods());
> 113
> 114 methods.removeAll(OBJECT_METHODS);
> 115
> 116 boolean modulePreventsServiceDecoration = moduleClass.getAnnotation(PreventServiceDecoration.class) != null;
> 117
> 118 grind(methods, modulePreventsServiceDecoration);
> 119 bind(methods, modulePreventsServiceDecoration);
> 120
> 121 if (methods.isEmpty()) return;
> 122
> 123 throw new RuntimeException(String.format("Module class %s contains unrecognized public methods: %s.",
> 124 moduleClass.getName(),
> 125 InternalUtils.joinSorted(methods)));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TAP5-927) Cannot use Scala for Tapestry IOC
Modules
Posted by "Peter Niederwieser (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783445#action_12783445 ]
Peter Niederwieser commented on TAP5-927:
-----------------------------------------
Probably this could be solved just like http://issues.apache.org/jira/browse/TAP5-839 by ignoring public synthetic methods in module classes.
> Cannot use Scala for Tapestry IOC Modules
> -----------------------------------------
>
> Key: TAP5-927
> URL: https://issues.apache.org/jira/browse/TAP5-927
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-ioc
> Affects Versions: 5.1.0.5
> Reporter: Philip Lopez
> Priority: Minor
>
> Scala (as of 2.7.7) adds a public method $tag() to classes. It's not particularly pretty (and $tag() is apparently deprecated) but it's there. (See http://programming-scala.labs.oreilly.com/ch14.html#CommandLineToolDecompilers)
> The (new, in 5.1.0.x) checks in org.apache.tapestry5.ioc.internal.DefaultModuleDefImp mean that a module implemented in Scala throws an exception on load:
> java.lang.RuntimeException: Module class <MODULE_NAME> contains unrecognized public methods: public static final int <MODULE_NAME>.$tag() throws java.rmi.RemoteException.
> It would be nice to have a way to work around this so that Scala could be used with Tapestry IOC 5.1.0.x (including Modules). One generic approach may be to have an @IgnoredPublicMethods annotation applicable to Module classes that took an array of Strings that named methods that should also be removed from the "methods" set before checking whether there are superfluous public methods. Of course, there's always the hard-code exception too (ugly but a lot less "investment" for this pesky incompatibility).
> As an example, the following article describes Scala and Tapestry: http://fanf42.blogspot.com/2009/02/tapestry-5-scala-view-article-in-html.html. If you checkout the git project and update the Tapestry release version to 5.1.0.5, you'll see it fail, where in 5.0.x it worked.
> The relevant code is:
> 109 // Want to verify that every public method is meaningful to Tapestry IoC. Remaining methods might
> 110 // have typos, i.e., "createFoo" that should be "buildFoo".
> 111
> 112 Set<Method> methods = CollectionFactory.newSet(moduleClass.getMethods());
> 113
> 114 methods.removeAll(OBJECT_METHODS);
> 115
> 116 boolean modulePreventsServiceDecoration = moduleClass.getAnnotation(PreventServiceDecoration.class) != null;
> 117
> 118 grind(methods, modulePreventsServiceDecoration);
> 119 bind(methods, modulePreventsServiceDecoration);
> 120
> 121 if (methods.isEmpty()) return;
> 122
> 123 throw new RuntimeException(String.format("Module class %s contains unrecognized public methods: %s.",
> 124 moduleClass.getName(),
> 125 InternalUtils.joinSorted(methods)));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.