Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 399789

Summary: [Add parameter] Strong precondition: The method [] from the type [] is not visible
Product: [Eclipse Project] JDT Reporter: Gustavo Soares <gsoares>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: noopur_gupta
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard: stalebug

Description Gustavo Soares CLA 2013-02-02 18:16:17 EST
Step 1: Create the classes:

package p1;
public class A{
  long k(){ return 58; }
  public long m(){
    return new C().k();
  }
}

package p2;
import p1.*;
public class B extends A {
}

package p1;
import p2.*;
public class C extends B {
  public long k(){return 24;}
}


Step 2: apply the change method signature to add a parameter "int i" to the method A.k. Eclipse will show a warning: the method k(int) from type A is not visible. However, if we apply the transformation regardless the warning, the resulting program will compile:

package p1;
public class A{
  long k(int i){ return 58; }
  public long m(){
    return new C().k(0);
  }
}


package p2;
import p1.*;
public class B extends A {
}

package p1;
import p2.*;
public class C extends B {
  public long k(int i){return 24;}
}
Comment 1 Noopur Gupta CLA 2013-02-05 07:18:34 EST
Tested with Build ID: I20130204-1400.
The bug is reproducible.
Comment 2 Eclipse Genie CLA 2019-11-09 14:53:39 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.