Commit Graph

39 Commits

Author SHA1 Message Date
Jinseong Jeon 5596c3ae80 AA: better error message for file w/o containing module
...instead of throwing NoSuchElementException
2023-07-13 11:51:23 +02:00
Jinseong Jeon 0d19a5b3ea AA: make paths platform-independent before using JRT file system
^KT-59697 Fixed
2023-06-28 22:13:16 +02:00
Pavel Kirpichenkov 630c8e9df6 [AA, tests] Limit scopes of test libraries to their roots, add JDK_HOME
Without the fix, all libraries share the global scope for all project
libraries. JDK_HOME was used implicitly for things such as providing
Record support, but was not included as a test library/sdk.

KT-59637
2023-06-27 10:29:22 +00:00
Jinseong Jeon 799aadfacf AA: add an option to create Application env for production v.s. test mode
...and use production mode by default for AA standalone

^KT-59511 Fixed
2023-06-22 11:32:29 +02:00
Pavel Mikhailovskii 89c8392255 Make it possible to instantiate StandaloneAnalysisAPISession with a custom clasloader 2023-06-13 13:34:11 +00:00
Ilya Kirillov 78f09409b7 [Analysis API] move ClsKotlinBinaryClassCache/FileAttributeService service registration to StandaloneProjectFactory 2023-06-02 09:16:47 +00:00
Ilya Kirillov fbcf73eb42 [Analysis API Standalone] commonize logic for Analysis API FIR service registration between standalone and tests 2023-06-02 09:16:47 +00:00
Ilya Kirillov feaf9acd1d [Analysis API] move KotlinFakeClsStubsCache service registration to StandaloneProjectFactory
so it can be used from standalone mode
2023-06-02 09:16:47 +00:00
Ilya Kirillov 452844ffc6 [Analysis API] move KotlinReferenceProvidersService service registration to StandaloneProjectFactory
so it can be used from standalone mode
2023-06-02 09:16:47 +00:00
Ilya Kirillov 9f2d750f98 [Analysis API] move KtResolveExtensionProvider EP registration to common code
so it can be used from standalone mode
2023-06-02 09:16:47 +00:00
Ilya Kirillov 2d08d29dac [Java Resolution] use a smart psi pointer to store PSI in JavaElement for IDE
`JavaElement`s are reused between read actions, so underlying PSI elements might be invalidated when using hard PSI references

^KT-58194 fixed
2023-05-31 13:01:19 +00:00
Yan Zhulanow c90d094af6 [LL API] Pass a contextual module to ProjectStructureProvider
In certain cases, it's impossible to determine which module owns a
particular file without knowing the analysis context. For instance,
the file might be a part of a physical module, and be also included into
a virtual ad-hoc module (to be analyzed in separate, e.g. a VCS diff).

The new API allows to pass a contextual module. Basically it means
"give me a module for this element, implying that we are now analyzing a
contextual module".

^KT-57559 Fixed
2023-05-16 08:42:57 +00:00
Anna Kozlova 5ca052f87b [LL] [cls] use stubBased symbol provider for builtins
this gives the following benefits:
1. no protobuf in memory, all data is already present in stubs
2. given that symbol provider for libraries is already stub based,
we can get rid of complicated code to find source psi by deserialized fir
3. it's also possible to reduce number of index access,
when fir is requested for given ktElement
2023-05-09 07:36:09 +00:00
Anna Kozlova d59d66e876 [AA, LL] use stubs to build deserialized Fir elements in IDE
^KTIJ-24638

Notice on `DebugSymbolRenderer`:
stub based deserializer sets source directly,
but it's available in IDE mode only.
Thus, standalone and IDE tests have different results.
In order to avoid this, sources for compiled code are explicitly ignored

Notice on distinct callables:
for a file which belong to multiple libraries, decompiled code would be build per library.
In order to avoid ambiguity errors for members in that file,
we need to distinct provided elements by origins
failed test from IJ repo:
 FirReferenceResolveWithCrossLibTestGenerated#testSetWithTypeParameters
2023-04-27 11:37:28 +00:00
Roman Golyshev d4cffb8a5a [213] Switch to 213 platform
KTI-1114
2023-04-21 13:19:04 +00:00
Ilya Kirillov d68587de77 [Analysis API] implement API to extend Kotlin resolution by generated declarations
^KT-57930 fixed
2023-04-19 16:09:04 +00:00
Dmitriy Novozhilov b6a41c6d93 [CLI] Extract classes of compiler configuration from :compiler:cli to the separate module
Those classes mainly include KotlinCoreEnvironment and its dependencies

This change is needed for two reasons:
1. Splitting of some common configuration of compiler from logic of CLI
    makes code structure more clean
2. There is a need to add dependency on `:analysis:analysis-api-standalone`
    to `:compiler:cli`, because FIR analogue of AnalysysHandlerExtension uses
    services from it. But the problems is that standalone AA itself depends
    on classes for compiler configuration, which leads to circular
    dependency between those modules. Extracting configuration to
    `:compiler:cli-base` solves the problem
2023-03-16 15:16:32 +00:00
Yan Zhulanow f6f667c387 [LL API] Adjust services required by LLFirBuiltinsSessionFactory
As 'initialiseVirtualFileFinderServices()' that is run during
test initialization collects transitive dependencies, all of them
must be ready. However, 'KtNotUnderContentRootModuleForTest' has a
built-in dependency provided by 'LLFirBuiltinsSessionFactory'.
2023-01-25 08:04:40 +00:00
Marco Pennekamp a777ffcd8a [AA] KT-55566 StandaloneProjectFactory: Setup JDK default module roots
- Setup JDK default module roots in `StandaloneProjectFactory` (compare
  with `KotlinCoreEnvironment`). The implementation is a distilled
  version of `ClasspathRootsResolver`'s default module handling.
- This fixes an issue where some LL FIR tests with JDK 17 and 11 had
  mismatched types between Kotlin and Java sources.

^KT-55566 fixed
2023-01-04 11:46:11 +00:00
Marco Pennekamp e68111c218 [AA] KT-55566 StandaloneProjectFactory: Setup Java language level before Java files are parsed
- LL FIR tests with Java `record` classes and other new syntax features
  failed because `file.packageName` in `findJvmRootsForJavaFiles`
  caused the Java file to be parsed before the Java language level was
  configured. The Java language level is now set up in
  `registerJavaPsiFacade`, which is early enough.
2023-01-04 11:46:10 +00:00
Jinseong Jeon 5bf333f6f5 AA: look up built-ins module for deserialized declarations from built-ins 2022-09-17 16:43:10 +02:00
Jinseong Jeon 1b79ee89ba AA: drop ProjectStructureProvider#getKtBinaryModules
Instead, provide an option to register PSI declaration provider inside
Analysis API session builder where we can retrieve all necessary pieces,
including CoreJarFileSystem, PackagePartProvider, and binary modules
from internal project structure provider.
2022-08-17 19:16:18 +02:00
Ilya Kirillov dd00062559 [analysis] introduce KtBuiltinsModule and remove hacks related to the stdlib module search 2022-07-19 17:17:33 +02:00
Ilya Kirillov dc4527462f [LL FIR] create separate library session for each library 2022-07-19 17:17:33 +02:00
Jinseong Jeon 20d618c0a8 AA: populate CorePackageIndex
so that annotations in package-info.java can be propagated properly
2022-06-28 11:44:41 +02:00
Jinseong Jeon 4af2fcd633 AA: handle lib directory as a binary root 2022-06-21 11:34:09 +02:00
Jinseong Jeon 814920b344 AA: restore JavaRoot from binary roots in JDK module 2022-06-21 11:34:09 +02:00
Jinseong Jeon abdc2cf85e AA: populate SingleJavaFileRootsIndex properly 2022-06-16 22:14:18 +02:00
Jinseong Jeon 5c147c1ded AA: fail-safe binary root lookup 2022-06-09 10:35:17 +02:00
Jinseong Jeon c1b2469e51 AA: register CoreJavaFileManager
in a similar way
KotlinCoreEnvironment.ProjectEnvironment.registerJavaPsiFacade does
2022-06-09 10:35:17 +02:00
Jinseong Jeon af053fd8f3 AA: fail-safe JvmRoot lookup 2022-06-09 10:35:17 +02:00
Jinseong Jeon aef3df0336 AA: introduce AA session and builder 2022-06-09 10:35:16 +02:00
Jinseong Jeon 5585d84808 AA: make utils in StandaloneProjectFactory more general 2022-06-09 10:35:16 +02:00
Jinseong Jeon 355fd48782 AA: remove test prefix at non-test module 2022-06-09 10:35:15 +02:00
Jinseong Jeon e830778b46 AA: fix typo in StandaloneProjectFactory 2022-05-09 00:22:53 +02:00
Jinseong Jeon 3f05ba04a9 AA: add JDK_HOME as dependent SDK module 2022-05-09 00:22:52 +02:00
Ilya Kirillov 2649788b87 [analysis api fir] put every library into a separate KtModule in tests 2022-04-13 12:53:22 +02:00
Ilya Kirillov 252d8e283b [low level fir] create separate FirModuleData for every library module dependency 2022-04-13 12:53:21 +02:00
Ilya Kirillov 4bd7fed1ea [analysis api, test] rework test infrastructure, add multimodule tests 2022-04-13 12:53:01 +02:00