From ea322017a04b23c227792e1f0a411dfd84bbb268 Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Thu, 24 Jan 2019 00:11:40 +0300 Subject: [PATCH] [groovy] spock: don't feed synthetic `get_` into processor, there is a field `_` in `spock.lang.Specification` already --- .../ext/spock/SpockMemberContributor.java | 34 ++----------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/ext/spock/SpockMemberContributor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/ext/spock/SpockMemberContributor.java index 84e8c924aae7..f13ca4ff80b3 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/ext/spock/SpockMemberContributor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/ext/spock/SpockMemberContributor.java @@ -1,18 +1,4 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.ext.spock; import com.intellij.psi.PsiClass; @@ -23,10 +9,7 @@ import com.intellij.psi.scope.ElementClassHint; import com.intellij.psi.scope.PsiScopeProcessor; import com.intellij.psi.util.PsiTreeUtil; import org.jetbrains.annotations.NotNull; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression; import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod; -import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightMethodBuilder; -import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils; import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor; import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil; @@ -61,23 +44,10 @@ public class SpockMemberContributor extends NonCodeMembersContributor { else { SpockVariableDescriptor spockVar = cachedValue.get(nameHint); if (spockVar != null && spockVar.getNavigationElement() != place) { - if (!processor.execute(spockVar.getVariable(), state)) return; + processor.execute(spockVar.getVariable(), state); } } } - - if (ResolveUtil.shouldProcessMethods(classHint)) { - String nameHint = ResolveUtil.getNameHint(processor); - if (nameHint == null) { - nameHint = place instanceof GrReferenceExpression ? ((GrReferenceExpression)place).getReferenceName() : null; - if (nameHint != null) nameHint = GroovyPropertyUtils.getGetterNameNonBoolean(nameHint); - } - if ("get_".equals(nameHint)) { - GrLightMethodBuilder m = new GrLightMethodBuilder(aClass.getManager(), "get_"); - m.setReturnType(null); - if (!processor.execute(m, state)) return; - } - } } @Override