-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistency with numeric keys in attributes map #604
Comments
I remember that I did some changes for numeric attributes to fix problems when iterating over the attributes and suddenly finding a Long instead of a String in a I'll dig into this again once I find the time. The Javadoc of the source above is also crappy, I'll fix this. |
Thank you for the quick feedback. Of course we can decide to not expose the numeric keys in the Java Map, because I agree that they are really useful (I do not think that somebody will use the positional attribute in the AST classes, when he has much more convenient methods or attribute to access the same information). What is really disturbing at the moment is this "the information is here, depending on how you access it". I did not check the Javadoc in details, but I guess that the current state is a violation of the Map interface contract. |
…) consistently for the attributes maps.
Fixes #604. Implement containsKey() and keySet().contains() consisten…
Ï tested it with the latest It looks good to me. |
Fixed with #609 |
Take this simple example:
With Version
1.6.0-alpha.6
console output is:I do not expect
attributes.keySet().contains("1")
andattributes.containsKey("1")
to return something different.Of course
attributes.get("1")
returns null and this is not what I expected…I did also some tests with Version
1.5.6
(this imply a other version of JRuby)Produces this output:
Interesting fact, this code snippet:
Produces:
This is a little bit better. But this demonstrates that using
String
for the key type might not be a god idea.I tried my second snippet with
1.6.0-alpha.6
and I got:This is really wired…
What do you think?
The text was updated successfully, but these errors were encountered: