Results 1 to 6 of 6
- 10-27-2011, 06:43 AM #1
Member
- Join Date
- Oct 2011
- Posts
- 3
- Rep Power
- 0
- 10-27-2011, 07:01 AM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
Re: Regular expession that matchs a Java Method declaration and body
Have you an idea?
What says google?
Regex to match a Java method signature - Stack Overflow
Regex that Will Match a Java Method Declaration - Stack Overflow
The method must have a return value?
That could be be complicated (generics and so on) ....Java regex for a method signature with a Collection<GenericType> return type - Stack Overflow
Why do you need that?
- 10-27-2011, 07:14 AM #3
Member
- Join Date
- Oct 2011
- Posts
- 3
- Rep Power
- 0
Re: Regular expession that matchs a Java Method declaration and body
thanks for the reply. I have already checked out the links that you'd sent to me. I got some ideas but i am still not able to make out the pattern to match the methods. yeah, it might have return value. I need this for part of my testing approach's implementation, where it should automatically extract methods.
- 10-27-2011, 07:25 AM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
Re: Regular expession that matchs a Java Method declaration and body
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 10-27-2011, 07:36 AM #5
Member
- Join Date
- Oct 2011
- Posts
- 3
- Rep Power
- 0
Re: Regular expession that matchs a Java Method declaration and body
thanks Jos! you are right, but i believe it still can be done. The only matter is how to use a proper combination of Regular Expressions Constructs to come up with the desired pattern. Anyway, what would be your idea (other than regex) in order to help automated extracting of methods from a Java class?
- 10-27-2011, 07:47 AM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
Re: Regular expession that matchs a Java Method declaration and body
Belief only leads to religion and we all know the consequences of that ;-) I'd try to use javac itself for the task; it has a complete API (see tihe documentation); you can make it parse source text and not generate class files; the AST (Abstract Syntax Tree) can be read by the application too, so you can get the method definitions out of the text).
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
invalid method declaration
By mcfer in forum New To JavaReplies: 8Last Post: 09-22-2012, 01:26 PM -
Please help me fix this error: invalid method declaration
By amrmb09 in forum Java AppletsReplies: 1Last Post: 10-17-2011, 11:45 AM -
error: Missing method, body, or declare abstract public static void main
By MBD in forum New To JavaReplies: 2Last Post: 09-27-2011, 03:59 PM -
invalid method declaration error
By bsarules in forum Java AppletsReplies: 7Last Post: 05-25-2010, 06:06 PM -
Error: invalid method declaration
By silvia in forum New To JavaReplies: 1Last Post: 07-27-2007, 12:10 PM


2Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks