JDK-5003431 : java.lang.Object cannot be dereferenced
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: generic
  • Submitted: 2004-02-25
  • Updated: 2007-12-07
  • Resolved: 2006-01-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b67Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
See <http://forum.java.sun.com/thread.jsp?forum=316&thread=495830>

class Test {
    static class SomeType<T> { T t = null; }

    static <T> T nil() { return (new SomeType<T>()).t; }

    public static void test() {
        nil().getClass();               // error: java.lang.Object cannot be dereferenced
    }
}

Comments
PUBLIC COMMENTS I tried the following code with 6u16 and it compiles fine: class SomeClass { void callSomeMethodOfSomeClass() {} } class Test { public <S extends SomeClass> S getSome() { return null; } void test() { getSome().callSomeMethodOfSomeClass(); } } Please attach a complete test case that can be used to reproduce the problem.
19-08-2009

SUGGESTED FIX http://sa.sfbay.sun.com/projects/langtools_data/mustang/5034571/
26-01-2006

WORK AROUND Test.<Object>nil().getClass(); ###@###.### 2005-03-26 02:56:24 GMT
26-03-2005

SUGGESTED FIX Index: src/share/classes/com/sun/tools/javac/comp/Infer.java ============================================================ @@ -247,7 +251,7 @@ List<Type> targs = Type.map(undetvars, getInstFun); checkWithinBounds(that.tvars, targs, warn); - return qtype1.map(getInstFun); + return getInstFun.apply(qtype1); } /** Instantiate method type `mt' by finding instantiations of ###@###.### 2005-2-01 08:14:58 GMT
01-02-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: dragon
07-09-2004

PUBLIC COMMENTS ...
07-09-2004

EVALUATION A bug. ###@###.### 2004-02-25
25-02-2004