1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.tools.metalava.model 18 19 interface ConstructorItem : CallableItem { 20 21 /** Override to specialize return type. */ returnTypenull22 override fun returnType(): ClassTypeItem 23 24 /** Override to specialize return type. */ 25 override fun type() = returnType() 26 27 override fun accept(visitor: ItemVisitor) { 28 visitor.visit(this) 29 } 30 31 @Deprecated( 32 message = 33 "There is no point in calling this method on ConstructorItem as it always returns true", 34 ReplaceWith("") 35 ) isConstructornull36 override fun isConstructor(): Boolean = true 37 38 /** Returns the internal name of the class, as seen in bytecode */ 39 override fun internalName(): String = "<init>" 40 41 override fun findCorrespondingItemIn( 42 codebase: Codebase, 43 superMethods: Boolean, 44 duplicate: Boolean, 45 ) = containingClass().findCorrespondingItemIn(codebase)?.findConstructor(this) 46 47 /** True if this is the primary constructor in Kotlin. */ 48 val isPrimary: Boolean 49 50 /** 51 * True if this is a [ConstructorItem] that was created implicitly by the compiler and so does 52 * not have any corresponding source code. 53 */ 54 fun isImplicitConstructor(): Boolean = false 55 } 56