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

Commits on Dec 1, 2016

  1. Copy the full SHA
    bea0778 View commit details
  2. Copy the full SHA
    6a82812 View commit details
30 changes: 12 additions & 18 deletions tool/truffle/generate-options.rb
Original file line number Diff line number Diff line change
@@ -38,7 +38,8 @@
)
end

File.write('truffle/src/main/java/org/jruby/truffle/options/NewOptions.java', ERB.new(%{/*
File.write('truffle/src/main/java/org/jruby/truffle/options/NewOptions.java', ERB.new(<<JAVA).result)
/*
* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
@@ -58,20 +59,17 @@
@Generated("tool/truffle/generate-options.rb")
public class NewOptions {
<% options.each do |o| %>
<% if o.type.end_with?('[]') %>@CompilationFinal(dimensions=1) <% end %>public final <%= o.type %> <%= o.constant %>;
<% options.each do |o| %><% if o.type.end_with?('[]') %>@CompilationFinal(dimensions=1) <% end %>public final <%= o.type %> <%= o.constant %>;
<% end %>
NewOptions(OptionsBuilder builder) {
<% options.each do |o| %>
<%= o.constant %> = builder.getOrDefault(OptionsCatalog.<%= o.constant %>);
<% end %>
}
<% options.each do |o| %> <%= o.constant %> = builder.getOrDefault(OptionsCatalog.<%= o.constant %>);
<% end %>}
}
}).result)
JAVA

File.write('truffle/src/main/java/org/jruby/truffle/options/OptionsCatalog.java', ERB.new(%{/*
File.write('truffle/src/main/java/org/jruby/truffle/options/OptionsCatalog.java', ERB.new(<<JAVA).result)
/*
* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
@@ -89,20 +87,16 @@
@Generated("tool/truffle/generate-options.rb")
public class OptionsCatalog {
<% options.each do |o| %>
public static final OptionDescription <%= o.constant %> = new <%= o.type_cons %>("<%= o.name %>", "<%= o.description %>", <%= o.default %>);
<% options.each do |o| %>public static final OptionDescription <%= o.constant %> = new <%= o.type_cons %>("<%= o.name %>", "<%= o.description %>", <%= o.default %>);
<% end %>
public static OptionDescription fromName(String name) {
switch (name) {
<% options.each do |o| %>
case "<%= o.name %>":
<% options.each do |o| %>case "<%= o.name %>":
return <%= o.constant %>;
<% end %>
default:
<% end %>default:
return null;
}
}
}
}).result)
JAVA
Original file line number Diff line number Diff line change
@@ -18,18 +18,12 @@
@Generated("tool/truffle/generate-options.rb")
public class NewOptions {


@CompilationFinal(dimensions=1) public final String[] ARGUMENTS;

public final boolean EXCEPTIONS_PRINT_JAVA;


NewOptions(OptionsBuilder builder) {

ARGUMENTS = builder.getOrDefault(OptionsCatalog.ARGUMENTS);

EXCEPTIONS_PRINT_JAVA = builder.getOrDefault(OptionsCatalog.EXCEPTIONS_PRINT_JAVA);

}

}
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ public class OptionTypeException extends UnsupportedOperationException {

private final String name;

public OptionTypeException(String name) {
public OptionTypeException(String name, String value) {
super(String.format("Unsupported value '%s' for option %s", value, name));
this.name = name;
}

Original file line number Diff line number Diff line change
@@ -16,21 +16,15 @@
@Generated("tool/truffle/generate-options.rb")
public class OptionsCatalog {


public static final OptionDescription ARGUMENTS = new StringArrayOptionDescription("arguments", "Command line arguments for the Ruby program", new String[]{});

public static final OptionDescription EXCEPTIONS_PRINT_JAVA = new BooleanOptionDescription("exceptions.print_java", "Print Java exceptions at the point of translating them to Ruby exceptions", false);


public static OptionDescription fromName(String name) {
switch (name) {

case "arguments":
return ARGUMENTS;

case "exceptions.print_java":
return EXCEPTIONS_PRINT_JAVA;

default:
return null;
}
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ public class UnknownOptionException extends UnsupportedOperationException {
private final String name;

public UnknownOptionException(String name) {
super(String.format("Unknown option %s", name));
this.name = name;
}