Where PsiDocComment is attached to PsiDocCommentOwner for Java AST?

Hello,
I found that Groovy AST and Java AST is different in place of javadoc(PsiDocComment) node position - for Groovy AST comment node is sibling withmethod(PsiDocCommentOwner).
Its clearly described by methods in org.jetbrains.plugins.groovy.lang.groovydoc.psi.impl.GrDocCommentUtil.
But in com.intellij.psi.impl.source.PsiMethodImpl#getDocComment comment is obtained directly from current AST tree of method.
I tried to find differences in pasesrs for groovy and java but didn't find any in case of comments.
Element types com.intellij.psi.impl.source.tree.JavaDocElementType#DOC_COMMENT and org.jetbrains.plugins.groovy.lang.groovydoc.parser.GroovyDocElementTypes#GROOVY_DOC_COMMENT are structurally the same.
And I didn't find any checking/addition of DOC_COMMENT in com.intellij.lang.java.parser.DeclarationParser where java class body is parsed.

Can someone point me to this difference/mechanism?

Thanks in advance!

Please sign in to leave a comment.