-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
When creating a subclass of BigDecimal the class returned on construction is BigDecimal and not the extended class. Discovered by @kouno.
Construction inside RubyBigDecimal.java seems to be the cause of the issue. All BigDecimal#new calls seem to call the BigDecimal argumented constructor.
public RubyBigDecimal(Ruby runtime, BigDecimal value) {
super(runtime, runtime.getClass("BigDecimal"));
this.value = value;
}This should be replaced with a helper constructor that takes into account this.metaClass
private RubyBigDecimal createBigDecimal(Ruby runtime, BigDecimal value) {
return new RubyBigDecimal(runtime, this.getMetaClass(), value);
}And all constructions from operations should use this.
https://gist.github.com/2878757
SHA: 02002ed
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels