[prev in list] [next in list] [prev in thread] [next in thread] 

List:       velocity-dev
Subject:    [jira] Commented: (VELOCITY-745) Modify ClassMap.java to use
From:       "Nathan Bubna (JIRA)" <dev () velocity ! apache ! org>
Date:       2010-03-26 1:02:27
Message-ID: 1136012029.501241269565347267.JavaMail.jira () brutus ! apache ! org
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/VELOCITY-745?page=com.atlassian.jira.plugi \
n.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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic