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

Commits on Apr 5, 2016

  1. Copy the full SHA
    9c555c2 View commit details
  2. Copy the full SHA
    90f7ad6 View commit details
Showing with 13 additions and 21 deletions.
  1. +3 −3 core/src/main/java/org/jruby/util/CodegenUtils.java
  2. +10 −18 core/src/main/java/org/jruby/util/JavaNameMangler.java
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/util/CodegenUtils.java
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ public static String ci(Class n) {
throw new RuntimeException("Unrecognized type in compiler: " + n.getName());
}
} else {
return "[" + ci(n);
return '[' + ci(n);
}
} else {
if (n.isPrimitive()) {
@@ -89,7 +89,7 @@ public static String ci(Class n) {
throw new RuntimeException("Unrecognized type in compiler: " + n.getName());
}
} else {
return "L" + p(n) + ";";
return 'L' + p(n) + ';';
}
}
}
@@ -282,7 +282,7 @@ public static String getAnnotatedBindingClassName(String javaMethodName, CharSeq
if (multi) {
commonClassSuffix += javaMethodName;
} else {
commonClassSuffix += required + "$" + optional + "$" + javaMethodName;
commonClassSuffix += required + '$' + optional + '$' + javaMethodName;
}
return typeName + commonClassSuffix;
}
28 changes: 10 additions & 18 deletions core/src/main/java/org/jruby/util/JavaNameMangler.java
Original file line number Diff line number Diff line change
@@ -279,33 +279,25 @@ public static String encodeScopeForBacktrace(IRScope scope) {
} else if (scope instanceof IRScriptBody) {
return "RUBY$script";
}
throw new RuntimeException("unknown scope type for backtrace encoding: " + scope.getClass());
throw new IllegalStateException("unknown scope type for backtrace encoding: " + scope.getClass());
}

public static String decodeMethodForBacktrace(String methodName) {
if (!methodName.startsWith("RUBY$")) return null;

String[] elts = methodName.split("\\$");
String type = elts[1];
String name;
final String type = elts[1];

// root body gets named (root)
switch (type) {
case "script":
return "<top>";
case "metaclass":
return "singleton class";
}

// remaining cases have an encoded name
name = demangleMethodName(elts[2]);
switch (type) {
case "method": return name;
case "block": return "block in " + name;
case "class": // fall through
case "module": return "<" + type + ":" + name + ">";
default:
throw new RuntimeException("unknown encoded method type '" + type + "' from '" + methodName);
case "script": return "<top>";
case "metaclass": return "singleton class";
// remaining cases have an encoded name
case "method": return demangleMethodName(elts[2]);
case "block": return "block in " + demangleMethodName(elts[2]);
case "class": // fall through
case "module": return '<' + type + ':' + demangleMethodName(elts[2]) + '>';
}
throw new IllegalStateException("unknown encoded method type '" + type + "' from " + methodName);
}
}