-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2fcs
-
sparc
-
solaris_2.4
-
Verified
Name: akC45999 Date: 07/07/98
The Java VM spec chapter "4.5 Fields" reads:
...
If the method is either native or abstract, its method_info structure must not have a Code attribut.
But the attached test shows that VM doesn't reject a class which contain two fields with the same name and descriptor.
--------------------------------- test.java
import java.io.PrintStream;
public class test {
public static void main(String argv[]) {
try {
Class.forName("BadClass");
System.out.println("Very bad");
} catch (Throwable e) {
System.out.println("Exception " + e);
}
}
}
--------------------------------- BadClass.jasm
class BadClass
{
Field badField:I;
Field badField:I;
}
------------------------------------- dotest
#!/bin/sh
TESTCLASSES=/opt/home/testclasses
CLASSPATH=$TESTCLASSES
export CLASSPATH
jasm -d $TESTCLASSES *.jasm
javac -d $TESTCLASSES *.java
java -verify test;
----------------------------------------
Running the test:
novo48% dotest
Very bad
novo48%
======================================================================
======================================================================
Name: akC45999 Date: 07/07/98
The Java VM spec chapter "4.5 Fields" reads:
...
No two fields in one class file may have the same name and descriptor.
But the attached test shows that VM doesn't reject a class which contain two fields with the same name and descriptor.
--------------------------------- test.java
import java.io.PrintStream;
public class test {
public static void main(String argv[]) {
try {
Class.forName("BadClass");
System.out.println("Very bad");
} catch (Throwable e) {
System.out.println("Exception " + e);
}
}
}
--------------------------------- BadClass.jasm
class BadClass
{
Field badField:I;
Field badField:I;
}
------------------------------------- dotest
#!/bin/sh
TESTCLASSES=/opt/home/testclasses
CLASSPATH=$TESTCLASSES
export CLASSPATH
jasm -d $TESTCLASSES *.jasm
javac -d $TESTCLASSES *.java
java -verify test;
----------------------------------------
Running the test:
novo48% dotest
Very bad
novo48%
======================================================================
======================================================================