Skip to content

Commit

Permalink
Showing 10 changed files with 53 additions and 35 deletions.
4 changes: 3 additions & 1 deletion core/pom.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
version = File.read( File.join( basedir, '..', 'VERSION' ) ).strip
version = ENV['JRUBY_VERSION'] ||
File.read( File.join( basedir, '..', 'VERSION' ) ).strip

project 'JRuby Core' do

model_version '4.0.0'
Original file line number Diff line number Diff line change
@@ -167,7 +167,7 @@ public String toString() {
for (int i = 0; i < in.size(); i++) {
if (in.get(i)) {
count++;
buf.append(' ').append(i);
buf.append(' ').append(problem.getVariable(i));
if (count % 10 == 0) buf.append("\t\n");
}
}
@@ -179,7 +179,7 @@ public String toString() {
for (int i = 0; i < out.size(); i++) {
if (out.get(i)) {
count++;
buf.append(' ').append(i);
buf.append(' ').append(problem.getVariable(i));
if (count % 10 == 0) buf.append("\t\n");
}
}
5 changes: 5 additions & 0 deletions core/src/main/java/org/jruby/ir/operands/Self.java
Original file line number Diff line number Diff line change
@@ -60,4 +60,9 @@ public void visit(IRVisitor visitor) {
public int compareTo(Object o) {
return this == o ? 0 : -1;
}

@Override
public String toString() {
return NAME;
}
}
5 changes: 3 additions & 2 deletions lib/pom.rb
Original file line number Diff line number Diff line change
@@ -25,8 +25,9 @@ def initialize( name, version, default_spec = true )
]

project 'JRuby Lib Setup' do

version = File.read( File.join( basedir, '..', 'VERSION' ) ).strip

version = ENV['JRUBY_VERSION'] ||
File.read( File.join( basedir, '..', 'VERSION' ) ).strip

model_version '4.0.0'
id 'jruby-stdlib'
5 changes: 3 additions & 2 deletions maven/pom.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
project 'JRuby Artifacts' do

version = File.read( File.join( basedir, '..', 'VERSION' ) ).strip

version = ENV['JRUBY_VERSION'] ||
File.read( File.join( basedir, '..', 'VERSION' ) ).strip

model_version '4.0.0'
id 'jruby-artifacts'
4 changes: 3 additions & 1 deletion pom.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
version = File.read( File.join( basedir, 'VERSION' ) ).strip
version = ENV['JRUBY_VERSION'] ||
File.read( File.join( basedir, 'VERSION' ) ).strip

project 'JRuby', 'https://github.com/jruby/jruby' do

model_version '4.0.0'
45 changes: 21 additions & 24 deletions spec/jrubyc/java/constructor_spec.rb
Original file line number Diff line number Diff line change
@@ -54,52 +54,49 @@ def generate(script)
describe "with no arguments" do
it "generates a default constructor" do
cls = generate("class Foo; def initialize; end; end").classes[0]
cls.constructor?.should be true
expect( cls.constructor? ).to be true

init = cls.methods[0]
init.should_not be nil
init.name.should == "initialize"
init.constructor?.should == true
init.java_signature.to_s.should == "Object initialize()"
init.args.length.should == 0
expect( init = cls.methods[0] ).to_not be nil
expect( init.name ).to eql 'initialize'
expect( init.constructor? ).to be true
expect( init.java_signature.to_s ).to eql 'Object initialize()'
expect( init.args.length ).to eql 0

java = init.to_s
java.should match EMPTY_INITIALIZE_PATTERN
expect( java ).to match EMPTY_INITIALIZE_PATTERN
end
end

describe "with one argument and no java_signature" do
it "generates an (Object) constructor" do
cls = generate("class Foo; def initialize(a); end; end").classes[0]
cls.constructor?.should be true
expect( cls.constructor? ).to be true

init = cls.methods[0]
init.name.should == "initialize"
init.constructor?.should == true
init.java_signature.to_s.should == "Object initialize(Object a)"
init.args.length.should == 1
init.args[0].should == 'a'
expect( init.name ).to eql 'initialize'
expect( init.constructor? ).to be true
expect( init.java_signature.to_s ).to eql 'Object initialize(Object a)'
expect( init.args ).to eql ['a']

java = init.to_s
java.should match OBJECT_INITIALIZE_PATTERN
expect( java ).to match OBJECT_INITIALIZE_PATTERN
end
end

describe "with one argument and a java_signature" do
it "generates a type-appropriate constructor" do
cls = generate("class Foo; java_signature 'Foo(String)'; def initialize(a); end; end").classes[0]
cls.constructor?.should be true
expect( cls.constructor? ).to be true

init = cls.methods[0]
init.name.should == "initialize"
init.constructor?.should == true
init.java_signature.should_not == nil
init.java_signature.to_s.should == "Foo(String)"
init.args.length.should == 1
init.args[0].should == 'a'
expect( init.name ).to eql 'initialize'
expect( init.constructor? ).to be true
expect( init.java_signature ).to_not be nil
expect( init.java_signature.to_s ).to eql "Foo(String)"
expect( init.args ).to eql ['a']

java = init.to_s
java.should match STRING_INITIALIZE_PATTERN
expect( java ).to match STRING_INITIALIZE_PATTERN
end
end

@@ -108,7 +105,7 @@ def generate(script)
cls = generate("class Foo; java_signature 'Foo() throws FooBarException'; def initialize(); end; end").classes[0]

method = cls.methods[0]
method.java_signature.to_s.should == 'Foo() throws FooBarException'
expect( method.java_signature.to_s ).to eql 'Foo() throws FooBarException'
end

it 'generates a throws clause for more than one exception' do
4 changes: 3 additions & 1 deletion truffle/pom.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
version = File.read( File.join( basedir, '..', 'VERSION' ) ).strip
version = ENV['JRUBY_VERSION'] ||
File.read( File.join( basedir, '..', 'VERSION' ) ).strip

project 'JRuby Truffle' do

model_version '4.0.0'
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ private StringCachingHelperNode getHelperNode() {
CompilerDirectives.transferToInterpreter();
findContextNode = insert(RubyLanguage.INSTANCE.unprotectedCreateFindContextNode());
final RubyContext context = RubyLanguage.INSTANCE.unprotectedFindContext(findContextNode);
helperNode = insert(ForeignReadNodeFactory.StringCachingHelperNodeGen.create(null, null));
helperNode = insert(ForeignReadNodeFactory.StringCachingHelperNodeGen.create(context, null, null));
}

return helperNode;
@@ -65,6 +65,10 @@ private StringCachingHelperNode getHelperNode() {
})
protected static abstract class StringCachingHelperNode extends RubyNode {

public StringCachingHelperNode(RubyContext context) {
super(context, null);
}

public abstract Object executeStringCachingHelper(VirtualFrame frame, DynamicObject receiver, Object name);

@Specialization(
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ private StringCachingHelperNode getHelperNode() {
CompilerDirectives.transferToInterpreter();
findContextNode = insert(RubyLanguage.INSTANCE.unprotectedCreateFindContextNode());
final RubyContext context = RubyLanguage.INSTANCE.unprotectedFindContext(findContextNode);
helperNode = insert(ForeignWriteNodeFactory.StringCachingHelperNodeGen.create(null, null, null));
helperNode = insert(ForeignWriteNodeFactory.StringCachingHelperNodeGen.create(context, null, null, null));
}

return helperNode;
@@ -64,6 +64,10 @@ private StringCachingHelperNode getHelperNode() {
})
protected static abstract class StringCachingHelperNode extends RubyNode {

public StringCachingHelperNode(RubyContext context) {
super(context, null);
}

public abstract Object executeStringCachingHelper(VirtualFrame frame, DynamicObject receiver,
Object name, Object value);

0 comments on commit c2ab6ec

Please sign in to comment.