Support secondary constructors in decompiled text
Build cls stubs for secondary constructors
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.psi.stubs.impl.KotlinFileStubImpl;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class JetFileElementType extends IStubFileElementType<KotlinFileStub> {
|
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";
|
private static final String NAME = "kotlin.FILE";
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ public class DescriptorRendererBuilder {
|
|||||||
};
|
};
|
||||||
private boolean renderDefaultValues = true;
|
private boolean renderDefaultValues = true;
|
||||||
private boolean flexibleTypesForCode = false;
|
private boolean flexibleTypesForCode = false;
|
||||||
|
private boolean secondaryConstructorsAsPrimary = true;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private DescriptorRenderer.OverrideRenderingPolicy overrideRenderingPolicy = DescriptorRenderer.OverrideRenderingPolicy.RENDER_OPEN;
|
private DescriptorRenderer.OverrideRenderingPolicy overrideRenderingPolicy = DescriptorRenderer.OverrideRenderingPolicy.RENDER_OPEN;
|
||||||
@@ -211,6 +212,7 @@ public class DescriptorRendererBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
public DescriptorRendererBuilder setRenderDefaultValues(boolean renderDefaultValues) {
|
public DescriptorRendererBuilder setRenderDefaultValues(boolean renderDefaultValues) {
|
||||||
this.renderDefaultValues = renderDefaultValues;
|
this.renderDefaultValues = renderDefaultValues;
|
||||||
return this;
|
return this;
|
||||||
@@ -222,11 +224,18 @@ public class DescriptorRendererBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
public DescriptorRendererBuilder setFlexibleTypesForCode(boolean flexibleTypesForCode) {
|
public DescriptorRendererBuilder setFlexibleTypesForCode(boolean flexibleTypesForCode) {
|
||||||
this.flexibleTypesForCode = flexibleTypesForCode;
|
this.flexibleTypesForCode = flexibleTypesForCode;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public DescriptorRendererBuilder setSecondaryConstructorsAsPrimary(boolean secondaryConstructorsAsPrimary) {
|
||||||
|
this.secondaryConstructorsAsPrimary = secondaryConstructorsAsPrimary;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public DescriptorRenderer build() {
|
public DescriptorRenderer build() {
|
||||||
return new DescriptorRendererImpl(
|
return new DescriptorRendererImpl(
|
||||||
@@ -234,7 +243,8 @@ public class DescriptorRendererBuilder {
|
|||||||
normalizedVisibilities, showInternalKeyword, prettyFunctionTypes, uninferredTypeParameterAsName,
|
normalizedVisibilities, showInternalKeyword, prettyFunctionTypes, uninferredTypeParameterAsName,
|
||||||
overrideRenderingPolicy, valueParametersHandler, textFormat, excludedAnnotationClasses, includePropertyConstant,
|
overrideRenderingPolicy, valueParametersHandler, textFormat, excludedAnnotationClasses, includePropertyConstant,
|
||||||
includeSynthesizedParameterNames, withoutFunctionParameterNames, withoutTypeParameters, receiverAfterName,
|
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
|
@NotNull
|
||||||
private final TextFormat textFormat;
|
private final TextFormat textFormat;
|
||||||
private final boolean includePropertyConstant;
|
private final boolean includePropertyConstant;
|
||||||
|
private final boolean secondaryConstructorsAsPrimary;
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Set<FqName> excludedAnnotationClasses;
|
private final Set<FqName> excludedAnnotationClasses;
|
||||||
|
|
||||||
@@ -105,7 +106,8 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
boolean withoutSuperTypes,
|
boolean withoutSuperTypes,
|
||||||
@NotNull Function1<JetType, JetType> typeNormalizer,
|
@NotNull Function1<JetType, JetType> typeNormalizer,
|
||||||
boolean renderDefaultValues,
|
boolean renderDefaultValues,
|
||||||
boolean flexibleTypesForCode
|
boolean flexibleTypesForCode,
|
||||||
|
boolean secondaryConstructorsAsPrimary
|
||||||
) {
|
) {
|
||||||
this.nameShortness = nameShortness;
|
this.nameShortness = nameShortness;
|
||||||
this.withDefinedIn = withDefinedIn;
|
this.withDefinedIn = withDefinedIn;
|
||||||
@@ -121,6 +123,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
this.debugMode = debugMode;
|
this.debugMode = debugMode;
|
||||||
this.textFormat = textFormat;
|
this.textFormat = textFormat;
|
||||||
this.includePropertyConstant = includePropertyConstant;
|
this.includePropertyConstant = includePropertyConstant;
|
||||||
|
this.secondaryConstructorsAsPrimary = secondaryConstructorsAsPrimary;
|
||||||
this.excludedAnnotationClasses = new HashSet<FqName>(excludedAnnotationClasses);
|
this.excludedAnnotationClasses = new HashSet<FqName>(excludedAnnotationClasses);
|
||||||
this.prettyFunctionTypes = prettyFunctionTypes;
|
this.prettyFunctionTypes = prettyFunctionTypes;
|
||||||
this.uninferredTypeParameterAsName = uninferredTypeParameterAsName;
|
this.uninferredTypeParameterAsName = uninferredTypeParameterAsName;
|
||||||
@@ -802,14 +805,19 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
renderVisibility(constructor.getVisibility(), builder);
|
renderVisibility(constructor.getVisibility(), builder);
|
||||||
renderMemberKind(constructor, 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);
|
renderValueParameters(constructor, builder);
|
||||||
renderWhereSuffix(constructor.getTypeParameters(), builder);
|
|
||||||
|
if (secondaryConstructorsAsPrimary) {
|
||||||
|
renderWhereSuffix(constructor.getTypeParameters(), builder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderWhereSuffix(@NotNull List<TypeParameterDescriptor> typeParameters, @NotNull StringBuilder builder) {
|
private void renderWhereSuffix(@NotNull List<TypeParameterDescriptor> typeParameters, @NotNull StringBuilder builder) {
|
||||||
|
|||||||
+25
-16
@@ -16,19 +16,23 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.decompiler.stubBuilder
|
package org.jetbrains.kotlin.idea.decompiler.stubBuilder
|
||||||
|
|
||||||
import com.intellij.psi.stubs.StubElement
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
import com.intellij.psi.stubs.StubElement
|
||||||
import org.jetbrains.kotlin.serialization.Flags
|
import org.jetbrains.kotlin.idea.decompiler.stubBuilder.FlagsToModifiers.MODALITY
|
||||||
import org.jetbrains.kotlin.serialization.ProtoBuf.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.KotlinFunctionStubImpl
|
||||||
|
import org.jetbrains.kotlin.psi.stubs.impl.KotlinPlaceHolderStubImpl
|
||||||
import org.jetbrains.kotlin.psi.stubs.impl.KotlinPropertyStubImpl
|
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.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.serialization.deserialization.NameResolver
|
||||||
import org.jetbrains.kotlin.idea.decompiler.stubBuilder.FlagsToModifiers.*
|
import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer
|
||||||
|
|
||||||
fun createCallableStub(
|
fun createCallableStub(
|
||||||
parentStub: StubElement<out PsiElement>,
|
parentStub: StubElement<out PsiElement>,
|
||||||
@@ -60,11 +64,14 @@ private class CallableClsStubBuilder(
|
|||||||
private val c = outerContext.child(callableProto.getTypeParameterList())
|
private val c = outerContext.child(callableProto.getTypeParameterList())
|
||||||
private val typeStubBuilder = TypeClsStubBuilder(c)
|
private val typeStubBuilder = TypeClsStubBuilder(c)
|
||||||
private val isTopLevel: Boolean get() = protoContainer.packageFqName != null
|
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()
|
private val callableStub = doCreateCallableStub()
|
||||||
|
|
||||||
fun build() {
|
fun build() {
|
||||||
createModifierListStub()
|
createModifierListStub()
|
||||||
val typeConstraintListData = typeStubBuilder.createTypeParameterListStub(callableStub, callableProto.getTypeParameterList())
|
val typeParameterList = if (isConstructor) emptyList() else callableProto.getTypeParameterList()
|
||||||
|
val typeConstraintListData = typeStubBuilder.createTypeParameterListStub(callableStub, typeParameterList)
|
||||||
createReceiverTypeReferenceStub()
|
createReceiverTypeReferenceStub()
|
||||||
createValueParameterList()
|
createValueParameterList()
|
||||||
createReturnTypeStub()
|
createReturnTypeStub()
|
||||||
@@ -82,11 +89,13 @@ private class CallableClsStubBuilder(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createReturnTypeStub() {
|
private fun createReturnTypeStub() {
|
||||||
typeStubBuilder.createTypeReferenceStub(callableStub, callableProto.getReturnType())
|
if (!isConstructor)
|
||||||
|
typeStubBuilder.createTypeReferenceStub(callableStub, callableProto.getReturnType())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createModifierListStub() {
|
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 modifierListStubImpl = createModifierListStubForDeclaration(callableStub, callableProto.getFlags(), relevantModifiers)
|
||||||
val annotationIds = c.components.annotationLoader.loadCallableAnnotations(
|
val annotationIds = c.components.annotationLoader.loadCallableAnnotations(
|
||||||
@@ -96,9 +105,7 @@ private class CallableClsStubBuilder(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun doCreateCallableStub(): StubElement<out PsiElement> {
|
private fun doCreateCallableStub(): StubElement<out PsiElement> {
|
||||||
val callableKind = Flags.CALLABLE_KIND[callableProto.getFlags()]
|
|
||||||
val callableName = c.nameResolver.getName(callableProto.getName())
|
val callableName = c.nameResolver.getName(callableProto.getName())
|
||||||
val callableFqName = c.containerFqName.child(callableName)
|
|
||||||
|
|
||||||
return when (callableKind) {
|
return when (callableKind) {
|
||||||
ProtoBuf.Callable.CallableKind.FUN -> {
|
ProtoBuf.Callable.CallableKind.FUN -> {
|
||||||
@@ -106,7 +113,7 @@ private class CallableClsStubBuilder(
|
|||||||
parent,
|
parent,
|
||||||
callableName.ref(),
|
callableName.ref(),
|
||||||
isTopLevel,
|
isTopLevel,
|
||||||
callableFqName,
|
c.containerFqName.child(callableName),
|
||||||
isExtension = callableProto.hasReceiverType(),
|
isExtension = callableProto.hasReceiverType(),
|
||||||
hasBlockBody = true,
|
hasBlockBody = true,
|
||||||
hasBody = Flags.MODALITY[callableProto.getFlags()] != Modality.ABSTRACT,
|
hasBody = Flags.MODALITY[callableProto.getFlags()] != Modality.ABSTRACT,
|
||||||
@@ -125,11 +132,13 @@ private class CallableClsStubBuilder(
|
|||||||
hasInitializer = false,
|
hasInitializer = false,
|
||||||
hasReceiverTypeRef = callableProto.hasReceiverType(),
|
hasReceiverTypeRef = callableProto.hasReceiverType(),
|
||||||
hasReturnTypeRef = true,
|
hasReturnTypeRef = true,
|
||||||
fqName = callableFqName,
|
fqName = c.containerFqName.child(callableName),
|
||||||
isProbablyNothingType = isProbablyNothing(callableProto)
|
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")
|
else -> throw IllegalStateException("Unknown callable kind $callableKind")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -135,7 +135,7 @@ private class ClassClsStubBuilder(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createConstructorStub() {
|
private fun createConstructorStub() {
|
||||||
if (!isClass()) return
|
if (!isClass() || !classProto.hasPrimaryConstructor()) return
|
||||||
|
|
||||||
val primaryConstructorProto = classProto.getPrimaryConstructor()
|
val primaryConstructorProto = classProto.getPrimaryConstructor()
|
||||||
if (primaryConstructorProto.hasData()) {
|
if (primaryConstructorProto.hasData()) {
|
||||||
@@ -198,7 +198,8 @@ private class ClassClsStubBuilder(
|
|||||||
|
|
||||||
private fun createCallableMemberStubs(classBody: KotlinPlaceHolderStubImpl<JetClassBody>) {
|
private fun createCallableMemberStubs(classBody: KotlinPlaceHolderStubImpl<JetClassBody>) {
|
||||||
val container = ProtoContainer(classProto, null)
|
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)
|
createCallableStub(classBody, callableProto, c, container)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.types.isFlexible
|
|||||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||||
import org.jetbrains.kotlin.load.kotlin.header.isCompatiblePackageFacadeKind
|
import org.jetbrains.kotlin.load.kotlin.header.isCompatiblePackageFacadeKind
|
||||||
import org.jetbrains.kotlin.load.kotlin.header.isCompatibleClassKind
|
import org.jetbrains.kotlin.load.kotlin.header.isCompatibleClassKind
|
||||||
|
import org.jetbrains.kotlin.resolve.descriptorUtil.secondaryConstructors
|
||||||
import org.jetbrains.kotlin.types.flexibility
|
import org.jetbrains.kotlin.types.flexibility
|
||||||
|
|
||||||
private val FILE_ABI_VERSION_MARKER: String = "FILE_ABI"
|
private val FILE_ABI_VERSION_MARKER: String = "FILE_ABI"
|
||||||
@@ -85,6 +86,7 @@ private val descriptorRendererForDecompiler = DescriptorRendererBuilder()
|
|||||||
else type
|
else type
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.setSecondaryConstructorsAsPrimary(false)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
private val descriptorRendererForKeys = DescriptorRenderer.COMPACT_WITH_MODIFIERS
|
private val descriptorRendererForKeys = DescriptorRenderer.COMPACT_WITH_MODIFIERS
|
||||||
@@ -153,7 +155,8 @@ private fun buildDecompiledText(packageFqName: FqName, descriptors: List<Declara
|
|||||||
builder.append(subindent)
|
builder.append(subindent)
|
||||||
appendDescriptor(defaultObject, 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) {
|
if (member.getContainingDeclaration() != descriptor) {
|
||||||
continue
|
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 */ }
|
||||||
|
}
|
||||||
|
}
|
||||||
+27
@@ -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
|
||||||
+6
@@ -120,6 +120,12 @@ public class ClsStubBuilderTestGenerated extends AbstractClsStubBuilderTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("SecondaryConstructors")
|
||||||
|
public void testSecondaryConstructors() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/stubBuilder/SecondaryConstructors/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("TopLevelMembersAnnotatedPackage")
|
@TestMetadata("TopLevelMembersAnnotatedPackage")
|
||||||
public void testTopLevelMembersAnnotatedPackage() throws Exception {
|
public void testTopLevelMembersAnnotatedPackage() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/stubBuilder/TopLevelMembersAnnotatedPackage/");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/stubBuilder/TopLevelMembersAnnotatedPackage/");
|
||||||
|
|||||||
+6
@@ -86,6 +86,12 @@ public class DecompiledTextTestGenerated extends AbstractDecompiledTextTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("SecondaryConstructors")
|
||||||
|
public void testSecondaryConstructors() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/SecondaryConstructors/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SimpleClass")
|
@TestMetadata("SimpleClass")
|
||||||
public void testSimpleClass() throws Exception {
|
public void testSimpleClass() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/SimpleClass/");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/SimpleClass/");
|
||||||
|
|||||||
@@ -216,6 +216,12 @@ public class StubBuilderTestGenerated extends AbstractStubBuilderTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("SecondaryConstructors.kt")
|
||||||
|
public void testSecondaryConstructors() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/stubs/SecondaryConstructors.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SimpleEnumBuild.kt")
|
@TestMetadata("SimpleEnumBuild.kt")
|
||||||
public void testSimpleEnumBuild() throws Exception {
|
public void testSimpleEnumBuild() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/stubs/SimpleEnumBuild.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/stubs/SimpleEnumBuild.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user