-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
1.2.0
-
sparc
-
solaris_2.5.1
Name: ngC57085 Date: 06/26/98
Compiler version "1.2beta4" (build JDK-1.2beta4-I)
Java compiler crashes while trying to compile next test.
This test also crash all previos compiler versions.
An example and compiler diagnostics follow:
-------------------------------------------------------
class arr00509 {
Object a = new void[1];
}
> uname -a
SunOS novo35 5.5.1 Generic_103640-12 sun4m sparc SUNW,SPARCstation-20
> javac arr00509.java
sun.tools.java.CompilerError: codeValue
at sun.tools.tree.NewArrayExpression.codeValue(Compiled Code)
at sun.tools.tree.ConvertExpression.codeValue(Compiled Code)
at sun.tools.tree.AssignExpression.code(Compiled Code)
at sun.tools.tree.CommaExpression.code(Compiled Code)
at sun.tools.tree.ExpressionStatement.code(Compiled Code)
at sun.tools.javac.SourceMember.code(Compiled Code)
at sun.tools.javac.SourceMember.code(Compiled Code)
at sun.tools.javac.SourceClass.compileClass(Compiled Code)
at sun.tools.javac.SourceClass.compile(Compiled Code)
at sun.tools.javac.Main.compile(Compiled Code)
at sun.tools.javac.Main.main(Compiled Code)
arr00509.java:0: class arr00509:arr00509()@sun.tools.java.CompilerError: codeValue
class arr00509{
^
1 error
-------------------------------------------------------
Therewith javac normaly compile bogus array creation expression type
of void[][]. This fact stay in contadictionary with JLS section 15.9 which state:
"... that is a new array whose elements are of the type specified by the PrimitiveType or TypeName."
The type void is neither PrimitiveType, nor TypeName JLS 4.2 & JLS 3.8
The VM throws an exception while trying to execute bytecode produced
by javac in this case.
An programm example and VM diagnostics follow:
-------------------------------------------------------
public class arr00510 {
public static void main(String[] args) {
Object a = new void[2][2];
}
}
> uname -a
SunOS novo35 5.5.1 Generic_103640-12 sun4m sparc SUNW,SPARCstation-20
>javac arr00510.java
>
> java -version
java version "1.2beta4"
Classic VM (build JDK-1.2beta4-I, green threads, sunwjit)
> java arr00510
Exception in thread "main" java.lang.ClassFormatError: arr00510 (Illegal Class name "[[V")
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Compiled Code)
at java.security.SecureClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.findClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
-------------------------------------------------------
======================================================================