Skip to content

Commit

Permalink
Fix for JRUBY-3491: NullPointerException when calling #arity on Klass…
Browse files Browse the repository at this point in the history
….method(:new)

git-svn-id: http://svn.codehaus.org/jruby/branches/jruby-1_2@9404 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information
headius committed Mar 13, 2009
1 parent 473fc55 commit 5a929c9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/org/jruby/RubyClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ public IRubyObject newInstance(ThreadContext context, IRubyObject[] args, Block
return obj;
}

// TODO: replace this with a smarter generated invoker that can handle 0-N args
public static class SpecificArityNew extends JavaMethod {
public SpecificArityNew(RubyModule implClass, Visibility visibility) {
super(implClass, visibility);
Expand Down
2 changes: 1 addition & 1 deletion src/org/jruby/internal/runtime/methods/JavaMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
public abstract class JavaMethod extends DynamicMethod implements JumpTarget, Cloneable {
protected int arityValue;
protected Arity arity;
protected Arity arity = Arity.OPTIONAL;
private String javaName;
private boolean isSingleton;
protected StaticScope staticScope;
Expand Down
1 change: 1 addition & 0 deletions test/jruby_index
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ test_included_in_object_space
test_io
test_load
test_math
test_method
test_method_cache
test_method_override_and_caching
test_nkf
Expand Down
10 changes: 10 additions & 0 deletions test/test_method.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'test/unit'

class TestMethod < Test::Unit::TestCase
# JRUBY-3491: NullPointerException when calling #arity on Klass.method(:new)
def test_jruby_3491
assert_nothing_raised do
String.method(:new).arity
end
end
end

0 comments on commit 5a929c9

Please sign in to comment.