JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-5451

Unessesary late error message when subclassing a packaged class with no public constructors.

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6RC1
    • Fix Version/s: JRuby 1.7.0.RC2
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Number of attachments :
      1

      Description

      It is possible to subclass a class with no public constructors. However, it is not possible to create instances of that class. A more helpful error message than

      ArgumentError: Constructor invocation failed: tried to access method com.foo.bar.Foo.(Ljava/lang/String;)V from class org.jruby.proxy.com.foo.bar.Foo$Proxy0

      would be nice.

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        My suggestion on IRC was that we could add an early check to confirm the target superclass has public constructors, similar to how we check if it is final. That would avoid the confusing error message that comes when you try to construct the Ruby subclass.

        Show
        Charles Oliver Nutter added a comment - My suggestion on IRC was that we could add an early check to confirm the target superclass has public constructors, similar to how we check if it is final. That would avoid the confusing error message that comes when you try to construct the Ruby subclass.
        Show
        Douglas Campos added a comment - first stab at it https://github.com/qmx/jruby/commit/3a00ee7c714d5589d11c6e45804ba8c816047a39

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Linus Sellberg
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: