You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Steve O'Hara (JIRA)" <de...@velocity.apache.org> on 2009/11/19 23:49:39 UTC

[jira] Created: (VELOCITY-745) Modify ClassMap.java to use getMethods() rather than get getDeclaredMethods()

Modify ClassMap.java to use getMethods() rather than get getDeclaredMethods()
-----------------------------------------------------------------------------

                 Key: VELOCITY-745
                 URL: https://issues.apache.org/jira/browse/VELOCITY-745
             Project: Velocity
          Issue Type: Improvement
          Components: Engine
    Affects Versions: 1.6.2
         Environment: All
            Reporter: Steve O'Hara
            Priority: Minor


The code that recurses up the super classes to find all public methods using getDeclaredMethods() is now redundant and can be replaced with a single call to getMethods() - this intrinsically provides all inherited public methods.

-- 
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@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Updated: (VELOCITY-745) Modify ClassMap.java to use getMethods() rather than get getDeclaredMethods()

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Bubna updated VELOCITY-745:
----------------------------------


If there were once reasons for doing it as it currently is done, i've been unable to think of them so far.  I'll aim to deal with this before any 1.7 release.  It ought to simplify things, and simply trying it is probably the best way to see if there's something i'm overlooking.

> Modify ClassMap.java to use getMethods() rather than get getDeclaredMethods()
> -----------------------------------------------------------------------------
>
>                 Key: VELOCITY-745
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-745
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.6.2
>         Environment: All
>            Reporter: Steve O'Hara
>            Priority: Minor
>
> The code that recurses up the super classes to find all public methods using getDeclaredMethods() is now redundant and can be replaced with a single call to getMethods() - this intrinsically provides all inherited public methods.

-- 
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@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-745) Modify ClassMap.java to use getMethods() rather than get getDeclaredMethods()

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849969#action_12849969 ] 

Nathan Bubna commented on VELOCITY-745:
---------------------------------------

Hmm.  First attempt failed (JDK1.5):

Testcase: Foreach-introspect took 0.015 sec
	Caused an ERROR
ASTMethod.execute() : exception invoking method 'next' in class java.util.AbstractList$Itr
org.apache.velocity.exception.VelocityException: ASTMethod.execute() : exception invoking method 'next' in class java.util.AbstractList$Itr
	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:208)
	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)
	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:369)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
	at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:420)
	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
	at org.apache.velocity.Template.merge(Template.java:356)
	at org.apache.velocity.Template.merge(Template.java:260)
	at org.apache.velocity.test.TemplateTestCase.runTest(TemplateTestCase.java:205)
Caused by: java.lang.IllegalAccessException: Class org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl can not access a member of class java.util.AbstractList$Itr with modifiers "public"
	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)
	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)
	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)

Clearly, this is not as simple as it seems.  getMethods() appears to return the implementing methods of public interfaces, which are not necessarily in public classes (e.g above).  This then causes trouble when you go to invoke.  I don't think it should do this, but it does.

Anyone have any insight into this?  I'm in newborn-baby-sleep-deprivation-mode, so i may be missing something obvious.

> Modify ClassMap.java to use getMethods() rather than get getDeclaredMethods()
> -----------------------------------------------------------------------------
>
>                 Key: VELOCITY-745
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-745
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.6.2
>         Environment: All
>            Reporter: Steve O'Hara
>            Priority: Minor
>
> The code that recurses up the super classes to find all public methods using getDeclaredMethods() is now redundant and can be replaced with a single call to getMethods() - this intrinsically provides all inherited public methods.

-- 
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@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org