[Bug 555419] New: Erroneous unchecked javac error when compiling valid program
http://bugzilla.novell.com/show_bug.cgi?id=555419
User archie@dellroad.org added comment
http://bugzilla.novell.com/show_bug.cgi?id=555419#c31
Summary: Erroneous unchecked javac error when compiling valid
program
Classification: openSUSE
Product: openSUSE 11.1
Version: Final
Platform: PC
OS/Version: openSUSE 11.1
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Java
AssignedTo: bnc-team-java@forge.provo.novell.com
ReportedBy: archie@dellroad.org
QAContact: qa@suse.de
Found By: ---
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3)
Gecko/20090909 SUSE/3.5.3-1.2 Firefox/3.5.3
Compiling this program:
public class Foo<T> {
private final Class<T> type;
public Foo(Class<T> type) {
this.type = type;
}
public T cast(Object obj) {
return this.type.cast(obj);
}
public void handle(T obj) {
}
static void apply(Foo<?> foo, Object obj) {
foo.handle(foo.cast(obj));
}
}
gives this error:
Foo.java:18: handle(capture#31 of ?) in Foo<capture#31 of ?>
cannot be applied to (java.lang.Object)
foo.handle(foo.cast(obj));
^
But this is bogus. Obviously the type of "foo.cast(obj)" is also "capture#31 of
?".
More info:
$ javac -version
javac 1.6.0_0
$ rpm -qf /usr/lib/jvm/java-1.6.0-openjdk/bin/javac
java-1_6_0-openjdk-devel-1.6_b16-0.1.3
Reproducible: Always
Steps to Reproduce:
1. Copy test case into Foo.java
2. Run "javac Foo.java"
3. Witness failure to compile
Actual Results:
Foo.java:18: handle(capture#31 of ?) in Foo
http://bugzilla.novell.com/show_bug.cgi?id=555419
Michal Vyskocil
http://bugzilla.novell.com/show_bug.cgi?id=555419
--- Comment #2 from Archie Cobbs
http://bugzilla.novell.com/show_bug.cgi?id=555419
--- Comment #3 from Archie Cobbs
http://bugzilla.novell.com/show_bug.cgi?id=555419#c4
Archie Cobbs
http://bugzilla.novell.com/show_bug.cgi?id=555419#c5
Michal Vyskocil
http://bugzilla.novell.com/show_bug.cgi?id=555419
http://bugzilla.novell.com/show_bug.cgi?id=555419#c6
--- Comment #6 from Archie Cobbs
participants (1)
-
bugzilla_noreply@novell.com