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 Availabitlity 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.
2009-08-19

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

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

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
2005-02-01

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

PUBLIC COMMENTS ...
2004-09-07

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