Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Don't include imports from previously processed ruby files in every generated java file. #579

Merged
merged 1 commit into from

2 participants

@JonAdams1000

Using the --java option with jrubyc when compiling multiple ruby files resulted in each generated file containing all the imports from all the previously processed scripts.

Jonathan Adams Use duplicated imports list so that the default imports list does not…
… get changed with every compiled script.
c85a4e9
@headius headius merged commit 2894dcb into from
@headius
Owner

Thanks! Good find!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 11, 2013
  1. Use duplicated imports list so that the default imports list does not…

    Jonathan Adams authored
    … get changed with every compiled script.
This page is out of date. Refresh to see the latest.
View
2  lib/ruby/shared/jruby/compiler/java_class.rb
@@ -288,7 +288,7 @@ class RubyScript
def initialize(script_name, imports = BASE_IMPORTS)
@classes = []
@script_name = script_name
- @imports = imports
+ @imports = imports.dup
@requires = []
@package = ""
end
View
13 spec/compiler/rubyscript_spec.rb
@@ -0,0 +1,13 @@
+require 'jruby/compiler/java_class'
+
+describe JRuby::Compiler::RubyScript do
+
+ it "resets import list for each instance" do
+ script1 = JRuby::Compiler::RubyScript.new("script1")
+ script1.add_import('my.java.import')
+
+ script2 = JRuby::Compiler::RubyScript.new("script2")
+ script2.imports.should_not include('my.java.import')
+ end
+
+end
Something went wrong with that request. Please try again.