Index: test/test_io.rb
===================================================================
--- test/test_io.rb	(revision 4889)
+++ test/test_io.rb	(working copy)
@@ -33,6 +33,15 @@
     assert(b == "\nB\n", "gets of non-paragraph \"\\n\\n\" failed")
   end
 
+  def test_fd_for_alias
+    f = File.new(@file, "w")
+    f.puts("heh")
+    g = IO.for_fd(f.fileno)
+    assert_kind_of(IO, g)
+    assert_equal(f.fileno, g.fileno)
+    assert(!g.closed?)
+  end
+
   def test_two_ios_with_same_filenos
     # Two ios with same fileno, but different objects.
     f = File.new(@file, "w")
Index: src/org/jruby/RubyIO.java
===================================================================
--- src/org/jruby/RubyIO.java	(revision 4889)
+++ src/org/jruby/RubyIO.java	(working copy)
@@ -1337,6 +1337,13 @@
     
     /* class methods for IO */
     
+    @JRubyMethod(name = {"new", "for_fd"}, rest = true, frame = true, meta = true)
+    public static IRubyObject newInstance(IRubyObject recv, IRubyObject[] args, Block block) {
+        IRubyObject obj = ((RubyClass)recv).allocate();
+        obj.callMethod(recv.getRuntime().getCurrentContext(), "initialize", args, block);
+        return obj;
+    }
+
     /** rb_io_s_foreach
     *
     */

