Commit Graph

50542 Commits

Author SHA1 Message Date
Yan Zhulanow 4e84a6b601 Kapt: Do partial analysis only for stub generation
Kapt has a 'compile' mode which repeats analysis after the annotation processing.
It should not run in the partial analysis mode.
2018-11-27 22:21:23 +09:00
Yan Zhulanow 69ec958aab Kapt: Add tests for the command-line 'kapt' tool 2018-11-27 22:21:23 +09:00
Yan Zhulanow 6e5eb0fdd4 Kapt: Implement 'kapt' command-line tool (KT-24998, KT-24997) 2018-11-27 22:21:23 +09:00
Yan Zhulanow 2e56feed73 Performance optimization: do not create a new list object on each new option 2018-11-27 22:21:23 +09:00
Yan Zhulanow b6aecf3933 Remove hacky PluginURLClassLoader
It was once needed for the compiler plugins bundled straight into the compiler (read: kapt1). Since there are no bundled plugins anymore, the parent-last plugin classloader itself is not needed anymore.
2018-11-27 22:21:22 +09:00
Yan Zhulanow 02340a4fe3 Removed obsolete 'BundledCompilerPlugins' class
It was used once in kapt1, but since it's gone, there is no need in this anymore.
2018-11-27 22:21:22 +09:00
Yan Zhulanow c5e241d5c6 Remove deprecated usages of CliOption in official compiler plugins 2018-11-27 22:21:22 +09:00
Yan Zhulanow 49941339a3 Introduce AbstractCliOption, rewrite all possible kapt options as enum values 2018-11-27 22:21:22 +09:00
Yan Zhulanow 546eff6e45 Kapt: Use light analysis by default 2018-11-27 22:21:21 +09:00
Yan Zhulanow fa0f447a23 Minor: Refactor AptMode a bit 2018-11-27 22:21:21 +09:00
Yan Zhulanow fe0f9005b0 Kapt: Allow to use class output directory as a generated class output 2018-11-27 22:21:21 +09:00
Yan Zhulanow 7893bb60a6 Kapt: Using 'kapt' configuration without the 'kotlin-kapt' plugin applied should throw an error (KT-26145) 2018-11-27 22:21:21 +09:00
victor.petukhov f5d44003cd Add tests for type annotations with unresolved reference and invalid target (KT-28424, KT-28449) 2018-11-27 13:55:12 +03:00
Andrey Uskov 620969652a Fixed dependency resolution of root project
#KT-28389 Fixed
2018-11-27 13:46:56 +03:00
Toshiaki Kameyama 4abcd9a053 Make internal: don't suggest for @JvmField property inside companion object of interface #KT-27138 Fixed 2018-11-26 18:39:54 +03:00
Pavel Punegov 9cc93e9e55 Fix Contracts deserialization for native plugin 2018-11-26 18:19:03 +03:00
Pavel Punegov fe0a2bc75e Provide SerializerExtension methods with child DescriptorSerializer instance
to make Native be able to serialize backing properties and inline bodies.
Change visibility for functions and properties of DescriptorSerializer.
2018-11-26 18:15:30 +03:00
Toshiaki Kameyama 726b9272f3 Move out of companion object: don't suggest for @JvmField property inside companion object of interface #KT-28443 Fixed 2018-11-26 18:01:43 +03:00
Nikolay Krasko 3ca934e5ea Update test data for gradle migration test 2018-11-26 17:23:00 +03:00
Nikolay Krasko bc6f53d023 Auto-indent || and && operator typed on a new line (KT-28402)
#KT-28402 Fixed
2018-11-26 17:22:59 +03:00
Nikolay Krasko 9c41ec46ee Auto-indent elvis operator on new line (KT-28371)
#KT-28371 Fixed
2018-11-26 17:22:58 +03:00
Nikolay Krasko 8fad4db8ce Auto-popup lambda type parameter info (KT-28401)
#KT-28401 Fixed
2018-11-26 17:22:45 +03:00
Vyacheslav Gerasimov d30b66467b 183: Update 183 Idea version to the release one 2018-11-26 17:00:38 +03:00
Simon Ogorodnik fd1a6f3830 KT-20725: Fix storing NotProperty settings
#KT-20725 fixed
2018-11-26 16:38:23 +03:00
Mikhail Glukhikh cb7f7b1de5 Report "use of non-const Kotlin property" also on some assignments
#KT-25536 Fixed
2018-11-26 15:54:20 +03:00
Mikhail Glukhikh 651faa4ab2 Report "use of non-const Kotlin property" also on Java case labels
#KT-25536 Fixed
2018-11-26 15:54:07 +03:00
Denis Zharkov 23c43cd124 Support retrieving class of enum entry in ultra-light classes 2018-11-26 11:36:43 +03:00
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