Exception when two parameters named identically
-----------------------------------------------
Key: JRUBY-5571
URL: http://jira.codehaus.org/browse/JRUBY-5571
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.6RC3
Environment: JRuby running in 1.9.2 mode
Linux rupert-laptop 2.6.32-29-generic #58-Ubuntu SMP Fri Feb 11 19:00:09 UTC
2011 i686 GNU/Linux
Reporter: Robert Pankowecki
Assignee: Thomas E Enebo
def self.without_rejected_or_cancelled_requests(query, _, _)
query.with_statuses(:pending, :approving, :approved).not_cancelled
end
As you can see there are two parameters in this method that are not used in the
body and are named the same way as underscore. I had two different exceptions
when looking around this bug. Renaming the parameters to _a, _b solved the
issue.
Exceptions:
A) When running from rake test
1) Error:
test_approvals_are_created_on_pending(Absence::ApprovalTest):
NoMethodError: undefined method `with_statuses' for nil:NilClass
org/jruby/RubyBasicObject.java:1654:in `method_missing'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activesupport-3.0.5/lib/active_support/whiny_nil.rb:48:in
`method_missing'
/home/rupert/develop/gavdihrpif/app/models/absence/request.rb:51:in
`without_rejected_or_cancelled_requests'
org/jruby/RubyBasicObject.java:1692:in `__send__'
org/jruby/RubyKernel.java:2071:in `send'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/intime-0.15.1/lib/intime/query_conflicts.rb:45:in
`query_in_scope'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/intime-0.15.1/lib/intime/query_conflicts.rb:17:in
`query_conflicting_records'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/intime-0.15.1/lib/intime/uniqueness_in_time_validator.rb:68:in
`find_conflicting_records'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/intime-0.15.1/lib/intime/uniqueness_in_time_validator.rb:72:in
`map_of_conflicting_records'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/intime-0.15.1/lib/intime/uniqueness_in_time_validator.rb:62:in
`validate'
org/jruby/RubyBasicObject.java:1671:in `__send__'
org/jruby/RubyKernel.java:2063:in `send'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activesupport-3.0.5/lib/active_support/callbacks.rb:318:in
`_callback_before_611'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activesupport-3.0.5/lib/active_support/callbacks.rb:465:in
`_run_validate_callbacks'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activemodel-3.0.5/lib/active_model/validations.rb:212:in
`run_validations!'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activemodel-3.0.5/lib/active_model/validations/callbacks.rb:67:in
`run_validations!'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activesupport-3.0.5/lib/active_support/callbacks.rb:435:in
`_run_validation_callbacks'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activemodel-3.0.5/lib/active_model/validations/callbacks.rb:67:in
`run_validations!'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activemodel-3.0.5/lib/active_model/validations.rb:179:in
`valid?'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activerecord-3.0.5/lib/active_record/validations.rb:55:in
`valid?'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/state_machine-0.9.4/lib/state_machine/integrations/active_model.rb:372:in
`valid?'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/state_machine-0.9.4/lib/state_machine/transition_collection.rb:149:in
`run_actions'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/state_machine-0.9.4/lib/state_machine/transition_collection.rb:169:in
`catch_exceptions'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/state_machine-0.9.4/lib/state_machine/transition_collection.rb:147:in
`run_actions'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/state_machine-0.9.4/lib/state_machine/transition_collection.rb:132:in
`run_callbacks'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/state_machine-0.9.4/lib/state_machine/transition_collection.rb:211:in
`run_callbacks'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/state_machine-0.9.4/lib/state_machine/transition_collection.rb:63:in
`perform'
org/jruby/RubyKernel.java:1204:in `catch'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/state_machine-0.9.4/lib/state_machine/transition_collection.rb:63:in
`perform'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/state_machine-0.9.4/lib/state_machine/transition_collection.rb:185:in
`within_transaction'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/state_machine-0.9.4/lib/state_machine/transition_collection.rb:62:in
`perform'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/state_machine-0.9.4/lib/state_machine/integrations/active_model.rb:372:in
`valid?'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activerecord-3.0.5/lib/active_record/validations.rb:75:in
`perform_validations'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activerecord-3.0.5/lib/active_record/validations.rb:43:in
`save'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activerecord-3.0.5/lib/active_record/attribute_methods/dirty.rb:21:in
`save'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activerecord-3.0.5/lib/active_record/transactions.rb:240:in
`save'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activerecord-3.0.5/lib/active_record/transactions.rb:292:in
`with_transaction_returning_status'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activerecord-3.0.5/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in
`transaction'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activerecord-3.0.5/lib/active_record/transactions.rb:207:in
`transaction'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activerecord-3.0.5/lib/active_record/transactions.rb:290:in
`with_transaction_returning_status'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activerecord-3.0.5/lib/active_record/transactions.rb:240:in
`save'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activerecord-3.0.5/lib/active_record/transactions.rb:251:in
`rollback_active_record_state!'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activerecord-3.0.5/lib/active_record/transactions.rb:239:in
`save'
/home/rupert/develop/gavdihrpif/test/unit/absence/approval_test.rb:15:in
`assert_difference'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activesupport-3.0.5/lib/active_support/testing/assertions.rb:42:in
`assert_difference'
/home/rupert/develop/gavdihrpif/test/unit/absence/approval_test.rb:13:in
`assert_difference'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activesupport-3.0.5/lib/active_support/testing/assertions.rb:42:in
`assert_difference'
/home/rupert/develop/gavdihrpif/test/unit/absence/approval_test.rb:12:in
`test_approvals_are_created_on_pending'
org/jruby/RubyBasicObject.java:1665:in `__send__'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/mocha-0.9.8/lib/mocha/integration/mini_test/version_131_and_above.rb:26:in
`run'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activesupport-3.0.5/lib/active_support/testing/setup_and_teardown.rb:35:in
`run'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activesupport-3.0.5/lib/active_support/callbacks.rb:433:in
`_run_setup_callbacks'
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activesupport-3.0.5/lib/active_support/testing/setup_and_teardown.rb:34:in
`run'
B) When trying to repeat in rails console:
Absence::Request.without_rejected_or_cancelled_requests(Absence::Request.scoped,
nil, nil)
Java::JavaLang::RuntimeException: TwoVarDynamicScope does not support scopes
with 3 variables
from
org.jruby.runtime.scope.NoVarsDynamicScope.setArgValues(NoVarsDynamicScope.java:130)
from org.jruby.ast.ArgsNode.prepare(ArgsNode.java:323)
from
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:274)
from
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:211)
from
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:322)
from
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:207)
from org.jruby.ast.CallThreeArgNode.interpret(CallThreeArgNode.java:61)
from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:103)
from org.jruby.ast.RootNode.interpret(RootNode.java:129)
from
org.jruby.evaluator.ASTInterpreter.INTERPRET_EVAL(ASTInterpreter.java:95)
from
org.jruby.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:160)
from org.jruby.RubyKernel.evalCommon(RubyKernel.java:1134)
from org.jruby.RubyKernel.eval19(RubyKernel.java:1092)
from
org.jruby.RubyKernel$s$0$3$eval19.call(RubyKernel$s$0$3$eval19.gen:65535)
from
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:179)
from
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:69)
... 158 levels...
from
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:319)
from
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
from
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
from
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:282)
from
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:139)
from script.rails.__file__(script/rails:6)
from script.rails.load(script/rails)
from org.jruby.Ruby.runScript(Ruby.java:670)
from org.jruby.Ruby.runNormally(Ruby.java:574)
from org.jruby.Ruby.runFromMain(Ruby.java:423)
from org.jruby.Main.doRunFromMain(Main.java:278)
from org.jruby.Main.internalRun(Main.java:198)
from org.jruby.Main.run(Main.java:164)
from org.jruby.Main.run(Main.java:148)
from
org.jruby.util.ShellLauncher$ScriptThreadProcess.run(ShellLauncher.java:139)
from java.lang.Thread.run(Thread.java:636)jruby-1.6.0.RC3 :009 >
jruby-1.6.0.RC3 :010 >
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email