Skip to main content

javax.script.SimpleBindings bug/rfe

No replies
zero
Offline
Joined: 2003-06-10

Hey there,

I noticed some issues looking at the class javax.script.SimpleBindings:

1. the javadoc tells that: Object remove(Object key) is OPTIONAL, then it should throw an UnsupportedOperationException like the collections in java.util do, doesn't it?

2. the 'containsKey', 'get' and 'remove' methods accept Object parameters though they are casted to a Strings, which may lead to a ClassCastException. I guess that changing the parameters to Strings is desired, because one could only have an Object reference to a String. Although IMHO taking the cast out from this class would be a good idea, I suggest an alternative if this is not acceptable: Why no call the parameters' 'toString()' methods, this would still allow arbitrary objects, but would remove the Exception?

Any feedback, including a simple explanation why sticking with the current design, would be great.

With best regards,
Michael