Convert method to closure intention fix
authorunknown <Maxim.Medvedev@.Labs.IntelliJ.Net>
Thu, 1 Oct 2009 11:07:19 +0000 (15:07 +0400)
committerMaxim Medvedev <maxim.medvedev@jetbrains.com>
Thu, 1 Oct 2009 14:08:48 +0000 (18:08 +0400)
plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertMethodToClosureIntention.java

index 55ff3eec9cc3149e0350dd29f842bbc99b67eac5..f3a494db1f6fbb848672219a023632bb399d0466 100644 (file)
@@ -42,7 +42,11 @@ public class ConvertMethodToClosureIntention extends Intention {
   protected void processIntention(@NotNull PsiElement element) throws IncorrectOperationException {
     final GrMethod method = (GrMethod)element;
     StringBuilder builder = new StringBuilder(method.getTextLength());
-    builder.append(method.getModifierList().getText()).append(' ');
+    String modifiers = method.getModifierList().getText();
+    if (modifiers.trim().length() == 0) {
+      modifiers = "def";
+    }
+    builder.append(modifiers).append(' ');
     builder.append(method.getName()).append("={");
     builder.append(method.getParameterList().getText()).append(" ->");
     final GrOpenBlock block = method.getBlock();