IDEADEV-40940: Groovy 1​.​7: Throwable at GrTypeDefinitionImpl​.​addMemberDeclaration...
authorMaxim Medvedev <maxim.medvedev@jetbrains.com>
Tue, 17 Nov 2009 16:45:22 +0000 (19:45 +0300)
committerMaxim Medvedev <maxim.medvedev@jetbrains.com>
Tue, 17 Nov 2009 16:45:22 +0000 (19:45 +0300)
plugins/groovy/src/org/jetbrains/plugins/groovy/overrideImplement/GroovyOverrideImplementUtil.java

index 4a3f9c879807924f110ce2d4969ffc36603049f1..51f0c2b50b9b0b02f232e1bc2a32ebb28ec7b939 100644 (file)
@@ -60,6 +60,9 @@ import java.util.Properties;
 public class GroovyOverrideImplementUtil {
   private static final Logger LOG = Logger.getInstance("org.jetbrains.plugins.groovy.overrideImplement.GroovyOverrideImplementUtil");
 
+  private GroovyOverrideImplementUtil() {
+  }
+
   public static void invokeOverrideImplement(final Project project, final Editor editor, final PsiFile file, boolean isImplement) {
     final int offset = editor.getCaretModel().getOffset();
 
@@ -159,13 +162,13 @@ public class GroovyOverrideImplementUtil {
               anchor = nextElement;
             }
 
-            aClass.addMemberDeclaration(result, anchor);
+            final GrMethod addedMethod = aClass.addMemberDeclaration(result, anchor);
 
-            PsiUtil.shortenReferences(result);
-              //[GenerateMembersUtil.positionCaret in unsuitable because method.getBody() returns null, it is neccesary use method.getBlock() instead.
+            PsiUtil.shortenReferences(addedMethod);
+              //[GenerateMembersUtil.positionCaret in unsuitable because method.getBody() returns null, it is necessary use method.getBlock() instead.
               //but it is impossible in common case]
 //            GenerateMembersUtil.positionCaret(editor, result, true);
-            positionCaret(editor, result);
+            positionCaret(editor, addedMethod);
           } catch (IncorrectOperationException e) {
             throw new RuntimeException(e);
           }