Override/Implement: Use function body template when generating functions with default body

#KT-11807 Fixed
This commit is contained in:
Alexey Sedunov
2016-04-18 16:33:17 +03:00
parent df07554764
commit 1635018fe7
60 changed files with 165 additions and 116 deletions
+1
View File
@@ -16,6 +16,7 @@ New features:
- [KT-11768](https://youtrack.jetbrains.com/issue/KT-11768) Implement "Introduce local variable" intention
- [KT-11692](https://youtrack.jetbrains.com/issue/KT-11692) Support Spring model diagrams for Kotlin classes
- [KT-11574](https://youtrack.jetbrains.com/issue/KT-11574) Support predefined Java positions for language injection
- [KT-11807](https://youtrack.jetbrains.com/issue/KT-11807) Use function body template when generating overriding functions with default body
Issues fixed:
@@ -4,7 +4,7 @@ interface I {
class A : I {
override fun foo(p: Int) {
<caret><selection>throw UnsupportedOperationException()</selection>
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -1,7 +1,7 @@
fun<T> f(){
JavaClass<T>(object: Comparator<T> {
override fun compare(var1: T, var2: T): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
})
}
@@ -1,6 +1,6 @@
var r : Runnable = object: Runnable {
override fun run() {
<caret><selection>throw UnsupportedOperationException()</selection>
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -2,7 +2,7 @@ import java.io.Closeable
val c: java.io.Closeable = object: Closeable {
override fun close() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -3,7 +3,7 @@ fun registerHandler(handler: Handler<out Message>) {}
fun test() {
registerHandler(object: Handler<Message> {
override fun handle(e: Message) {
<caret><selection>throw UnsupportedOperationException()</selection>
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
})
}
@@ -24,6 +24,8 @@ import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
import org.jetbrains.kotlin.idea.core.TemplateKind
import org.jetbrains.kotlin.idea.core.getFunctionBodyTextFromTemplate
import org.jetbrains.kotlin.idea.core.util.DescriptorMemberChooserObject
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
import org.jetbrains.kotlin.psi.*
@@ -115,7 +117,7 @@ private fun generateProperty(project: Project, descriptor: PropertyDescriptor, b
val body = buildString {
append("\nget()")
append(" = ")
append(generateUnsupportedOrSuperCall(descriptor, bodyType))
append(generateUnsupportedOrSuperCall(project, descriptor, bodyType))
if (descriptor.isVar) {
append("\nset(value) {}")
}
@@ -139,17 +141,26 @@ private fun generateFunction(project: Project, descriptor: FunctionDescriptor, b
val returnsNotUnit = returnType != null && !KotlinBuiltIns.isUnit(returnType)
val body = if (bodyType != OverrideMemberChooserObject.BodyType.NO_BODY) {
val delegation = generateUnsupportedOrSuperCall(descriptor, bodyType)
"{" + (if (returnsNotUnit && bodyType != OverrideMemberChooserObject.BodyType.EMPTY) "return " else "") + delegation + "}"
val delegation = generateUnsupportedOrSuperCall(project, descriptor, bodyType)
"{" + (if (returnsNotUnit && bodyType != OverrideMemberChooserObject.BodyType.EMPTY) "return " else "") + delegation + "\n}"
}
else ""
return KtPsiFactory(project).createFunction(OVERRIDE_RENDERER.render(newDescriptor) + body)
}
fun generateUnsupportedOrSuperCall(descriptor: CallableMemberDescriptor, bodyType: OverrideMemberChooserObject.BodyType): String {
fun generateUnsupportedOrSuperCall(
project: Project,
descriptor: CallableMemberDescriptor,
bodyType: OverrideMemberChooserObject.BodyType
): String {
if (bodyType == OverrideMemberChooserObject.BodyType.EMPTY) {
return "throw UnsupportedOperationException()"
if (descriptor !is FunctionDescriptor) return "throw UnsupportedOperationException()"
return getFunctionBodyTextFromTemplate(project,
TemplateKind.FUNCTION,
descriptor.name.asString(),
descriptor.returnType?.let { IdeDescriptorRenderers.SOURCE_CODE.renderType(it) } ?: "Unit",
null)
}
else {
return buildString {
@@ -165,7 +176,7 @@ fun generateUnsupportedOrSuperCall(descriptor: CallableMemberDescriptor, bodyTyp
val renderedName = it.name.render()
if (it.varargElementType != null) "*$renderedName" else renderedName
}
paramTexts.joinTo(this, prefix="(", postfix=")")
paramTexts.joinTo(this, prefix = "(", postfix = ")")
}
}
}
@@ -0,0 +1,65 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.idea.core
import com.intellij.ide.fileTemplates.FileTemplate
import com.intellij.ide.fileTemplates.FileTemplateManager
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.project.Project
import com.intellij.util.IncorrectOperationException
import org.jetbrains.kotlin.name.FqName
import java.util.*
private val FUNCTION_BODY_TEMPLATE = "New Kotlin Function Body.kt"
private val SECONDARY_CONSTRUCTOR_BODY_TEMPLATE = "New Kotlin Secondary Constructor Body.kt"
private val ATTRIBUTE_FUNCTION_NAME = "FUNCTION_NAME"
enum class TemplateKind(val templateFileName: String) {
FUNCTION(FUNCTION_BODY_TEMPLATE), SECONDARY_CONSTRUCTOR(SECONDARY_CONSTRUCTOR_BODY_TEMPLATE)
}
fun getFunctionBodyTextFromTemplate(
project: Project,
kind: TemplateKind,
name: String?,
returnType: String,
classFqName: FqName? = null
): String {
val fileTemplate = FileTemplateManager.getInstance(project)!!.getCodeTemplate(kind.templateFileName)
val properties = Properties()
properties.setProperty(FileTemplate.ATTRIBUTE_RETURN_TYPE, returnType)
if (classFqName != null) {
properties.setProperty(FileTemplate.ATTRIBUTE_CLASS_NAME, classFqName.asString())
properties.setProperty(FileTemplate.ATTRIBUTE_SIMPLE_CLASS_NAME, classFqName.shortName().asString())
}
if (name != null) {
properties.setProperty(ATTRIBUTE_FUNCTION_NAME, name)
}
return try {
fileTemplate!!.getText(properties)
}
catch (e: ProcessCanceledException) {
throw e
}
catch (e: Throwable) {
// TODO: This is dangerous.
// Is there any way to avoid catching all exceptions?
throw IncorrectOperationException("Failed to parse file template", e)
}
}
@@ -165,9 +165,9 @@ abstract class KotlinGenerateTestSupportActionBase(
val functionDescriptor = functionInPlace.resolveToDescriptor() as FunctionDescriptor
val overriddenDescriptors = functionDescriptor.overriddenDescriptors
val bodyText = when (overriddenDescriptors.size) {
0 -> generateUnsupportedOrSuperCall(functionDescriptor, BodyType.EMPTY)
1 -> generateUnsupportedOrSuperCall(overriddenDescriptors.single(), BodyType.SUPER)
else -> generateUnsupportedOrSuperCall(overriddenDescriptors.first(), BodyType.QUALIFIED_SUPER)
0 -> generateUnsupportedOrSuperCall(project, functionDescriptor, BodyType.EMPTY)
1 -> generateUnsupportedOrSuperCall(project, overriddenDescriptors.single(), BodyType.SUPER)
else -> generateUnsupportedOrSuperCall(project, overriddenDescriptors.first(), BodyType.QUALIFIED_SUPER)
}
functionInPlace.bodyExpression?.delete()
functionInPlace.add(KtPsiFactory(project).createBlock(bodyText))
@@ -21,20 +21,16 @@ import com.intellij.codeInsight.navigation.NavigationUtil
import com.intellij.codeInsight.template.*
import com.intellij.codeInsight.template.impl.TemplateImpl
import com.intellij.codeInsight.template.impl.TemplateManagerImpl
import com.intellij.ide.fileTemplates.FileTemplate
import com.intellij.ide.fileTemplates.FileTemplateManager
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.ScrollType
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.fileEditor.OpenFileDescriptor
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.ui.DialogWrapper
import com.intellij.psi.*
import com.intellij.psi.codeStyle.CodeStyleManager
import com.intellij.psi.codeStyle.JavaCodeStyleManager
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.util.IncorrectOperationException
import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
import org.jetbrains.kotlin.cfg.pseudocode.Pseudocode
import org.jetbrains.kotlin.cfg.pseudocode.getContainingPseudocode
@@ -46,10 +42,8 @@ import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl
import org.jetbrains.kotlin.idea.caches.resolve.analyzeFullyAndGetResult
import org.jetbrains.kotlin.idea.caches.resolve.getJavaClassDescriptor
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
import org.jetbrains.kotlin.idea.core.CollectingNameValidator
import org.jetbrains.kotlin.idea.core.KotlinNameSuggester
import org.jetbrains.kotlin.idea.core.ShortenReferences
import org.jetbrains.kotlin.idea.core.insertMember
import org.jetbrains.kotlin.idea.core.*
import org.jetbrains.kotlin.idea.imports.importableFqName
import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createClass.ClassKind
import org.jetbrains.kotlin.idea.refactoring.*
import org.jetbrains.kotlin.idea.util.DialogWithEditor
@@ -66,7 +60,6 @@ import org.jetbrains.kotlin.psi.psiUtil.*
import org.jetbrains.kotlin.psi.typeRefHelpers.setReceiverTypeReference
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassOrAny
import org.jetbrains.kotlin.resolve.scopes.HierarchicalScope
import org.jetbrains.kotlin.resolve.scopes.LexicalScopeImpl
@@ -83,10 +76,6 @@ import org.jetbrains.kotlin.utils.addToStdlib.singletonOrEmptyList
import java.util.*
import kotlin.properties.Delegates
private val TEMPLATE_FROM_USAGE_FUNCTION_BODY = "New Kotlin Function Body.kt"
private val TEMPLATE_FROM_USAGE_SECONDARY_CONSTRUCTOR_BODY = "New Kotlin Secondary Constructor Body.kt"
private val ATTRIBUTE_FUNCTION_NAME = "FUNCTION_NAME"
/**
* Represents a single choice for a type (e.g. parameter type or return type).
*/
@@ -691,35 +680,18 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
private fun setupFunctionBody(func: KtFunction) {
val oldBody = func.bodyExpression ?: return
val templateName = when (func) {
is KtSecondaryConstructor -> TEMPLATE_FROM_USAGE_SECONDARY_CONSTRUCTOR_BODY
is KtNamedFunction -> TEMPLATE_FROM_USAGE_FUNCTION_BODY
val templateKind = when (func) {
is KtSecondaryConstructor -> TemplateKind.SECONDARY_CONSTRUCTOR
is KtNamedFunction -> TemplateKind.FUNCTION
else -> throw AssertionError("Unexpected declaration: " + func.getElementTextWithContext())
}
val fileTemplate = FileTemplateManager.getInstance(func.project)!!.getCodeTemplate(templateName)
val properties = Properties()
properties.setProperty(FileTemplate.ATTRIBUTE_RETURN_TYPE, if (skipReturnType) "Unit" else func.typeReference!!.text)
receiverClassDescriptor?.let {
properties.setProperty(FileTemplate.ATTRIBUTE_CLASS_NAME, DescriptorUtils.getFqName(it).asString())
properties.setProperty(FileTemplate.ATTRIBUTE_SIMPLE_CLASS_NAME, it.name.asString())
}
if (callableInfo.name.isNotEmpty()) {
properties.setProperty(ATTRIBUTE_FUNCTION_NAME, callableInfo.name)
}
val bodyText = try {
fileTemplate!!.getText(properties)
}
catch (e: ProcessCanceledException) {
throw e
}
catch (e: Exception) {
// TODO: This is dangerous.
// Is there any way to avoid catching all exceptions?
throw IncorrectOperationException("Failed to parse file template", e)
}
val bodyText = getFunctionBodyTextFromTemplate(
func.project,
templateKind,
if (callableInfo.name.isNotEmpty()) callableInfo.name else null,
if (skipReturnType) "Unit" else func.typeReference!!.text,
receiverClassDescriptor?.importableFqName ?: receiverClassDescriptor?.name?.let { FqName.topLevel(it) }
)
oldBody.replace(KtPsiFactory(func).createBlock(bodyText))
}
@@ -5,6 +5,6 @@ import org.junit.runners.Parameterized
class A {
@Parameterized.Parameters
fun data(): Collection<Array<Any>> {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -5,6 +5,6 @@ import org.junit.Before
class A {
@Before
fun setUp() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -5,7 +5,7 @@ import org.junit.Before
class A {
@org.testng.annotations.BeforeMethod
fun setUp() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@Before
@@ -5,6 +5,6 @@ import org.junit.After
class A {
@After
fun tearDown() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -5,7 +5,7 @@ import org.junit.After
class A {
@org.testng.annotations.AfterMethod
fun tearDown() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@After
@@ -5,6 +5,6 @@ import org.junit.Test
class A {
@Test
fun name() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -4,6 +4,6 @@ import junit.framework.TestCase
class A : TestCase() {
fun testName() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -6,6 +6,6 @@ import org.testng.annotations.Test
@Test class A {
@DataProvider(name = "name")
fun name(): Array<Array<Any>> {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -6,6 +6,6 @@ import org.testng.annotations.Test
@Test class A {
@BeforeMethod
fun setUp() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -6,6 +6,6 @@ import org.testng.annotations.Test
@Test class A {
@AfterMethod
fun tearDown() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -5,6 +5,6 @@ import org.testng.annotations.Test
@Test class A {
@Test
fun testName() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -4,6 +4,6 @@ interface T {
class C : T {
override fun foo(a: Int) {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -5,7 +5,7 @@ interface T {
class C(t :T) : T by t {
override fun bar() {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
override fun equals(other: Any?): Boolean {
@@ -13,7 +13,7 @@ class C(t :T) : T by t {
}
override fun foo() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun hashCode(): Int {
@@ -23,7 +23,7 @@ class C : B(), I {
}
override fun g() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun hashCode(): Int {
@@ -5,6 +5,6 @@ interface T {
class C : T {
override fun Foo(): (String) -> Unit {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -5,6 +5,6 @@ interface T {
class C : T {
override fun Foo(): (String) -> Unit {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -4,6 +4,6 @@ interface Trait {
class TraitImpl : Trait {
override fun <A, B : Runnable, E : Map.Entry<A, B>> foo() where B : Cloneable, B : Comparable<B> {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -8,14 +8,14 @@ interface Some<T> {
class SomeOther<S> : Some<S> {
override fun someFoo() {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
override fun someGenericFoo(): S {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun someOtherFoo(): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -4,6 +4,6 @@ interface G<T> {
class GC() : G<Int> {
override fun foo(t: Int): Int {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -2,6 +2,6 @@
class MyClass<A: Comparable<A>> : Iterable<A> {
override fun iterator(): Iterator<A> {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -1,5 +1,5 @@
class C : (String) -> Boolean {
override fun invoke(p1: String): Boolean {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
}
@@ -3,6 +3,6 @@ import foo.B
class C : A() {
override fun foo(x: MutableList<Any?>?, y: String?): B<*>? {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -2,6 +2,6 @@ package foo
class Impl: B {
override fun foo(r: Runnable?) {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -2,6 +2,6 @@ import foo.Intf
class Impl(): Intf {
override fun getFooBar(): String? {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -2,6 +2,6 @@ import foo.Intf
class Impl(): Intf {
override fun fooBar(i: Int, s: Array<out String>?, foo: Any?) {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -7,7 +7,7 @@ fun f() {
object : C<R>() {
override fun f(a: R) {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
}
@@ -8,7 +8,7 @@ interface B {
class C : A(), B {
override fun bar() {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
override fun equals(other: Any?): Boolean {
@@ -4,6 +4,6 @@ interface A {
class B : A {
override fun String.foo() {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -20,6 +20,6 @@ class C : A(), I {
}
override fun z() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -6,7 +6,7 @@ interface Test {
class SomeTest : Test {
val hello = 12
override fun test() {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
override val testProp: Int
@@ -3,7 +3,7 @@ import lib.ArrayFactory
public class Impl : ArrayFactory {
override fun create(): lib.Array {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -6,6 +6,6 @@ interface Base {
class Derived : Base {
override fun foo(c: C<*>) {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
}
@@ -30,15 +30,15 @@ abstract class B : I2, A(), I3 {
}
override fun i() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun i1() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun i2() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun toString(): String {
@@ -4,6 +4,6 @@ interface G<T> {
class GC<T>() : G<T> {
override fun foo(t: T): T {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -4,6 +4,6 @@ interface Some {
class SomeOther : Some {
override fun foo(some: Int?): Int {
<selection><caret>throw UnsupportedOperationException()</selection>
<selection><caret>throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
@@ -8,6 +8,6 @@ enum class E : T<Int> {
A, B, C;
override fun foo(x: Int): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -8,6 +8,6 @@ enum class E : T<Int> {
A, B, C;
override fun foo(x: Int): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -8,7 +8,7 @@ enum class E : T<Int> {
A, B, C;
override fun foo(x: Int): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
val bar = 1
@@ -3,15 +3,15 @@
enum class E {
A {
override fun foo(x: Int): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}, B {
override fun foo(x: Int): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}, C {
override fun foo(x: Int): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
};
@@ -3,15 +3,15 @@
enum class E(n: Int) {
A(1) {
override fun foo(x: Int): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}, B(2) {
override fun foo(x: Int): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}, C(3) {
override fun foo(x: Int): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
};
@@ -6,14 +6,14 @@ interface T<X> {
class U : T<String> {
override fun foo(x: String): String {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
class V : T<Int> {
override fun foo(x: Int): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
+1 -1
View File
@@ -14,6 +14,6 @@ private class BaseImpl : Base() {
}
override fun toInt(arg: String): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
+1 -1
View File
@@ -8,7 +8,7 @@ class Container {
inner class BaseImpl : Base() {
override fun foo(): String {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
}
+1 -1
View File
@@ -9,6 +9,6 @@ interface Base {
class BaseImpl : Base {
override fun foo(x: Int): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ class BaseImpl : Container.Base {
get() = throw UnsupportedOperationException()
override fun bar(z: Int): String {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ sealed class Base {
abstract fun foo(): Int
class BaseImpl : Base() {
override fun foo(): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
}
@@ -10,7 +10,7 @@ sealed class Base {
class BaseImpl1 : Base() {
override fun foo(): Int {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
}
+1 -1
View File
@@ -5,6 +5,6 @@ interface I {
class A : I {
override fun foo() {
<caret><selection>throw UnsupportedOperationException()</selection>
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -5,6 +5,6 @@ abstract class A {
class B : A() {
override fun foo() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -14,6 +14,6 @@ interface A {
}
class B : A {
override fun gav() {
throw UnsupportedOperationException()
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}