Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-dev] Eclipse Refactoring

Technical questions and discussions about using eclipse and eclipse-based
tools, and developing plug-in tools should be posted to the newsgroups.
Mailing lists at eclipse.org are intended for use by developers actually
working on or otherwise contributing to day-to-day development.

This discussion should go to the eclipse.platform newsgroup. See
http://www.eclipse.org/newsgroups/index.html

This being said, some short answers:

For return values, you missed the case of loop reentrance for. Considering
the following code:

      void foo() {
            int i =0;
            while (true) {
                  System.out.println(i);
                  /*]*/System.out.println(i++);/*[*/
            }

extracting the code between /*]*/ and /*[*/ must return i although it is
not read right after the selection. It is read because there is a loop
around the statements you are extacting.

Dirk


                                                                           
             Irum Godil                                                    
             <softwarengineer2                                             
             004@xxxxxxxxx>                                             To 
             Sent by:                  jdtdev <jdt-dev@xxxxxxxxxxx>        
             jdt-dev-bounces@e                                          cc 
             clipse.org                                                    
                                                                   Subject 
                                       [jdt-dev] Eclipse Refactoring       
             14/11/2005 03:24                                              
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
               "Eclipse JDT                                                
                  general                                                  
             developers list."                                             
             <jdt-dev@eclipse.                                             
                   org>                                                    
                                                                           
                                                                           




Hi,
I am trying to understand the data flow analysis in Eclipse Extract Method
Refactoring. These are the observations I have made and I would appreciate
if someone can confirm for me that I am not missing on something, or
misunderstood something.

1) Basically, in terms of data flow, the refactoring deterimines:
arguments, local variables and return values of the methods.

The selected portion of the code to be refactored is checked for variables
that are being read and written to. All variables that are being read in
their first use (inside the selection) are passed as arguments to the
extracted method. All variables that are written to in their first use are
captured as local variables in the extracted method.

For return values, the variables that are being written(in the selection)
are compared to variables that are read in their first use right "after"
the selection. If there is one such variable it is captured as the return
value. If there are >1 such variables, then there is an error since there
are >1 return values.

2) Additionally, the flow analyzer checks if there are any partial returns
or branches off the selection, and if so, then it will throw an error.

I will really appreciate if somebody can point out to me any scenarios that
I may have missed.



Thanks a lot,
Sincerely,
Irum Godil.
www.cs.utoronto.ca/~irum



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com _______________________________________________
jdt-dev mailing list
jdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jdt-dev






Back to the top