structural search: array as an argument to a method.

I am trying to find all method invocations of a method called "prorate" that takes a BigDecimal array as one of it's arguments. Couldn't figure out a way to do this. This is what I tried as the search string:

$Instance$.$MethodCall$($Param1$,$Param2$,$Param3$)

where:
$MethodCall$ has a text/regexp constraint "prorate"
$Param1$ and $Param3$ have a count between 0 to 10000
$Param2$ has a type constraint "java.math.BigDecimal[]"

But this doesn't work - what am I doing wrong? Is there a better way of doing this?

4 comments
Comment actions Permalink

Hi,

$Param2$ should have expression type constraint set,
besides, [] should be quoted.

rohith wrote:

I am trying to find all method invocations of a method called "prorate" that takes a BigDecimal array as one of it's arguments. Couldn't figure out a way to do this. This is what I tried as the search string:

$Instance$.$MethodCall$($Param1$,$Param2$,$Param3$)

where:
$MethodCall$ has a text/regexp constraint "prorate"
$Param1$ and $Param3$ have a count between 0 to 10000
$Param2$ has a type constraint "java.math.BigDecimal[]"

But this doesn't work - what am I doing wrong? Is there a better way of doing this?



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Hi Maxim,
Thank you for that real fast reply! I tried out what you suggested, but I think I am missing something.

you suggested:
$Param2$ should have expression type constraint set,
besides, [] should be quoted.


In Edit Constraint -> Param2 -> Expression constraints -> "Text / regexp for java expression type" I have "java.math.BigDecimal\[\]". Is that what you meant? Or is there a different way of escaping the quoting things? If so, it still doesn't work for me. I've tried the following variations for "java.math.BigDecimal[]":

"java.math.BigDecimal[]"
"BigDecimal[]"
java.math.BigDecimal[]
BigDecimal[]
java.math.BigDecimal\[\]
BigDecimal\[\]
"java.math.BigDecimal\[\]"
"BigDecimal\[\]"

None of them seem to work.

Thanks,
Rohith.

0
Comment actions Permalink

Ok,

please file the JIRA issue with small fragment of code that was not found.

rohith wrote:

Hi Maxim,
Thank you for that real fast reply! I tried out what you suggested, but I think I am missing something.

>>you suggested:
>>$Param2$ should have expression type constraint set,
>> besides, [] should be quoted.


In Edit Constraint -> Param2 -> Expression constraints -> "Text / regexp for java expression type" I have "java.math.BigDecimal\[\]". Is that what you meant? Or is there a different way of escaping the quoting things? If so, it still doesn't work for me. I've tried the following variations for "java.math.BigDecimal[]":

"java.math.BigDecimal[]"
"BigDecimal[]"
java.math.BigDecimal[]
BigDecimal[]
java.math.BigDecimal\[\]
BigDecimal\[\]
"java.math.BigDecimal\[\]"
"BigDecimal\[\]"

None of them seem to work.

Thanks,
Rohith.



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Ok,

please file the JIRA issue with small fragment of
code that was not found.


Hi Maxim,
I've filed JIRA issue, here is the URL:
http://www.jetbrains.net/jira/browse/IDEA-1406

Thanks,
Rohith.

0

Please sign in to leave a comment.