|
|
|
Specs and fix committed in r6783. I had to clean up the specs a bit, so have a look and make sure they're still testing what you intended. Several would not pass as written, so I'm not sure if they were just overlooked or if they tested behavior you've fixed elsewhere...
Several of the specs are supposed to fail in JRuby trunk. The intent was to spec the fox but also spec that JavaField should automatically wrap/unwrap Ruby classes (which it does not currently hence the failures).
Note to self: don't comment in JIRA from iPhone.
I see the confusion. My words in the specs didn't quite match my intent. I mention that it should accept a Ruby value. What I also meant, but didn't say, was that it should accept a Ruby object upon which to set the Ruby value. Right now, JavaField#set_value breaks when a Ruby object is passed as the object param – which is why you have the @obj.java_object code in there. It should also work for @obj as well. Ok, I've expanded and cleaned up the specs to include all four cases across four visibilities: JavaField setting an X field with a Y value: ruby/ruby, ruby/java, java/ruby, java/java. Since we still can't set the field using nil (nor any other Ruby object) this will remain open and I'm bumping it to 1.2.
Fixed in commit 7533 on trunk. This fixes the original reported problem and fixes description of bug.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
Problem appeared to be in JavaUtil.java:445
parameterType.isPrimitive == false, evidently, when a wrapped 'nil' is passed as the argument. Therefore this fell through to line 477 causing an NPE. Added an else clause that returns null as was intended. Specs now SELECTIVELY pass.
Note about the attached specs: they test conditions that work now (i.e., passing in a JavaObject) and conditions that SHOULD work (i.e., passing in an object that responds_to? :java_object). Tests field mutators for private, protected and public. Needs tests for getters.