Details
-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
6
-
generic
-
generic
Description
The following program produces warnings only on -Xlint:all.
However, the warning does not have a prefix to identify its
lint category.
import static java.lang.System.out;
class Base {
void method1(Object[] args) {
out.println("Base:method1");
for (Object arg : args)
out.println(arg);
}
void method2(Object... args) {
out.println("Base:method2");
for (Object arg : args)
out.println(arg);
}
}
class Derived extends Base {
void method1(Object... args) {
out.println("derived:method1");
for (Object arg : args)
out.println(arg);
}
void method2(Object[] args) {
out.println("derived:method2");
for (Object arg : args)
out.println(arg);
}
}
class Tester {
public static void main(String[] args) {
out.println("Working with Base");
Base b = new Base();
b.method1(new Object[] { "Hello", "World"});
b.method2("Hello", "World");
b.method2(new Object[] { "Hello", "World"});
out.println("Working with Derivedd");
Derived d = new Derived();
d.method1("Hello", "World");
d.method1(new Object[] { "Hello", "World"});
d.method2("Hello", "World");
d.method2(new Object[] { "Hello", "World"});
out.println("Working with Derived as Base");
b = d;
b.method1(new Object[] { "Hello", "World"});
b.method2("Hello", "World");
b.method2(new Object[] { "Hello", "World"});
}
}
However, the warning does not have a prefix to identify its
lint category.
import static java.lang.System.out;
class Base {
void method1(Object[] args) {
out.println("Base:method1");
for (Object arg : args)
out.println(arg);
}
void method2(Object... args) {
out.println("Base:method2");
for (Object arg : args)
out.println(arg);
}
}
class Derived extends Base {
void method1(Object... args) {
out.println("derived:method1");
for (Object arg : args)
out.println(arg);
}
void method2(Object[] args) {
out.println("derived:method2");
for (Object arg : args)
out.println(arg);
}
}
class Tester {
public static void main(String[] args) {
out.println("Working with Base");
Base b = new Base();
b.method1(new Object[] { "Hello", "World"});
b.method2("Hello", "World");
b.method2(new Object[] { "Hello", "World"});
out.println("Working with Derivedd");
Derived d = new Derived();
d.method1("Hello", "World");
d.method1(new Object[] { "Hello", "World"});
d.method2("Hello", "World");
d.method2(new Object[] { "Hello", "World"});
out.println("Working with Derived as Base");
b = d;
b.method1(new Object[] { "Hello", "World"});
b.method2("Hello", "World");
b.method2(new Object[] { "Hello", "World"});
}
}