Uploaded image for project: 'Commons OGNL (Dormant)'
  1. Commons OGNL (Dormant)
  2. OGNL-249

Ognl.GetMethods does not return default methods in interfaces (new java 8 feature)

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0
    • 3.0.12
    • Core Runtime
    • None
    • Java 8, OSX, likely all environments tho.

    Description

      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.

      // INTERFACE
      package org.concordion;
      public interface InterfaceWithDefaults {
          default public void defaultMethod() { }
      }
      
      // 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));
          }
      }
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            lukaszlenart Lukasz Lenart
            drtimwright Tim Wright
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment