Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#215 Beanshell/Java inconsistencies

open
nobody
Parsing (77)
5
2005-04-27
2005-04-27
Anonymous
No

Below is a list of inconsistencies we have found between Beanshell
(in strict Java mode) and Sun's Java compiler.

1.
Given a class A with a subclass B which defines a method x,
Beanshell accepts code along the lines of

A a;
a = new B();
a.x();

works just fine (it shouldn't) - the type information isn't acting as a
filter as to what messages are acceptable.

2.
Under Java 1.5, sending capacity() and ensureCapacity() messages
to instances of StringBuilder results in method invocation errors.

3.
Private instance variables can be directly accessed - Beanshell
silently uses the getters and setters (even in strict Java mode).

4.
Literal Strings are treated as if they had been created with new
String().

Hence "fred" == "fred" evaluates to false.

5.
The use of the suffixes F and L for float and long literal values when
assigning to variables is not enforced.

6.
Using the postfix operators ++ and -- with values of type double or
float results in the error: "bsh.InterpreterError: bad double
unaryOperation"

7.
& and | are supported as bitwise operators but not as Boolean
operators.

Best wishes,

Rob Griffiths
r.w.griffiths@open.ac.uk

Discussion