Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8041916

ScriptEngine.getInterface fails if interface has static methods

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3
    • None
    • 8
    • core-libs

    Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      See test script below. First getInterface call returns non-null; second returns null. The only difference is the additional static method. Since static methods are not overrideable, their presence should be of no consequence.

      --------

      import javax.script.*;

      class Test {
      public static void main(String[] args) throws Throwable {
      ScriptEngine engine = new ScriptEngineManager().getEngineByName("JavaScript");
      engine.eval("var obj = { run: function() {} };");
      System.out.println(((Invocable)engine).getInterface(engine.get("obj"), A.class));
      System.out.println(((Invocable)engine).getInterface(engine.get("obj"), B.class));
      }

      public interface A {
      void run();
      }

      public interface B {
      void run();
      static void foo() {}
      }
      }

      --------

      I know I've filed this bug under the wrong subcategory -- that's your own stupid fault because nothing encompassing javax.script is on the list. Deal with it. I know you won't, though -- I am beyond sick and tired of every bug I report being flagrantly ignored, but I'll keep trying anyway. Perhaps somewhere, someday, someone will at least read one of them.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      Attachments

        Issue Links

          Activity

            People

              sundar Sundararajan Athijegannathan
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: