-
Bug
-
Resolution: Won't Fix
-
P5
-
None
-
6
-
generic
-
generic
This looks like a javac bug.
On 12/13/06, ... wrote:
Given these three files, javac reports:
imp03.java:10: f() in X.z1 cannot be applied to (int)
f(1);
^
This seems wrong to me. 7.5.3 says:
A single-static-import declaration d in a compilation unit c of package p that
imports a method named n with signature s shadows the declaration of any static
method named n with signature s imported by a static-import-on-demand declaration
in c, throughout c.
I read that as saying that the import of X.z1.f only shadows another method if that other method has the same signature. Am I missing something, or is this a javac bug?
[...]
::::::::::::::
imp03.java
::::::::::::::
import static X.z1.f;
import static X.z2.* ;
import static X.z1.g;
import static X.z2.*;
class A {
void h() {
g();
f();
f(1);
}
f my_f;
int i = f;
}
::::::::::::::
X/z1.java
::::::::::::::
package X;
public class z1 {
public static void f(){}
public static class f {}
public static int f;
public static void g(){}
}
::::::::::::::
X/z2.java
::::::::::::::
package X;
public class z2 {
public static void f(int i){}
public static void g(){}
}
On 12/13/06, ... wrote:
Given these three files, javac reports:
imp03.java:10: f() in X.z1 cannot be applied to (int)
f(1);
^
This seems wrong to me. 7.5.3 says:
A single-static-import declaration d in a compilation unit c of package p that
imports a method named n with signature s shadows the declaration of any static
method named n with signature s imported by a static-import-on-demand declaration
in c, throughout c.
I read that as saying that the import of X.z1.f only shadows another method if that other method has the same signature. Am I missing something, or is this a javac bug?
[...]
::::::::::::::
imp03.java
::::::::::::::
import static X.z1.f;
import static X.z2.* ;
import static X.z1.g;
import static X.z2.*;
class A {
void h() {
g();
f();
f(1);
}
f my_f;
int i = f;
}
::::::::::::::
X/z1.java
::::::::::::::
package X;
public class z1 {
public static void f(){}
public static class f {}
public static int f;
public static void g(){}
}
::::::::::::::
X/z2.java
::::::::::::::
package X;
public class z2 {
public static void f(int i){}
public static void g(){}
}