xt 发帖数: 17532 | 1 It is not always wrong, but it is very unstable on complicated
boolean expressions. After I use "()" around the expression,
the problem is gone. So it is really the JVM's problem. |
c*****t 发帖数: 1879 | 2 Show me your code first :)
FYI, ^, |, &, ||, && each has a different operator precedence. I
would STRONGLY suggest you to put parenthesis around expressions
involve them.
【在 xt 的大作中提到】 : It is not always wrong, but it is very unstable on complicated : boolean expressions. After I use "()" around the expression, : the problem is gone. So it is really the JVM's problem.
|
xt 发帖数: 17532 | 3
I have an ArrayList containing strings. I know it must have a particular
value, say "hey", then I used
if( !arrayList.get( 0 ).equals( "hey" ) ) {
...
}
It does not work.
So I changed to
if( !(arrayList.get( 0 ).equals( "hey" ) ) ) {
...
and it worked!
The problem is that the array list is a returned from a very complicated call,
which I cannot provide the source code at all. If I use
ArrayList list = new ArrayList();
list.add( "hey" );
String s = "hey";
if( !list.get(0).equals( s ) ) {
System.
【在 c*****t 的大作中提到】 : Show me your code first :) : FYI, ^, |, &, ||, && each has a different operator precedence. I : would STRONGLY suggest you to put parenthesis around expressions : involve them.
|
st 发帖数: 1685 | 4 ffdt...
【在 xt 的大作中提到】 : : I have an ArrayList containing strings. I know it must have a particular : value, say "hey", then I used : if( !arrayList.get( 0 ).equals( "hey" ) ) { : ... : } : It does not work. : So I changed to : if( !(arrayList.get( 0 ).equals( "hey" ) ) ) { : ...
|
c*****t 发帖数: 1879 | 5
Did you mean by compiler or JVM not working?
【在 xt 的大作中提到】 : : I have an ArrayList containing strings. I know it must have a particular : value, say "hey", then I used : if( !arrayList.get( 0 ).equals( "hey" ) ) { : ... : } : It does not work. : So I changed to : if( !(arrayList.get( 0 ).equals( "hey" ) ) ) { : ...
|
X****r 发帖数: 3557 | 6 I didn't read the whole thread so I must have missed something here,
but isn't operator precedence issue should have solved in compilation
to byte-code?
【在 xt 的大作中提到】 : : I have an ArrayList containing strings. I know it must have a particular : value, say "hey", then I used : if( !arrayList.get( 0 ).equals( "hey" ) ) { : ... : } : It does not work. : So I changed to : if( !(arrayList.get( 0 ).equals( "hey" ) ) ) { : ...
|
xt 发帖数: 17532 | 7
Yeah, you are right. So it is the IBM JDK that sucks.
【在 X****r 的大作中提到】 : I didn't read the whole thread so I must have missed something here, : but isn't operator precedence issue should have solved in compilation : to byte-code?
|
c****e 发帖数: 90 | 8
What do you expect? It's a free open source VM. you got what you
paid for.
And btw, you do know it's dealing with byte-code instead of source
right?
【在 xt 的大作中提到】 : It is not always wrong, but it is very unstable on complicated : boolean expressions. After I use "()" around the expression, : the problem is gone. So it is really the JVM's problem.
|
xt 发帖数: 17532 | 9
IBM JDK is free, but IBM WebSphere or DB2 is NOT free. If I use
WebSphere, I have to use IBM JDK. IBM JDK is *NOT* totally open
source, because it has many weird stuffs on top of standard JDK.
This is why you cannot connect to Websphere using Sun JDK.
So it is the JDK problem, curtasy of IBM.
【在 c****e 的大作中提到】 : : What do you expect? It's a free open source VM. you got what you : paid for. : And btw, you do know it's dealing with byte-code instead of source : right?
|
x***n 发帖数: 39 | 10 I'll test it after I go back home and get an IBM JDK.
Please also try to think of an IBM bug and so that we can agree on you.
call,
【在 xt 的大作中提到】 : : IBM JDK is free, but IBM WebSphere or DB2 is NOT free. If I use : WebSphere, I have to use IBM JDK. IBM JDK is *NOT* totally open : source, because it has many weird stuffs on top of standard JDK. : This is why you cannot connect to Websphere using Sun JDK. : So it is the JDK problem, curtasy of IBM.
|
xt 发帖数: 17532 | 11
This problem does not always happen, but it does happen in some
complicated cases. I don't expect anything like if( s.equals("a") ) to
fail, and it doesn't.
【在 x***n 的大作中提到】 : I'll test it after I go back home and get an IBM JDK. : Please also try to think of an IBM bug and so that we can agree on you. : : call,
|