A DESCRIPTION OF THE PROBLEM :
I have me strange behaviour of java compiler - seems to be a bug. Eclipse compiler compiles and program runs but javac does not compile. Program example is in `Steps to Reproduce` block.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
public class Test {
public static void main(String[] args) {
UpperLevelClass.InnerClass c = new UpperLevelClass.InnerClass();
c.methodNameOne("a", new Integer(2));
}
}
class UpperLevelClass {
private static void methodNameTwo(String a, String b) {
System.out.println("UpperLevelClass.methodNameTwo");
}
private static void methodNameOne(String a, String b) {
System.out.println("UpperLevelClass.methodNameOne");
}
static class InnerClass extends UpperLevelClass {
void methodNameOne(String a, Integer b) {
System.out.println("InnerClass.methodNameOne");
methodNameTwo("", "");
methodNameOne("", "");//error
}
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
InnerClass.methodNameOne
UpperLevelClass.methodNameTwo
UpperLevelClass.methodNameOne
ACTUAL -
error: incompatible types: String cannot be converted to Integer
methodNameOne("", "");
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
CUSTOMER SUBMITTED WORKAROUND :
Specify upper level class name for static method. Like UpperLevelClass.methodNameOne.
FREQUENCY : always
I have me strange behaviour of java compiler - seems to be a bug. Eclipse compiler compiles and program runs but javac does not compile. Program example is in `Steps to Reproduce` block.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
public class Test {
public static void main(String[] args) {
UpperLevelClass.InnerClass c = new UpperLevelClass.InnerClass();
c.methodNameOne("a", new Integer(2));
}
}
class UpperLevelClass {
private static void methodNameTwo(String a, String b) {
System.out.println("UpperLevelClass.methodNameTwo");
}
private static void methodNameOne(String a, String b) {
System.out.println("UpperLevelClass.methodNameOne");
}
static class InnerClass extends UpperLevelClass {
void methodNameOne(String a, Integer b) {
System.out.println("InnerClass.methodNameOne");
methodNameTwo("", "");
methodNameOne("", "");//error
}
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
InnerClass.methodNameOne
UpperLevelClass.methodNameTwo
UpperLevelClass.methodNameOne
ACTUAL -
error: incompatible types: String cannot be converted to Integer
methodNameOne("", "");
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
CUSTOMER SUBMITTED WORKAROUND :
Specify upper level class name for static method. Like UpperLevelClass.methodNameOne.
FREQUENCY : always