Eclipse Refactoring

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Eclipse Refactoring

Irum Godil
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.
 

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

Reply | Threaded
Open this post in threaded view
|

Re: Eclipse Refactoring

Dirk Baeumer
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                                            
             [hidden email]>                                             To
             Sent by:                  jdtdev <[hidden email]>        
             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
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jdt-dev




_______________________________________________
jdt-dev mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jdt-dev
Reply | Threaded
Open this post in threaded view
|

Wochenplan

Benno Baumgartner
15: Text edit merge for clean ups: Find more stable solution with the
possibility for a multi fix to request a new ast if another multi fix may
have changed the same region in an ast as the current multi fix is trying
to change. Finish convert single control statement body to block clean up.
16:  Write performance tests for clean-ups and improve performance
17: Write tests for surround with template, various bug fixing, get this
api done for PackageSelectionDialog.
18: bug 114734 , add "light" clean up (on current cu without
dialog/preview)

_______________________________________________
jdt-dev mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jdt-dev
Reply | Threaded
Open this post in threaded view
|

Re: Wochenplan

Benno Baumgartner
Ooooops, sorry for that, ignore the mail: Wochenplan. It's getting late
here, I think I need a coffee....

Regards
      Benno



                                                                           
             Benno                                                        
             Baumgartner/Zuric                                            
             h/IBM@IBMCH                                                To
             Sent by:                  "Eclipse JDT general developers    
             jdt-dev-bounces@e         list." <[hidden email]>        
             clipse.org                                                 cc
                                       Martin Aeschlimann/Zurich/IBM@IBMCH
                                                                   Subject
             11/14/2005 05:21          [jdt-dev] Wochenplan                
             PM                                                            
                                                                           
                                                                           
             Please respond to                                            
               "Eclipse JDT                                                
                  general                                                  
             developers list."                                            
             <jdt-dev@eclipse.                                            
                   org>                                                    
                                                                           
                                                                           




15: Text edit merge for clean ups: Find more stable solution with the
possibility for a multi fix to request a new ast if another multi fix may
have changed the same region in an ast as the current multi fix is trying
to change. Finish convert single control statement body to block clean up.
16:  Write performance tests for clean-ups and improve performance
17: Write tests for surround with template, various bug fixing, get this
api done for PackageSelectionDialog.
18: bug 114734 , add "light" clean up (on current cu without
dialog/preview)

_______________________________________________
jdt-dev mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jdt-dev


_______________________________________________
jdt-dev mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jdt-dev