Name: akC45999 Date: 07/03/98
The Java VM spec chapter "2.16.1 Virtual Machine Start-up" reads:
...
The method main must be declared public, static, and void.
But the attached test shows that VM doesn't reject a class containing
method main() declared without public keyword.
--------------------------------- execution00201.jasm
public class execution00201
{
static Method main:"([Ljava/lang/String;)V"
stack 2 locals 1
{
bipush 95/*STATUS_TEMP*/;
invokestatic Method java/lang/System.exit:"(I)V";
return;
}
} // end Class execution00201
------------------------------------- dotest
#!/bin/sh
TESTCLASSES=/opt/home/testclasses
CLASSPATH=$TESTCLASSES
export CLASSPATH
jasm -d $TESTCLASSES execution00201.jasm
java -verify execution00201;
echo res=$?
----------------------------------------
Running the test:
novo48% dotest
res=95
novo48%
======================================================================
======================================================================
- duplicates
-
JDK-4155575 (launcher) main method should have to be public
- Resolved