105 Commits

Author SHA1 Message Date
Jinseong Jeon 6fc02c3408 SLC: ROOT package exists no matter what
^KT-59843 Fixed
2023-07-11 11:47:23 +02:00
Jinseong Jeon 7f1424737e LC: rework modality of enum class
It is abstract if it has abstract member.
It is final if it doesn't have enum entries that need subclass.
Otherwise, it is open (i.e., no modifier)

^KT-57567 Fixed
2023-06-23 16:19:06 +02:00
Dmitrii Gridin 742c3de112 [LC] rename lightClasses/lightClasses to lightClasses/lightClassByFqName 2023-01-02 15:05:37 +00:00
Dmitrii Gridin eb3ad7e6b1 [LC] move light class related tests to one directory 2023-01-02 15:05:36 +00:00
Dmitry Gridin f10c5c28a5 Revert "Revert "[light classes] drop old light classes and backend: iteration #1""
This reverts commit 57de064251.
2022-06-28 17:57:29 +02:00
Dmitry Gridin 57de064251 Revert "[light classes] drop old light classes and backend: iteration #1"
This reverts commit 3cb2df9360.
2022-06-28 13:52:11 +02:00
Dmitry Gridin 3cb2df9360 [light classes] drop old light classes and backend: iteration #1
drop clsDelegate and related

^KT-48773
2022-06-28 11:44:38 +00:00
Dmitry Gridin 862e87b1ba JavaElementFinder: support repeatable annotation container
^KTIJ-19318
2021-09-09 11:17:35 +00:00
Dmitriy Novozhilov c8f3a4802e [TEST] Introduce test-infrastructure-utils module and extract common test utilities here 2020-12-16 19:52:22 +03:00
Dmitriy Novozhilov 1ee38286a8 [TEST] Move generated compiler tests to test-gen directory 2020-11-27 12:55:45 +03:00
Igor Yakovlev dbb4337ac4 [ULC] Fix invalid annotation resolve for KtUltraLightParameterForSetterParameter 2020-09-11 12:49:02 +03:00
Igor Yakovlev 7cb2631991 [ULC] Fix light class Coherence test 2020-09-11 12:49:01 +03:00
Alexander Udalov 8a4510c21b Regenerate tests 2020-01-02 10:31:00 +01:00
Dmitriy Novozhilov e7f8c8e155 [TEST] Regenerate tests after previous commit 2019-12-12 16:11:45 +03:00
Nikolay Krasko 4ed64b0283 Regenerate tests with TargetBackend.ANY remove and using runTest with this 2019-10-23 12:49:48 +03:00
Alexander Udalov f9d61f2dc7 Make inline+reified functions synthetic instead of private in bytecode
#KT-18563 Fixed
2019-05-28 16:17:49 +02:00
nikita.movshin 65244b4bea Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update only 2 lines copyright.
2019-04-23 20:09:22 +03:00
Denis Zharkov 5ec93f2718 Avoid assertion in bridges-generation for light classes
^KT-11656
2019-01-14 14:54:18 +03:00
Mikhael Bogdanov cf47bc0130 Update copyright in generated compiler tests 2019-01-02 12:37:06 +01:00
Denis Zharkov 6fc8c98aea Avoid calling PsiType::resolve while adding supertype references
Otherwise, e.g. in case of inner classes it may lead to
StackOverflowError:
- Someone tries to resolve supertypes
- We're starting building extends/implements lists
- Then calling resolve on the type references leads that some logic
in Java resolution again is trying to resolve supertype of the same
class (only in case of inner ones)

Probably, it could be fixed on the side of Java resolve
but at the same time it's clear that calling `resolve` while building
extends list it's really somewhat not very cool

The exception is following:
	at org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration$_extendsList$2.invoke(KtLightClassForSourceDeclaration.kt:77)
	at org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration$_extendsList$2.invoke(KtLightClassForSourceDeclaration.kt:73)
	at kotlin.SafePublicationLazyImpl.getValue(LazyJVM.kt:107)
	at org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration.get_extendsList(KtLightClassForSourceDeclaration.kt)
	at org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration.getExtendsList(KtLightClassForSourceDeclaration.kt:320)
	at com.intellij.psi.impl.PsiClassImplUtil.getExtendsListTypes(PsiClassImplUtil.java:1017)
	at com.intellij.psi.impl.light.AbstractLightClass.getExtendsListTypes(AbstractLightClass.java:137)
	at com.intellij.psi.impl.ScopedClassHierarchy.getSuperTypes(ScopedClassHierarchy.java:95)
	at com.intellij.psi.impl.ScopedClassHierarchy.visitType(ScopedClassHierarchy.java:80)
	at com.intellij.psi.impl.ScopedClassHierarchy.getSuperClassSubstitutor(ScopedClassHierarchy.java:115)
	at com.intellij.psi.impl.JavaClassSupersImpl.getSuperSubstitutorWithCaching(JavaClassSupersImpl.java:111)
	at com.intellij.psi.impl.JavaClassSupersImpl.getSuperClassSubstitutor(JavaClassSupersImpl.java:71)
	at com.intellij.psi.util.TypeConversionUtil.getMaybeSuperClassSubstitutor(TypeConversionUtil.java:1089)
	at com.intellij.psi.util.TypeConversionUtil.getClassSubstitutor(TypeConversionUtil.java:1055)
	at com.intellij.psi.impl.compiled.ClsJavaCodeReferenceElementImpl.advancedResolveImpl(ClsJavaCodeReferenceElementImpl.java:143)
	at com.intellij.psi.impl.compiled.ClsJavaCodeReferenceElementImpl.access$000(ClsJavaCodeReferenceElementImpl.java:43)
	at com.intellij.psi.impl.compiled.ClsJavaCodeReferenceElementImpl$Resolver.resolve(ClsJavaCodeReferenceElementImpl.java:121)
	at com.intellij.psi.impl.compiled.ClsJavaCodeReferenceElementImpl$Resolver.resolve(ClsJavaCodeReferenceElementImpl.java:115)
	at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$resolveWithCaching$1(ResolveCache.java:203)
	at com.intellij.openapi.util.RecursionManager$2.doPreventingRecursion(RecursionManager.java:99)
	at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:202)
	at com.intellij.psi.impl.compiled.ClsJavaCodeReferenceElementImpl.multiResolve(ClsJavaCodeReferenceElementImpl.java:223)
	at com.intellij.psi.impl.compiled.ClsJavaCodeReferenceElementImpl.advancedResolve(ClsJavaCodeReferenceElementImpl.java:213)
	at com.intellij.psi.impl.source.PsiClassReferenceType.resolveGenerics(PsiClassReferenceType.java:191)
	at com.intellij.psi.impl.source.PsiClassReferenceType.resolve(PsiClassReferenceType.java:138)
	at org.jetbrains.kotlin.asJava.classes.LightReferenceListBuilder.addReference(LightReferenceListBuilder.java:53)
	at org.jetbrains.kotlin.asJava.classes.KtUltraLightClass.createExtendsList(ultraLightPsi.kt:91)
	at org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration$_extendsList$2.invoke(KtLightClassForSourceDeclaration.kt:77)
	at org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration$_extendsList$2.invoke(KtLightClassForSourceDeclaration.kt:73)
	at kotlin.SafePublicationLazyImpl.getValue(LazyJVM.kt:107)
	at org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration.get_extendsList(KtLightClassForSourceDeclaration.kt)
	at org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration.getExtendsList(KtLightClassForSourceDeclaration.kt:320)
	at com.intellij.psi.impl.PsiClassImplUtil.getExtendsListTypes(PsiClassImplUtil.java:1017)
	at com.intellij.psi.impl.light.AbstractLightClass.getExtendsListTypes(AbstractLightClass.java:137)
	a
2018-11-08 15:25:41 +03:00
Mikhael Bogdanov d2a205c72d Update synthetic parameter processing logic according to ASM 7 changes
#KT-27774 Fixed
2018-11-07 15:42:57 +01:00
Alexander Udalov 5da8ce844a Minor, move ContentRoot and KotlinSourceRoot to module 'cli'
Also move CONTENT_ROOTS from JVMConfigurationKeys to
CLIConfigurationKeys since it's used on all platforms, not just JVM
2018-08-07 13:38:30 +02:00
Pavel V. Talanov 6cea843461 J2K JavaElementFinder: autoconvert and fix compilation errors 2018-06-06 20:45:41 +02:00
Nikolay Krasko 062a212b61 Don't build light classes for local classes with parse errors (KT-24323, EA-107235)
Also use checks for building light classes in `getLightClassDataHolder`.
2018-05-16 12:55:09 +03:00
Zalim Bashorov ab03ab84bb Regenerate tests 2018-04-19 13:17:27 +03:00
Zalim Bashorov 9970dd051f Fix copyright's start year in generated tests 2018-03-14 15:04:58 +03:00
Mikhail Glukhikh 2a6f1d7731 Regenerate tests 2018-03-07 19:24:56 +03:00
Pavel V. Talanov 498431311c Light classes: test "JvmPackageName" and actual declarations 2018-03-06 12:06:59 +01:00
Pavel V. Talanov 89c82a85d0 Do not build light classes for expect classes
#KT-15482 Fixed
2018-03-05 18:07:36 +01:00
Dmitry Jemerov e80dae1802 Update copyright in generated tests 2018-01-10 11:55:28 +01:00
Nicolay Mitropolsky 6ac345df51 Caching KtLightClassForSourceDeclaration (KT-21701)
to make their UserData survive for longer, because otherwise a new LightClass with empty UserData comes to Spring every time, but Spring stores a lot of important things in UserData
2017-12-14 18:05:47 +03:00
Mikhael Bogdanov f529069077 Move common test parts to tests-common. Minify test jar dependencies 2017-11-28 11:04:39 +01:00
Pavel V. Talanov 9e061d3bbb Fix light class exception on empty multifile facade
Fix generating multifile facade with all members private (in bytecode)
leading to delegate not being generated for corresponding light class

 #KT-20966 Fixed
2017-11-03 16:44:53 +03:00
Mikhail Zarechenskiy bbf4c56c06 Update generated tests 2017-09-15 11:47:16 +03:00
Mikhail Zarechenskiy 68259f7939 Allow assigning array to vararg in named form in annotations
See more in KT-20171
2017-09-14 18:27:41 +03:00
Nikolay Krasko 94e3a51a45 Test no psi stub mismatch for light classes with suspend in overloads
IdeCompiledLightClassTestGenerated is relevant.
2017-09-14 12:28:26 +03:00
Vyacheslav Gerasimov 89257e6397 Implement light classes for Kotlin scripts 2017-09-12 13:10:38 +03:00
Vyacheslav Gerasimov 26cbcfa1ac J2K: AbstractCompilerLightClassTest java -> kt 2017-09-12 13:10:38 +03:00
Alexander Udalov 8db736e2b4 Support FULL_JDK directive in diagnostic tests 2017-08-17 12:35:56 +03:00
Alexander Udalov 9274d963aa Create KotlinCoreEnvironment a bit later in tests
Before this change, diagnostic tests with Java source files failed
because KotlinCoreEnvironment was being created in the test's setUp,
even before the test data file has been split into .java/.kt and the
resulting .java files have been copied to a temporary directory. In
KotlinCoreEnvironment's constructor, we now inspect all roots for
module-info files, which involves calling VirtualFile.getChildren on all
roots in the configuration. CoreLocalVirtualFile.getChildren is
cached on the first access, and so because the temporary directory with
.java files was empty at this point, the VirtualFile for that directory
returned empty array in getChildren later in the test, resulting in
unresolved reference errors.

This is fixed by creating the environment _after_ the .java files have
been copied to a temporary directory. Note that slow assertions for
flexible types are now enabled in KtUsefulTestCase instead of
KotlinTestWithEnvironmentManagement, because BaseDiagnosticsTest no
longer inherits from the latter
2017-06-29 15:59:56 +03:00
Pavel V. Talanov 0571c62943 KtLightElements: make light annotations lazier
Allow to get annotation list and to invoke `findAnnotation` without building delegate
Introduce KtLightNullabilityAnnotation which holds nullability information and is built
    before delegate is built
2017-05-02 15:40:17 +03:00
Pavel V. Talanov f3dd09beaf Lighter classes: DeprecationLevel.HIDDEN affects codegen 2017-04-24 20:55:50 +03:00
Pavel V. Talanov 3401529be1 IDELightClassContexts#isDummyResolveApplicable: add missing check
Missing check caused exact resolve being applied to every class that had 'equals' overridden
2017-04-18 14:59:43 +03:00
Pavel V. Talanov 2f159bb64b Light classes: do not rely on dummy context when data class autogenerated members conflict with declared members
Fix related issues with nested classes
2017-04-09 15:10:29 +03:00
Pavel V. Talanov 4f701285b1 Light class builder: do not generate methods delegating to DefaultImpls in kotlin classes
Class APIs from java point of view stays the same so we can avoid generating those methods
Otherwise we have to calculate all supertypes when getMethods() is called,
    which imposes severe performance penalties
We have to pretend these methods are not 'abstract' (also we consider them 'default' for safety)
    so java highlighting does not report "class should be abstract" for all inheritors
We have to manually report "class should be abstract" on some of the java inheritors,
    specifically those that are implementing interfaces directly
	    as opposed to extending kotlin classes implementing those interfaces
2017-04-09 15:09:01 +03:00
Alexander Udalov 5ebee6ceca Use Java 8 lambdas instead of anonymous classes in compiler modules 2017-04-03 14:49:23 +03:00
Alexander Udalov 6aa0f7bb65 Use multi-catch when possible 2017-04-03 14:26:53 +03:00
Pavel V. Talanov ee33879031 Light class tests: hidden deprecated affects codegen
Provide fix later
2017-03-27 17:59:05 +03:00
Pavel V. Talanov e822a17c0d Lazy light classes: can't use laziness for classes with supertypes delegates 2017-03-27 17:59:03 +03:00
Pavel V. Talanov 2291d91109 KtLightMethod: isVarArgs() does not trigger exact delegate computation 2017-03-27 17:59:01 +03:00