in src/main/kotlin/com/netflix/dgs/plugin/hints/DgsComponentInspector.kt [37:66]
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
return UastVisitorAdapter(object : AbstractUastNonRecursiveVisitor() {
@Suppress("UElementAsPsi")
override fun visitClass(node: UClass): Boolean {
val dgsService = node.project.getService(DgsService::class.java)
if(!dgsService.isDgsProject(node.project)) {
return false
}
val hasDgsComponentAnnotation: Boolean =
node.javaPsi.hasAnnotation("com.netflix.graphql.dgs.DgsComponent")
if (Arrays.stream(node.methods)
.anyMatch { m ->
DgsConstants.dgsAnnotations.stream().anyMatch { annotation -> m.javaPsi.hasAnnotation(annotation) }
} && !hasDgsComponentAnnotation
) {
node.identifyingElement?.let {
holder.registerProblem(
it,
MyBundle.getMessage("dgs.inspection.missing.component.annotation"),
ProblemHighlightType.WARNING,
DgsComponentQuickfix
)
}
return true
}
return false
}
}, false)
}