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

Key: IDEADEV-5517
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Normal Normal
Assignee: Eugene Vigdorchik
Reporter: Keith Lea
Votes: 0
Watchers: 0
Operations

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

"Use Interface Where Possible" produces bad (red) code when type is parameter to method overridden/implemented from generic class/interface

Created: 06 Apr 06 19:11   Updated: 09 Apr 06 16:05
Component/s: Refactoring
Fix Version/s: Demetra 5231

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 5,181
Fixed in build: 5,222
Severity: High


 Description  « Hide
interface Int<T> { void method(T x); }

class Sub implements Int<Xyz> {
  public void method(Xyz x) { x.inInt(); }
}

interface Xint { void inInt(); }

class Xyz implements Xint {
  public void inInt() { }
}

Execute "use interface" for Xyz to use Xint. It produces:

interface Int<T> { void method(T x); }

class Sub implements Int<Xyz> {
  public void method(Xint x) { x.inInt(); }
}

interface Xint { void inInt(); }

class Xyz implements Xint {
  public void inInt() { }
}

This breaks the code because the refactoring changed the signature of method() without changing the type argument to Int. I imagine this could break code in more subtle ways that wouldn't be caught by the compiler.



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