Closed Bug 30814 Opened 26 years ago Closed 26 years ago

NativeJavaMethod does not implement getDefaultValue correctly

Categories

(Rhino Graveyard :: Core, defect, P3)

x86
Windows NT

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jeff, Assigned: norrisboyd)

Details

NativeJavaMethod in 1.4 release 3 (I believe) always returns this (the implementation is just "return this;". This means that if a script attempts to concat a string and a NativeJavaMethod (for instance to display what the variable contains) it will throw an Exception due to NativeJavaMethod not being a primitive type (or its getDefaultValue( String.class) not returning one). Shouldn't the implementation instead be identical to NativeJavaClass.getDefaultValue()?
So the bug is against 1.4R3? In the tip, I'm able to do the following: js> f = java.lang.String.valueOf function valueOf() { [native code] } js> f + " " function valueOf() { [native code] }
Yes, you're right. In tip it appears that NativeJavaMethod no longer defines getDefaultValue and instead relies on ScriptableObject's implementation which should do the right thing. Sorry for the confusion.
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.