Structural search: matching methods with specific access scope

I'd like to find all methods that have some annotation.
This is easy using SSR, there's even an existing template for that.

I didn't figure out these two things:

  • How do I limit the results to methods with package-level access?
  • Is it possible to limit the results to all non-public methods?


Thanks,
-tt

3 comments
Comment actions Permalink

You might set Groovy script constraint for method name like
'!__context__.modifierList.hasModifierProperty("public")'.
There is also special annotation for package level visibility, it is
present in predefined templates

Taras Tielkes wrote:

I'd like to find all methods that have some annotation.

This is easy using SSR, there's even an existing template for that.

I didn't figure out these two things:

  • How do I limit the results to methods with package-level access?

  • Is it possible to limit the results to all non-public methods?


Thanks,

-tt

---
Original message URL:
http://www.jetbrains.net/devnet/message/5227604#5227604



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

0
Comment actions Permalink

Hi Maxim,

Thanks for the suggestion, I've found @Modifier("packageLocal"), and it works perfectly.

I'm using the 8.0 release build, and when performing a simple search for annotated methods, I get 2 hits for each occurrence. Is this a known problem, or should I file a new ticket?

The query I'm running is a simple as this:
----

class $Class$ {
  @$Annotation$( )
  $MethodType$ $MethodName$($ParameterType$ $ParameterName$);
}
----
$Annotation$ is set to some specific type, $MethodName$ is target of search.



 


Regards,
Taras

0
Comment actions Permalink

Seems like a bug.

Taras Tielkes wrote:

Hi Maxim,

Thanks for the suggestion, I've found @Modifier("packageLocal"), and it works perfectly.

I'm using the 8.0 release build, and when performing a simple search for annotated methods, I get 2 hits for each occurrence. Is this a known problem, or should I file a new ticket?

The query I'm running is a simple as this:
----

class $Class$ {
@$Annotation$( )
$MethodType$ $MethodName$($ParameterType$ $ParameterName$);
}
----
$Annotation$ is set to some specific type, $MethodName$ is target of search.





Regards,
Taras

---
Original message URL: http://www.jetbrains.net/devnet/message/5227680#5227680



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

0

Please sign in to leave a comment.