Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.7
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: Ruby 1.9.3
-
Labels:None
-
Number of attachments :
Description
Minimal reproduction:
system ~/projects/jruby $ jruby -rjava -rdelegate -e "class Foo; end; class Bar < DelegateClass(Foo); include java.lang.Runnable; end"
NameError: undefined method `===' for class `Bar'
append_features at org/jruby/java/proxies/JavaInterfaceTemplate.java:81
include at org/jruby/RubyModule.java:2123
Bar at -e:1
(root) at -e:1
I believe this is because the 1.9 version of delegate.rb explicitly undefines === on the class, with this code:
class Delegator < BasicObject
kernel = ::Kernel.dup
kernel.class_eval do
[:to_s,:inspect,:=~,:!~,:===,:<=>,:eql?,:hash].each do |m|
undef_method m
end
end
include kernel
...
And we unconditionally try to alias/wrap === with this code in JavaInterfaceTemplate.java:
// Because we implement Java interfaces now, we need a new === that's
// aware of those additional "virtual" supertypes
clazz.defineAlias("old_eqq", "===");
clazz.addMethod("===", new JavaMethodOne(clazz, Visibility.PUBLIC) {
I have a fix pending that will simply not do this when there's no === defined on the source class.
Activity
Charles Oliver Nutter
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Resolution | Fixed [ 1 ] | |
| Assignee | Thomas E Enebo [ enebo ] | Charles Oliver Nutter [ headius ] |
| Status | Open [ 1 ] | Resolved [ 5 ] |