Commit Graph

2025 Commits

Author SHA1 Message Date
Dmitry Savvinov 708fead1cc Add debug strings to frontend scopes-related structures
Such as:
- PackageFragmentProviders, and, in particular,
CompositePackageFragmentProviders
- JavaPackageFragments
- Scopes produced by those providers

The rationale is that a lot of frontend-facing bugs (like red code) are
easily recognizeable in resolution. But at that point you just see a
bunch of scopes, without meaningful toStrings, you don't know who has
produced them, and what's exactly wrong.

With this commit it should make debugging slightly easier: now at least
you'll be able to see that "this scope is a scope of package fragment
for foo.bar of module baz" and decide whether the declaration should or
should not have been resolved from such scope.
2021-06-03 17:21:59 +03:00
Dmitriy Novozhilov f9eba6e842 [FIR] Fix determining dependencies for modular jdk in CLI 2021-05-25 15:08:47 +03:00
Dmitriy Novozhilov ff3f3d2f9b [FIR] Properly setup search scope for IC symbol provider 2021-05-20 14:21:49 +03:00
Dmitriy Novozhilov 6e4cc49f1d [FIR] Cleanup IC provider creation in FirSessionFactory 2021-05-20 14:21:47 +03:00
Dmitriy Novozhilov 6d38a236c1 [FIR] Extract FIR related part of KotlinToJVMBytecodeCompiler to separate file 2021-05-20 14:21:46 +03:00
Dmitriy Novozhilov 99cdb86145 [FIR] Move createSessionWithDependencies to FirSessionFactory 2021-05-19 16:29:20 +03:00
Dmitriy Novozhilov 2ee54c2201 [FIR] Remove way to create FirSession using Module
The problem is that Module may not contain some default dependencies in
  classpath roots, so it's incorrect to take them from it
2021-05-19 16:29:19 +03:00
Dmitriy Novozhilov 7d5fa2830d [FIR] Properly create source search scope in FIR CLI compiler 2021-05-18 20:56:05 +03:00
Dmitriy Novozhilov 02c58b7a8f [FIR] Refactor deserialized dependency providers and session factories with FirModuleData 2021-05-14 14:30:33 +03:00
Xin Wang b9209962cd CLI: Add documentation for -J argument in kotlinc -help 2021-05-11 19:50:24 +02:00
Jinseong Jeon efba90c6f1 LC: rename KtLightClassForFacade to ...Impl
before introducing a common interface for light class for facade

This is a mechanical refactoring.
2021-05-05 14:11:48 +02:00
Victor Petukhov 909f0d8bdb Implement caching module annotations per class id 2021-04-30 14:43:27 +03:00
Victor Petukhov 2e57ff25ee Leave KotlinCliJavaFileManager::findClass only passing JavaClassFinder.Request 2021-04-30 14:43:27 +03:00
Victor Petukhov bc5e92033b Support reading annotations on java 9 module on sources and binaries 2021-04-30 14:43:27 +03:00
Victor Petukhov 71755b7a5e Support java 9 modules in the diagnostic tests both in sources and binaries 2021-04-30 14:43:26 +03:00
Mikhael Bogdanov dfc6d85aee Enable runtime string concatenation by default (for -Xjvm-target=9 or greater)
#KT-42522 Fixed
2021-04-27 09:08:28 +02:00
Andrey Zinovyev f71e08df4d [lombok] Experimental lombok plugin prototype
Add extension point for java descriptors
Add simple usage of this point to generate getter method
Add simple test infrastructure to test compilation with lombok plugin
2021-04-25 18:17:53 +03:00
Simon Ogorodnik c6fa363487 [FIR] Add warning if FIR is used 2021-04-23 19:49:46 +03:00
Simon Ogorodnik 539d3e5df2 Add full-pipeline modularized tests for old frontend 2021-04-15 13:36:00 +03:00
Dmitriy Novozhilov 1f62a2d8cc [FIR] Add disposing of FirJavaElementFinder in FIR compiler entrypoint 2021-04-15 10:30:09 +03:00
Dmitriy Novozhilov 803d47daaa Distinguish classes from different sourcesets in SealedInheritorInSameModuleChecker
#KT-45848 Fixed
#KT-46031
2021-04-13 11:21:58 +03:00
Alexander Udalov 115e2673ae Minor, fix javac deprecation warning in DynamicBundle 2021-04-12 14:38:09 +02:00
Vyacheslav Gerasimov f2a892a972 Cleanup 201 and as41 bunch files 2021-03-30 14:23:43 +03:00
Alexander Udalov 6e86df2f6d Workaround illegal access to JDK internals in DynamicBundle
This is basically a manual cherry-pick of
https://github.com/JetBrains/intellij-community/commit/547caebd980d.

 #KT-44624 Fixed
2021-03-30 11:33:07 +02:00
Alexander Udalov 8e1a70cff6 Copy com.intellij.DynamicBundle to compiler/cli
This is needed to fix KT-44264 without updating the whole project to
intellij 203, which might take significant time.

In this commit, the file is copied as is from
https://github.com/JetBrains/intellij-community/blob/27837dd8e68a95cc4da0954f93321c98017b3d11/platform/core-api/src/com/intellij/DynamicBundle.java.
2021-03-30 11:33:07 +02:00
Ting-Yuan Huang 4db79285c1 Add AnalysisHandlerExtension extension point for K2MetadataCompiler
AnalysisHandlerExtension allows compiler plugins to:
1. Intercept and override the default analysis.
2. Utilize the compiler infrastructure to do custom analysis.

A well know plugin on the JVM platform is KAPT.
2021-03-29 20:41:03 +03:00
Vladimir Dolzhenko 51393d2d0f Fix compilation 2021-03-25 16:23:01 +01:00
Simon Ogorodnik 0aca68e7c7 FIR: Add init time measurement to full pipeline 2021-03-25 18:05:51 +03:00
Ilya Chernikov 9ac6d30953 Fix arguments processing with scripting with old backend by default 2021-03-24 22:38:59 +01:00
Ilya Chernikov bcd7bc5fd7 Fix arguments processing with scriting with old backend by default 2021-03-24 21:26:57 +01:00
Ilya Chernikov 3e458a1efb FIR: Add IncrementalPackagePartsProvider usage in cli...
also refactor IncrementalPackagePartsProvider and parents to simplify
usage
2021-03-24 21:24:18 +01:00
Ilya Chernikov f8d50d585d FIR: Implement lookup tracking 2021-03-24 21:24:18 +01:00
Ilya Chernikov 7d29ae7cce FIR: add incremental compilation tests 2021-03-24 21:24:18 +01:00
Ilya Chernikov 88e7ba2a3b FIR: Report syntax errors in cli compilation 2021-03-24 21:24:18 +01:00
Ilya Muradyan 14d386223b [REPL] Fix unresolved imports caching
Before this fix, if some imports were not resolved during compilation,
this result had been saved in caches, and this import couldn't been
resolved during following compilations even if it was added to the
module dependencies. This commit adds special handling of resolution
caches for the REPL compiler.
2021-03-24 13:35:33 +03:00
Mikhail Zarechenskiy 111e54c8c1 Do not generate DefaultImpls for light classes if not needed
#KT-41130 In Progress
2021-03-18 16:38:52 +03:00
Alexander Udalov 83a4b6396a Deduplicate source roots in psi2ir and CLI
Compiler plugins can add new source roots to the next compilation round
by using `AnalysisResult.RetryWithAdditionalRoots`. Some plugins added
already existing source roots to this list in some cases. For example,
this is reproducible with `square/anvil` with incremental compilation
(KT-45100, KT-44925). Psi2ir didn't deduplicate the source files before,
which resulted in several classes with the same name linked to the same
symbol. This led to a "symbol is already bound" exception, and in case
of KT-44925, to an additional NPE when we were rendering the class to
display it in the message.

The solution is to deduplicate classes before psi2ir. Note that this
commit has two changes, in CLI and in psi2ir. Any one of these is
sufficient for fixing the problem, however both are made just to make it
more future-proof against new components and/or changes in existing
subsystems (e.g. fir2ir).

In the old JVM backend, similar deduplication was happening in
`ClassFileFactory.registerSourceFiles`, which is why the problem is not
reproducible there.

 #KT-45100 Fixed
2021-03-15 16:30:46 +01:00
Dmitriy Novozhilov f82c7c4678 [FIR] Cleanup session creation utils 2021-03-11 13:10:04 +03:00
Vladimir Ivanov fd02802028 [Native] Export KDoc into generated native header 2021-03-09 16:50:23 +03:00
scaventz 81a495b494 Fix the NullPointerException when pathname does not name a parent. 2021-03-06 01:50:40 -08:00
Alexander Udalov 1f8de46b3c JVM IR: do not depend on StubGeneratorExtensions in backend
Move most of the implementation from JvmGeneratorExtensions to
JvmGeneratorExtensionsImpl. The latter implements
StubGeneratorExtensions from psi2ir, and doing so helps to remove direct
dependency on this part of psi2ir from backend.
2021-03-05 20:46:33 +01:00
Alexander Udalov f332192de8 IR: remove SourceManager, make PsiSourceManager a singleton 2021-03-05 20:46:33 +01:00
Alexander Udalov e7e17cdaa9 Revert "Fix KotlinCoreEnvironment projectCount disposable"
This reverts commit 99a6bdeec7.

 #KT-45007 Fixed
2021-03-05 17:40:39 +01:00
scaventz 28452fc38e Kotlinc: catch FileNotFoundException caused by problematic destination. 2021-03-04 11:25:35 -08:00
Alexander Likhachev 3537c699b5 [Gradle] Read system properties at configuration time using Gradle providers
The change is a step to fully support Gradle configuration cache.
Relates to #KT-43605
Relates to #KT-44611
2021-03-04 19:36:11 +03:00
Alexander Udalov 837eb739ea IR: move CompilationErrorException to frontend.common 2021-02-24 19:07:37 +01:00
Alexander Udalov 2e2caae05c Extract control flow analysis to separate module
Extract a service interface out of ControlFlowInformationProviderImpl
and register its implementation in two "leaf" modules: 'cli',
'idea-core'.

This improves parallel build, since a lot of modules depend on
'frontend' but only these two modules reference the implementation and
thus depend on the full CFA implementation now.
2021-02-24 17:17:04 +01:00
Alexander Udalov ca5a35b4b3 Move CompilerEnvironment from 'frontend' to 'cli'
This is needed in order to have a single convenient place where to
register frontend services implemented _outside_ of the 'frontend'
module, such as the control flow analysis, extracted to a separate
module in a subsequent commit.
2021-02-24 17:17:03 +01:00
Alexander Udalov 862a9143da Do not report errors about bytecode version
#KT-41758
2021-02-23 12:45:40 +01:00
Georgy Bronnikov 103f82c95c IR: an option to automatically select the number of lowering threads 2021-02-17 11:03:27 +03:00