>From: ###@###.### (Mike Montwill )
This does not look like form output to me.
when running the following code:
class baseClass {
public baseClass() {}
}
class derivedClass extends baseClass {
public derivedClass () {}
public void doSomething () {}
}
class testClass {
public testClass () {
baseClass baseVar = new baseClass();
derivedClass derivedVar = (derivedClass) baseVar; //******
// derivedVar.doSomething();
}
static public void main (String argv[]) {
testClass t = new testClass();
}
}
through the java interpreter after compiling it with javac
the program terminates normally even though the starred line
should throw an exception.
The exception is only thrown if the following line is uncommented.
The bug here is that a sideeffect (an exception) is optimized away when
derivedVar is not utilized.
Environment:
Win95, JDK release ver 1.0
Mike Montwill - ###@###.###
This does not look like form output to me.
when running the following code:
class baseClass {
public baseClass() {}
}
class derivedClass extends baseClass {
public derivedClass () {}
public void doSomething () {}
}
class testClass {
public testClass () {
baseClass baseVar = new baseClass();
derivedClass derivedVar = (derivedClass) baseVar; //******
// derivedVar.doSomething();
}
static public void main (String argv[]) {
testClass t = new testClass();
}
}
through the java interpreter after compiling it with javac
the program terminates normally even though the starred line
should throw an exception.
The exception is only thrown if the following line is uncommented.
The bug here is that a sideeffect (an exception) is optimized away when
derivedVar is not utilized.
Environment:
Win95, JDK release ver 1.0
Mike Montwill - ###@###.###
- duplicates
-
JDK-1226346 Compiler removes cast checks whent the result is dead
- Closed