Support secondary constructors in decompiled text

Build cls stubs for secondary constructors
This commit is contained in:
Pavel V. Talanov
2015-03-12 13:06:38 +03:00
parent 026e35b6d0
commit c0a031eafe
15 changed files with 351 additions and 28 deletions
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.psi.stubs.impl.KotlinFileStubImpl;
import java.io.IOException;
public class JetFileElementType extends IStubFileElementType<KotlinFileStub> {
public static final int STUB_VERSION = 38;
public static final int STUB_VERSION = 39;
private static final String NAME = "kotlin.FILE";
@@ -53,6 +53,7 @@ public class DescriptorRendererBuilder {
};
private boolean renderDefaultValues = true;
private boolean flexibleTypesForCode = false;
private boolean secondaryConstructorsAsPrimary = true;
@NotNull
private DescriptorRenderer.OverrideRenderingPolicy overrideRenderingPolicy = DescriptorRenderer.OverrideRenderingPolicy.RENDER_OPEN;
@@ -211,6 +212,7 @@ public class DescriptorRendererBuilder {
return this;
}
@NotNull
public DescriptorRendererBuilder setRenderDefaultValues(boolean renderDefaultValues) {
this.renderDefaultValues = renderDefaultValues;
return this;
@@ -222,11 +224,18 @@ public class DescriptorRendererBuilder {
return this;
}
@NotNull
public DescriptorRendererBuilder setFlexibleTypesForCode(boolean flexibleTypesForCode) {
this.flexibleTypesForCode = flexibleTypesForCode;
return this;
}
@NotNull
public DescriptorRendererBuilder setSecondaryConstructorsAsPrimary(boolean secondaryConstructorsAsPrimary) {
this.secondaryConstructorsAsPrimary = secondaryConstructorsAsPrimary;
return this;
}
@NotNull
public DescriptorRenderer build() {
return new DescriptorRendererImpl(
@@ -234,7 +243,8 @@ public class DescriptorRendererBuilder {
normalizedVisibilities, showInternalKeyword, prettyFunctionTypes, uninferredTypeParameterAsName,
overrideRenderingPolicy, valueParametersHandler, textFormat, excludedAnnotationClasses, includePropertyConstant,
includeSynthesizedParameterNames, withoutFunctionParameterNames, withoutTypeParameters, receiverAfterName,
renderDefaultObjectName, withoutSuperTypes, typeNormalizer, renderDefaultValues, flexibleTypesForCode);
renderDefaultObjectName, withoutSuperTypes, typeNormalizer, renderDefaultValues, flexibleTypesForCode,
secondaryConstructorsAsPrimary);
}
}
@@ -76,6 +76,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
@NotNull
private final TextFormat textFormat;
private final boolean includePropertyConstant;
private final boolean secondaryConstructorsAsPrimary;
@NotNull
private final Set<FqName> excludedAnnotationClasses;
@@ -105,7 +106,8 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
boolean withoutSuperTypes,
@NotNull Function1<JetType, JetType> typeNormalizer,
boolean renderDefaultValues,
boolean flexibleTypesForCode
boolean flexibleTypesForCode,
boolean secondaryConstructorsAsPrimary
) {
this.nameShortness = nameShortness;
this.withDefinedIn = withDefinedIn;
@@ -121,6 +123,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
this.debugMode = debugMode;
this.textFormat = textFormat;
this.includePropertyConstant = includePropertyConstant;
this.secondaryConstructorsAsPrimary = secondaryConstructorsAsPrimary;
this.excludedAnnotationClasses = new HashSet<FqName>(excludedAnnotationClasses);
this.prettyFunctionTypes = prettyFunctionTypes;
this.uninferredTypeParameterAsName = uninferredTypeParameterAsName;
@@ -802,14 +805,19 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
renderVisibility(constructor.getVisibility(), builder);
renderMemberKind(constructor, builder);
builder.append(renderKeyword("constructor")).append(" ");
builder.append(renderKeyword("constructor"));
if (secondaryConstructorsAsPrimary) {
ClassDescriptor classDescriptor = constructor.getContainingDeclaration();
builder.append(" ");
renderName(classDescriptor, builder);
renderTypeParameters(classDescriptor.getTypeConstructor().getParameters(), builder, false);
}
ClassDescriptor classDescriptor = constructor.getContainingDeclaration();
renderName(classDescriptor, builder);
renderTypeParameters(classDescriptor.getTypeConstructor().getParameters(), builder, false);
renderValueParameters(constructor, builder);
renderWhereSuffix(constructor.getTypeParameters(), builder);
if (secondaryConstructorsAsPrimary) {
renderWhereSuffix(constructor.getTypeParameters(), builder);
}
}
private void renderWhereSuffix(@NotNull List<TypeParameterDescriptor> typeParameters, @NotNull StringBuilder builder) {
@@ -16,19 +16,23 @@
package org.jetbrains.kotlin.idea.decompiler.stubBuilder
import com.intellij.psi.stubs.StubElement
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf.Modality
import com.intellij.psi.stubs.StubElement
import org.jetbrains.kotlin.idea.decompiler.stubBuilder.FlagsToModifiers.MODALITY
import org.jetbrains.kotlin.idea.decompiler.stubBuilder.FlagsToModifiers.VISIBILITY
import org.jetbrains.kotlin.psi.JetSecondaryConstructor
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes
import org.jetbrains.kotlin.psi.stubs.impl.KotlinFunctionStubImpl
import org.jetbrains.kotlin.psi.stubs.impl.KotlinPlaceHolderStubImpl
import org.jetbrains.kotlin.psi.stubs.impl.KotlinPropertyStubImpl
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind
import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.MemberKind
import org.jetbrains.kotlin.resolve.dataClassUtils.isComponentLike
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.MemberKind
import org.jetbrains.kotlin.serialization.ProtoBuf.Modality
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.idea.decompiler.stubBuilder.FlagsToModifiers.*
import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer
fun createCallableStub(
parentStub: StubElement<out PsiElement>,
@@ -60,11 +64,14 @@ private class CallableClsStubBuilder(
private val c = outerContext.child(callableProto.getTypeParameterList())
private val typeStubBuilder = TypeClsStubBuilder(c)
private val isTopLevel: Boolean get() = protoContainer.packageFqName != null
private val callableKind = Flags.CALLABLE_KIND[callableProto.getFlags()]
private val isConstructor = callableKind == ProtoBuf.Callable.CallableKind.CONSTRUCTOR
private val callableStub = doCreateCallableStub()
fun build() {
createModifierListStub()
val typeConstraintListData = typeStubBuilder.createTypeParameterListStub(callableStub, callableProto.getTypeParameterList())
val typeParameterList = if (isConstructor) emptyList() else callableProto.getTypeParameterList()
val typeConstraintListData = typeStubBuilder.createTypeParameterListStub(callableStub, typeParameterList)
createReceiverTypeReferenceStub()
createValueParameterList()
createReturnTypeStub()
@@ -82,11 +89,13 @@ private class CallableClsStubBuilder(
}
private fun createReturnTypeStub() {
typeStubBuilder.createTypeReferenceStub(callableStub, callableProto.getReturnType())
if (!isConstructor)
typeStubBuilder.createTypeReferenceStub(callableStub, callableProto.getReturnType())
}
private fun createModifierListStub() {
val relevantModifiers = if (isTopLevel) listOf(VISIBILITY) else listOf(VISIBILITY, MODALITY)
val isModalityIrrelevant = isTopLevel || isConstructor
val relevantModifiers = if (isModalityIrrelevant) listOf(VISIBILITY) else listOf(VISIBILITY, MODALITY)
val modifierListStubImpl = createModifierListStubForDeclaration(callableStub, callableProto.getFlags(), relevantModifiers)
val annotationIds = c.components.annotationLoader.loadCallableAnnotations(
@@ -96,9 +105,7 @@ private class CallableClsStubBuilder(
}
private fun doCreateCallableStub(): StubElement<out PsiElement> {
val callableKind = Flags.CALLABLE_KIND[callableProto.getFlags()]
val callableName = c.nameResolver.getName(callableProto.getName())
val callableFqName = c.containerFqName.child(callableName)
return when (callableKind) {
ProtoBuf.Callable.CallableKind.FUN -> {
@@ -106,7 +113,7 @@ private class CallableClsStubBuilder(
parent,
callableName.ref(),
isTopLevel,
callableFqName,
c.containerFqName.child(callableName),
isExtension = callableProto.hasReceiverType(),
hasBlockBody = true,
hasBody = Flags.MODALITY[callableProto.getFlags()] != Modality.ABSTRACT,
@@ -125,11 +132,13 @@ private class CallableClsStubBuilder(
hasInitializer = false,
hasReceiverTypeRef = callableProto.hasReceiverType(),
hasReturnTypeRef = true,
fqName = callableFqName,
fqName = c.containerFqName.child(callableName),
isProbablyNothingType = isProbablyNothing(callableProto)
)
}
ProtoBuf.Callable.CallableKind.CONSTRUCTOR -> throw IllegalStateException("Should not be called for constructor!")
ProtoBuf.Callable.CallableKind.CONSTRUCTOR -> {
KotlinPlaceHolderStubImpl<JetSecondaryConstructor>(parent, JetStubElementTypes.SECONDARY_CONSTRUCTOR)
}
else -> throw IllegalStateException("Unknown callable kind $callableKind")
}
}
@@ -135,7 +135,7 @@ private class ClassClsStubBuilder(
}
private fun createConstructorStub() {
if (!isClass()) return
if (!isClass() || !classProto.hasPrimaryConstructor()) return
val primaryConstructorProto = classProto.getPrimaryConstructor()
if (primaryConstructorProto.hasData()) {
@@ -198,7 +198,8 @@ private class ClassClsStubBuilder(
private fun createCallableMemberStubs(classBody: KotlinPlaceHolderStubImpl<JetClassBody>) {
val container = ProtoContainer(classProto, null)
for (callableProto in classProto.getMemberList()) {
val allMembers = classProto.getSecondaryConstructorList() + classProto.getMemberList()
for (callableProto in allMembers) {
createCallableStub(classBody, callableProto, c, container)
}
}
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.types.isFlexible
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.kotlin.load.kotlin.header.isCompatiblePackageFacadeKind
import org.jetbrains.kotlin.load.kotlin.header.isCompatibleClassKind
import org.jetbrains.kotlin.resolve.descriptorUtil.secondaryConstructors
import org.jetbrains.kotlin.types.flexibility
private val FILE_ABI_VERSION_MARKER: String = "FILE_ABI"
@@ -85,6 +86,7 @@ private val descriptorRendererForDecompiler = DescriptorRendererBuilder()
else type
}
.setSecondaryConstructorsAsPrimary(false)
.build()
private val descriptorRendererForKeys = DescriptorRenderer.COMPACT_WITH_MODIFIERS
@@ -153,7 +155,8 @@ private fun buildDecompiledText(packageFqName: FqName, descriptors: List<Declara
builder.append(subindent)
appendDescriptor(defaultObject, subindent)
}
for (member in descriptor.getDefaultType().getMemberScope().getDescriptors()) {
val allDescriptors = descriptor.secondaryConstructors + descriptor.getDefaultType().getMemberScope().getDescriptors()
for (member in allDescriptors) {
if (member.getContainingDeclaration() != descriptor) {
continue
}
@@ -0,0 +1,20 @@
// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available
package test
internal final class SecondaryConstructors(x: kotlin.Boolean) {
test.anno public constructor(x: kotlin.String) { /* compiled code */ }
private constructor(x: kotlin.Int) { /* compiled code */ }
internal final inner class Inner<T : kotlin.String, G : kotlin.Int> where G : kotlin.Number {
public constructor(x: T, g: G) { /* compiled code */ }
}
internal final class Nested {
test.anno public constructor(z: kotlin.Int) { /* compiled code */ }
internal constructor() { /* compiled code */ }
}
}
@@ -0,0 +1,27 @@
package test
class SecondaryConstructors(x: Boolean) {
init {
}
anno constructor(x: String) : this(x == "abc") {
}
init {
}
private constructor(x: Int) : this(x < 0) {
}
inner class Inner<T : String, G : Int> where G : Number {
constructor(x: T, g: G) {
}
}
class Nested {
anno constructor(z: Int) {}
internal constructor() {}
}
}
annotation class anno
@@ -0,0 +1,27 @@
package test
class SecondaryConstructors(x: Boolean) {
init {
}
anno constructor(x: String) : this(x == "abc") {
}
init {
}
private constructor(x: Int) : this(x < 0) {
}
inner class Inner<T : String, G : Int> where G : Number {
constructor(x: T, g: G) {
}
}
class Nested {
anno constructor(z: Int) {}
internal constructor() {}
}
}
annotation class anno
@@ -0,0 +1,95 @@
PsiJetFileStubImpl[package=test]
PACKAGE_DIRECTIVE:
REFERENCE_EXPRESSION:[referencedName=test]
CLASS:[fqName=test.SecondaryConstructors, isEnumEntry=false, isLocal=false, isTopLevel=true, isTrait=false, name=SecondaryConstructors, superNames=[]]
MODIFIER_LIST:[internal final]
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=x]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Boolean]
CLASS_BODY:
SECONDARY_CONSTRUCTOR:
MODIFIER_LIST:[public]
ANNOTATION_ENTRY:[hasValueArguments=false, shortName=anno]
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=test]
REFERENCE_EXPRESSION:[referencedName=anno]
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=x]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=String]
SECONDARY_CONSTRUCTOR:
MODIFIER_LIST:[private]
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=x]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Int]
CLASS:[fqName=test.SecondaryConstructors.Inner, isEnumEntry=false, isLocal=false, isTopLevel=false, isTrait=false, name=Inner, superNames=[]]
MODIFIER_LIST:[inner internal final]
TYPE_PARAMETER_LIST:
TYPE_PARAMETER:[fqName=null, isInVariance=false, isOutVariance=false, name=T]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=String]
TYPE_PARAMETER:[fqName=null, isInVariance=false, isOutVariance=false, name=G]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Int]
TYPE_CONSTRAINT_LIST:
TYPE_CONSTRAINT:[isDefaultObjectConstraint=false]
REFERENCE_EXPRESSION:[referencedName=G]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Number]
CLASS_BODY:
SECONDARY_CONSTRUCTOR:
MODIFIER_LIST:[public]
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=x]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=T]
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=g]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=G]
CLASS:[fqName=test.SecondaryConstructors.Nested, isEnumEntry=false, isLocal=false, isTopLevel=false, isTrait=false, name=Nested, superNames=[]]
MODIFIER_LIST:[internal final]
CLASS_BODY:
SECONDARY_CONSTRUCTOR:
MODIFIER_LIST:[public]
ANNOTATION_ENTRY:[hasValueArguments=false, shortName=anno]
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=test]
REFERENCE_EXPRESSION:[referencedName=anno]
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=z]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Int]
SECONDARY_CONSTRUCTOR:
MODIFIER_LIST:[internal]
VALUE_PARAMETER_LIST:
@@ -0,0 +1,78 @@
PsiJetFileStubImpl[package=test]
PACKAGE_DIRECTIVE:
REFERENCE_EXPRESSION:[referencedName=test]
CLASS:[fqName=test.SecondaryConstructors, isEnumEntry=false, isLocal=false, isTopLevel=true, isTrait=false, name=SecondaryConstructors, superNames=[]]
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=x]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=Boolean]
CLASS_BODY:
ANONYMOUS_INITIALIZER:
SECONDARY_CONSTRUCTOR:
MODIFIER_LIST:[]
ANNOTATION_ENTRY:[hasValueArguments=false, shortName=anno]
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=anno]
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=x]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=String]
ANONYMOUS_INITIALIZER:
SECONDARY_CONSTRUCTOR:
MODIFIER_LIST:[private]
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=x]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=Int]
CLASS:[fqName=test.SecondaryConstructors.Inner, isEnumEntry=false, isLocal=false, isTopLevel=false, isTrait=false, name=Inner, superNames=[]]
MODIFIER_LIST:[inner]
TYPE_PARAMETER_LIST:
TYPE_PARAMETER:[fqName=null, isInVariance=false, isOutVariance=false, name=T]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=String]
TYPE_PARAMETER:[fqName=null, isInVariance=false, isOutVariance=false, name=G]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=Int]
TYPE_CONSTRAINT_LIST:
TYPE_CONSTRAINT:[isDefaultObjectConstraint=false]
REFERENCE_EXPRESSION:[referencedName=G]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=Number]
CLASS_BODY:
SECONDARY_CONSTRUCTOR:
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=x]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=T]
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=g]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=G]
CLASS:[fqName=test.SecondaryConstructors.Nested, isEnumEntry=false, isLocal=false, isTopLevel=false, isTrait=false, name=Nested, superNames=[]]
CLASS_BODY:
SECONDARY_CONSTRUCTOR:
MODIFIER_LIST:[]
ANNOTATION_ENTRY:[hasValueArguments=false, shortName=anno]
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=anno]
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=z]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=Int]
SECONDARY_CONSTRUCTOR:
MODIFIER_LIST:[internal]
VALUE_PARAMETER_LIST:
CLASS:[fqName=test.anno, isEnumEntry=false, isLocal=false, isTopLevel=true, isTrait=false, name=anno, superNames=[]]
MODIFIER_LIST:[annotation]
@@ -0,0 +1,27 @@
package test
class SecondaryConstructors(x: Boolean) {
init {
}
anno constructor(x: String) : this(x == "abc") {
}
init {
}
private constructor(x: Int) : this(x < 0) {
}
inner class Inner<T : String, G : Int> where G : Number {
constructor(x: T, g: G) {
}
}
class Nested {
anno constructor(z: Int) {}
internal constructor() {}
}
}
annotation class anno
@@ -120,6 +120,12 @@ public class ClsStubBuilderTestGenerated extends AbstractClsStubBuilderTest {
doTest(fileName);
}
@TestMetadata("SecondaryConstructors")
public void testSecondaryConstructors() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/stubBuilder/SecondaryConstructors/");
doTest(fileName);
}
@TestMetadata("TopLevelMembersAnnotatedPackage")
public void testTopLevelMembersAnnotatedPackage() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/stubBuilder/TopLevelMembersAnnotatedPackage/");
@@ -86,6 +86,12 @@ public class DecompiledTextTestGenerated extends AbstractDecompiledTextTest {
doTest(fileName);
}
@TestMetadata("SecondaryConstructors")
public void testSecondaryConstructors() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/SecondaryConstructors/");
doTest(fileName);
}
@TestMetadata("SimpleClass")
public void testSimpleClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/SimpleClass/");
@@ -216,6 +216,12 @@ public class StubBuilderTestGenerated extends AbstractStubBuilderTest {
doTest(fileName);
}
@TestMetadata("SecondaryConstructors.kt")
public void testSecondaryConstructors() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/stubs/SecondaryConstructors.kt");
doTest(fileName);
}
@TestMetadata("SimpleEnumBuild.kt")
public void testSimpleEnumBuild() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/stubs/SimpleEnumBuild.kt");