override fun visitMethod()

in src/main/kotlin/com/netflix/dgs/plugin/hints/DgsFieldSimplifyingInspector.kt [39:65]


            override fun visitMethod(node: UMethod): Boolean {
                val dgsService = node.project.getService(DgsService::class.java)
                if(!dgsService.isDgsProject(node.project)) {
                    return false
                }

                val psiAnnotation = node.annotations.find { DgsDataFetcher.isDataFetcherAnnotation(it) }
                if (psiAnnotation != null) {
                    val fieldAttribute = psiAnnotation.findAttribute("field")
                    if (fieldAttribute != null) {
                        val fieldValue = (fieldAttribute.attributeValue as JvmAnnotationConstantValue?)?.constantValue
                        if (fieldValue == node.name) {
                            val message = MyBundle.getMessage(
                                "dgs.inspection.fieldvalue.simplify"
                            )
                            holder.registerProblem(
                                psiAnnotation.toUElement()?.sourcePsi!!,
                                message,
                                ProblemHighlightType.WEAK_WARNING,
                                DgsFieldNameQuickFix()
                            )
                        }
                    }
                }

                return true
            }