Commit Graph

2035 Commits

Author SHA1 Message Date
Mikhail Glukhikh 298a30d245 Minor: run javac-mode compileJava after destroying of generation state
Not very important but seems more logical
2019-10-03 11:16:24 +03:00
Mikhail Glukhikh bbd8fb8b23 JavacWrapper: add support for JvmPackageName annotation
This fixes previously added testWithStdLib/streams.kt test
2019-10-03 11:16:24 +03:00
Alexander Gorshenev c227c13799 Commonizing klib metadata between native and js 2019-10-01 17:38:57 +03:00
Anton Bannykh ead8379c50 JS: add -Xmetadata-only flag for JS common code modules (KT-33142 fixed) 2019-09-27 19:12:03 +03:00
Ilya Chernikov 1e80c03d41 Fix Extensions/Components API usage in core environment for 193+
for it the com.intellij.core.JavaCoreApplicationEnvironment has to be
copied to the compiler (named now KotlinCoreApplicationEnvironment)
and modified accordingly
2019-09-27 11:51:25 +02:00
Ilya Chernikov 517e5e8954 Fix loading scripting plugin from the current classloader
previous code was completely wrong - wrong package and wrong procedure
#KT-34011 fixed
2019-09-26 11:46:55 +02:00
Vyacheslav Gerasimov c1e1dbd83e Build: Fix usages of "java.home" for tools.jar dependency
#KT-33984
2019-09-25 17:54:18 +03:00
Vladimir Dolzhenko 750a677366 Register manually IDEKotlinBinaryClassCache for AbstractLoadJavaClsStubTest.kt 2019-09-25 14:49:17 +02:00
Dmitry Savvinov bfacc1a3c5 Introduce AbstractResolverForProject
Previously, ResolverForProjectImpl had multiple callbacks in
constructor. Some of those callbacks were used only to overcome module
visibility and provide an ability to inject IDE-specific logic into
compiler (ResolverForProject is in the 'compiler'-module)

This commit introduces abstract class which implements
environment-independent logic (previously, this logic had been stored in
ResolverForProjectImpl) with several abstract met hods (previously,
callbacks). Then, we provide few concrete implementations of
AbstractResolverForProject with clear semantics:

- IdeaResolverForProject: resolver used in IDE, where we have indices,
  oracles, multiple modules, etc.
- ResolverForSingleModuleProject: resolver for project with only one
  module, commonly used for CLI compiler/tests
- one anonymous implementation for MultimoduleTests

This refactoring achieves several things:
- now it is easier to see what kinds of ResolverForProject you might see
  in some particular environment (previously, one had to inspect all
  call-sites of constructor)
- we can easily add IDE-specific logic in IdeaResolverForProject without
  adding noisy callbacks (which most probably wouldn't have any other
  non-trivial implementations)
2019-09-24 17:05:05 +03:00
Alexander Udalov 6ef434a711 JVM IR: add -Xir-check-local-names to check names for consistency
Since KotlinTypeMapper is no longer used in the JVM IR backend, we need
not run CodegenBinding.initTrace and check that names of local entities
are exactly equal to local names computed by that algorithm.

However, it's still useful as an opt-in flag, to discover issues where
unwanted elements take part in the naming (such as temporary IR
variables, see for example cb2e68fece). So we introduce a new command
line argument -Xir-check-local-names which, when the IR backend is used
(via -Xuse-ir), launches the name computation algorithm from the old
backend and then compares that the names are exactly equal to the names
computed by the IR backend in InventNamesForLocalClasses.
2019-09-18 17:55:42 +02:00
Vyacheslav Gerasimov 6327f657a5 193: Add bunches for 193 platform 2019-09-17 21:16:13 +03:00
Svyatoslav Kuzmich 9594e9b3b1 [JS IR BE] Initial export generation 2019-08-30 13:15:37 +03:00
Nikolay Krasko 4d0fc1dc22 Remove 182 support
#KT-33536 Fixed
2019-08-30 12:13:44 +03:00
Ilya Chernikov 31c56d7794 Set java.class.path property in runner and loader
#KT-24991 fixed
2019-08-28 17:59:12 +02:00
Ilya Chernikov 08720a3dc6 Set thread context classloader in the kotlin runner
#KT-26624 fixed
2019-08-28 17:59:11 +02:00
Dmitry Savvinov 0065236bde Move default implementation of TargetPlatform.platformName to leaf classes
Otherwise, we have a static initialization loop, leading to null-leaks

Removing default interface method indeed disconnects the loop, as per JVM
Specification, "5.5 Initialization".

See KT-33245 for detailed explanations

^KT-33245 Fixed
2019-08-12 13:06:51 +03:00
Alexander Udalov 9456763576 Minor, fix debug info when inferring API version 2019-08-09 15:47:09 +02:00
Mikhail Zarechenskiy 04e57f712e [NI] Introduce feature for passing function references with defaults
Relates to KT-8834, we continue reducing differences between old and new
 inference. Note that as for `SamConversionPerArgument`, this feature
 is enabled in the compiler and not in the IDE to avoid breaking code
 for those users that already enabled new inference in the compiler
2019-08-07 15:58:36 +03:00
Dmitry Savvinov 2b4d70fcf0 [Resolve] Rewrite how built-ins are created
Under COMPOSITE mode we don't have a globally known way to create
built-ins, instead, we have to create them on per-module basis.

So, in this commit we:

1. Use builtInsProvider: (ModuleInfo) -> KotlinBuiltIns instead of
precomputed builtIns instance, in order to be able to calculate
builtIns on per-module basis

2. Introduce new entity, called BuiltInsCache, which, roughly
speaking, is a map of form ModuleInfo -> KotlinBuiltIns, to prevent
creation of multiple builtInsInstances
NB. Actually, it's of form BuiltInsCacheKey -> KotlinBuiltIns, because
we shouldn't create new builtIns for each module. Also, currently,
each platform has its own BuiltInsCacheKey implementation, because
parameters by which built-ins are created, are a bit different across
different platforms. Ideally, we should eliminate those differences
and they use one concrete implementation as a key.
2019-07-30 12:41:40 +03:00
Dmitry Savvinov b48218e722 [Resolve] Make ResolversForModule less static
As consequence, remove IdePlatformKindTooling.resolverForModule, because
it became more than just field, and it duplicates similar API in
IdePlatformKindResolution anyways
2019-07-30 12:41:40 +03:00
Ilya Chernikov 0072f8c265 Improve JSR-223 engine diagnostics
also abstract invoke wrapper creation
2019-07-26 08:55:14 +02:00
Victor Petukhov e25b315319 Introduce -Xpolymorphic-signature compiler flag as more priority than -XXLanguage:+PolymorphicSignature 2019-07-26 09:01:25 +03:00
Victor Petukhov 944ee8fcd5 Introduce -Xinline-classes compiler flag as more priority than -XXLanguage:+InlineClasses 2019-07-26 09:01:25 +03:00
Yan Zhulanow ccff347ffc Kapt: Attach generated Kotlin sources in 'compilation' mode (KT-32535) 2019-07-26 02:40:32 +09:00
Ilya Chernikov 9ae0ff03fa Improve script and REPL result handling:
- implement error result
- refactor other result classes
- implement handling in the script evaluation extension - also restores
  previous script error reporting functionality
- add possibility to customize result fileds in script and REPL
- refactor result calculation in the backend: cleanup, rename (since
  it is not only about REPL now)
2019-07-11 15:50:26 +02:00
Ilya Chernikov 1ab255eafb Use kotlin home for automatic loading of the scripting plugin 2019-07-11 15:50:25 +02:00
Nikolay Krasko 0b8f35c04d Revert "Register mock injection language manager in compiler"
This reverts commit 674badc6

Since idea 192.5587.17 idea has own InjectedLanguageManager registration
and fails because of duplicate.

org.junit.ComparisonFailure: exception: org.picocontainer.defaults.DuplicateComponentKeyRegistrationException: Key com.intellij.lang.injection.InjectedLanguageManager duplicated
	at com.intellij.util.pico.DefaultPicoContainer.registerComponent(DefaultPicoContainer.java:123)
	at com.intellij.util.pico.DefaultPicoContainer.registerComponentInstance(DefaultPicoContainer.java:331)
	at com.intellij.mock.MockComponentManager.registerService(MockComponentManager.java:89)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$ProjectEnvironment.registerJavaPsiFacade(KotlinCoreEnvironment.kt:162)
	at com.intellij.core.JavaCoreProjectEnvironment.<init>(JavaCoreProjectEnvironment.java:55)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreProjectEnvironment.<init>(KotlinCoreProjectEnvironment.kt:27)
	...
2019-07-05 09:08:15 +03:00
Andrey Uskov e079615cdf Add possibility to edit target platform for non-HMPP projects in order to keep ability to edit target platform for IDEA-based projects 2019-07-02 22:46:48 +03:00
Andrey Uskov 9fc60be9d8 Fix serialization of facet settings in order to read properly
settings of native platforms
2019-07-02 22:46:47 +03:00
Nikolay Krasko 12bb1a5bd1 Make invalidateOnOOCB explicit in ResolverForProjectImpl and remove usage in tests 2019-07-02 13:45:35 +03:00
Alexey Tsvetkov ffa191d91d Fix filling Main-Class attribute in manifest file of output jar
Before 5b7cee6221 JVM CLI compiler
was calling `KotlinToJVMBytecodeCompiler.compileBunchOfSources`.
`compileBunchOfSources` detected possible main classes,
and filled the Main-Class attribute in output jar
if if there was only one candidate.

After the change JVM CLI began calling
`KotlinToJVMBytecodeCompiler.compileModules`, which was not searching for a main class.

This change adds searching for main classes to `compileModules`.
We search for a main class only when one module is compiled,
and an output is written a jar file (so the change only affects JVM CLI compilation).

    #KT-32272 Fixed
2019-07-01 13:57:04 +03:00
Mikhail Zarechenskiy c2cf4aa2b5 [NI] Move ability to convert standalone SAM-argument under the feature
If new inference is enabled only for IDE analysis, then this feature
 will be disabled to reduce difference between new and old inference,
 but if new inference is enabled in the compiler, then this feature
 will be enabled too to preserve behavior of new inference for
 compilation

 #KT-32175 Fixed
 #KT-32143 Fixed
 #KT-32123 Fixed
 #KT-32230 Fixed
2019-07-01 12:53:33 +03:00
Vyacheslav Gerasimov 22bbbeb1ec Build: Fix manifest for kotlin-compiler in jps build
Trigger manifest generation from jar task during jps import
2019-06-27 17:56:51 +03:00
Vyacheslav Gerasimov fc68bb46dc Build: Move compiler.xml extensions to cli-common 2019-06-27 17:56:51 +03:00
Vyacheslav Gerasimov db3b01d2d4 Build: Centralize compiler dist build logic in :kotlin-compiler project 2019-06-27 17:56:48 +03:00
Nikolay Krasko 674badc692 Register mock injection language manager in compiler
In 192 it's important to have service registered since
https://github.com/JetBrains/intellij-community/commit/f204718c885034bc2fa4be4b281ff4bbd5fa4ef4

Caused by: java.lang.IllegalArgumentException: Argument for @NotNull parameter 'value' of com/intellij/openapi/util/UserDataHolderBase.putUserDataIfAbsent must not be null
	at com.intellij.openapi.util.UserDataHolderBase.$$$reportNull$$$0(UserDataHolderBase.java)
	at com.intellij.openapi.util.UserDataHolderBase.putUserDataIfAbsent(UserDataHolderBase.java)
	at com.intellij.openapi.util.NotNullLazyKey.getValue(NotNullLazyKey.java:41)
	at com.intellij.lang.injection.InjectedLanguageManager.getInstance(InjectedLanguageManager.java:41)
	at com.intellij.psi.impl.PsiCachedValue.isVeryPhysical(PsiCachedValue.java:74)
	at com.intellij.psi.impl.PsiCachedValue.anyChangeImpliesPsiCounterChange(PsiCachedValue.java:57)

Reproduced with Fir2IrTextTestGenerated
2019-06-25 11:49:00 +03:00
Nikolay Krasko 5119979571 Fix compile warnings with 192.5118.30 in backward compatible way 2019-06-25 11:48:59 +03:00
Nikolay Krasko beb1bc09d4 Update to 192.5118.30 2019-06-25 11:48:59 +03:00
Roman Artemev cc46657c99 [JS IR BE] Fix misprint 2019-06-14 18:40:59 +03:00
Vyacheslav Gerasimov 5a39c637c2 Build: Fix intellij dependency leak from ir tree module 2019-06-13 21:03:55 +03:00
Andrey Uskov c0bf5a6566 Import of middle HMPP target platforms is supported 2019-06-13 18:30:01 +03:00
Dmitry Savvinov 174ef56991 [Expect/Actual] Remove PlatformExpectedAnnotator 2019-06-10 13:34:27 +03:00
Mikhail Zarechenskiy 787a8bb9bd Revert "[NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI"
This reverts commit 7c4101e21c.

 #KT-31866 Fixed
 #KT-31868 Fixed
 #EA-125401 Fixed
 #KT-25290 Open
2019-06-07 12:31:38 +03:00
Svyatoslav Kuzmich cd651be461 [JS IR BE] Migrate JS BE to common klib utils 2019-06-05 11:15:45 +03:00
Igor Yakovlev fa6b21357b Add cache to KLightClassForFacade 2019-06-03 17:23:40 +03:00
Igor Yakovlev 24253e21d0 Add ultraKtLightClassForFacade multifile support 2019-06-03 17:23:40 +03:00
Igor Yakovlev 86e9018f49 Add text functions to KtLightClassForFacade 2019-06-03 17:23:39 +03:00
Igor Yakovlev 852a4bc0ca Add support UL for FileFacade 2019-06-03 17:23:39 +03:00
Dmitriy Novozhilov 7c4101e21c [NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI 2019-05-29 10:35:46 +03:00
Mikhail Zarechenskiy 848640253a Revert "[NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI"
This reverts commit f20ec3e0a6.
2019-05-29 01:31:28 +03:00