String index out of range: 0: String index out of range: 0

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
This commit is contained in:
Maxim Medvedev
2010-04-01 17:49:42 +04:00
parent a49882335e
commit 605beba382
@@ -122,12 +122,18 @@ public class GroovyPsiElementFactoryImpl extends GroovyPsiElementFactory {
final String typeText = getTypeText(type);
int lastDot = typeText.lastIndexOf('.');
int idx = 0 < lastDot && lastDot < typeText.length() - 1 ? lastDot + 1 : 0;
char c = typeText.charAt(idx);
if (!Character.isLetter(c) || Character.isLowerCase(c) &&
!GroovyNamesUtil.isKeyword(typeText)) { //primitive type
if (typeText.length() == 0) {
text.append("def ");
}
text.append(typeText).append(" ");
else {
char c = typeText.charAt(idx);
if (!Character.isLetter(c) || Character.isLowerCase(c) && !GroovyNamesUtil.isKeyword(typeText)) { //primitive type
text.append("def ");
}
else {
text.append(typeText).append(" ");
}
}
} else {
text.append("def ");
}