[ 
https://issues.apache.org/jira/browse/OGNL-249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14506589#comment-14506589
 ] 

Tim Wright commented on OGNL-249:
---------------------------------

Hi,

Sorry about the delay in getting back to you - I started a new job and it's 
been hectic.

I can confirm that getAllMethods is finding the default method. However, that's 
not solving my problem - mainly because I didn't give you some important 
context.

Our code is actually calling Ognl.getValue which eventually calls "callMethod" 
which calls "getMethods" -  so while I can confirm that getAllMethods does 
work, I can't actually use the fixed method!

Stack trace below:

org.concordion.internal.InvalidExpressionException: NoSuchMethodException: 
youShouldFindMe()
at ognl.OgnlRuntime.callAppropriateMethod (OgnlRuntime.java:824)
at ognl.ObjectMethodAccessor.callMethod (ObjectMethodAccessor.java:61)
at ognl.OgnlRuntime.callMethod (OgnlRuntime.java:860)
at ognl.ASTMethod.getValueBody (ASTMethod.java:73)
at ognl.SimpleNode.evaluateGetValueBody (SimpleNode.java:170)
at ognl.SimpleNode.getValue (SimpleNode.java:210)
at ognl.Ognl.getValue (Ognl.java:333)
at ognl.Ognl.getValue (Ognl.java:378)
at ognl.Ognl.getValue (Ognl.java:357)
at org.concordion.internal.OgnlEvaluator.evaluate (OgnlEvaluator.java:32)


> Ognl.GetMethods does not return default methods in interfaces (new java 8 
> feature)
> ----------------------------------------------------------------------------------
>
>                 Key: OGNL-249
>                 URL: https://issues.apache.org/jira/browse/OGNL-249
>             Project: Commons OGNL
>          Issue Type: Bug
>          Components: Core Runtime
>    Affects Versions: 3.0
>         Environment: Java 8, OSX, likely all environments tho.
>            Reporter: Tim Wright
>             Fix For: 4.0
>
>
> Hi,
> I'm a contributor to an open source automated test framework called 
> "Concordion". We use OGNL internally to evaulate test specifications. One of 
> our users has reported a bug where Concordion cannot call default interface 
> methods. We've traced the problem to OGNL - the OgnlRuntime.getMethods method 
> is not returning default implementations of interface methods. We've verified 
> the behaviour in OGNL versions 2.6.9 and 3.0.9.
> Consider the following interface and junit test file. The test fails. But it 
> probably should not.
> {code:java}
> // INTERFACE
> package org.concordion;
> public interface InterfaceWithDefaults {
>     default public void defaultMethod() { }
> }
> {code}
> {code:java}
> // TEST CLASS
> package org.concordion;
> import ognl.OgnlRuntime;
> import org.junit.Test;
> import static org.junit.Assert.assertNotNull;
> public class TestDefaultMethods implements InterfaceWithDefaults {
>     @Test
>     public void testDefaultMethod() {
>         defaultMethod();
>         assertNotNull(OgnlRuntime.getMethods(TestDefaultMethods.class, 
> "defaultMethod", false));
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to