Permalink
Browse files

Use duplicated imports list so that the default imports list does not…

… get changed with every compiled script.
  • Loading branch information...
1 parent 281ead7 commit c85a4e99a784d7cd0c222677eca20d57c01895f6 Jonathan Adams committed Mar 11, 2013
Showing with 14 additions and 1 deletion.
  1. +1 −1 lib/ruby/shared/jruby/compiler/java_class.rb
  2. +13 −0 spec/compiler/rubyscript_spec.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
@@ -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

0 comments on commit c85a4e9

Please sign in to comment.