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.text 18 19 import com.android.tools.metalava.model.ConstructorItem 20 import com.android.tools.metalava.model.DefaultModifierList 21 22 class TextConstructorItem( 23 codebase: TextCodebase, 24 name: String, 25 containingClass: TextClassItem, 26 modifiers: TextModifiers, 27 returnType: TextTypeItem, 28 position: SourcePositionInfo 29 ) : TextMethodItem(codebase, name, containingClass, modifiers, returnType, position), 30 ConstructorItem { 31 32 override var superConstructor: ConstructorItem? = null 33 isConstructornull34 override fun isConstructor(): Boolean = true 35 36 companion object { 37 fun createDefaultConstructor( 38 codebase: TextCodebase, 39 containingClass: TextClassItem, 40 position: SourcePositionInfo, 41 ): TextConstructorItem { 42 val name = containingClass.name 43 val modifiers = TextModifiers(codebase, DefaultModifierList.PACKAGE_PRIVATE, null) 44 45 val item = TextConstructorItem( 46 codebase = codebase, 47 name = name, 48 containingClass = containingClass, 49 modifiers = modifiers, 50 returnType = containingClass.asTypeInfo(), 51 position = position, 52 ) 53 modifiers.setOwner(item) 54 return item 55 } 56 } 57 } 58