From 2416310c50487dcb29d342e523c768fd5ea21908 Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Mon, 19 Aug 2013 14:47:50 +0400 Subject: [PATCH] return type of dynamic methods --- .../intentions/dynamic/elements/DMethodElement.java | 4 ++-- .../psi/impl/synthetic/GrDynamicImplicitMethod.java | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/elements/DMethodElement.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/elements/DMethodElement.java index c86109ed94aa..edf4bf6c0801 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/elements/DMethodElement.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/elements/DMethodElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 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. @@ -56,7 +56,7 @@ public class DMethodElement extends DItemElement { if (myImplicitMethod != null) return myImplicitMethod; Boolean aStatic = isStatic(); - myImplicitMethod = new GrDynamicImplicitMethod(manager, getName(), containingClassName, aStatic != null && aStatic.booleanValue(), myPairs); + myImplicitMethod = new GrDynamicImplicitMethod(manager, getName(), containingClassName, aStatic != null && aStatic.booleanValue(), myPairs, getType()); return myImplicitMethod; } } \ No newline at end of file diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrDynamicImplicitMethod.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrDynamicImplicitMethod.java index 0045c4cb0926..d0ef1ca2d10c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrDynamicImplicitMethod.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrDynamicImplicitMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 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. @@ -57,12 +57,14 @@ public class GrDynamicImplicitMethod extends GrLightMethodBuilder implements GrD private final String myContainingClassName; private final List myParamInfos; + private final String myReturnType; public GrDynamicImplicitMethod(PsiManager manager, String name, String containingClassName, boolean isStatic, - List paramInfos) { + List paramInfos, + String returnType) { super(manager, name); myContainingClassName = containingClassName; myParamInfos = paramInfos; @@ -75,6 +77,9 @@ public class GrDynamicImplicitMethod extends GrLightMethodBuilder implements GrD for (ParamInfo pair : paramInfos) { addParameter(pair.name, pair.type, false); } + + setReturnType(returnType, getResolveScope()); + myReturnType = returnType; } public String getContainingClassName() { @@ -95,7 +100,7 @@ public class GrDynamicImplicitMethod extends GrLightMethodBuilder implements GrD } public GrDynamicImplicitMethod copy() { - return new GrDynamicImplicitMethod(myManager, getName(), getContainingClassName(), hasModifierProperty(PsiModifier.STATIC), ContainerUtil.newArrayList(myParamInfos)); + return new GrDynamicImplicitMethod(myManager, getName(), getContainingClassName(), hasModifierProperty(PsiModifier.STATIC), ContainerUtil.newArrayList(myParamInfos), myReturnType); } public boolean isValid() {