History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-1339
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Bill Dortch
Reporter: Nick Sieger
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JRuby

Constants nested in a Module are not included

Created: 10/Sep/07 08:25 PM   Updated: 22/Dec/07 06:28 AM
Component/s: Core Classes/Modules
Affects Version/s: JRuby 1.1+, JRuby 1.0.1, JRuby 1.0.2
Fix Version/s: JRuby 1.1+, JRuby 1.0.2

Time Tracking:
Not Specified

File Attachments: 1. File find_me.rb (0.5 kb)


Testcase included: yes


 Description  « Hide
The attached test case succeeds in Ruby, but fails in JRuby.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Nick Sieger - 10/Sep/07 08:26 PM
FYI, this issue was discovered debugging differences in SOAP4R between MRI and JRuby. It makes use of modules and nested classes, and includes the module. The const_from_name function is copied from SOAP4R.

Nick Sieger - 10/Sep/07 08:27 PM

Bill Dortch - 10/Sep/07 10:04 PM
This affects both defined? and const_defined? – neither currently searches the class/module hierarchy. Will fix with other ivar/cvar/constant work I'm doing now.

Charles Oliver Nutter - 10/Sep/07 10:05 PM
We'll need a fix on trunk too...will you be fixing this on trunk as well Bill?

Bill Dortch - 10/Sep/07 11:58 PM
Yes – actually, I'd like to merge all the ivar/cvar/constant code currently in bdortch/attrs back into trunk fairly soon, though it's not quite ready (I hope to wrap it up tonight/tomorrow). It should be mostly non-controversial (and definitely beneficial!), but there are a few things that need some feedback/discussion (maybe not in this thread):
  • I've taken a preliminary stab at factoring/decomposing the IRubyObject interface. I can omit/undo this for the merge back to trunk if it needs more thought. The reason for doing this is to permit (eventually) non-RubyObject/IRubyObject class/object implementations. Not necessarily to support lightweights, either (though that would be a goal) – there is a pretty good case to be made, for example, for not defining the variableStore (was instanceVariables) and dataStruct fields for most built-in types (storing vars externally for those types on the rare occasion someone wants to, see experiment in bdortch/bnw), and always instantiating a (final) variableStore for user-defined types. Another interesting idea might be having RubyNumeric subclass java.lang.Number, to eventually simplify method signatures that might take raw/native (java.lang) or JRuby built-in values.
  • I've renamed some methods (and deprecated the old names) in an effort to impart some consistency/clarity. The changes involving (the overloading of) "instance variables" are really necessary – I've put a lot of effort into untangling that knot, the current (trunk) implementation being full of bugs, thread-safety violations, and so on. The new code clearly distinguishes among ivars, cvars, constants and "internal" variables (like those used when marshaling Ranges), and in code I'm currently working on, actually treats them differently (constant storage/lookup is optimized). Some of the other changes (searchConstant in place of getConstant) are primarily for clarity. I've retained, but deprecated, the old names.

As I said, I should have this stuff wrapped up in the next day or so. There are a couple of pieces not yet in SVN, notably a ConcurrentModuleVariableStore (in progress) that includes the constant optimization I mentioned, and also a concurrent implementation of RubySymbol.SymbolTable that shows a 15% improvement in bench_symbol before I've even hooked up the "fast" lookup method. The performance gains of all the "concurrent" code should be even more pronounced in multi-threaded benchmarks (I'm working on some).

-Bill


Nick Sieger - 11/Sep/07 09:23 AM
There should be a simple version of the fix that goes into 1.0.2 though. What you're describing Bill sounds more like an overhaul.

Bill Dortch - 18/Sep/07 01:32 AM
Fixed for 1_0 branch in commit 4347. Fixed in bdortch/attrs branch, awaiting merge to trunk.

Bill Dortch - 22/Sep/07 01:20 AM
Hmm, fix for 1_0 (4347) does not appear to be correct. Researching...

Bill Dortch - 25/Sep/07 04:35 AM
Fixed in 4385 (1_0) and 4387 (1.x).