由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Stupid IBM JVM: operator precedence
相关主题
Stupid IBM JDKhow to set java run time locale/encoding?
新手上路,请多指教如何改变JDK 的语言设置
java 6要来了help:tomcat5 on FC4
Java's performance myth再请教一个 编译错误
xp 是不是不支持jave 阿?swing 在 mac intel 下的bug怎么修正?
JDK Source?java memory problem with redhat enterprise
java在美国到底怎样?out of memory
Java on AIXHow is the Jboss AS performance?
相关话题的讨论汇总
话题: ibm话题: jvm话题: jdk话题: so话题: precedence
进入Java版参与讨论
1 (共1页)
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,

1 (共1页)
进入Java版参与讨论
相关主题
How is the Jboss AS performance?xp 是不是不支持jave 阿?
Oracle的jvm收费版本JDK Source?
大家都用Java 7吗java在美国到底怎样?
这几年Java跟其他语言的差距拉大了。Java on AIX
Stupid IBM JDKhow to set java run time locale/encoding?
新手上路,请多指教如何改变JDK 的语言设置
java 6要来了help:tomcat5 on FC4
Java's performance myth再请教一个 编译错误
相关话题的讨论汇总
话题: ibm话题: jvm话题: jdk话题: so话题: precedence