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: 35e3dcd1e408
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6e76d1febc9f
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Mar 7, 2018

  1. Copy the full SHA
    7d8700b View commit details
  2. yay...we have all this jcodings data on alnum but Ruby ignores it. Id…

    …entifiers
    
    are ridiculously accepting of ALL non-ascii codepoints.
    enebo committed Mar 7, 2018
    Copy the full SHA
    6e76d1f View commit details
Showing with 8 additions and 16 deletions.
  1. +2 −1 core/src/main/java/org/jruby/RubySymbol.java
  2. +6 −15 core/src/main/java/org/jruby/internal/runtime/NativeThread.java
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/RubySymbol.java
Original file line number Diff line number Diff line change
@@ -203,7 +203,8 @@ public final boolean eql(IRubyObject other) {
*/
public boolean validConstantName() {
return ByteListHelper.eachCodePoint(getBytes(), (int index, int codepoint, Encoding encoding) ->
index == 0 && encoding.isUpper(codepoint) || index != 0 && (encoding.isAlnum(codepoint) || codepoint == '_'));
index == 0 && encoding.isUpper(codepoint) ||
index != 0 && (encoding.isAlnum(codepoint) || !Encoding.isAscii(codepoint) || codepoint == '_'));
}

@Override
21 changes: 6 additions & 15 deletions core/src/main/java/org/jruby/internal/runtime/NativeThread.java
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@
public class NativeThread implements ThreadLike {
private final Reference<Thread> nativeThread;
public final RubyThread rubyThread;
public IRubyObject rubyName;
public String rubyName;

public NativeThread(RubyThread rubyThread, Thread nativeThread) {
this.rubyThread = rubyThread;
@@ -111,24 +111,15 @@ public Thread nativeThread() {

// FIXME: bytelist_love: ThreadLike should deprecate these in favor of IRubyObject versions so we can properly encode names.
@Override
@Deprecated
public void setRubyName(String name) {
if (name == null) {
rubyName = null;
} else {
rubyName = rubyThread.getContext().runtime.newString(name);
}
updateName();
}

public void setRubyName(IRubyObject name) {
this.rubyName = name;
updateName();
}

@Override
@Deprecated
public String getRubyName() {
return rubyName == null ? null : rubyName.asJavaString();
return rubyName;
}

@Override
@@ -138,11 +129,11 @@ public String getReportName() {
Thread thread = getThread();
if (thread != null) nativeName = thread.getName();

if (rubyName == null || rubyName.isNil() || ((RubyString) rubyName).size() == 0) {
if (rubyName == null || rubyName.length() == 0) {
return nativeName.equals("") ? "(unnamed)" : nativeName;
}

return nativeName.equals("") ? rubyName.toString() : rubyName + " (" + nativeName + ")";
return nativeName.equals("") ? rubyName : rubyName + " (" + nativeName + ")";
}

private static final String RUBY_THREAD_PREFIX = "Ruby-";
@@ -151,7 +142,7 @@ void updateName() {
// "Ruby-0-Thread-16: (irb):21"
// "Ruby-0-Thread-17@worker#1: (irb):21"
String newName;
String setName = rubyName == null ? null : rubyName.asJavaString();
String setName = rubyName;
Thread thread = getThread();

if (thread == null) return;