From 20c985bb4de736b70e73ff4af155a53a057592c7 Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Wed, 15 Feb 2017 12:33:12 +0300 Subject: [PATCH] [groovy] collect method info for original method if current is a mirror This change allows to add method infos for trait methods. --- .../plugins/groovy/extensions/GroovyMethodInfo.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/extensions/GroovyMethodInfo.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/extensions/GroovyMethodInfo.java index 39e71c86ea88..c6b53496e4e5 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/extensions/GroovyMethodInfo.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/extensions/GroovyMethodInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,10 +24,10 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall; +import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyNamesUtil; import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil; import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightMethodBuilder; import org.jetbrains.plugins.groovy.lang.resolve.ClosureMissingMethodContributor; -import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyNamesUtil; import org.jetbrains.plugins.groovy.util.FixedValuesReferenceProvider; import java.lang.reflect.Modifier; @@ -126,6 +126,13 @@ public class GroovyMethodInfo { if (methodKind instanceof String) { lightMethodInfos = getInfos(LIGHT_METHOD_INFOS, (String)methodKind, method); } + + if (method instanceof PsiMirrorElement) { + PsiElement prototype = ((PsiMirrorElement)method).getPrototype(); + if (prototype instanceof PsiMethod) { + method = (PsiMethod)prototype; + } + } List methodInfos = null;