Commit Graph

616 Commits

Author SHA1 Message Date
Igor Yakovlev 4efab51751 Fix allopen call from UL methods
Fixed #KT-35577
2019-12-20 16:57:53 +03:00
Igor Yakovlev 2639ed2c48 Fix invalid equality for UL methods
Potentially fixed #KT-34796
2019-12-15 23:42:31 +03:00
Alexander Shustanov c9cba34d67 KT-35454 Weird implementation of KtUltraLightFieldImpl.isEquivalentTo 2019-12-13 20:07:45 +03:00
Igor Yakovlev 6792d22c31 Fix minor bugs for UL methods and parameters representation
Remove INSTANCE field for local object declarations
Remove private suspend functions create from UL
Add correct extension function parameter name
Add support for setparam annotation modifier
2019-12-10 18:26:08 +03:00
Alexander Udalov fd627603a0 Refactor CompilationErrorHandler
It only had one implementation THROW_EXCEPTION, inline it everywhere
with a call to a static method
2019-12-03 10:48:34 +01:00
Igor Yakovlev 0ff77bd3c5 Add UL support for const fields initializers
Fixed #KT-34081
2019-12-02 20:41:47 +03:00
Igor Yakovlev 8f9895e64e Add external keyword support for UL
Fixed #KT-34923
2019-11-21 22:49:23 +03:00
Vladimir Dolzhenko 03c7f4bf00 Wrap KtClassOrObject.isLocal, KtFile.isScript with runReadAction in LightClasses
#EA-211576 Fixed

(cherry picked from commit 75a59d4bced714af51abd7e354bc873313b28051)
2019-10-26 21:10:38 +02:00
Vladimir Dolzhenko 00055fc20a Wrap KtClassOrObject.isLocal, KtFile.isScript with runReadAction in LightClasses
#EA-211576 Fixed

(cherry picked from commit 75a59d4bced714af51abd7e354bc873313b28051)
2019-10-26 09:42:49 +02:00
Vladimir Dolzhenko 96768cbf2d Clean up after acquire lock for several seconds to create LightClasses to workaround dead-lock over resolve
Relates to #KT-34279
2019-10-25 22:05:28 +02:00
Vladimir Dolzhenko d16a1b14d8 Acquire lock for several seconds to create LightClasses to workaround dead-lock over resolve
Relates to #KT-34279
2019-10-24 17:32:36 +02:00
Igor Yakovlev bc66834c3c Fix UL classes descriptors leaks
UL classes built upon descriptors and UL support classes are saving a descriptors.
This could lead to descriptors leakage so we have to eliminate any fields with descriptor references.

Fixed #KT-34337
2019-10-21 22:04:49 +03:00
Igor Yakovlev 8c65a9a2aa Move AllOpen UL support to separate extension 2019-10-18 23:22:48 +03:00
Igor Yakovlev 58b8d8868a Remove fallbacking of UL (to LightClasses) by complexity checking 2019-10-18 23:22:47 +03:00
Igor Yakovlev 3f9bffcc5f Move UL compiler plugin support to separate extension point 2019-10-18 23:22:47 +03:00
Igor Yakovlev 6ce37fff95 Add UL support for AllOpen compiler plugin 2019-10-18 23:22:47 +03:00
Igor Yakovlev 558a700f51 Add UL support for ParcelableCodegenExtension compiler plugin 2019-10-18 23:22:47 +03:00
Igor Yakovlev 110a6700e4 Add UL support for NoArg compiler plugin 2019-10-18 23:22:47 +03:00
Dmitry Gridin 1a8796c79a LightClassDataHolder: shouldn't catch ControlFlowException 2019-10-14 21:45:10 +07:00
Dmitry Gridin 7c1f2e8735 LightClassDataHolder: cleanup code 2019-10-14 21:45:10 +07:00
Mikhail Zarechenskiy 71cb5e07db Minor, don't recreate Set with the same values 2019-10-11 18:47:54 +03:00
Nikolay Krasko 8cda36ef15 Fix IdeLightClassTestGenerated tests for idea <= 191 2019-10-08 01:04:54 +03:00
Vyacheslav Gerasimov 3f1d3dab14 193: Request StubComputationTracker as component from project
Fixes assert:
com.intellij.testFramework.LoggedErrorProcessor$TestLoggerAssertionError: org.jetbrains.kotlin.asJava.builder.StubComputationTracker requested as a service, but it is a component - convert it to a service or change call to project.getComponent()
2019-10-04 17:04:54 +03:00
Igor Yakovlev d5e4227a1d Revert commit and additional workaround to diagnostics problem
Another workaround of testClassObjectCopiedFieldObject test fix

Revert "Fix testClassObjectCopiedFieldObject test"

This reverts commit 8def1f07aa.
2019-10-02 20:18:24 +03:00
Igor Yakovlev 8def1f07aa Fix testClassObjectCopiedFieldObject test
Fix of the test
PsiCheckerTestGenerated$DuplicateJvmSignature$Fields.testClassObjectCopiedFieldObject
additionally fixed the bug with blinking this test example in IDEA with UL classes enabled.

The story:
Extra diagnostics could be requested for any KtClassOrObject but for _nested_  classes result may depend on outer class members signature collecting. So the the order of outer/nested diagnostic reporting takes matter.
So for nested classes/objects we have to gen members of outer classes.
2019-10-01 13:53:21 +03:00
Igor Yakovlev cef6b71897 Fix ultraLightClass method argument types erasure
Fix IdeRegression.testImplementingMap test
2019-10-01 13:53:20 +03:00
Igor Yakovlev f8bd3518dc UL method and parameter Move&Rename refactoring 2019-09-23 17:30:15 +03:00
Igor Yakovlev fc70fd05fc Enable kotlin.collections support for UL classes
Removed restriction for classes derived from Kotlin collections
Added type erasure for java collection overrided methods
2019-09-23 17:30:15 +03:00
Vladimir Dolzhenko c3265a8bf0 Decrease Light classes code generation in multithreaded cases by guarding KotlinClassInnerStuffCache, LightClassDataHolder.ForClass cache values calculation with lock 2019-09-13 15:10:09 +02:00
Vladimir Dolzhenko d3d85d50ab Rewrite KotlinClassInnerStuffCache into Kt, p2 2019-09-13 15:09:02 +02:00
Vladimir Dolzhenko 6146b0eb53 Rewrite KotlinClassInnerStuffCache into Kt, p1 2019-09-13 15:08:40 +02:00
Igor Yakovlev 8fa67f0478 Add correct modification tracking on UltraLight classes
Fixed #KT-32820
2019-09-10 14:38:10 +03:00
Nikolay Krasko 63f43d9b2e Revert "Use lazySync instead of lazyPub to avoid raise on creation LightClasses"
The commit causes deadlock in 183 branch in KotlinLintTestGenerated test.

This reverts commit d6c54b84
2019-09-03 12:42:56 +03:00
Igor Yakovlev 79a603768a UltraLight implementation for local and anonymous declarations 2019-09-02 17:42:50 +03:00
Vladimir Dolzhenko d6c54b845b Use lazySync instead of lazyPub to avoid raise on creation LightClasses 2019-09-02 15:30:08 +02:00
Igor Yakovlev 1aa8e28dd8 Add JvmOverloads to KtLightClassImpl
Added @JvmOverloads annotation to primary constructor for binary compatibility issues
2019-08-15 15:49:14 +03:00
Igor Yakovlev fd5bf33861 Removed asserts for mirror files for java stubs on kt files
The behavior of this part of code is following:
1) We wrap the kotlin light class to the object that wraps the kt files into compiled (!) cls stub (notice, that most of the time it is a single file wrapper)
2) Platform wishes to get the mirror psi of this "compiled" stub work with text of it.
3) Platform request mirror element that asserted to be ok ONLY for multifiles stub.
4) It leads to EA-209577

There is no idea why so, but the exception is high-rated, so this assertion was deleted.

Fixed EA-209577
2019-08-14 20:12:55 +03:00
Nikolay Krasko 83e422fc3b Workaround copied kotlin element happened to be outside the KtFile
Can be reproduced after revert with
IdeLightClassTestGenerated$Local.testDollarsInNameLocal test.
2019-08-01 18:21:13 +03:00
Nikolay Krasko 5614afed14 Fix over-caching content in light classes for local declarations (KT-32820)
Use combination of OOCB and file tracker for local classes.

#KT-32820 Fixed
2019-08-01 18:16:36 +03:00
Nikolay Krasko ce3ad8f4da Use kotlin specific OOCB tracker for light classes inner cache
ClassInnerStuffCache from the platform caches everything with platform
OUT_OF_CODE_BLOCK tracker.
2019-08-01 18:16:35 +03:00
Nicolay Mitropolsky 5f9660cd33 KtLightParameter introduced as interface 2019-07-24 10:11:45 +03:00
Nicolay Mitropolsky 50158e508a org.jetbrains.kotlin.asJava.elements.LightParameter converted to Kotlin
to avoid clashes in `getMethod` with `KtLightParameter`
2019-07-24 10:11:44 +03:00
Nicolay Mitropolsky 7dcd3849e0 org.jetbrains.kotlin.asJava.elements.LightParameter converted to Kotlin: Rename .java to .kt 2019-07-24 10:11:44 +03:00
Nicolay Mitropolsky 8982a49dcb renaming KtLightParameter to KtLightParameterImpl 2019-07-24 10:11:44 +03:00
Nikolay Krasko 3e9765f5bb Don't over-cache own methods list in KtUltraLightClass
The might be code that stores light class references (for example
ChangeMethodSignatureFromUsageFix) and tries to find methods
after invalidating. Internal class caches has an additional assert that
methods obtained are valid and this assert can be violated if the list
of methods was cached before some method invalidation.

This a major problem of current light-classes implementation. Other
places should be checked and fixed as well.

Check test:
QuickFixMultiFileTestGenerated$ChangeSignature$Jk.testJkKeepValOnAddingParameter1

Caused by: java.lang.AssertionError: Element: class org.jetbrains.kotlin.asJava.classes.KtUltraLightMethodForSourceDeclaration #kotlin  because: File language:Language: JAVA != Provider base language:Language: kotlin
invalidated at: no info

Attachments:

	at com.intellij.testFramework.LoggedErrorProcessor.processError(LoggedErrorProcessor.java:61)
	at org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase$setUp$1.processError(KotlinLightCodeInsightFixtureTestCase.kt:84)
	at com.intellij.testFramework.TestLogger.error(TestLogger.java:40)
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:170)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:442)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1166)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:423)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:586)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:86)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:422)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:398)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:164)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:218)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:396)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:174)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.intellij.psi.PsiInvalidElementAccessException: Element: class org.jetbrains.kotlin.asJava.classes.KtUltraLightMethodForSourceDeclaration #kotlin  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.PsiClassImplUtil$1.add(PsiClassImplUtil.java:380)
	at com.intellij.psi.scope.processor.FilterScopeProcessor.execute(FilterScopeProcessor.java:59)
	at com.intellij.psi.impl.PsiClassImplUtil.processDeclarationsInClassNotCached(PsiClassImplUtil.java:684)
	at com.intellij.psi.impl.PsiClassImplUtil.lambda$createMembersMap$2(PsiClassImplUtil.java:395)
	at com.intellij.util.containers.ConcurrentFactoryMap$2.create(ConcurrentFactoryMap.java:181)
	at com.intellij.util.containers.ConcurrentFactoryMap.get(ConcurrentFactoryMap.java:45)
	at com.intellij.psi.impl.PsiClassImplUtil$MembersMap.get(PsiClassImplUtil.java:357)
	at com.intellij.psi.impl.PsiClassImplUtil$MembersMap.access$000(PsiClassImplUtil.java:349)
	at com.intellij.psi.impl.PsiClassImplUtil.getMap(PsiClassImplUtil.java:207)
	at com.intellij.psi.impl.PsiClassImplUtil.findByMap(PsiClassImplUtil.java:153)
	at com.intellij.psi.impl.PsiClassImplUtil.findMethodsByName(PsiClassImplUtil.java:96)
	at com.intellij.psi.impl.source.ClassInnerStuffCache.findMethodsByName(ClassInnerStuffCache.java:67)
	at org.jetbrains.kotlin.asJava.classes.KtLightClassBase.findMethodsByName(KtLightClassBase.kt:52)
	at com.intellij.codeInsight.daemon.impl.quickfix.ChangeMethodSignatureFromUsageFix.getShortText(ChangeMethodSignatureFromUsageFix.java:94)
	at com.intellij.codeInsight.daemon.impl.quickfix.ChangeMethodSignatureFromUsageFix.isAvailable(ChangeMethodSignatureFromUsageFix.java:152)
	at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.availableFor(ShowIntentionActionsHandler.java:127)
	at com.intellij.codeInsight.intention.impl.CachedIntentions.wrapActionsTo(CachedIntentions.java:183)
	at com.intellij.codeInsight.intention.impl.CachedIntentions.wrapAndUpdateActions(CachedIntentions.java:135)
	at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.doCollectInformation(ShowIntentionsPass.java:222)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:69)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:430)
	... 15 more
2019-07-18 22:10:20 +03:00
Nikolay Krasko 73356cbb4b Check self before complex equivalence check in light parameter 2019-07-18 22:10:20 +03:00
Nikolay Krasko 484c4ca268 Try to postpone activating decompiler from light element equivalence 2019-07-18 22:10:20 +03:00
Nikolay Krasko 9fd46c105d Reformat and cleanup in asJava/elements 2019-07-18 22:10:20 +03:00
Nikolay Krasko 353ca9752f Better validity check for kotlin light element
There're exceptions from `isWritable` method in light classes caused by
accessing invalid elements.

Override KtLightMemberImpl implementation to avoid activating
decompiler during validity check.
2019-07-18 22:10:20 +03:00
Igor Yakovlev cd6abcd4c9 Expect modifier definitions is not exposed by UL-classes 2019-07-12 16:33:52 +03:00