Commit Graph

50515 Commits

Author SHA1 Message Date
Denis Zharkov 5cf2d659dc Minor. Split ultraLightPsi.kt into three files
By one for PsiClass, PsiField and PsiMethod implementations
2018-11-26 11:36:31 +03:00
Denis Zharkov 5231da4320 Fix hasAlias check when resolving annotation in ultra-light classes
When trying to estimate if annotation entry might be resolved
to a specified fqName we should track the short name from entry itself
instead of the short name of desired annotation
2018-11-26 11:36:30 +03:00
Denis Zharkov aa5a2a2643 Support @JvmField on primary ctr properties in ultra-light classes 2018-11-26 11:36:29 +03:00
Denis Zharkov 206466f6ce Support enums in ultra-light classes
There's no need to add "values"/"valueOf" methods for them
(see com.intellij.psi.impl.compiled.StubBuildingVisitor#visitMethod that ignores them too)

We already have tests that check enum entries/synthetic methods
are properly resolved in Java:
idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/*Enum*
2018-11-26 11:36:28 +03:00
Denis Zharkov d5a640b82d Get rid of checks for ultra-light classes unsupported annotations
Seems like all of the Jvm* annotations related to classes are supported by now
2018-11-26 11:36:28 +03:00
Denis Zharkov ca9f42f449 Support @JvmName in ultra-light classes 2018-11-26 11:36:27 +03:00
Denis Zharkov 17328a442a Support @JvmSynthetic in ultra-light classes 2018-11-26 11:36:26 +03:00
Denis Zharkov 91c86f7f56 Fix refactorings that remove parameter based on ultra-light classes
This commit fixes the exception attached to the bottom of the message
The problem is that when creating ChangeSignatureProcessor for old PsiMethod
that points to the parameter that is already removed from PSI, some pieces
of platform code run resolution on the light PSI that eventually checks
if the source element is valid.

For KtUltraLightParameter, it inherits "isValid" from LightElement and
the latter is defined as getNavigationElement().isValid(),
while here navigationElement points to already removed parameter,
and marked as invalid.

The simplest solution was to define KtUltraLightParameter::isValid
as it was before ultra-light classes, i.e. checking if parent is valid
(see KtLightElementBase::isValid)

com.intellij.psi.PsiInvalidElementAccessException: Element: class com.intellij.psi.impl.compiled.ClsJavaCodeReferenceElementImpl #JAVA  because: File language:Language: JAVA != Provider base language:Language: kotlin
invalidated at: no info
	at com.intellij.psi.util.PsiUtilCore.ensureValid(PsiUtilCore.java:482)
	at com.intellij.psi.impl.source.PsiClassReferenceType.resolveGenerics(PsiClassReferenceType.java:190)
	at com.intellij.psi.impl.source.PsiClassReferenceType.resolve(PsiClassReferenceType.java:138)
	at com.intellij.psi.util.PsiUtil.resolveClassInType(PsiUtil.java:445)
	at com.intellij.psi.util.PsiUtil.convertAnonymousToBaseType(PsiUtil.java:484)
	at com.intellij.psi.impl.light.LightTypeElement.<init>(LightTypeElement.java:33)
	at com.intellij.psi.impl.PsiElementFactoryImpl.createTypeElement(PsiElementFactoryImpl.java:142)
	at com.intellij.refactoring.changeSignature.JavaChangeInfoImpl.fillOldParams(JavaChangeInfoImpl.java:218)
	at com.intellij.refactoring.changeSignature.JavaChangeInfoImpl.<init>(JavaChangeInfoImpl.java:127)
	at com.intellij.refactoring.changeSignature.JavaChangeInfoImpl.<init>(JavaChangeInfoImpl.java:86)
	at com.intellij.refactoring.changeSignature.ChangeSignatureProcessor.generateChangeInfo(ChangeSignatureProcessor.java:121)
	at com.intellij.refactoring.changeSignature.ChangeSignatureProcessor.<init>(ChangeSignatureProcessor.java:88)
	at org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinChangeInfo$getOrCreateJavaChangeInfos$3.invoke(KotlinChangeInfo.kt:400)
	at org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinChangeInfo$getOrCreateJavaChangeInfos$5.invoke(KotlinChangeInfo.kt:469)
	at org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinChangeInfo.getOrCreateJavaChangeInfos(KotlinChangeInfo.kt:498)
	at org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinChangeSignatureUsageProcessor.processUsage(KotlinChangeSignatureUsageProcessor.kt:847)
	at com.intellij.refactoring.changeSignature.ChangeSignatureProcessorBase.doChangeSignature(ChangeSignatureProcessorBase.java:218)
2018-11-26 11:36:25 +03:00
Denis Zharkov 7de8b4de4e Support declarations returning object literals in ultra-light classes 2018-11-26 11:36:25 +03:00
Denis Zharkov 28f20a97f8 Support @JvmOverloads annotation in ultra-light classes 2018-11-26 11:25:42 +03:00
Denis Zharkov 41997769e3 Support @JvmField annotation in light classes 2018-11-26 11:25:42 +03:00
Sergey Rostov dcc47fd8ef JPS: support KotlinResourceSourceRootType
Implementation is similar to KotlinSourceRootProvider.
This workaround is required since ResourcesTarget.computeRootDescriptors
supports only JavaResourceRoots.

#KT-27622 Fixed
2018-11-26 09:29:49 +03:00
Sergey Rostov 1301333e37 JPS, tests, minor: rename test files in modules for better readability 2018-11-26 09:29:38 +03:00
Sergey Rostov 63c6e3e1b4 JPS, minor: formatting 2018-11-26 09:29:38 +03:00
Sergey Rostov 32bd4d5936 JPS, tests: update removeAndRestoreCompanion[WithImplicitUsages] test data
src/A.kt is affected by removed classes
2018-11-26 09:29:38 +03:00
Sergey Rostov 7cdd5257c8 JPS: clear target local cache version file when caches are not required anymore
Makes changeIncrementalOption/incrementalOff test green
2018-11-26 09:29:38 +03:00
Sergey Rostov 1f162cfacf JPS, tests, minor: reformat test data for changeIncrementalOption/incrementalOff 2018-11-26 09:29:38 +03:00
Sergey Rostov 4cd4e230bf JPS, tests: update test data for cacheVersionChanged/withError
In this test only lookups caches are invalidated and only in first step.
module4 shouldn't be rebuilt since is compiled in step 1 and it is independent of all dirty modules.

Previously this module was rebuilt because of #KT-27044 which is fixed
by 5232f08
2018-11-26 09:29:38 +03:00
Sergey Rostov a508f53f9d JPS, tests, minor: reformat test data for cacheVersionChanged/withError 2018-11-26 09:29:38 +03:00
Sergey Rostov 06b908d48f JPS, tests: Add docs for incremental/cacheVersionChanged tests 2018-11-26 09:29:38 +03:00
Ilya Gorbunov 290efe3749 BFS improvement in Gradle importer
Avoid queuing duplicate dependencies and excessive `contains` checks
by tracking discovered modules instead of processed.

Use ArrayDeque instead of LinkedList
2018-11-24 16:20:29 +03:00
Toshiaki Kameyama e409007749 Join Lines: join initializer + if null check to elvis (KT-22388)
#KT-22388 Fixed
2018-11-24 02:30:10 +03:00
Vyacheslav Gerasimov 0708872f62 Remove kotlin-ultimate from VcsDirectoryMappings 2018-11-23 22:29:08 +03:00
Alexander Udalov a796f11934 Support calling methods annotated with PolymorphicSignature
#KT-14416 Fixed
 #KT-26165 Fixed
2018-11-23 18:41:33 +01:00
Alexander Udalov b940418604 Compute default method signature lazily in CallableMethod
To prevent calling mapDefaultMethod for methods which are guaranteed
not to have default parameters (e.g. signature-polymorphic methods)
2018-11-23 18:41:32 +01:00
Alexander Udalov 0331f84ccd Make parameter descriptor in CallGenerator.genValueAndPut optional
The main implementation in DefaultCallGenerator did not use anything
from that parameter anyway in 99% cases, except the type, which is
passed separately now as JvmKotlinType. This will be useful to implement
call generation for functions which do not have descriptors for their
value parameters (such as signature-polymorphic)

 #KT-14416 In Progress
2018-11-23 18:41:32 +01:00
Alexander Udalov 7766f0a89d J2K CallBasedArgumentGenerator: convert and prettify 2018-11-23 18:41:32 +01:00
Alexander Udalov b66755b2d6 J2K CallBasedArgumentGenerator: rename .java -> .kt 2018-11-23 18:41:32 +01:00
Dmitriy Dolovov bdaf762d93 CLion/AppCode: Disable action items in IDE:
- Convert Java File to Kotlin File
- Decompile Kotlin To Java

Issue #KT-28345:fixed
2018-11-23 22:27:23 +07:00
Dmitriy Dolovov 597d119ab7 CLion/AppCode: New plugin versioning schema
Use -PdeployVersion=<kotlin_version> to specify Kotlin version
Use -PcidrPluginVersion=<plugin_version> to specify CLion or AppCode plugin version (default is "beta-1")
2018-11-23 22:27:23 +07:00
Dmitriy Dolovov b39656a85a CLion/AppCode: Use LLDB bindings in Kotlin/Native debugger 2018-11-23 22:27:23 +07:00
Dmitriy Dolovov 5dca9b3de5 CLion/AppCode: Re-enable specific EPs for Kotlin/Native
Issue #KT-26717
2018-11-23 22:27:23 +07:00
Simon Ogorodnik 8ed63d1c18 CLion: Patch some xml's of Java plugin to make it work more stable
To get rid of exceptions while startup and indexing
2018-11-23 22:27:23 +07:00
Simon Ogorodnik 2b3b5876aa CLion/AppCode: Use default platform for libraries, if no LibraryKind is specified
To avoid Unknown platform JVM
2018-11-23 22:27:23 +07:00
Vyacheslav Karpukhin 1b9b545643 CLion: limit plugin compatibility 2018-11-23 22:27:23 +07:00
Simon Ogorodnik a8e5c01126 CLion/AppCode: Build artifacts via compilations, not via tasks 2018-11-23 22:27:23 +07:00
Simon Ogorodnik 7f0fcf7ef1 CLion/AppCode: Do not import sourceSets with unsupported platforms 2018-11-23 22:27:22 +07:00
Simon Ogorodnik 4a99cb274b CLion/AppCode: Provide proper TargetPlatform & TargetPlatformVersion to FE 2018-11-23 22:27:22 +07:00
Simon Ogorodnik 49de7becfd CLion/AppCode: Disable module type check for Kotlin Facet adding 2018-11-23 22:27:22 +07:00
Simon Ogorodnik 64800266f5 CLion/AppCode: Provide proper default platform instead of JVM 2018-11-23 22:27:22 +07:00
Simon Ogorodnik 39b151e37b CLion/AppCode: Fix facet configuring 2018-11-23 22:27:22 +07:00
Vyacheslav Karpukhin 6dccafb469 CLion/AppCode: Move KotlinMPPGradleProjectResolver declaration from gradle-java.xml to gradle.xml 2018-11-23 22:27:22 +07:00
Vyacheslav Karpukhin 632dcc31bd CLion/AppCode: Added kotlin-ultimate repository. 2018-11-23 22:27:21 +07:00
Mikhail Zarechenskiy 7b108541a9 [NI] Add test for obsolete issue
It was fixed after c6712ff861

 #KT-25182 Obsolete
2018-11-23 17:30:37 +03:00
Mikhail Zarechenskiy 30aee3bfb6 [NI] Update test data 2018-11-23 17:30:37 +03:00
victor.petukhov 68c1e70b74 Add real literals spec tests 2018-11-23 17:24:13 +03:00
victor.petukhov 73ecde6cc3 Add boolean literals diagnostic spec tests 2018-11-23 17:24:01 +03:00
victor.petukhov 1af1eed31c Add when expression PSI spec tests 2018-11-23 17:23:51 +03:00
victor.petukhov 64f531fc93 Reorganize spec tests infrastructure code
- Add the tests mute system for the diagnostic tests
- Move the code for the test info parsing to the separate package `parsers`
- Unification of the `linked` and `not linked` spec tests
- Package structure is refactored
- Change the multiline comment format with a test information
- Actualize `PrintSpecTestsStatistic`
- Other different code improvements
2018-11-23 17:23:41 +03:00
Mikhail Glukhikh 2af9efa4a0 Fix failing test (related to KT-28381, KT-28382 commits) 2018-11-23 15:43:39 +03:00