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

Key: IDEADEV-7527
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Eugene Vigdorchik
Reporter: Boaz Nahum
Votes: 0
Watchers: 1
Operations

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

Good code is red: Ambiguous method call

Created: 24 Jul 06 15:36   Updated: 25 Jul 06 21:45
Component/s: Editor. Error Highlighting
Fix Version/s: Demetra 5561

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: None
Image Attachments:

1. ScreenHunter_016.jpg
(9 kb)

Build: 5,557
Fixed in build: 5,562
Severity: Extreme


 Description  « Hide
This is new to build 5557.
Hundreds of our files become red...
class Key<T> {
    Object add(T v) {
        return v;
    }
}

class WKey<W, T> extends Key<T> {

    @Override
    W add(T v) {
        return null;
    }
}

class IBug {

    public <W, T> void addItem(WKey<W, T> key, T v) {
        key.add(v); // --> demetra draw this in red, see attachment
    }
}


 All   Comments   Work Log   Change History      Sort Order:
Michael Abato - 24 Jul 06 17:58
I was about to submit an item that may be another case of this one. The following code is marked red in 5557, but compiles:
package com.example;

import java.util.*;

public class A {

  public static class Bx<T> {
    public Collection<? extends String> foo(T t) {
      return null;
    }
  }
  public static interface B<T> {
    public Collection<? extends String> foo(T t);
  }
  public static class C implements B<String> {
    public StringList foo(String s) {
      return new StringList();
    }
  }

  public static class StringList extends ArrayList<String> { }

  public static void main(String[] args) {
    new C().foo("sdf");
  }
}

The critical point seems to be that the analyzer doesn't realize StringList satisfies Collection<? extends String> - variations not naming the ArrayList<String> as a separate class are fine.

Not as critical for me - it doesn't penetrate our code. I'll obviously check in the next release, but I'm adding it here so that you could check it yourself.


Eugene Vigdorchik - 24 Jul 06 18:00
Yeah, this is another incarnation of the same bug, and it has been fixed.

Boaz Nahum - 25 Jul 06 11:13
Sorry, it still unresoved in 5561.

Eugene Vigdorchik - 25 Jul 06 12:33
It must be the case that my fix did not get it into 5561. Last minute fix, you know...

Boaz Nahum - 25 Jul 06 12:38
We are all developers and we are all human.

Sebastian Graca - 25 Jul 06 20:46
There's a typo in the error message: "ambigous"

Michael Abato - 25 Jul 06 21:45
I've confirmed my variant persists in 5561, now in several places in my projects. I'll wait until the fix makes it into a release to either confirm or break it out to a separate issue...