1 /* 2 * Copyright 2020 Google LLC 3 * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 // TEST PROCESSOR: DeclarationUtilProcessor 19 // FORMAT: <name>: isInternal: isLocal: isPrivate: isProtected: isPublic: isOpen 20 // EXPECTED: 21 // Cls: internal 22 // Cls / <init>: public 23 // Cls.b: public open 24 // Cls / <init>: public 25 // Cls / <init> / aaa: local 26 // Cls.prop: public open 27 // Cls.protectedProp: protected open 28 // Cls.abstractITFFun: public open 29 // Cls.pri: private 30 // ITF: public open 31 // ITF.prop: public open 32 // ITF.protectedProp: protected open 33 // ITF.b: public open 34 // ITF.abstractITFFun: public open 35 // ITF.nonAbstractITFFun: public open 36 // ITF.nonAbstractITFFun / aa: local 37 // NestedClassSubjects: public open 38 // NestedClassSubjects.NestedDataClass: public 39 // NestedClassSubjects.NestedDataClass / <init>: public 40 // NestedClassSubjects.NestedDataClass.field: public 41 // NestedClassSubjects.NestedFinalClass: public 42 // NestedClassSubjects.NestedFinalClass / <init>: public 43 // NestedClassSubjects.NestedFinalClass.field: public 44 // NestedClassSubjects.NestedOpenClass: public open 45 // NestedClassSubjects.NestedOpenClass / <init>: public 46 // NestedClassSubjects.NestedOpenClass.field: public 47 // NestedClassSubjects.NestedInterface: public open 48 // SealedBase: public open 49 // SealedBase.<init>: public 50 // SealedImpl: public 51 // SealedImpl.<init>: public 52 // END 53 // FILE: a.kt 54 internal class Cls(override val b: Int) : ITF { 55 constructor() { 56 val aaa = 2 57 Cls(aaa) 58 } 59 override val prop: Int = 2 60 61 override val protectedProp: Int = 2 62 abstractITFFunnull63 override fun abstractITFFun(): Int { 64 return 2 65 } 66 67 private val pri: Int = 3 68 } 69 70 interface ITF { 71 val prop: Int 72 73 protected val protectedProp: Int 74 75 val b: Int = 1 76 abstractITFFunnull77 fun abstractITFFun(): Int 78 79 fun nonAbstractITFFun(): Int { 80 val aa = "local" 81 return 1 82 } 83 } 84 85 interface NestedClassSubjects { 86 data class NestedDataClass( 87 val field: String, 88 ) 89 class NestedFinalClass( 90 val field: String, 91 ) 92 open class NestedOpenClass( 93 val field: String, 94 ) 95 interface NestedInterface 96 } 97 98 sealed class SealedBase 99 100 class SealedImpl: SealedBase 101