Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 69f0830ac5f5^
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d13e7bfe4792
Choose a head ref
  • 19 commits
  • 12 files changed
  • 1 contributor

Commits on Jan 16, 2015

  1. Copy the full SHA
    69f0830 View commit details
  2. Copy the full SHA
    7ca8585 View commit details
  3. Copy the full SHA
    35a0b80 View commit details
  4. Copy the full SHA
    23447ec View commit details
  5. Copy the full SHA
    18ceae2 View commit details
  6. Copy the full SHA
    7dc3a87 View commit details
  7. Add Fixnum#bit_length.

    headius committed Jan 16, 2015
    Copy the full SHA
    2978e96 View commit details
  8. Copy the full SHA
    dd7c429 View commit details
  9. Copy the full SHA
    206da46 View commit details
  10. Copy the full SHA
    f19286d View commit details
  11. Copy the full SHA
    9f567e2 View commit details
  12. Copy the full SHA
    846b8ad View commit details
  13. Add Method#original_name.

    headius committed Jan 16, 2015
    Copy the full SHA
    bef2574 View commit details
  14. Add Mutex#owned?.

    headius committed Jan 16, 2015
    Copy the full SHA
    cb6e2a6 View commit details
  15. Copy the full SHA
    7b487de View commit details
  16. Copy the full SHA
    658d272 View commit details
  17. Copy the full SHA
    0ab2c71 View commit details
  18. Copy the full SHA
    5b3c37c View commit details
  19. Copy the full SHA
    d13e7bf View commit details
10 changes: 0 additions & 10 deletions core/src/main/java/org/jruby/RubyEnumerable.java
Original file line number Diff line number Diff line change
@@ -968,21 +968,11 @@ public static IRubyObject each_with_index19(ThreadContext context, IRubyObject s
return block.isGiven() ? each_with_indexCommon19(context, self, block, args) : enumeratorizeWithSize(context, self, "each_with_index", args, enumSizeFn(context, self));
}

@JRubyMethod
public static IRubyObject enum_with_index(ThreadContext context, IRubyObject self, Block block) {
return block.isGiven() ? each_with_indexCommon(context, self, block) : enumeratorize(context.runtime, self, "enum_with_index");
}

@JRubyMethod
public static IRubyObject each_with_object(ThreadContext context, IRubyObject self, IRubyObject arg, Block block) {
return block.isGiven() ? each_with_objectCommon19(context, self, block, arg) : enumeratorizeWithSize(context, self, "each_with_object", new IRubyObject[] { arg }, enumSizeFn(context, self));
}

@JRubyMethod
public static IRubyObject with_object(ThreadContext context, IRubyObject self, final IRubyObject arg, final Block block) {
return block.isGiven() ? each_with_objectCommon19(context, self, block, arg) : enumeratorize(context.runtime, self, "with_object", arg);
}

@JRubyMethod(rest = true)
public static IRubyObject each_entry(ThreadContext context, final IRubyObject self, final IRubyObject[] args, final Block block) {
return block.isGiven() ? each_entryCommon(context, self, args, block) : enumeratorizeWithSize(context, self, "each_entry", args, enumSizeFn(context, self));
31 changes: 0 additions & 31 deletions core/src/main/java/org/jruby/RubyFile.java
Original file line number Diff line number Diff line change
@@ -410,37 +410,6 @@ public static final FileTime getBirthtimeWithNIO(String pathString) {
return null;
}

@JRubyMethod(required = 1)
public IRubyObject lchmod(ThreadContext context, IRubyObject arg) {
int mode = (int) arg.convertToInteger().getLongValue();

if (!new File(getPath()).exists()) {
throw context.runtime.newErrnoENOENTError(getPath());
}

return context.runtime.newFixnum(context.runtime.getPosix().lchmod(getPath(), mode));
}

// TODO: this method is not present in MRI!
@JRubyMethod(required = 2)
public IRubyObject lchown(ThreadContext context, IRubyObject arg1, IRubyObject arg2) {
int owner = -1;
if (!arg1.isNil()) {
owner = RubyNumeric.num2int(arg1);
}

int group = -1;
if (!arg2.isNil()) {
group = RubyNumeric.num2int(arg2);
}

if (!new File(getPath()).exists()) {
throw context.runtime.newErrnoENOENTError(getPath());
}

return context.runtime.newFixnum(context.runtime.getPosix().lchown(getPath(), owner, group));
}

@JRubyMethod
public IRubyObject lstat(ThreadContext context) {
checkClosed(context);
18 changes: 5 additions & 13 deletions core/src/main/java/org/jruby/RubyFixnum.java
Original file line number Diff line number Diff line change
@@ -342,18 +342,6 @@ public RubyString to_s(IRubyObject arg0) {
return getRuntime().newString(bl);
}

/** fix_id2name
*
*/
@JRubyMethod
public IRubyObject id2name() {
RubySymbol symbol = RubySymbol.getSymbolLong(getRuntime(), value);

if (symbol != null) return getRuntime().newString(symbol.asJavaString());

return getRuntime().getNil();
}

/** fix_to_sym
*
*/
@@ -597,7 +585,6 @@ public RubyBoolean even_p(ThreadContext context) {
return context.runtime.getFalse();
}

@JRubyMethod
public IRubyObject pred(ThreadContext context) {
return context.runtime.newFixnum(value-1);
}
@@ -1223,6 +1210,11 @@ public IRubyObject succ(ThreadContext context) {
return ((RubyFixnum) this).op_plus_one(context);
}

@JRubyMethod
public IRubyObject bit_length(ThreadContext context) {
return context.runtime.newFixnum(64 - Long.numberOfLeadingZeros(value));
}

@Override
public IRubyObject id() {
if (value <= Long.MAX_VALUE / 2 && value >= Long.MIN_VALUE / 2) {
16 changes: 0 additions & 16 deletions core/src/main/java/org/jruby/RubyHash.java
Original file line number Diff line number Diff line change
@@ -1451,14 +1451,6 @@ public void visit(IRubyObject key, IRubyObject value) {
return modified[0];
}

/** rb_hash_sort
*
*/
@JRubyMethod
public IRubyObject sort(ThreadContext context, Block block) {
return to_a().sort_bang(context, block);
}

/** rb_hash_index
*
*/
@@ -1494,14 +1486,6 @@ public void visit(IRubyObject key, IRubyObject value) {
}
}

/** rb_hash_indexes
*
*/
@JRubyMethod(name = {"indexes", "indices"}, rest = true)
public RubyArray indices(ThreadContext context, IRubyObject[] indices) {
return values_at(context, indices);
}

/** rb_hash_keys
*
*/
9 changes: 1 addition & 8 deletions core/src/main/java/org/jruby/RubyKernel.java
Original file line number Diff line number Diff line change
@@ -1038,13 +1038,6 @@ public Binding convertToBinding(IRubyObject scope) {
}
};


@JRubyMethod(module = true, visibility = PRIVATE)
public static IRubyObject callcc(ThreadContext context, IRubyObject recv, Block block) {
RubyContinuation continuation = new RubyContinuation(context.runtime);
return continuation.enter(context, continuation, block);
}

public static IRubyObject caller(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
return caller20(context, recv, args, block);
}
@@ -1627,7 +1620,7 @@ public static IRubyObject exec(ThreadContext context, IRubyObject recv, IRubyObj
/* Actual exec definition which calls this internal version is specified
* in /core/src/main/ruby/jruby/kernel/kernel.rb.
*/
@JRubyMethod(required = 4, module = true, visibility = PRIVATE)
@JRubyMethod(required = 4, visibility = PRIVATE)
public static IRubyObject _exec_internal(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
Ruby runtime = context.runtime;

5 changes: 3 additions & 2 deletions core/src/main/java/org/jruby/RubyMarshal.java
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@
import org.jruby.runtime.Block;
import org.jruby.runtime.Constants;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.Visibility;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.marshal.MarshalStream;
import org.jruby.runtime.marshal.UnmarshalStream;
@@ -71,7 +72,7 @@ public static RubyModule createMarshalModule(Ruby runtime) {
return module;
}

@JRubyMethod(required = 1, optional = 2, module = true)
@JRubyMethod(required = 1, optional = 2, module = true, visibility = Visibility.PRIVATE)
public static IRubyObject dump(IRubyObject recv, IRubyObject[] args, Block unusedBlock) {
Ruby runtime = recv.getRuntime();
IRubyObject objectToDump = args[0];
@@ -119,7 +120,7 @@ private static void setBinmodeIfPossible(ThreadContext context, IRubyObject io)
if (io.respondsTo("binmode")) io.callMethod(context, "binmode");
}

@JRubyMethod(name = {"load", "restore"}, required = 1, optional = 1, module = true)
@JRubyMethod(name = {"load", "restore"}, required = 1, optional = 1, module = true, visibility = Visibility.PRIVATE)
public static IRubyObject load(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block unusedBlock) {
Ruby runtime = context.runtime;
IRubyObject in = args[0];
9 changes: 9 additions & 0 deletions core/src/main/java/org/jruby/RubyMethod.java
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@
import org.jruby.ext.jruby.JRubyLibrary;
import org.jruby.anno.JRubyMethod;
import org.jruby.anno.JRubyClass;
import org.jruby.internal.runtime.methods.AliasMethod;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.internal.runtime.methods.ProcMethod;
import org.jruby.internal.runtime.methods.UndefinedMethod;
@@ -301,5 +302,13 @@ public IRubyObject super_method(ThreadContext context) {
RubyModule superClass = Helpers.findImplementerIfNecessary(receiver.getMetaClass(), implementationModule).getSuperClass();
return super_method(context, receiver, superClass);
}

@JRubyMethod
public IRubyObject original_name(ThreadContext context) {
if (method instanceof AliasMethod) {
return context.runtime.newString(((AliasMethod)method).getOldName());
}
return name(context);
}
}

5 changes: 5 additions & 0 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -2132,6 +2132,11 @@ public IRubyObject instance_method(IRubyObject symbol) {
return newMethod(null, symbol.asJavaString(), false, null);
}

@JRubyMethod(name = "public_instance_method", required = 1)
public IRubyObject public_instance_method(IRubyObject symbol) {
return newMethod(null, symbol.asJavaString(), false, PUBLIC);
}

/** rb_class_protected_instance_methods
*
*/
34 changes: 17 additions & 17 deletions core/src/main/java/org/jruby/RubyProcess.java
Original file line number Diff line number Diff line change
@@ -188,7 +188,7 @@ public IRubyObject op_equal(ThreadContext context, IRubyObject other) {
return invokedynamic(context, runtime.newFixnum(status), MethodNames.OP_EQUAL, other);
}

@JRubyMethod(name = {"to_i", "to_int"})
@JRubyMethod(name = {"to_i"})
public IRubyObject to_i(ThreadContext context) {
return to_i(context.runtime);
}
@@ -315,7 +315,7 @@ public IRubyObject to_i() {

@JRubyModule(name="Process::UID")
public static class UserID {
@JRubyMethod(name = "change_privilege", module = true)
@JRubyMethod(name = "change_privilege", module = true, visibility = PRIVATE)
public static IRubyObject change_privilege(IRubyObject self, IRubyObject arg) {
throw self.getRuntime().newNotImplementedError("Process::UID::change_privilege not implemented yet");
}
@@ -324,7 +324,7 @@ public static IRubyObject change_privilege(IRubyObject self, IRubyObject arg) {
public static IRubyObject eid(IRubyObject self) {
return euid(self.getRuntime());
}
@JRubyMethod(name = "eid", module = true)
@JRubyMethod(name = "eid", module = true, visibility = PRIVATE)
public static IRubyObject eid(ThreadContext context, IRubyObject self) {
return euid(context.runtime);
}
@@ -333,25 +333,25 @@ public static IRubyObject eid(ThreadContext context, IRubyObject self) {
public static IRubyObject eid(IRubyObject self, IRubyObject arg) {
return eid(self.getRuntime(), arg);
}
@JRubyMethod(name = "eid=", module = true)
@JRubyMethod(name = "eid=", module = true, visibility = PRIVATE)
public static IRubyObject eid(ThreadContext context, IRubyObject self, IRubyObject arg) {
return eid(context.runtime, arg);
}
public static IRubyObject eid(Ruby runtime, IRubyObject arg) {
return euid_set(runtime, arg);
}

@JRubyMethod(name = "grant_privilege", module = true)
@JRubyMethod(name = "grant_privilege", module = true, visibility = PRIVATE)
public static IRubyObject grant_privilege(IRubyObject self, IRubyObject arg) {
throw self.getRuntime().newNotImplementedError("Process::UID::grant_privilege not implemented yet");
}

@JRubyMethod(name = "re_exchange", module = true)
@JRubyMethod(name = "re_exchange", module = true, visibility = PRIVATE)
public static IRubyObject re_exchange(ThreadContext context, IRubyObject self) {
return switch_rb(context, self, Block.NULL_BLOCK);
}

@JRubyMethod(name = "re_exchangeable?", module = true)
@JRubyMethod(name = "re_exchangeable?", module = true, visibility = PRIVATE)
public static IRubyObject re_exchangeable_p(IRubyObject self) {
throw self.getRuntime().newNotImplementedError("Process::UID::re_exchangeable? not implemented yet");
}
@@ -360,15 +360,15 @@ public static IRubyObject re_exchangeable_p(IRubyObject self) {
public static IRubyObject rid(IRubyObject self) {
return rid(self.getRuntime());
}
@JRubyMethod(name = "rid", module = true)
@JRubyMethod(name = "rid", module = true, visibility = PRIVATE)
public static IRubyObject rid(ThreadContext context, IRubyObject self) {
return rid(context.runtime);
}
public static IRubyObject rid(Ruby runtime) {
return uid(runtime);
}

@JRubyMethod(name = "sid_available?", module = true)
@JRubyMethod(name = "sid_available?", module = true, visibility = PRIVATE)
public static IRubyObject sid_available_p(IRubyObject self) {
throw self.getRuntime().newNotImplementedError("Process::UID::sid_available not implemented yet");
}
@@ -400,7 +400,7 @@ public static IRubyObject switch_rb(ThreadContext context, IRubyObject self, Blo

@JRubyModule(name="Process::GID")
public static class GroupID {
@JRubyMethod(name = "change_privilege", module = true)
@JRubyMethod(name = "change_privilege", module = true, visibility = PRIVATE)
public static IRubyObject change_privilege(IRubyObject self, IRubyObject arg) {
throw self.getRuntime().newNotImplementedError("Process::GID::change_privilege not implemented yet");
}
@@ -409,7 +409,7 @@ public static IRubyObject change_privilege(IRubyObject self, IRubyObject arg) {
public static IRubyObject eid(IRubyObject self) {
return eid(self.getRuntime());
}
@JRubyMethod(name = "eid", module = true)
@JRubyMethod(name = "eid", module = true, visibility = PRIVATE)
public static IRubyObject eid(ThreadContext context, IRubyObject self) {
return eid(context.runtime);
}
@@ -421,25 +421,25 @@ public static IRubyObject eid(Ruby runtime) {
public static IRubyObject eid(IRubyObject self, IRubyObject arg) {
return eid(self.getRuntime(), arg);
}
@JRubyMethod(name = "eid=", module = true)
@JRubyMethod(name = "eid=", module = true, visibility = PRIVATE)
public static IRubyObject eid(ThreadContext context, IRubyObject self, IRubyObject arg) {
return eid(context.runtime, arg);
}
public static IRubyObject eid(Ruby runtime, IRubyObject arg) {
return RubyProcess.egid_set(runtime, arg);
}

@JRubyMethod(name = "grant_privilege", module = true)
@JRubyMethod(name = "grant_privilege", module = true, visibility = PRIVATE)
public static IRubyObject grant_privilege(IRubyObject self, IRubyObject arg) {
throw self.getRuntime().newNotImplementedError("Process::GID::grant_privilege not implemented yet");
}

@JRubyMethod(name = "re_exchange", module = true)
@JRubyMethod(name = "re_exchange", module = true, visibility = PRIVATE)
public static IRubyObject re_exchange(ThreadContext context, IRubyObject self) {
return switch_rb(context, self, Block.NULL_BLOCK);
}

@JRubyMethod(name = "re_exchangeable?", module = true)
@JRubyMethod(name = "re_exchangeable?", module = true, visibility = PRIVATE)
public static IRubyObject re_exchangeable_p(IRubyObject self) {
throw self.getRuntime().newNotImplementedError("Process::GID::re_exchangeable? not implemented yet");
}
@@ -448,15 +448,15 @@ public static IRubyObject re_exchangeable_p(IRubyObject self) {
public static IRubyObject rid(IRubyObject self) {
return rid(self.getRuntime());
}
@JRubyMethod(name = "rid", module = true)
@JRubyMethod(name = "rid", module = true, visibility = PRIVATE)
public static IRubyObject rid(ThreadContext context, IRubyObject self) {
return rid(context.runtime);
}
public static IRubyObject rid(Ruby runtime) {
return gid(runtime);
}

@JRubyMethod(name = "sid_available?", module = true)
@JRubyMethod(name = "sid_available?", module = true, visibility = PRIVATE)
public static IRubyObject sid_available_p(IRubyObject self) {
throw self.getRuntime().newNotImplementedError("Process::GID::sid_available not implemented yet");
}
12 changes: 6 additions & 6 deletions core/src/main/java/org/jruby/RubySignal.java
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ public static void createSignal(Ruby runtime) {
//registerThreadDumpSignalHandler(runtime);
}

@JRubyMethod(module = true)
@JRubyMethod(meta = true)
public static IRubyObject list(ThreadContext context, IRubyObject recv) {
Ruby runtime = recv.getRuntime();
RubyHash names = RubyHash.newHash(runtime);
@@ -79,27 +79,27 @@ public static IRubyObject list(ThreadContext context, IRubyObject recv) {
return names;
}

@JRubyMethod(required = 2, module = true)
@JRubyMethod(required = 2, meta = true)
public static IRubyObject __jtrap_kernel(final IRubyObject recv, IRubyObject block, IRubyObject sig) {
return SIGNALS.trap(recv, block, sig);
}

@JRubyMethod(required = 1, module = true)
@JRubyMethod(required = 1, meta = true)
public static IRubyObject __jtrap_platform_kernel(final IRubyObject recv, IRubyObject sig) {
return SIGNALS.restorePlatformDefault(recv, sig);
}

@JRubyMethod(required = 1, module = true)
@JRubyMethod(required = 1, meta = true)
public static IRubyObject __jtrap_osdefault_kernel(final IRubyObject recv, IRubyObject sig) {
return SIGNALS.restoreOSDefault(recv, sig);
}

@JRubyMethod(required = 1, module = true)
@JRubyMethod(required = 1, meta = true)
public static IRubyObject __jtrap_restore_kernel(final IRubyObject recv, IRubyObject sig) {
return SIGNALS.ignore(recv, sig);
}

@JRubyMethod(required = 1, module = true)
@JRubyMethod(required = 1, meta = true)
public static IRubyObject signame(ThreadContext context, final IRubyObject recv, IRubyObject rubySig) {
long sig = rubySig.convertToInteger().getLongValue();
String signame = signo2signm(sig);
Loading