IDEA-74565 Groovy: SpinAllocator$AllocatorExhaustedException at GroovyPsiElementFactoryImpl.createMethod() after invoking "Generate Getter and Setter" action several times

This commit is contained in:
Maxim Medvedev
2011-09-23 16:01:49 +04:00
parent 98ef318369
commit 0cfa18f8a8
@@ -760,14 +760,19 @@ public class GroovyPsiElementFactoryImpl extends GroovyPsiElementFactory {
@Override
public GrMethod createMethod(@NotNull @NonNls String name, @Nullable PsiType returnType) throws IncorrectOperationException {
StringBuilder builder = StringBuilderSpinAllocator.alloc();
if (returnType != null) {
builder.append(returnType.getCanonicalText());
try {
if (returnType != null) {
builder.append(returnType.getCanonicalText());
}
else {
builder.append("def");
}
builder.append(' ').append(name).append("(){}");
return createMethodFromText(builder.toString());
}
else {
builder.append("def");
finally {
StringBuilderSpinAllocator.dispose(builder);
}
builder.append(' ').append(name).append("(){}");
return createMethodFromText(builder.toString());
}
@NotNull