Fixed 'Implement members implement functions with no curly braces - not convenient'

#KT-1317 fixed
This commit is contained in:
Evgeny Gerashchenko
2012-02-23 23:00:03 +04:00
parent 6fadca9ac1
commit 8575da228d
5 changed files with 13 additions and 11 deletions
@@ -128,13 +128,7 @@ public abstract class OverrideImplementMethodsHandler implements LanguageCodeIns
ImportClassHelper.addImportDirectiveIfNeeded(returnType, file); ImportClassHelper.addImportDirectiveIfNeeded(returnType, file);
} }
final String initializer = defaultInitializer(returnType, stdlib); bodyBuilder.append("{").append("throw UnsupportedOperationException()").append("}");
if (initializer != null) {
bodyBuilder.append(" = ").append(initializer);
}
else {
bodyBuilder.append("{").append("throw UnsupportedOperationException()").append("}");
}
return JetPsiFactory.createFunction(project, bodyBuilder.toString()); return JetPsiFactory.createFunction(project, bodyBuilder.toString());
} }
@@ -14,5 +14,7 @@ class SomeOther<S> : Some<S> {
override fun someGenericFoo(): S { override fun someGenericFoo(): S {
throw UnsupportedOperationException() throw UnsupportedOperationException()
} }
override fun someOtherFoo(): Int = 0 override fun someOtherFoo(): Int {
throw UnsupportedOperationException()
}
} }
@@ -4,5 +4,7 @@ trait G<T> {
class GC() : G<Int> { class GC() : G<Int> {
override fun foo(t: Int): Int = 0 override fun foo(t: Int): Int {
throw UnsupportedOperationException()
}
} }
@@ -2,5 +2,7 @@ import foo.Intf
class Impl(): Intf { class Impl(): Intf {
override fun getFooBar(): String? = null override fun getFooBar(): String? {
throw UnsupportedOperationException()
}
} }
@@ -4,5 +4,7 @@ trait Some {
class SomeOther : Some { class SomeOther : Some {
override fun foo(some: Int?): Int = 0 override fun foo(some: Int?): Int {
throw UnsupportedOperationException()
}
} }