-
Bug
-
Resolution: Fixed
-
P4
-
1.0.2, 1.1
-
1.2
-
sparc
-
solaris_2.4
Name: vsC45997 Date: 11/27/96
The section "13.4.11 volatile Fields" of The JLS contains the following:
"If a field that is not declared private was not declared volatile and
is changed to be declared volatile, or vice versa, then a linkage time
error, specifically an IncompatibleClassChangeError, may result if the
field is used by a preexisting binary that expected a field of the
opposite volatility. Such changes are not recommended in code that has
been widely distributed."
But I cannot catch IncompatibleClassChangeError on the proper binary
compatibility tests below.
First test consist of two files.
// FILE: binc02201.java
package javasoft.sqe.tests.lang.binc022.binc02201;
import java.io.PrintStream;
class Super { char f = 'f'; }
public class binc02201 extends Super {
public static void main(String argv[])
{
System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
}
public static int run(String argv[],PrintStream out) {
char c;
try {
c = new Super().f;
out.println(c);
}
catch (IncompatibleClassChangeError e) {
out.println (e);
return 0;
}
out.println ("failed");
return 2;
}
}
// FILE: binc02201a.java
package javasoft.sqe.tests.lang.binc022.binc02201;
class Super { volatile char f = 'a'; }
After separate compilation and execution with -verify option we have
on both 1.0.2 and 1.1 compilers:
javac -d . binc02201.java
javac -d . binc02201a.java
java -verify javasoft.sqe.tests.lang.binc022.binc02201.binc02201
a
failed
Second test consist of two files.
// FILE: binc02202.java
package javasoft.sqe.tests.lang.binc022.binc02202;
import java.io.PrintStream;
class Super { volatile char f = 'f'; }
public class binc02202 extends Super {
public static void main(String argv[])
{
System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
}
public static int run(String argv[],PrintStream out) {
char c;
try {
c = new Super().f;
out.println(c);
}
catch (IncompatibleClassChangeError e) {
out.println (e);
return 0;
}
out.println ("failed");
return 2;
}
}
// FILE: binc02202a.java
package javasoft.sqe.tests.lang.binc022.binc02202;
class Super { char f = 'a'; }
After separate compilation and execution with -verify option we have
on both 1.0.2 and 1.1 compilers:
javac -d . binc02202.java
javac -d . binc02202a.java
java -verify javasoft.sqe.tests.lang.binc022.binc02202.binc02202
a
failed
======================================================================