History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-18425
Type: Bug Bug
Status: Open Open
Assignee: Alexey Kudravtsev
Reporter: Eugene Kirpichov
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

Good code is red in generic anonymous class; + incorrect generated override

Created: 16 Jun 08 17:40   Updated: 16 Jun 08 17:57
Component/s: Code Analysis. Inspection, Compiling Project, Editor. Error Highlighting

Environment: Windows XP Pro SP2

Build: 7,860
Severity: High


 Description  « Hide
The following code compiles OK, but an error is highlighted.
public abstract class BiFunction<A,B> {
    public abstract B apply(A a);
    public abstract A unapply(B b);
    public BiFunction<B,A> flip() {
        return new BiFunction<B, A>() { // Class "Anonymous class derived from BiFunction" must either be declared abstract or implement abstract method 'apply(A)' in 'BiFunction'
            public A apply(B b) {
                return BiFunction.this.unapply(b);
            }

            public B unapply(A a) {
                return BiFunction.this.apply(a);
            }
        };
    }
}

Ctrl-I inside the anonymous class doesn't offer anything, Ctrl-O shows types of all methods correctly, but if I try to override flip(), it produces

@Override
            public BiFunction<A, B> flip() {
                return super.flip();    //To change body of overridden methods use File | Settings | File Templates.
            }

which is obviously incorrect and is highlighted as a warning.



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.