Skip to content

IntelliJ inspection catching Class#fun in Java and Kotlin code

Notifications You must be signed in to change notification settings

akozlova/test_problem

Repository files navigation

Test problem

Write inspection to detect pack.ages.Class.fun

Java inspection

  1. visitReferenceExpression looks for a PsiReferenceExpression where the lastChild name is fun.
  2. Then it checks whether expression.resolve().stub.parentStub corresponds to pack.ages.Class

Kotlin inspection (obsolete)

A AbstractUastNonRecursiveVisitor looking for the following UExpression node is setup :

  1. sourcePsi is a REFERENCE_EXPRESSION corresponding to invokeLater
  2. the "parent" sourcePsi?.parent?.parent?.firstChild?.lastChild is a REFERENCE_EXPRESSION corresponding to SwingUtilities

Kotlin PSI tree

About

IntelliJ inspection catching Class#fun in Java and Kotlin code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published