可能在Lint中的错误

我试图做一个自定义的皮棉,我基本上工作,但报告失败时,我试图报告一个PsiElement:

private void checkClassAnnotations(JavaContext context, PsiClass psiClass, UCallExpression node) { for (PsiField psiField : uClass.getAllFields()) { PsiAnnotation[] allAnnotations = context.getEvaluator().getAllAnnotations(psiField, true); Set<String> annotations = new HashSet<>(); for (PsiAnnotation allAnnotation : allAnnotations) { annotations.add(allAnnotation.getQualifiedName()); } if (!annotations.contains("com.google.gson.annotations.SerializedName")) { context.report(ISSUE, context.getLocation(psiField), "The field \"" + psiField.getName() + "\" is not annotated with SerializedName: **Not annotated**"); } } } 

该代码的作品,但是当我尝试报告的PsiField Android Studio的位置不会突出显示该行。 不过,当我运行lint时,我可以看到HTML报告中突出显示的行,但只能看到Java。

我注意到,如果我向UcallExpression的位置报告,Android Studio在Kotlin和Java中正确突出显示了这一行,但这不是正确的报告地点。 我希望这个lint可以用于Kotlin和Java,我的猜测是Android Studio需要一个Uast对象来正确报告,有没有办法将一个PsiField转换为UField