From mail sent to ###@###.###:
From ###@###.### Tue Jan 2 10:16 PST 1996
Date: Tue, 2 Jan 96 08:09:26 -0600
X-Sender: ###@###.### (Unverified)
Mime-Version: 1.0
To: java@java
From: "David P. Hummel" <###@###.###>
Subject: JDK 1.0 beta 2 compiler bug?
Technical Support,
Consider the following class:
public class bar {
void foo() {
;
}
int foo;
}
I receive the following error when I compile this class:
"Duplicate variable declaration: int foo was void foo()"
Now, consider this class with the declarations switched:
public class bar {
int foo;
void foo() {
;
}
}
When I compile this class, I don't receive an error from the
compiler. According to section 6.1.6 of the Java Specification,
I was expecting the following error:
"Duplicate variable declaration: void foo() was int foo"
(I experience the same behavior using both Windows95 and Solaris
2.4 versions of the JDK 1.0 beta 2.)
Does this example expose an bug in the compiler or an bug
in my understanding of section 6.1.6?
Thank you.
- David P. Hummel
From ###@###.### Tue Jan 2 10:16 PST 1996
Date: Tue, 2 Jan 96 08:09:26 -0600
X-Sender: ###@###.### (Unverified)
Mime-Version: 1.0
To: java@java
From: "David P. Hummel" <###@###.###>
Subject: JDK 1.0 beta 2 compiler bug?
Technical Support,
Consider the following class:
public class bar {
void foo() {
;
}
int foo;
}
I receive the following error when I compile this class:
"Duplicate variable declaration: int foo was void foo()"
Now, consider this class with the declarations switched:
public class bar {
int foo;
void foo() {
;
}
}
When I compile this class, I don't receive an error from the
compiler. According to section 6.1.6 of the Java Specification,
I was expecting the following error:
"Duplicate variable declaration: void foo() was int foo"
(I experience the same behavior using both Windows95 and Solaris
2.4 versions of the JDK 1.0 beta 2.)
Does this example expose an bug in the compiler or an bug
in my understanding of section 6.1.6?
Thank you.
- David P. Hummel
- duplicates
-
JDK-1237673 Defining method and variable with same name generates inconsistent errors
- Closed