Can this be done with a Structured Search?

I haven't had any luck trying to write a structured search that will
find all class instance variables that don't have either public or
private specified.

eg.

class SomeClass {

public String someString;
private Object _myObject;
int status; <---- i want this to become: public int status;
Object anObject; <----- i want this to become: public Object anObject;

public SomeClass() {}
}

I'm not sure if this can be done using a structured search.

If there is another way of doing this maybe?

Thanks

Peter

3 comments
Comment actions Permalink

Hi,

It is not possible right now, because empty access modifier is treated
as -any- access modifier, you can add JIRA request for this feature of SS.

Peter wrote:

I haven't had any luck trying to write a structured search that will
find all class instance variables that don't have either public or
private specified.

eg.

class SomeClass {

public String someString;
private Object _myObject;
int status; <---- i want this to become: public int status;
Object anObject; <----- i want this to become: public Object anObject;

public SomeClass() {}
}

I'm not sure if this can be done using a structured search.

If there is another way of doing this maybe?

Thanks

Peter



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

0
Comment actions Permalink

Hi Maxim,

Thanks for your response :)

Do you know if there is an inspection that i could use to find the same
thing? If i have to, i will use this inpsection and modify all
occurances manually.

Adding this feature request to JIRA :)

Thanks

Peter


Maxim Mossienko wrote:

Hi,

It is not possible right now, because empty access modifier is treated
as -any- access modifier, you can add JIRA request for this feature of SS.

Peter wrote:

>> I haven't had any luck trying to write a structured search that will
>> find all class instance variables that don't have either public or
>> private specified.
>>
>> eg.
>>
>> class SomeClass {
>> public String someString;
>> private Object _myObject;
>> int status; <---- i want this to become: public int status;
>> Object anObject; <----- i want this to become: public Object
>> anObject;
>>
>> public SomeClass() {}
>> }
>>
>> I'm not sure if this can be done using a structured search.
>>
>> If there is another way of doing this maybe?
>>
>> Thanks
>>
>> Peter


0
Comment actions Permalink

added http://www.jetbrains.net/jira/browse/IDEA-2295

Peter wrote:

I haven't had any luck trying to write a structured search that will
find all class instance variables that don't have either public or
private specified.

eg.

class SomeClass {

public String someString;
private Object _myObject;
int status; <---- i want this to become: public int status;
Object anObject; <----- i want this to become: public Object anObject;

public SomeClass() {}
}

I'm not sure if this can be done using a structured search.

If there is another way of doing this maybe?

Thanks

Peter

0

Please sign in to leave a comment.