Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wtp-dev] [Action] Some APIs are using non-API types


Hi Tim,

I believe the issue here is that the API scanner cannot tell whether method

   public final void initialize(InternalClass in) {
     this.in = in;

  }


is a hook for an internal variable that the delegate never has access to, or is a public method that by mistake takes in an internal class. As long as ADelegate is defined in component.xml as an API, initialize will be flagged as an API because it is public. This is a limitation in the scanner because it doesn't allow you define APIs on the method level. We decided not to support this because we wanted to discourage the practice of defining both API and non-API methods in the same class.

Is there no way to get rip of such hook without redesign? If so, I would suggest we rename the method to something like internalInitialize, and make sure we javadoc it with "This is NOT an API".

Thanks,

Jeffrey Liu
IBM Rational Software - Performance Analyst
IBM Toronto Lab.
8200 Warden Ave. Markham, Ontario, L6G 1C7
Internal mail: D3/R8V/8200/MKM (D3-268)
T/L: 969 3531
Tel: (905) 413 3531
Fax: (905) 413 4920
jeffliu@xxxxxxxxxx



Timothy Deboer/Toronto/IBM@IBMCA
Sent by: wtp-dev-bounces@xxxxxxxxxxx

05/07/2005 04:12 PM

Please respond to
"General discussion of project-wide or architectural issues."

To
"General discussion of project-wide or architectural issues." <wtp-dev@xxxxxxxxxxx>
cc
Subject
Re: [wtp-dev] [Action] Some APIs are using non-API types






Hi Arthur, Jeffrey,


A couple of the violations are mine and are indeed violations. However, there are a couple of mine that I do not beleive are violations. Maybe there is another way to do this; maybe I just haven't tagged the methods correctly in my component.xml. Either way, please let me know if my approach is valid.


Take the example below - this is a class that would be implemented as part of an extension point. As part of the implementation of callMe() or other methods implemented by the class, it may need access to API or state that only this particular class should be able to access. To allow this, the delegate has a private internal variable that is used as a hook, and a couple final methods in the class allow the internal variable to be set (when the delegate is created) and to call methods on it. The delegate never has access to the internal class, nor can it override the methods.


public abstract class ADelegate {

  private InternalClass in;


  /**

   * Method used to set the internal class. This method should never be called by clients.

   */

  public final void initialize(InternalClass in) {

     this.in = in;

  }


  /**

   * Method to get some value that should only be accessible to this class.

   */

  protected final int getSomeValue() {

     return in.getValue();

  }


  /**

   * Method to set state that only this extension point should have access to.

   */

  protected final void setSomeState(int i) {

     in.setState(i);

  }


  /**

   * Method to be implemented by delegate

   */

  public abstract void callMe();


  ...

}


Thanks,

Tim deBoer
WebSphere Tools - IBM Canada Ltd.
(905) 413-3503  (tieline 969)
deboer@xxxxxxxxxx


Arthur Ryman/Toronto/IBM@IBMCA
Sent by: wtp-dev-bounces@xxxxxxxxxxx

05/06/2005 09:25 AM

Please respond to
"General discussion of project-wide or architectural issues."

To
"General discussion of project-wide or architectural issues." <wtp-dev@xxxxxxxxxxx>
cc
Subject
Re: [wtp-dev] [Action] Some APIs are using non-API types








Jeffrey,


Thx for tracking these API defects. I suggest we let the owners fix these next week. If any of these violations remain after that (5/16), please open Bugzilla bugs to track them.


Arthur Ryman,
Rational Desktop Tools Development

phone: +1-905-413-3077, TL 969-3077
assistant: +1-905-413-2411, TL 969-2411
fax: +1-905-413-4920, TL 969-4920
mobile: +1-416-939-5063, text: 4169395063@xxxxxxx
intranet: http://labweb.torolab.ibm.com/DRY6/

Jeffrey Liu/Toronto/IBM@IBMCA
Sent by: wtp-dev-bounces@xxxxxxxxxxx

05/03/2005 11:28 AM

Please respond to
"General discussion of project-wide or architectural issues."


To
wtp-dev@xxxxxxxxxxx
cc
Subject
[wtp-dev] [Action] Some APIs are using non-API types










Hi component leads,


The latest API progress report show that some of our APIs have dependency on non-API types. For example, a method API returns a non-API type. These APIs cannot be deemed as APIs because of such dependency. We need to clean them up. I suggest we either say they are not APIs or we modify them so that they do not extend/implement/return/input/throw non-APIs. Please review the report and take necessary actions.


To view the report, open:


http://download.eclipse.org/webtools/downloads/drops/S-1.0M4-200504292037/apitools/api-progress.html

and click on:



Thanks,


Jeffrey Liu
IBM Rational Software - Performance Analyst
IBM Toronto Lab.
8200 Warden Ave. Markham, Ontario, L6G 1C7
Internal mail: D3/R8V/8200/MKM (D3-268)
T/L: 969 3531
Tel: (905) 413 3531
Fax: (905) 413 4920
jeffliu@xxxxxxxxxx
_______________________________________________
wtp-dev mailing list
wtp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/wtp-dev
_______________________________________________
wtp-dev mailing list
wtp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/wtp-dev

_______________________________________________
wtp-dev mailing list
wtp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/wtp-dev


Back to the top