-
-
Notifications
You must be signed in to change notification settings - Fork 942
Description
Environment
- JRuby: jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 Java HotSpot(TM) 64-Bit Server VM 25.181-b13 on 1.8.0_181-b13 +jit [linux-x86_64]
- Operating system and platform: Linux shoes 4.15.0-23-generic JRUBY-5190 #25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Expected Behavior
Creating a JRuby class from an abstract Java class should have a constructor that can be called through reflection. This means that the following code should work JRubyConcreteClass.java_class.constructor.new_instance when JRubyConcreteClass derives from an abstract Java class.
Actual Behavior
It complains that it can't instantiate the concrete class because it can't make an instance of the abstract base class. The error says "TypeError: can't make instance of AbstractClass". I have created a repository that reproduces the issue. Also overriding abstract java methods in JRuby doesn't seem to work either which is something that would be helpful to have.
Potential Work Around for now
As a work around I am going to create concrete derived classes that directly implement the abstract methods and then add new setter type methods that JRuby code can then call to set data on. The data populated through these setters will then be used inside of the overridden abstract methods to get the desired behavior. This is a hack, but I think it will work for now.
I am also open to helping out with some development depending on what might be involved in fixing improving the behavior of implementations of abstract Java classes.
Thank you for your time and help!