Re: refactoring in jdee
On Sat, Oct 02, 2004 at 11:28:15PM -0400, Nascif Abousalh-Neto wrote: Yeah, other tools use gnuclient for the same purpose, like the emacs-python bridge. Usually a refactoring tool will need info from the IDE (region boundaries, for example) or will need to send commands back to it (inject new code in the buffer). Gnuclient provices a good way to do it (not that there are many alternatives...) I haven't used FreeFactor in a while so I can't help you much with this problem. I don't think the tool has kept up-to-date with the changes in JDEE, their web site mentions the 2.2.9 version... But it was a nice start, perhaps it could be *the* refactoring tool for JDEE with the appropriate effort behind it. Hi Graham, Are you still having fun with FreeFactor? Hi Nascif, Unfortunately Freefactor hasn't been touched for quite a long time now. As you say, the error is probably caused by changes to JDEE since freefactor was written. I don't have much time to devote to this anymore, but I'm happy to help anyone who might want to take a stab at fixing things. cheers, Graham. -- Graham Bennett
Re: refactoring in jdee
Freefactor looks interesting, I like their idea of using gnuclient to allow the java process to evaluate expressions in emacs I wasn't able to get it to work though. After renaming jde-db-source-directories to jde-sourcepath and checking that gnudoit works I got this exception : java.lang.NullPointerException at antlr.Parser.setASTNodeClass(Parser.java:324) at net.sourceforge.transmogrify.symtab.parser.FileParser.makeRecognizer(FileParser.java:167) at net.sourceforge.transmogrify.symtab.parser.FileParser.parseFile(FileParser.java:131) at net.sourceforge.transmogrify.symtab.parser.FileParser.doFile(FileParser.java:108) at org.freefactor.model.CodeModel.parse(CodeModel.java:120) at org.freefactor.tool.emacs.EmacsTool.testRefactoring(Unknown Source) at org.freefactor.tool.emacs.EmacsTool.apply(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:494) at bsh.Reflect.invokeMethod(Unknown Source) at bsh.Reflect.invokeObjectMethod(Unknown Source) at bsh.BSHPrimarySuffix.doName(Unknown Source) at bsh.BSHPrimarySuffix.doSuffix(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) at bsh.Interpreter.run(Unknown Source) at bsh.Interpreter.main(Unknown Source) Any ideas? Did you have to make any changes to get it running ? Suraj On Fri, 1 Oct 2004 12:36:57 -0400, Nascif Abousalh-Neto [EMAIL PROTECTED] wrote: Another tool to consider is FreeFactor. It is in SourceForge, and it is already integrated with Emacs. It is still alpha, but is a good start for a true refactoring tool. http://sourceforge.net/projects/freefactor. A true refactoring tool needs access to the full syntactic tree of the source code - not just method signatures, but also method bodies. Does semantic support that? How about jde-usages?
Re: refactoring in jdee
By method extraction I mean, pulling a block out of a method and creating a new method with it. On Thu, 30 Sep 2004 11:03:54 -0700, Raul Acevedo [EMAIL PROTECTED] wrote: On Thu, 2004-09-30 at 12:01 -0600, m0smith wrote: Also, extracting a method woutld be very useful. Good lord that sounds like dental work. :) What exactly is method extraction? Raul -- I am, truly and sincerely, your friend and well-wisher, m0smith http://www.topoged.com
Re: [jde] Re: refactoring in jdee
Raul == Raul Acevedo [EMAIL PROTECTED] writes: Raul On Thu, 2004-09-30 at 13:58 -0400, Matt Kurjanowicz wrote: The ability to change class names as well would be awesome :) Raul Yes, that would be cool also. In terms of priority, I'd Raul rather see variable and method refactoring first, since that's Raul a bit more common. Raul With jde-usages in place, adding this to JDEE would be one of Raul the last major steps towards it being as full featured as Raul commercial IDEs. :) Method push up, and pull down would be good as well. Using something like jrefactory would be another option. However, it regenerates the refactored classes entirely, which is a bit of a pain, as it reformats the whole class. Cheers Phil
RE: refactoring in jdee
Another tool to consider is FreeFactor. It is in SourceForge, and it is already integrated with Emacs. It is still alpha, but is a good start for a true refactoring tool. http://sourceforge.net/projects/freefactor. A true refactoring tool needs access to the full syntactic tree of the source code - not just method signatures, but also method bodies. Does semantic support that? How about jde-usages?
RE: refactoring in jdee
I think this might be a problem for refactoring support, as you have to manipulate the source code on the abstract syntax tree level - a refactoring is usually implemented by applying a transformation to the AST, then generating code from the transformed tree or affected tree section (for all the files affected). Since you have to correlate the source code with the AST, I don't think that the byte-code would have enough information (maybe it has with the line numbers from the debug information, not sure). Maybe for some simple refactorings it would be sufficient, but for example for extract method, the input to the refactoring is a region in the source code - not a symbol name, but a sequencial group of lines. One would have to be able to map that back to the structure created from the byte-code. The documentation of CEDET (http://cedet.sourceforge.net/semantic.shtml) describes the following among the new features of the Semantic 2.0 package: Bison ported to Emacs David Ponce has ported Bison to Emacs Lisp. Languages supported via the new wisent parser will run faster. New languages will be easier to support as you can run a handy script to port directly from .y sources. Maybe the new parser could provide the more advanced data structures required to support refactoring. -Original Message- From: Suraj Acharya [mailto:[EMAIL PROTECTED] Sent: Friday, October 01, 2004 1:10 PM To: Nascif Abousalh-Neto Cc: [EMAIL PROTECTED] Subject: Re: refactoring in jdee jde-usages doesn't parse any source at all, it only looks at byte-code from classes in jde-global-classpath. Suraj On Fri, 1 Oct 2004 12:36:57 -0400, Nascif Abousalh-Neto [EMAIL PROTECTED] wrote: Another tool to consider is FreeFactor. It is in SourceForge, and it is already integrated with Emacs. It is still alpha, but is a good start for a true refactoring tool. http://sourceforge.net/projects/freefactor. A true refactoring tool needs access to the full syntactic tree of the source code - not just method signatures, but also method bodies. Does semantic support that? How about jde-usages?
Re: refactoring in jdee
On Thu, 2004-09-30 at 13:50 -0400, Paul Kinnucan wrote: My plan originally was to use xref as a basis for factoring commands. Now it appears that jde-usages might be a better basis. I need input on what kind of factoring commands users want. I think just being able to refactor variable and method name changes would be awesome. Raul
Re: refactoring in jdee
The ability to change class names as well would be awesome :) -Matt Kurjanowicz On Thu, 30 Sep 2004 10:54:50 -0700, Raul Acevedo [EMAIL PROTECTED] wrote: On Thu, 2004-09-30 at 13:50 -0400, Paul Kinnucan wrote: My plan originally was to use xref as a basis for factoring commands. Now it appears that jde-usages might be a better basis. I need input on what kind of factoring commands users want. I think just being able to refactor variable and method name changes would be awesome. Raul -- Matthew Kurjanowicz [EMAIL PROTECTED] The Readme Plugin http://projassist.sourceforge.net/readme-plugin/ The Projassist Project * Making Bug-Tracking Easy * http://projassist.sourceforge.net/
Re: refactoring in jdee
Raul Acevedo writes: On Thu, 2004-09-30 at 13:50 -0400, Paul Kinnucan wrote: My plan originally was to use xref as a basis for factoring commands. Now it appears that jde-usages might be a better basis. I need input on what kind of factoring commands users want. I think just being able to refactor variable and method name changes would be awesome. That should be fairly straight forward, using jde-usages as a basis. Paul
Re: refactoring in jdee
Also, extracting a method woutld be very useful. On Thu, 30 Sep 2004 10:54:50 -0700, Raul Acevedo [EMAIL PROTECTED] wrote: On Thu, 2004-09-30 at 13:50 -0400, Paul Kinnucan wrote: My plan originally was to use xref as a basis for factoring commands. Now it appears that jde-usages might be a better basis. I need input on what kind of factoring commands users want. I think just being able to refactor variable and method name changes would be awesome. Raul -- I am, truly and sincerely, your friend and well-wisher, m0smith http://www.topoged.com
Re: [jde] Re: refactoring in jdee
On Thu, 2004-09-30 at 13:58 -0400, Matt Kurjanowicz wrote: The ability to change class names as well would be awesome :) Yes, that would be cool also. In terms of priority, I'd rather see variable and method refactoring first, since that's a bit more common. With jde-usages in place, adding this to JDEE would be one of the last major steps towards it being as full featured as commercial IDEs. :) Raul
Re: refactoring in jdee
On Thu, 2004-09-30 at 12:01 -0600, m0smith wrote: Also, extracting a method woutld be very useful. Good lord that sounds like dental work. :) What exactly is method extraction? Raul
RE: refactoring in jdee
I guess we don't have to list each type of refactoring. We could get the readymade list from Eclipse or IDEA and then prioritize the list. Another cool thing in these IDEs is a notion of Quick Fixes, auto naming of local variables etc. Here are the links: Eclipse: Refactoring: http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse.jdt.doc.user /reference/ref-menu-refactor.htm Quick Fix: http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse.jdt.doc.user /concepts/cquickfix.htm IDEA: Refactoring: http://www.jetbrains.com/idea/docs/help/refactoring/ Intention Actions: http://www.jetbrains.com/idea/docs/help/editing/intentionactions.html ala Quick Fixes Regards, Sandip -Original Message- From: Paul Kinnucan [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 10:51 AM To: Raul Acevedo Cc: [EMAIL PROTECTED] Subject: refactoring in jdee Raul Acevedo writes: I know this question comes up at least once a year. I figure it's about time to ask again, in case new tools have come up. How do you do refactoring in Emacs/JDEE? Are there plans to include refactoring into JDEE at some point? My plan originally was to use xref as a basis for factoring commands. Now it appears that jde-usages might be a better basis. I need input on what kind of factoring commands users want. Paul
Re: refactoring in jdee
Also, as long as we're writing down our Christmas wish-lists :) (it's a long list, and I certainly don't expect even a fraction of these to be done any time soon, if ever): 1) moving methods (both static and non-static) and static fields between classes 2) changing method signatures 3) making a non-static method static 4) extracting interfaces and abstract super-classes from a concrete class 5) change declaration and associated assignment by method-invocation to use interfaces/abstract classes where possible 6) extract a method from a block of code 7) change local variable to class-level field 8) extract a constant 9) renaming and moving packages 10) replacing sequence of constants with a type-safe enumeration class 11) replacing a temporary variable with a query-method 12) in-lining a temporary variable 13) hiding delegated classes 14) removing the middle-man to a delegated class 15) replace fields with separate value-object (bean) class 16) replace method with delegated method-class 17) change inheritance to composition 18) introduce factory-class from a constructor Thanks!!! Erik On Thu, 30 Sep 2004, m0smith wrote: Also, extracting a method woutld be very useful. On Thu, 30 Sep 2004 10:54:50 -0700, Raul Acevedo [EMAIL PROTECTED] wrote: On Thu, 2004-09-30 at 13:50 -0400, Paul Kinnucan wrote: My plan originally was to use xref as a basis for factoring commands. Now it appears that jde-usages might be a better basis. I need input on what kind of factoring commands users want. I think just being able to refactor variable and method name changes would be awesome. Raul -- I am, truly and sincerely, your friend and well-wisher, m0smith http://www.topoged.com
Re: refactoring in jdee
I see two ways of approaching getting some refactoring functionality in JDE: 1) Use the parse information from semantic with perhaps a semanticdb backend for jar and class files using jde-usages. Semantic didn't parse java methd bodies when I last checked so this restricts the kinds of refactoring we can do. This is probably the right way to do refactoring but it will take a lot of time before we can do all the refactorings other IDEs provide. 2) Use an external refactoring tool to do the heavy lifting. I've spent some time looking at jrefactory which seems to be frequntly updated and was designed with the object being plugged into a IDE. All the IDEs it is being used with are written in java so I'm not sure how well it will work for us. The refactoring libraries from the eclise project are another option but they seem to be very tightly integrated into their IDE. Here are a list of refactoring operations that jrefactory says it can do : http://jrefactory.sourceforge.net/csrefactory.html I use Extract Method and Rename Method the most. You can use jde-usages as a start to rename a method. I even tried to automate it using a macro but discarded it because jde-usages can only tell you the line on which the method call exists, so if there is another method with the same name called on the line, or of it method name is mentioned in a comment its hard to figure out automatically where the method call is. Extract method, where the IDE converts some code into a method and guess the inputs and outputs, seems much harder. I'm not suggesting that we should choose one of the two approaches, but that we should do both - initially do simpler refactorings using semantic and punt the more complicated global ones to an external tool while we figure out how to do them in emacs. Suraj On Thu, 30 Sep 2004 13:50:45 -0400, Paul Kinnucan [EMAIL PROTECTED] wrote: Raul Acevedo writes: I know this question comes up at least once a year. I figure it's about time to ask again, in case new tools have come up. How do you do refactoring in Emacs/JDEE? Are there plans to include refactoring into JDEE at some point? My plan originally was to use xref as a basis for factoring commands. Now it appears that jde-usages might be a better basis. I need input on what kind of factoring commands users want. Paul
RE: refactoring in jdee
Chitale, Sandip V writes: I guess we don't have to list each type of refactoring. We could get the readymade list from Eclipse or IDEA and then prioritize the list. Another cool thing in these IDEs is a notion of Quick Fixes, auto naming of local variables etc. How does autonaming of local variables work? Paul Here are the links: Eclipse: Refactoring: http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse.jdt.doc.user /reference/ref-menu-refactor.htm Quick Fix: http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse.jdt.doc.user /concepts/cquickfix.htm IDEA: Refactoring: http://www.jetbrains.com/idea/docs/help/refactoring/ Intention Actions: http://www.jetbrains.com/idea/docs/help/editing/intentionactions.html ala Quick Fixes Regards, Sandip -Original Message- From: Paul Kinnucan [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 10:51 AM To: Raul Acevedo Cc: [EMAIL PROTECTED] Subject: refactoring in jdee Raul Acevedo writes: I know this question comes up at least once a year. I figure it's about time to ask again, in case new tools have come up. How do you do refactoring in Emacs/JDEE? Are there plans to include refactoring into JDEE at some point? My plan originally was to use xref as a basis for factoring commands. Now it appears that jde-usages might be a better basis. I need input on what kind of factoring commands users want. Paul
RE: refactoring in jdee
For example: TemplateManager tem| with cursor at | if you invoke the completion key sequence Eclipse completes it to: TemplateManager templateManager| Similarly: TemplateManager man| with cursor at | if you invoke the completion key sequence Eclipse completes it to: TemplateManager manager| This works with fields also: private TemplateManager _tem| with cursor at | if you invoke the completion key sequence Eclipse completes it to: private TemplateManager _templateManager| That is to say Eclipse takes into account the '_' prefix naming convention. I know this is an example of quick fix and not refactoring. This could be easily implemented in Emacs lisp + some help from Semantic. Sandip -Original Message- From: Paul Kinnucan [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 12:39 PM To: Chitale, Sandip V Cc: Paul Kinnucan; [EMAIL PROTECTED] Subject: RE: refactoring in jdee Chitale, Sandip V writes: I guess we don't have to list each type of refactoring. We could get the readymade list from Eclipse or IDEA and then prioritize the list. Another cool thing in these IDEs is a notion of Quick Fixes, auto naming of local variables etc. How does autonaming of local variables work? Paul Here are the links: Eclipse: Refactoring: http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse.jdt.doc.user /reference/ref-menu-refactor.htm Quick Fix: http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse.jdt.doc.user /concepts/cquickfix.htm IDEA: Refactoring: http://www.jetbrains.com/idea/docs/help/refactoring/ Intention Actions: http://www.jetbrains.com/idea/docs/help/editing/intentionactions.html ala Quick Fixes Regards, Sandip -Original Message- From: Paul Kinnucan [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 10:51 AM To: Raul Acevedo Cc: [EMAIL PROTECTED] Subject: refactoring in jdee Raul Acevedo writes: I know this question comes up at least once a year. I figure it's about time to ask again, in case new tools have come up. How do you do refactoring in Emacs/JDEE? Are there plans to include refactoring into JDEE at some point? My plan originally was to use xref as a basis for factoring commands. Now it appears that jde-usages might be a better basis. I need input on what kind of factoring commands users want. Paul