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

Commits on Sep 18, 2015

  1. Copy the full SHA
    8ea6782 View commit details
  2. Copy the full SHA
    1caf5f8 View commit details
Original file line number Diff line number Diff line change
@@ -401,10 +401,10 @@ public Object encodingMap(VirtualFrame frame) {
lookupTableWriteNode.call(frame, ret, "[]=", null, key, value);
}

final Hash.HashEntryIterator i = getContext().getRuntime().getEncodingService().getAliases().entryIterator();
final Hash<EncodingDB.Entry>.HashEntryIterator i = getContext().getRuntime().getEncodingService().getAliases().entryIterator();
while (i.hasNext()) {
final CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry<EncodingDB.Entry> e =
((CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry<EncodingDB.Entry>)i.next());
((CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry<EncodingDB.Entry>) i.next());

final Object upcased = upcaseNode.call(frame, Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), new ByteList(e.bytes, e.p, e.end - e.p), StringSupport.CR_UNKNOWN, null), "upcase", null);
final Object key = toSymNode.call(frame, upcased, "to_sym", null);
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
import org.jruby.truffle.om.dsl.processor.layout.model.PropertyModel;

import javax.lang.model.type.TypeKind;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
@@ -590,6 +591,7 @@ public void run(PropertyModel property, boolean last) {
}

if (property.hasGetter()) {
addUncheckedCastWarning(stream, property);
stream.println(" @Override");
stream.printf(" public %s %s(DynamicObject object) {%n", property.getType(), NameUtils.asGetter(property.getName()));
stream.printf(" assert is%s(object);%n", layout.getName());
@@ -631,6 +633,7 @@ public void run(PropertyModel property, boolean last) {
assert !(property.hasSetter() && property.hasUnsafeSetter());

if (property.hasSetter() || property.hasUnsafeSetter()) {
addUncheckedCastWarning(stream, property);
if (property.isShapeProperty()) {
stream.println(" @TruffleBoundary");
}
@@ -696,6 +699,13 @@ public void run(PropertyModel property, boolean last) {
stream.println("}");
}

private void addUncheckedCastWarning(final PrintStream stream, PropertyModel property) {
if (property.getType().toString().indexOf('<') != -1 ||
(property.isVolatile() && !property.getType().getKind().isPrimitive())) {
stream.println(" @SuppressWarnings(\"unchecked\")");
}
}

private void iterateProperties(List<PropertyModel> properties, PropertyIteratorAction action) {
for (int n = 0; n < properties.size(); n++) {
action.run(properties.get(n), n == properties.size() - 1);