Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Proper use of Strings to create SearchPatterns(Using the JavaSearch Engine)
Proper use of Strings to create SearchPatterns [message #520354] Thu, 11 March 2010 23:53 Go to next message
Eclipse UserFriend
Hello,

Issue: How to properly construct search strings so that
org.eclipse.jdt.core.search.SearchPattern#createPattern(String str .....) 
gives the expected results.

Details:

I have the search engine infrastructure up and working. My problem is with creating properly formatted strings that the search engine understands.

The javadoc for org.eclipse.jdt.core.search.SearchPattern states:

Method patterns have the following syntax:

[declaringType '.'] ['<' typeArguments '>'] methodName ['(' parameterTypes ')'] [returnType]

With some samples:

java.lang.Runnable.run() void
main(*)


Problem:

How to you specify methods with 2 or more arguments? For instance if I want to find references that call:

Foo.bar(String, Integer)

or

List<String> ls = ....
Foo.Bar(ls) // a method that takes a typed collection.


Thanks.



[Updated on: Thu, 11 March 2010 23:57] by Moderator

Re: Proper use of Strings to create SearchPatterns [message #521657 is a reply to message #520354] Thu, 18 March 2010 08:33 Go to previous messageGo to next message
Eclipse UserFriend
Method pattern as
Foo.bar(String, Integer) or Foo.Bar(List<String>) should do.
Re: Proper use of Strings to create SearchPatterns [message #521789 is a reply to message #521657] Thu, 18 March 2010 14:04 Go to previous messageGo to next message
Eclipse UserFriend
Sadly trying out:

Foo.bar(String, Integer) or Foo.Bar(List<String>)

was the first thing I attempted. Neither pattern achieves the desired result.
Re: Proper use of Strings to create SearchPatterns [message #521871 is a reply to message #520354] Thu, 18 March 2010 23:37 Go to previous message
Eclipse UserFriend
It should work. Can you give here the implementation you were using?
Previous Topic:What is the point of running a j2ee server adapter inside eclipse as opposed to
Next Topic:Eclipse is always locked [High CPU & RAM usage]
Goto Forum:
  


Current Time: Wed Mar 26 11:41:43 EDT 2025

Powered by FUDForum. Page generated in 0.03701 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top