This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 163969

Summary: [67cat] Internal compiler regression with generics (#2)
Product: java Reporter: matthies <matthies>
Component: CompilerAssignee: Dusan Balek <dbalek>
Status: RESOLVED WONTFIX    
Severity: blocker Keywords: REGRESSION
Priority: P3    
Version: 6.x   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:

Description matthies 2009-04-28 18:15:37 UTC
Example:



    class Test
    {
        interface Interval<T extends Comparable<? super T>>
        {
            T minimum();
            T maximum();
        }

        void f(Object obj)
        {
            if (obj instanceof Interval
               && ((Interval<?>) obj).minimum() instanceof Integer)
            {
                // ...
            }
        }
    }

The editor shows the following compiler error for the second "instanceof" expression:

    inconvertible types
    required: java.lang.Integer
    found: capture #nnn of ?

The code though is correct and compiles without errors with JDK 1.6, and no error is shown by the NetBeans 6.5 editor.
Comment 1 Dusan Balek 2009-04-29 10:27:13 UTC
Seems like a regression in the JDK1.7 compiler (1.6 compiles fine, errors while using 1.7).
Comment 2 Dusan Balek 2009-04-30 08:00:40 UTC
Copy & paste from the e-mail I've got from the javac people:
-------------------------------------------------------------------------------------------------------------------------
This seems a regression from 6548436 - cast conversion has a lot of problems in javac - and I'm trying to address
them... I guess this is one of those areas in which you do two steps further and a step beyond  :-(
I might need to spend some time on this - I'll keep you informed as soon as I discover a fix.
-------------------------------------------------------------------------------------------------------------------------
Comment 3 Dusan Balek 2009-05-14 13:56:06 UTC
Bug in JDK1.7 compiler. WONTFIX on NB side.