Structural search question
I did a global search and replace in my project
s/StringBuffer/StringBuilder/ But before I checked everything in it
occurred to me that my search might have changed the semantics of my
program (duh) ... e.g. if I change the signature of a method that I was
overriding.
Is there any way I can do a structural search to find all method
definitions in which at least one parameter is of type
java.lang.StringBuilder? It seems that in copying the "Methods of class"
template I can do a search for methods that match certain criteria, but
I can only actually get the filter on Return Type to work, otherwise if
I set a Text Constraint on ParameterType in the template, it returns me
all methods for which all parameters have type StringBuilder. (If I want
to exclude methods with no parameters I have to put an Occurrence Count
> 0 for Parameter which is a bit strange, why can't I put it on
ParameterType?)
I don't really understand how Structural Search works - am I using it
properly and it's buggy, or am I not using it properly, or is it not
possible to make it do what I want?
R
PS This is in Irida build 3235 but I have the same problems in 4.5
请先登录再写评论。
Hi,
If you want to find methods that have at least one parameter type of
e.g. StringBuilder, then you need add parameter declarations (with
0..max_value occurences) before and after the one of interest
E.g.
class $Class$ {
$ReturnType$ $MethodName$($DummyParameterType$ $DummyParameter$,
$ParameterType$ $Parameter$, $DummyParameterType2$ $DummyParameter2$);
}
Robert Gibson wrote:
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Thanks Maxim - where do I put the occurrence constraint?
DummyParameterType? DummyParameter? Both?
R
Maxim Mossienko wrote:
>> I did a global search and replace in my project
>> s/StringBuffer/StringBuilder/ But before I checked everything in it
>> occurred to me that my search might have changed the semantics of my
>> program (duh) ... e.g. if I change the signature of a method that I
>> was overriding.
>>
>> Is there any way I can do a structural search to find all method
>> definitions in which at least one parameter is of type
>> java.lang.StringBuilder? It seems that in copying the "Methods of
>> class" template I can do a search for methods that match certain
>> criteria, but I can only actually get the filter on Return Type to
>> work, otherwise if I set a Text Constraint on ParameterType in the
>> template, it returns me all methods for which all parameters have type
>> StringBuilder. (If I want to exclude methods with no parameters I have
>> to put an Occurrence Count > 0 for Parameter which is a bit strange,
>> why can't I put it on ParameterType?)
>>
>> I don't really understand how Structural Search works - am I using it
>> properly and it's buggy, or am I not using it properly, or is it not
>> possible to make it do what I want?
>>
>> R
>> PS This is in Irida build 3235 but I have the same problems in 4.5
Hi,
Press Edit variables, enter
0 .. max value in Occurence count for
$DummyParameterType$ $DummyParameter$, $DummyParameterType2$
$DummyParameter2$
Robert Gibson wrote:
>> Hi,
>>
>> If you want to find methods that have at least one parameter type of
>> e.g. StringBuilder, then you need add parameter declarations (with
>> 0..max_value occurences) before and after the one of interest
>>
>> E.g.
>>
>> class $Class$ {
>> $ReturnType$ $MethodName$($DummyParameterType$ $DummyParameter$,
>> $ParameterType$ $Parameter$, $DummyParameterType2$ $DummyParameter2$);
>> }
>>
>> Robert Gibson wrote:
>>
>>> I did a global search and replace in my project
>>> s/StringBuffer/StringBuilder/ But before I checked everything in it
>>> occurred to me that my search might have changed the semantics of my
>>> program (duh) ... e.g. if I change the signature of a method that I
>>> was overriding.
>>>
>>> Is there any way I can do a structural search to find all method
>>> definitions in which at least one parameter is of type
>>> java.lang.StringBuilder? It seems that in copying the "Methods of
>>> class" template I can do a search for methods that match certain
>>> criteria, but I can only actually get the filter on Return Type to
>>> work, otherwise if I set a Text Constraint on ParameterType in the
>>> template, it returns me all methods for which all parameters have
>>> type StringBuilder. (If I want to exclude methods with no parameters
>>> I have to put an Occurrence Count > 0 for Parameter which is a bit
>>> strange, why can't I put it on ParameterType?)
>>>
>>> I don't really understand how Structural Search works - am I using it
>>> properly and it's buggy, or am I not using it properly, or is it not
>>> possible to make it do what I want?
>>>
>>> R
>>> PS This is in Irida build 3235 but I have the same problems in 4.5
>>
>>
>>
>>
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Got it, thanks.
Maxim Mossienko wrote:
>> Thanks Maxim - where do I put the occurrence constraint?
>> DummyParameterType? DummyParameter? Both?
>>
>> R
>>
>> Maxim Mossienko wrote:
>>
>>> Hi,
>>>
>>> If you want to find methods that have at least one parameter type of
>>> e.g. StringBuilder, then you need add parameter declarations (with
>>> 0..max_value occurences) before and after the one of interest
>>>
>>> E.g.
>>>
>>> class $Class$ {
>>> $ReturnType$ $MethodName$($DummyParameterType$ $DummyParameter$,
>>> $ParameterType$ $Parameter$, $DummyParameterType2$ $DummyParameter2$);
>>> }
>>>
>>> Robert Gibson wrote:
>>>
>>>> I did a global search and replace in my project
>>>> s/StringBuffer/StringBuilder/ But before I checked everything in it
>>>> occurred to me that my search might have changed the semantics of my
>>>> program (duh) ... e.g. if I change the signature of a method that I
>>>> was overriding.
>>>>
>>>> Is there any way I can do a structural search to find all method
>>>> definitions in which at least one parameter is of type
>>>> java.lang.StringBuilder? It seems that in copying the "Methods of
>>>> class" template I can do a search for methods that match certain
>>>> criteria, but I can only actually get the filter on Return Type to
>>>> work, otherwise if I set a Text Constraint on ParameterType in the
>>>> template, it returns me all methods for which all parameters have
>>>> type StringBuilder. (If I want to exclude methods with no parameters
>>>> I have to put an Occurrence Count > 0 for Parameter which is a bit
>>>> strange, why can't I put it on ParameterType?)
>>>>
>>>> I don't really understand how Structural Search works - am I using
>>>> it properly and it's buggy, or am I not using it properly, or is it
>>>> not possible to make it do what I want?
>>>>
>>>> R
>>>> PS This is in Irida build 3235 but I have the same problems in 4.5
>>>
>>>
>>>
>>>
>>>