Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dmitry Jemerov
2015-10-19 21:01:38 +02:00
623 changed files with 2021 additions and 1473 deletions
@@ -133,7 +133,7 @@ private class FunctionClsStubBuilder(
val modalityModifier = if (isTopLevel) listOf() else listOf(MODALITY)
val modifierListStubImpl = createModifierListStubForDeclaration(
callableStub, functionProto.flags,
listOf(VISIBILITY, OPERATOR, INFIX) + modalityModifier
listOf(VISIBILITY, OPERATOR, INFIX, EXTERNAL_FUN, INLINE, TAILREC) + modalityModifier
)
val annotationIds = c.components.annotationLoader.loadCallableAnnotations(
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.decompiler.stubBuilder
import com.intellij.psi.PsiElement
import com.intellij.psi.stubs.StubElement
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.idea.decompiler.stubBuilder.FlagsToModifiers.DATA
import org.jetbrains.kotlin.idea.decompiler.stubBuilder.FlagsToModifiers.INNER
import org.jetbrains.kotlin.idea.decompiler.stubBuilder.FlagsToModifiers.MODALITY
import org.jetbrains.kotlin.idea.decompiler.stubBuilder.FlagsToModifiers.VISIBILITY
@@ -87,11 +88,13 @@ private class ClassClsStubBuilder(
val relevantFlags = arrayListOf(VISIBILITY)
if (isClass()) {
relevantFlags.add(INNER)
relevantFlags.add(DATA)
relevantFlags.add(MODALITY)
}
val additionalModifiers = when (classKind) {
ProtoBuf.Class.Kind.ENUM_CLASS -> listOf(JetTokens.ENUM_KEYWORD)
ProtoBuf.Class.Kind.COMPANION_OBJECT -> listOf(JetTokens.COMPANION_KEYWORD)
ProtoBuf.Class.Kind.ANNOTATION_CLASS -> listOf(JetTokens.ANNOTATION_KEYWORD)
else -> listOf<JetModifierKeywordToken>()
}
return createModifierListStubForDeclaration(parent, classProto.getFlags(), relevantFlags, additionalModifiers)
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.stubs.KotlinUserTypeStub
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes
import org.jetbrains.kotlin.psi.stubs.impl.*
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.ProtoBuf.Type
import org.jetbrains.kotlin.serialization.ProtoBuf.Type.Argument.Projection
@@ -162,8 +163,13 @@ class TypeClsStubBuilder(private val c: ClsStubBuilderContext) {
)
val varargElementType = valueParameterProto.varargElementType(c.typeTable)
val typeProto = varargElementType ?: valueParameterProto.type(c.typeTable)
val modifierList =
if (varargElementType != null) createModifierListStub(parameterStub, listOf(JetTokens.VARARG_KEYWORD)) else null
val modifiers = arrayListOf<JetModifierKeywordToken>()
if (varargElementType != null) { modifiers.add(JetTokens.VARARG_KEYWORD) }
if (Flags.IS_CROSSINLINE.get(valueParameterProto.flags)) { modifiers.add(JetTokens.CROSSINLINE_KEYWORD) }
if (Flags.IS_NOINLINE.get(valueParameterProto.flags)) { modifiers.add(JetTokens.NOINLINE_KEYWORD) }
val modifierList = createModifierListStub(parameterStub, modifiers)
val parameterAnnotations = c.components.annotationLoader.loadValueParameterAnnotations(
container, callableProto, callableProto.annotatedCallableKind, index, valueParameterProto
)
@@ -203,6 +203,30 @@ enum class FlagsToModifiers {
override fun getModifiers(flags: Int): JetModifierKeywordToken? {
return if (Flags.IS_INFIX.get(flags)) JetTokens.INFIX_KEYWORD else null
}
},
DATA {
override fun getModifiers(flags: Int): JetModifierKeywordToken? {
return if (Flags.IS_DATA.get(flags)) JetTokens.DATA_KEYWORD else null
}
},
EXTERNAL_FUN {
override fun getModifiers(flags: Int): JetModifierKeywordToken? {
return if (Flags.IS_EXTERNAL_FUNCTION.get(flags)) JetTokens.EXTERNAL_KEYWORD else null
}
},
INLINE {
override fun getModifiers(flags: Int): JetModifierKeywordToken? {
return if (Flags.IS_INLINE.get(flags)) JetTokens.INLINE_KEYWORD else null
}
},
TAILREC {
override fun getModifiers(flags: Int): JetModifierKeywordToken? {
return if (Flags.IS_TAILREC.get(flags)) JetTokens.TAILREC_KEYWORD else null
}
};
abstract fun getModifiers(flags: Int): JetModifierKeywordToken?
@@ -4,9 +4,6 @@
<extensions defaultExtensionNs="org.jetbrains.kotlin">
<defaultErrorMessages implementation="org.jetbrains.kotlin.resolve.jvm.diagnostics.DefaultErrorMessagesJvm"/>
<suppressStringProvider implementation="org.jetbrains.kotlin.load.kotlin.nativeDeclarations.SuppressNoBodyErrorsForExternalDeclarations"/>
<suppressStringProvider implementation="org.jetbrains.kotlin.load.kotlin.nativeDeclarations.SuppressNoBodyErrorsForNativeDeclarations"/>
<classBuilderInterceptorExtension implementation="org.jetbrains.kotlin.annotation.AnnotationCollectorExtension"/>
<analyzeCompleteHandlerExtension implementation="org.jetbrains.kotlin.resolve.jvm.AnalyzeCompleteHandlerExtension"/>
@@ -26,11 +26,11 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.diagnostics.Diagnostic;
import org.jetbrains.kotlin.idea.JetBundle;
import org.jetbrains.kotlin.idea.core.quickfix.QuickFixUtil;
import org.jetbrains.kotlin.idea.references.ReferenceUtilKt;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.psi.*;
public class MakeClassAnAnnotationClassFix extends KotlinQuickFixAction<JetAnnotationEntry> {
@@ -84,14 +84,13 @@ public class MakeClassAnAnnotationClassFix extends KotlinQuickFixAction<JetAnnot
public void invoke(@NotNull Project project, Editor editor, @NotNull JetFile file) throws IncorrectOperationException {
JetPsiFactory factory = new JetPsiFactory(annotationClass.getProject());
JetModifierList list = annotationClass.getModifierList();
String annotation = KotlinBuiltIns.FQ_NAMES.annotation.shortName().asString();
PsiElement added;
if (list == null) {
JetModifierList newModifierList = factory.createModifierList(annotation);
JetModifierList newModifierList = factory.createModifierList(JetTokens.ANNOTATION_KEYWORD);
added = annotationClass.addBefore(newModifierList, annotationClass.getClassOrInterfaceKeyword());
}
else {
JetAnnotationEntry entry = factory.createAnnotationEntry(annotation);
PsiElement entry = factory.createModifier(JetTokens.ANNOTATION_KEYWORD);
added = list.addBefore(entry, list.getFirstChild());
}
annotationClass.addAfter(factory.createWhiteSpace(), added);
@@ -58,7 +58,6 @@ import com.intellij.util.VisibilityUtil
import com.intellij.util.containers.MultiMap
import org.jetbrains.kotlin.asJava.KotlinLightMethod
import org.jetbrains.kotlin.asJava.LightClassUtil
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
@@ -450,8 +449,8 @@ private fun copyModifierListItems(from: PsiModifierList, to: PsiModifierList, wi
}
for (annotation in from.getAnnotations()) {
val annotationName = annotation.getQualifiedName()!!
if (KotlinBuiltIns.FQ_NAMES.annotation.asString() != annotationName
&& javaClass<Retention>().getName() != annotationName) {
if (javaClass<Retention>().getName() != annotationName) {
to.addAnnotation(annotationName)
}
}
@@ -24,6 +24,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.search.GlobalSearchScope;
@@ -225,11 +226,23 @@ public class KotlinRuntimeLibraryUtil {
public static String bundledRuntimeVersion(@NotNull String pluginVersion) {
int placeToSplit = -1;
for (int i = 1; i < pluginVersion.length(); i++) {
char ch = pluginVersion.charAt(i);
if (Character.isLetter(ch) && pluginVersion.charAt(i - 1) == '.') {
placeToSplit = i - 1;
break;
int ideaPatternIndex = StringUtil.indexOf(pluginVersion, "Idea");
if (ideaPatternIndex >= 2 && Character.isDigit(pluginVersion.charAt(ideaPatternIndex - 2))) {
placeToSplit = ideaPatternIndex - 1;
}
int ijPatternIndex = StringUtil.indexOf(pluginVersion, "IJ");
if (ijPatternIndex >= 2 && Character.isDigit(pluginVersion.charAt(ijPatternIndex - 2))) {
placeToSplit = ijPatternIndex - 1;
}
if (placeToSplit == -1) {
for (int i = 1; i < pluginVersion.length(); i++) {
char ch = pluginVersion.charAt(i);
if (Character.isLetter(ch) && pluginVersion.charAt(i - 1) == '.') {
placeToSplit = i - 1;
break;
}
}
}
@@ -246,9 +246,7 @@ public class OutdatedKotlinRuntimeNotification extends AbstractProjectComponent
String runtimeVersion = KotlinRuntimeLibraryUtil.bundledRuntimeVersion();
boolean isOutdated = libraryVersion == null
|| libraryVersion.startsWith("internal-") != runtimeVersion.startsWith("internal-")
|| VersionComparatorUtil.compare(runtimeVersion, libraryVersion) > 0;
boolean isOutdated = isRuntimeOutdated(libraryVersion, runtimeVersion);
if (isOutdated) {
outdatedLibraries.add(new VersionedLibrary(library, libraryVersion));
@@ -258,6 +256,12 @@ public class OutdatedKotlinRuntimeNotification extends AbstractProjectComponent
return outdatedLibraries;
}
public static boolean isRuntimeOutdated(String libraryVersion, String runtimeVersion) {
return libraryVersion == null
|| libraryVersion.startsWith("internal-") != runtimeVersion.startsWith("internal-")
|| VersionComparatorUtil.compare(runtimeVersion, libraryVersion) > 0;
}
@NotNull
public static Runnable showRuntimeJarNotFoundDialog(@NotNull final Project project, final @NotNull String jarName) {
return new Runnable() {
@@ -4,7 +4,7 @@
package test
@dependency.A @dependency.B @dependency.C public final class Annotations public constructor() {
@dependency.A @dependency.B @dependency.C @kotlin.inline public final val p: @dependency.B kotlin.Int /* compiled code */
@dependency.A @dependency.B @dependency.C public final val p: @dependency.B kotlin.Int /* compiled code */
@dependency.A @dependency.B @dependency.C @kotlin.inline public final fun f(@dependency.A @dependency.B @dependency.C i: @dependency.A kotlin.Int): kotlin.Unit { /* compiled code */ }
@dependency.A @dependency.B @dependency.C public final inline fun f(@dependency.A @dependency.B @dependency.C i: @dependency.A kotlin.Int): kotlin.Unit { /* compiled code */ }
}
@@ -7,5 +7,5 @@ import dependency.*
inline @A("f") @B(2) @C fun f(@A("i") @B(3) @C i: @A("int") Int) {
}
inline @A("p") @B(3) @C val p: @B(4) Int = 2
@A("p") @B(3) @C val p: @B(4) Int = 2
}
@@ -0,0 +1,14 @@
// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available
package test
public final data class Modifiers public constructor(x: kotlin.Int) {
public final val x: kotlin.Int /* compiled code */
public final operator fun component1(): kotlin.Int { /* compiled code */ }
public final inline fun inlined(crossinline arg1: () -> kotlin.Unit, noinline arg2: () -> kotlin.Unit): kotlin.Unit { /* compiled code */ }
public final tailrec fun sum(x: kotlin.Long, sum: kotlin.Long): kotlin.Long { /* compiled code */ }
}
@@ -0,0 +1,12 @@
package test
data class Modifiers(val x: Int) {
tailrec fun sum(x: Long, sum: Long): Long {
if (x == 0.toLong()) return sum
return sum(x - 1, sum + x)
}
inline fun inlined(crossinline arg1: ()->Unit, noinline arg2: ()->Unit): Unit {}
}
annotation class Ann
@@ -0,0 +1,11 @@
// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available
package test
public final class Modifiers public constructor() {
public final var extVar: kotlin.Int /* compiled code */
public final external fun extFun(): kotlin.Unit { /* compiled code */ }
}
@@ -0,0 +1,9 @@
package test
class Modifiers {
external fun extFun()
var extVar: Int = 1
external get
external set
}
+1 -1
View File
@@ -33,4 +33,4 @@ package testData.libraries
[public fun processDouble(d: testData.libraries.Double): kotlin.Unit { /* compiled code */ }]
[@kotlin.inline public fun <T> T.filter(predicate: (T) -> kotlin.Boolean): T? { /* compiled code */ }]
[public inline fun <T> T.filter(predicate: (T) -> kotlin.Boolean): T? { /* compiled code */ }]
@@ -5,16 +5,7 @@ PsiJetFileStubImpl[package=test.a]
REFERENCE_EXPRESSION:[referencedName=a]
IMPORT_LIST:
CLASS:[fqName=test.a.AnnotationClass, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=AnnotationClass, superNames=[Annotation]]
MODIFIER_LIST:[public final]
ANNOTATION_ENTRY:[hasValueArguments=false, shortName=annotation]
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=annotation]
REFERENCE_EXPRESSION:[referencedName=annotation]
MODIFIER_LIST:[public final annotation]
PRIMARY_CONSTRUCTOR:
MODIFIER_LIST:[public]
VALUE_PARAMETER_LIST:
@@ -113,16 +113,7 @@ PsiJetFileStubImpl[package=test.class_object]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Unit]
CLASS:[fqName=test.class_object.ClassObject.B.Companion.C.Companion.D.Companion.Anno, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=false, name=Anno, superNames=[Annotation]]
MODIFIER_LIST:[public final]
ANNOTATION_ENTRY:[hasValueArguments=false, shortName=annotation]
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=annotation]
REFERENCE_EXPRESSION:[referencedName=annotation]
MODIFIER_LIST:[public final annotation]
PRIMARY_CONSTRUCTOR:
MODIFIER_LIST:[public]
VALUE_PARAMETER_LIST:
@@ -7,14 +7,7 @@ PsiJetFileStubImpl[package=a.b.c]
REFERENCE_EXPRESSION:[referencedName=c]
IMPORT_LIST:
CLASS:[fqName=a.b.c.DataClass, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=DataClass, superNames=[]]
MODIFIER_LIST:[public final]
ANNOTATION_ENTRY:[hasValueArguments=false, shortName=data]
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=data]
MODIFIER_LIST:[public final data]
PRIMARY_CONSTRUCTOR:
MODIFIER_LIST:[public]
VALUE_PARAMETER_LIST:
@@ -0,0 +1,18 @@
package test
data class Modifiers(val x: Int) {
external fun extFun()
var extVar: Int = 1
external get
external set
tailrec fun sum(x: Long, sum: Long): Long {
if (x == 0.toLong()) return sum
return sum(x - 1, sum + x)
}
inline fun inlined(crossinline arg1: ()->Unit, noinline arg2: ()->Unit): Unit {}
annotation class Ann
}
@@ -0,0 +1,107 @@
PsiJetFileStubImpl[package=test]
PACKAGE_DIRECTIVE:
REFERENCE_EXPRESSION:[referencedName=test]
IMPORT_LIST:
CLASS:[fqName=test.Modifiers, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=Modifiers, superNames=[]]
MODIFIER_LIST:[public final data]
PRIMARY_CONSTRUCTOR:
MODIFIER_LIST:[public]
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=x]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Int]
CLASS_BODY:
PROPERTY:[fqName=test.Modifiers.extVar, hasDelegate=false, hasDelegateExpression=false, hasInitializer=false, hasReturnTypeRef=true, isExtension=false, isTopLevel=false, isVar=true, name=extVar]
MODIFIER_LIST:[public final]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Int]
PROPERTY:[fqName=test.Modifiers.x, hasDelegate=false, hasDelegateExpression=false, hasInitializer=false, hasReturnTypeRef=true, isExtension=false, isTopLevel=false, isVar=false, name=x]
MODIFIER_LIST:[public final]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Int]
FUN:[fqName=test.Modifiers.component1, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=component1]
MODIFIER_LIST:[public final operator]
VALUE_PARAMETER_LIST:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Int]
FUN:[fqName=test.Modifiers.extFun, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=extFun]
MODIFIER_LIST:[public final external]
VALUE_PARAMETER_LIST:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Unit]
FUN:[fqName=test.Modifiers.inlined, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=inlined]
MODIFIER_LIST:[public final inline]
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=arg1]
MODIFIER_LIST:[crossinline]
TYPE_REFERENCE:
FUNCTION_TYPE:
VALUE_PARAMETER_LIST:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Unit]
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=arg2]
MODIFIER_LIST:[noinline]
TYPE_REFERENCE:
FUNCTION_TYPE:
VALUE_PARAMETER_LIST:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Unit]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Unit]
FUN:[fqName=test.Modifiers.sum, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=sum]
MODIFIER_LIST:[public final tailrec]
VALUE_PARAMETER_LIST:
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=x]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Long]
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=sum]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Long]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Long]
CLASS:[fqName=test.Modifiers.Ann, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=false, name=Ann, superNames=[Annotation]]
MODIFIER_LIST:[public final annotation]
PRIMARY_CONSTRUCTOR:
MODIFIER_LIST:[public]
VALUE_PARAMETER_LIST:
DELEGATION_SPECIFIER_LIST:
DELEGATOR_SUPER_CLASS:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Annotation]
CLASS_BODY:
@@ -111,16 +111,7 @@ PsiJetFileStubImpl[package=test]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=Unit]
CLASS:[fqName=test.NamedCompanionObject.B.NamedInB.C.NamedInC.D.Companion.Anno, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=false, name=Anno, superNames=[Annotation]]
MODIFIER_LIST:[public final]
ANNOTATION_ENTRY:[hasValueArguments=false, shortName=annotation]
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=annotation]
REFERENCE_EXPRESSION:[referencedName=annotation]
MODIFIER_LIST:[public final annotation]
PRIMARY_CONSTRUCTOR:
MODIFIER_LIST:[public]
VALUE_PARAMETER_LIST:
@@ -124,14 +124,7 @@ PsiJetFileStubImpl[package=test]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=G1]
FUN:[fqName=test.TypeParams.f, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=true, isExtension=false, isTopLevel=false, name=f]
MODIFIER_LIST:[public final]
ANNOTATION_ENTRY:[hasValueArguments=false, shortName=inline]
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=kotlin]
REFERENCE_EXPRESSION:[referencedName=inline]
MODIFIER_LIST:[public final inline]
TYPE_PARAMETER_LIST:
TYPE_PARAMETER:[fqName=null, isInVariance=false, isOutVariance=false, name=G]
MODIFIER_LIST:[reified]
+1 -1
View File
@@ -2,4 +2,4 @@ fun test() {
listOf(1, 2, 4).<caret>filter { it > 0 }
}
//INFO: @inline <b>public</b> <b>fun</b> &lt;T&gt; Iterable&lt;T&gt;.filter(predicate: (T) &rarr; Boolean): List&lt;T&gt; <i>defined in</i> kotlin<p>Returns a list containing all elements matching the given <a href="psi_element://predicate">predicate</a>.</p>
//INFO: <b>public</b> inline <b>fun</b> &lt;T&gt; Iterable&lt;T&gt;.filter(predicate: (T) &rarr; Boolean): List&lt;T&gt; <i>defined in</i> kotlin<p>Returns a list containing all elements matching the given <a href="psi_element://predicate">predicate</a>.</p>
@@ -34,6 +34,50 @@ public class KotlinRuntimeLibraryUtilTest : TestCase() {
test("internal-0.1.2", "internal-0.1.2")
test(".0.1.2", ".0.1.2")
test("0.1.2.", "0.1.2.")
test("1.0.0-beta1-001-Idea141-12", "1.0.0-beta1-001")
test("1.0.1-beta5-013-Idea143-1", "1.0.1-beta5-013")
test("1.0.1-beta1-2-Idea143-1", "1.0.1-beta1-2")
test("1.0.3-beta1-2", "1.0.3-beta1-2")
test("1.0.0-beta1-001-IJ143-12", "1.0.0-beta1-001")
test("1.0.1-beta5-013-IJ142-1", "1.0.1-beta5-013")
test("1.0.1-beta1-2-IJ-2-1", "1.0.1-beta1-2")
test("1.0.3-beta1-2-IJ", "1.0.3-beta1-2")
test("2.15.789-Idea147-14", "2.15.789")
test("1.0.0-alpha", "1.0.0-alpha")
test("1.2.2123-alpha-023", "1.2.2123-alpha-023")
}
public fun testOutdatedRuntime() {
outdated("1.0.0-beta1-001-Idea141-12", "0.12.15")
outdated("1.0.0-beta1-001-Idea141-1", "0.152.16")
outdated("1.0.0-beta1-001-Idea141-1", "0.152.16")
notOutdated("1.0.0-beta1-001-Idea141-12", "1.0.0-beta1-001")
notOutdated("1.0.0-beta1-001-Idea143-14", "1.0.0-beta1-001")
notOutdated("1.0.0-beta1-001", "1.0.0-beta1-001")
notOutdated("1.0.0-beta1-001-Idea3-1", "1.0.0-beta1-001")
notOutdated("1.0.0-beta1-001-Idea3-(1)", "1.0.0-beta1-001")
outdated("1.0.0-beta1-002-Idea141-1", "1.0.0-beta1-001")
outdated("1.0.0-beta1-010-Idea141-1", "1.0.0-beta1-009")
outdated("1.0.0-beta1-100-Idea141-1", "1.0.0-beta1-099")
outdated("1.0.0-beta2-000-Idea141-1", "1.0.0-beta1-999")
outdated("1.1.0-beta1-000-Idea141-1", "1.0.9-beta9-999")
outdated("2.0.0-beta1-000-Idea141-1", "1.9.9-beta9-999")
}
private fun outdated(plugin: String, library: String) {
Assert.assertTrue("Should be outdated: plugin=$plugin, library=$library",
OutdatedKotlinRuntimeNotification.isRuntimeOutdated(library, KotlinRuntimeLibraryUtil.bundledRuntimeVersion(plugin)))
}
private fun notOutdated(plugin: String, library: String) {
Assert.assertFalse("Should NOT be outdated: plugin=$plugin, library=$library",
OutdatedKotlinRuntimeNotification.isRuntimeOutdated(library, KotlinRuntimeLibraryUtil.bundledRuntimeVersion(plugin)))
}
private fun test(version: String, expected: String) {
@@ -113,6 +113,12 @@ public class ClsStubBuilderTestGenerated extends AbstractClsStubBuilderTest {
doTest(fileName);
}
@TestMetadata("Modifiers")
public void testModifiers() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/stubBuilder/Modifiers/");
doTest(fileName);
}
@TestMetadata("MultifileClass")
public void testMultifileClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/stubBuilder/MultifileClass/");
@@ -107,6 +107,12 @@ public class CommonDecompiledTextFromJsMetadataTestGenerated extends AbstractCom
doTest(fileName);
}
@TestMetadata("Modifiers")
public void testModifiers() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/Modifiers/");
doTest(fileName);
}
@TestMetadata("Object")
public void testObject() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/Object/");
@@ -95,6 +95,12 @@ public class CommonDecompiledTextTestGenerated extends AbstractCommonDecompiledT
doTest(fileName);
}
@TestMetadata("Modifiers")
public void testModifiers() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/Modifiers/");
doTest(fileName);
}
@TestMetadata("NestedClasses")
public void testNestedClasses() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/NestedClasses/");
@@ -35,6 +35,12 @@ public class JvmDecompiledTextTestGenerated extends AbstractJvmDecompiledTextTes
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/decompiler/decompiledTextJvm"), Pattern.compile("^([^\\.]+)$"), true);
}
@TestMetadata("Modifiers")
public void testModifiers() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/decompiledTextJvm/Modifiers/");
doTest(fileName);
}
@TestMetadata("MultifileClass")
public void testMultifileClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/decompiler/decompiledTextJvm/MultifileClass/");