-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.2.0
-
sparc
-
solaris_2.4
Name: akC45999 Date: 07/03/98
The Java VM spec chapter "2.10.2 Signature" reads:
...
The signature of a method consists of the name of the method and the number and type of formal parameters (?2.10.1) to the method. A class may not declare two methods with the same signature.
But the attached test shows that VM doesn't reject a class containing
several methods with the same signature.
--------------------------------- methods00101z.java
public class methods00101z {
public static void main(String argv[]) {
try{
Class.forName("methods00101");
System.exit(97);
} catch (Throwable e) {
System.exit(95);
}
}
}
--------------------------------- methods00101.jasm
public class methods00101
{
static Method proc2:"(I)V" { return; }
static Method proc2:"(I)V" { return; }
} // end Class methods00101
------------------------------------- dotest
#!/bin/sh
TESTCLASSES=/opt/home/testclasses
CLASSPATH=$TESTCLASSES
export CLASSPATH
jasm -d $TESTCLASSES methods00101.jasm
javac -d $TESTCLASSES methods00101z.java
java -verify methods00101z;
echo res=$?
----------------------------------------
Running the test:
novo48% dotest
res=97
novo48%
======================================================================
======================================================================
- duplicates
-
JDK-4137346 vm permits to have methods with the same signature for a class
- Closed