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

Support @Getter annotation on constructor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8
    • None
    • core-libs
    • None

    Description

      Currently trying to define a getter on a JS constructor through nasgen using the following code:

          @Getter(where = Where.CONSTRUCTOR)
          public static Object lastMatch(Object self) {
              return "lastmatch";
          }

      throws the following exception on startup:

      Exception in thread "main" java.lang.IncompatibleClassChangeError
      at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:383)
      at jdk.nashorn.internal.objects.NativeRegExp$Constructor.<clinit>(Unknown Source)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:182)
      at jdk.nashorn.internal.objects.Global.initConstructor(Global.java:1580)
      at jdk.nashorn.internal.objects.Global.init(Global.java:1332)
      at jdk.nashorn.internal.objects.Global.initBuiltinObjects(Global.java:391)
      at jdk.nashorn.internal.runtime.Context.initGlobal(Context.java:784)
      at jdk.nashorn.internal.runtime.Context.createGlobal(Context.java:752)
      at jdk.nashorn.tools.Shell.run(Shell.java:157)
      at jdk.nashorn.tools.Shell.main(Shell.java:136)
      at jdk.nashorn.tools.Shell.main(Shell.java:115)
      Caused by: java.lang.NoSuchMethodException: no such method: jdk.nashorn.internal.objects.NativeRegExp$Constructor.lastMatch(Object)Object/invokeStatic
      at java.lang.invoke.MemberName.makeAccessException(MemberName.java:753)
      at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:870)
      at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:1032)
      at java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:1264)
      at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:381)
      ... 11 more
      Caused by: java.lang.NoSuchMethodError: jdk.nashorn.internal.objects.NativeRegExp$Constructor.lastMatch(Ljava/lang/Object;)Ljava/lang/Object;
      at java.lang.invoke.MethodHandleNatives.resolve(Native Method)
      at java.lang.invoke.MemberName$Factory.resolve(MemberName.java:842)
      at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:867)
      ... 14 more

      Attachments

        Issue Links

          Activity

            People

              hannesw Hannes Wallnoefer
              hannesw Hannes Wallnoefer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: