Compare commits

..

447 Commits

Author SHA1 Message Date
Nikolay Krasko
06644f5f54 minor 2020-11-25 19:56:52 +03:00
Nikolay Krasko
0007d90049 Reminder about -Pidea.fir.plugin=true for running fir-idea tests 2020-11-25 19:45:42 +03:00
Nikolay Krasko
acc7c907d8 logging 2020-11-25 19:44:45 +03:00
Mikhael Bogdanov
a0eb5b36d8 Switch ASM artifact 2020-11-25 18:11:05 +03:00
Dmitry Petrov
7cc6204d6b Minor: update testData 2020-11-25 17:31:47 +03:00
Dmitry Petrov
e5dce9f994 KT-42933 inline class backing field can't be static 2020-11-25 17:31:46 +03:00
Dmitry Petrov
f6abc5c3cf KT-43286 use JVM 1.8 intrinsics for coercible unsigned values only 2020-11-25 17:31:46 +03:00
Dmitry Petrov
498047e64e KT-43562 don't remap static inline class funs as special builtins 2020-11-25 17:31:46 +03:00
Sergey Shanshin
f6c7372089 Fix serializing properties with custom accessors (#3907)
Fixes Kotlin/kotlinx.serialization#956
2020-11-25 17:06:10 +03:00
pyos
7327c20200 FIR: add a resolution mode for property delegates
Like function arguments, they are context-dependent, but unlike function
arguments, callable references should be resolved eagerly as if they are
explicit receivers.
2020-11-25 16:55:10 +03:00
Jinseong Jeon
0a5b899aab FIR: more comprehensive substitution of stub types after builder inference 2020-11-25 16:55:09 +03:00
Jinseong Jeon
30c97e6cb4 FIR: update unsubstituted return types in builder
#KT-43340 Fixed
2020-11-25 16:55:09 +03:00
Jinseong Jeon
d58e5b1d95 Remove unnecessary semi-colons 2020-11-25 16:55:09 +03:00
Jinseong Jeon
a0dd62f8c5 Remove unnecessary expression 2020-11-25 16:55:09 +03:00
Jinseong Jeon
dfc5059d6b FIR: reproduce KT-43340 2020-11-25 16:55:08 +03:00
Andrei Klunnyi
c13650fd79 KT-43511 [Gradle Runner]: run task is not created for top level modules 2020-11-25 11:10:22 +00:00
Vladimir Dolzhenko
25a631a1ca Improved IDE performance tests vega specs 2020-11-25 10:08:57 +01:00
Ilya Kirillov
dcdd69d039 Invalidate caches before resolve in AbstractPerformanceHighlightingTest 2020-11-25 09:18:19 +01:00
Victor Petukhov
04846ca47a Rework checking constraints by presented OnlyInputTypes annotation in accordance with changed incorporation mechanism 2020-11-25 11:15:23 +03:00
Victor Petukhov
0857b9c9e7 Rethink constraints incorporation
Namely, remove incorporation “otherInsideMyConstraint” to eliminate
constraint system redundancy and produce a potentially very large number
 of constructs.
Instead, introduce not so “spreadable” incorporation during variable
fixation (equality constraint with result type into other constraints).
^KT-41644 Fixed
^KT-42195 Fixed
^KT-42920 Fixed
^KT-42791 Fixed
^KT-41741 Fixed
2020-11-25 11:15:20 +03:00
Victor Petukhov
616e40f879 Reuse equality constraints during simplification in adding constraints 2020-11-25 11:15:19 +03:00
Ilmir Usmanov
aabe709079 Value classes: Add @JvmInline annotation to stdlib 2020-11-25 01:08:31 +01:00
Andrey Uskov
a7100134a0 Don't mark testJsTestOutputFileInProjectWithAndroid as flaky in 202 2020-11-24 23:05:55 +03:00
Mikhail Glukhikh
ee40b3a4a4 Drop redundant fields around AbstractFir2IrLazyFunction 2020-11-24 17:50:12 +01:00
Mikhail Glukhikh
fda5ee7d06 Fir2IrLazyPropertyAccessor: make inline iff FIR accessor is inline 2020-11-24 17:50:12 +01:00
Mikhail Glukhikh
d27a0c91f6 Extract AbstractFir2IrLazyFunction (base for accessor & simple function) 2020-11-24 17:50:12 +01:00
Mikhail Glukhikh
c03fa59a63 Introduce Fir2IrLazyPropertyAccessor 2020-11-24 17:50:12 +01:00
Alexander Udalov
7117932623 JVM IR: handle JvmStatic in object as module phase
This allows to get rid of the situation where a JvmStatic function in
object can be seen in different states in different lowerings: unlowered
with a dispatch receiver parameter, declaration is lowered but calls are
not, and both declaration and calls are lowered.

Now it works like this:
1) JvmStatic functions in objects coming from dependencies are always
   loaded as lowered, without the extra dispatch receiver parameter. In
   psi2ir this is done via JVM-specific extension; in fir2ir it's done
   in place (but probably should be extracted to extension too).
2) Functions from sources are created as unlowered by both psi2ir and
   fir2ir, and are lowered in a module-wide phase at the beginning of
   JvmLower.
3) Calls to all JvmStatic functions from objects (from sources and
   dependencies) are lowered in the same phase at the beginning of
   JvmLower.

This ensures that all lowerings after the module-wide phase
`jvmStaticInObjectPhase`, which include all per-file phases, see all
JvmStatic functions in objects without the additional dispatch receiver
parameter, and calls do not have dispatch receiver either.

The only issue with this approach is that function/property reference
representation in reflection needs to have that dispatch receiver
parameter, and that is achieved via a hack in those lowerings, which
seems not too out of place anyway, given that they're handled specially
in kotlin-reflect as well.
2020-11-24 17:50:11 +01:00
Alexander Udalov
0a00cbefaf JVM IR: minor, refactor replaceThisByStaticReference
Allow to replace "this" references not only inside IrBody, but inside
any IrElement. This will be useful in JvmStatic in object lowering where
we want not only to replace usages inside the function body, but also in
default values of its parameters.
2020-11-24 17:50:11 +01:00
Margarita Bobova
ebb545a9fb Split ChangeLog file to files by major releases 2020-11-24 18:46:44 +03:00
Margarita Bobova
71d3d8bffc Add ChangeLog for 1.4.20 2020-11-24 18:46:44 +03:00
Leonid Startsev
b1c355e7eb Directly search in IrClass for declarations to fill bodies with plugin
because some other compiler plugins (Compose) copy/rewrite IR declarations
completely, and in the end, functions that are present in the final IR tree
do not have bodies.

Correctly create IrProperty and IrField when they were absent from the
descriptors (in case for private serializer properties)

Do not use symbol table because 'declare' API is not available in plugins.

Fixes https://github.com/JetBrains/compose-jb/issues/46
2020-11-24 18:40:10 +03:00
Ilya Goncharov
5efefabb93 [JS IR] webpackConfigAppliers as internal to not break Gradle lambda serialization in some cases
[JS IR] Add synthetic config and webpack config is nested object

^KT-43535 fixed
2020-11-24 17:49:33 +03:00
Mikhael Bogdanov
42a9d64578 Track binary output class names 2020-11-24 15:20:12 +01:00
Mikhael Bogdanov
6748560184 Proper support of aggregated processors 2020-11-24 15:20:12 +01:00
Ilya Goncharov
f382a55b17 [JS IR] Add EXPECTED_REACHABLE_NODES for JS tests of external tail args 2020-11-24 16:34:27 +03:00
Sergey Shanshin
176071b7db Add support of nullable serializers to UseSerializers annotation (#3906)
Fixes Kotlin/kotlinx.serialization#984
2020-11-24 16:34:02 +03:00
sebastian.sellmair
6c7247cbd3 syncKotlinAndAndroidSourceSets: Don't register Kotlin source dirs in Android java source dirs 2020-11-24 13:16:11 +00:00
sebastian.sellmair
2286498d8d Share defaultSourceFolder logic between syncKotlinAndAndroidSourceSets.kt and KotlinSourceSetFactory.kt 2020-11-24 13:16:10 +00:00
sebastian.sellmair
7c7eada452 Add comment about unsupported associate compilations to functionalTest source files 2020-11-24 13:16:10 +00:00
sebastian.sellmair
3f98e2974c Expand AndroidSourceSet#kotlinSourceSet to AndroidSourceSet#kotlinSourceSetOrNull 2020-11-24 13:16:09 +00:00
sebastian.sellmair
3e5cbf324d syncKotlinAndAndroidSourceSets.kt: Cover flavors with tests 2020-11-24 13:16:09 +00:00
sebastian.sellmair
cdfbbca580 Also register shaders for kotlin source sets 2020-11-24 13:16:08 +00:00
sellmair
2c325c45e2 Register Kotlin MPP source sets in AGP
^KT-43391 fixed
2020-11-24 13:16:07 +00:00
Dmitry Petrov
3a166f3592 KT-43525 forbid @JvmOverloads on mangled funs and hidden constructors 2020-11-24 16:06:20 +03:00
Alexander Udalov
ca78261d7f Minor, fix "unknown -Xstring-concat mode" error message 2020-11-24 11:50:31 +01:00
Alexander Udalov
ed481add08 Fix performance regression in KotlinSuppressCache.isSuppressedByAnnotated
After a seemingly innocent refactoring in 61548a0a36, we've lost the
optimization that was enabled by the suppressorAbove logic in
isSuppressedByAnnotated.
2020-11-24 11:49:31 +01:00
Ilya Goncharov
efee3ea648 [JS IR] - Remove file lowering declarations from lowering phases
- rename fileToPurenessInitializers onto fileToInitializerPureness
- remove redundant check on top-level property

[JS IR] Rename initialis* to initializ* for consistency

[JS IR] Move propertyLazyInitialization property to context from configuration

[JS IR] Add test on lazy initialization properties order

[JS IR] Add multi module for lazy initialization of properties

[JS IR] Move tests onto js.translator

[JS IR] Rename fileToInitializerPureness according to context name

^KT-43222 fixed
2020-11-24 12:33:44 +03:00
Ilya Goncharov
1b5ebd83de [JS IR] Lazy initialisation is optional for tests
^KT-43222 fixed
2020-11-24 12:33:43 +03:00
Ilya Goncharov
a2d41b86bf [JS IR] Add compiler argument about lazy initialisation
^KT-43222 fixed
2020-11-24 12:33:43 +03:00
Ilya Goncharov
fcb3ee5e45 [JS IR]Add check on pureness to not calculate fields to expression twice
^KT-43222 fixed
2020-11-24 12:33:42 +03:00
Ilya Goncharov
aa0f9dc1e2 [JS IR] Don't target exact wasm backend
^KT-43222 fixed
2020-11-24 12:33:42 +03:00
Ilya Goncharov
c224394dfc [JS IR] Return with createdOn hack
^KT-43222 fixed

[JS IR] Not create initialisation function for file if there were attempt to create it earlier

^KT-43222 fixed

[JS IR] Pureness for PIR and memoize file fields pureness

^KT-43222 fixed
2020-11-24 12:33:42 +03:00
Ilya Goncharov
8b4d42e70a [JS IR] Add initialisation call for functions in method
^KT-43222 fixed
2020-11-24 12:30:37 +03:00
Ilya Goncharov
06b276f9c3 [JS IR] Migrate on body lowering pass and declaration transformer
^KT-43222 fixed
2020-11-24 12:30:21 +03:00
Ilya Goncharov
99d0740234 [JS IR] Ignore JS_IR backend in top level side effect properties
^KT-43222 fixed
2020-11-24 12:30:04 +03:00
Ilya Goncharov
d6bc309c94 [JS IR] Eager initialisation for all pure properties
^KT-43222 fixed
2020-11-24 12:29:48 +03:00
Ilya Goncharov
3da9761f37 [JS IR] Add test on lazy initialisation
^KT-43222 fixed
2020-11-24 12:29:28 +03:00
Ilya Goncharov
f4c1e52338 [JS IR] Continuation parameter in main through accessor
^KT-43222 fixed
2020-11-24 12:29:11 +03:00
Ilya Goncharov
34ee146148 [JS IR] Internal visibility for init fun
^KT-43222 fixed
2020-11-24 12:28:57 +03:00
Ilya Goncharov
07b6ef65a3 [JS IR] Init delegated properties as usual
^KT-43222 fixed
2020-11-24 12:28:07 +03:00
Ilya Goncharov
841118a64d [JS IR] Add init properties call to top level functions
^KT-43222 fixed
2020-11-24 12:27:51 +03:00
Ilya Goncharov
5746a7c4fc [JS IR] Only consider top level properties
^KT-43222 fixed
2020-11-24 12:27:36 +03:00
Ilya Goncharov
0dc4f51d74 [JS IR] Add init function call into first step of property accessor
^KT-43222 fixed
2020-11-24 12:27:20 +03:00
Ilya Goncharov
71bfed3253 [JS IR] From searcher get only properties, mutate in lowering
^KT-43222 fixed
2020-11-24 12:27:04 +03:00
Ilya Goncharov
42e1a3280b [JS IR] Add guard into init properties function
^KT-43222 fixed
2020-11-24 12:25:38 +03:00
Ilya Goncharov
d752b7439e [JS IR] Add init function for properties
^KT-43222 fixed
2020-11-24 12:25:24 +03:00
Alexander Likhachev
003ea4bcdf [Gradle, MPP] Make metadata jar task cc-compatible with warnings
#KT-43329 Fixed
2020-11-24 11:33:20 +03:00
Shagen Ogandzhanian
3282e092d8 [JS] Don't fail on recursive upper bounds while resolving JsExports
Fixes https://youtrack.jetbrains.com/issue/KT-42112
2020-11-23 18:01:00 +01:00
Jinseong Jeon
f9a032dbfa FIR2IR: add AnnotationGenerator to Fir2IrComponents 2020-11-23 19:36:11 +03:00
Jinseong Jeon
eff4cec3e0 FIR2IR: convert annotations on delegated members 2020-11-23 19:36:10 +03:00
pyos
d980074624 FIR: deserialize the fun interface flag 2020-11-23 19:36:09 +03:00
pyos
20c7c4881d FIR: fix @JvmPackageName
A single `JvmGeneratorExtensions` instance should be passed around.
2020-11-23 19:36:08 +03:00
Shagen Ogandzhanian
2d4e9af289 [JS IR] Throw exception if test class or test method has explicit parameter
resolves https://youtrack.jetbrains.com/issue/KT-41032
2020-11-23 15:47:32 +01:00
Ilya Kirillov
c4a8d1c3a1 FIR: use java functional interface as a source of sam function call 2020-11-23 15:31:31 +01:00
Ilya Kirillov
7b1eef136e FIR IDE: introduce KtFirCollectionLiteralReference 2020-11-23 15:31:30 +01:00
Ilya Kirillov
bac5ebcb12 FIR IDE: use custom thread local value for storing KtFirScopeProvider
java.lang.ThreadLocal stores value maps in corresponding threads
which causes memory leaks
2020-11-23 15:31:29 +01:00
Ilya Kirillov
b31def0bae FIR IDE: invalidate analysis session on project roots change 2020-11-23 15:31:26 +01:00
Ilya Kirillov
be95d067f3 FIR IDE: add KotlinOutOfBlockPsiTreeChangePreprocessor 2020-11-23 15:31:24 +01:00
Ilya Kirillov
7a86ca632d FIR IDE: fix collecting diagnostics for anonymous object declaration 2020-11-23 15:31:20 +01:00
Ilya Kirillov
7061608567 FIR IDE: introduce common function to mute tests 2020-11-23 15:31:14 +01:00
Ilya Kirillov
e4d2e38ea2 FIR IDE: fix reference resolving of qualified expression with nested classes 2020-11-23 15:31:11 +01:00
Ilya Kirillov
164f4d14d7 FIR IDE: do not collect diagnostics for generated declarations 2020-11-23 15:31:08 +01:00
Ilya Kirillov
60cc30286c FIR IDE: update file structure testdata after structure elements classes rename 2020-11-23 15:31:05 +01:00
Ilya Kirillov
75990f7619 FIR IDE: fix tesdata 2020-11-23 15:31:02 +01:00
Ilya Kirillov
7320620285 FIR IDE: add local visibility to symbols 2020-11-23 15:30:58 +01:00
Ilya Kirillov
5fdcc4bb83 FIR IDE: refactor KotlinFirModificationTrackerService 2020-11-23 15:30:55 +01:00
Ilya Kirillov
112f6771eb FIR IDE: fix compilation 2020-11-23 15:30:51 +01:00
Ilya Kirillov
65b5e4b62b FIR IDE: make some session components to be non-thread local
To avoid memory leaks
2020-11-23 15:30:47 +01:00
Ilya Kirillov
c3caa3a137 FIR IDE: clean AbstractFirReferenceResolveTest 2020-11-23 15:30:42 +01:00
Ilya Kirillov
3174eb4b09 FIR IDE: do not get ktDeclaration for FirFile 2020-11-23 15:30:39 +01:00
Ilya Kirillov
ff7857a812 FIR IDE: refactor, simplify structure element class names 2020-11-23 15:30:37 +01:00
Ilya Kirillov
15277c0974 FIR IDE: introduce memory leak checking in symbols test 2020-11-23 15:30:36 +01:00
Ilya Kirillov
11e94c1de1 FIR IDE: fix building of local declaration symbols 2020-11-23 15:30:29 +01:00
Ilya Kirillov
e78e26234b FIR IDE: do not store cone session in every KtFirType 2020-11-23 15:30:24 +01:00
Ilya Kirillov
e54d16e7e4 FIR IDE: fix fir declaration leak in symbols 2020-11-23 15:30:20 +01:00
Ilya Kirillov
b01ee163d1 FIR IDE: wrap KotlinDeserializedJvmSymbolsProvider into thread safe cache
This is needed by the two reasons:
- KotlinDeserializedJvmSymbolsProvider does not cache all symbols by itself
and as KtSymbol's holds fir elements under via weak refs, this weak refs
may be garbage collected
- KotlinDeserializedJvmSymbolsProvider is not thread safe
2020-11-23 15:30:17 +01:00
Ilya Kirillov
911662bc2f FIR IDE: introduce out of block modification tracker tests 2020-11-23 15:30:14 +01:00
Ilya Kirillov
da7b12f7e1 FIR IDE: introduce ProjectWideOutOfBlockKotlinModificationTrackerTest 2020-11-23 15:30:12 +01:00
Ilya Kirillov
880e76b203 FIR IDE: introduce FIR IDE specific out of block modification tracker 2020-11-23 15:30:07 +01:00
Ilya Kirillov
6c1faec171 FIR IDE: introduce file structure tests 2020-11-23 15:30:05 +01:00
Ilya Kirillov
7c912cd3e4 FIR IDE: introduce FileElementFactory 2020-11-23 15:30:02 +01:00
Ilya Kirillov
315629c99b FIR IDE: refactor lock provider 2020-11-23 15:29:59 +01:00
Ilya Kirillov
559b07d78a FIR IDE: fix memory leak in scope provider 2020-11-23 15:29:58 +01:00
Ilya Goncharov
64895fe7da [JS IR] Test with js specific moved to js.translator
- Move js function from `main` to separate js file

^KT-40090 fixed
2020-11-23 16:05:33 +03:00
Ilya Goncharov
fe3030c432 [JS IR] Drop last null arguments in calls of external functions
^KT-40090 fixed
2020-11-23 16:05:19 +03:00
Ilya Goncharov
5c731c6c04 [JS IR] Add test in external js fun with default args
^KT-40090 fixed
2020-11-23 16:05:02 +03:00
Jinseong Jeon
8eb2ae18dc FIR checker: refactor EventOccurrencesRange accumulation 2020-11-23 14:54:19 +03:00
Jinseong Jeon
b9d3578a86 FIR checker: refactor ControlFlowInfos whose key is EdgeLabel 2020-11-23 14:54:19 +03:00
Jinseong Jeon
b6a4c279a4 FIR checker: refactor ControlFlowInfos whose value is EventOccurrencesRange 2020-11-23 14:54:19 +03:00
Jinseong Jeon
cf8f5b0912 FIR checker: make calls effect analyzer path-sensitive 2020-11-23 14:54:18 +03:00
Dmitry Petrov
2662679579 KT-43399 properly erase extension receiver type in property$annotations 2020-11-23 13:58:52 +03:00
Dmitry Petrov
551d0c1b64 JVM_IR KT-43440 private-to-this default interface funs are private 2020-11-23 13:56:17 +03:00
Dmitry Petrov
bf7fdcda6e KT-42909 fix missing loop variable in 'withIndex' ranges 2020-11-23 13:56:17 +03:00
Ilya Matveev
a9c9406a55 [Gradle, K/N] Set LIBCLANG_DISABLE_CRASH_RECOVERY=1 for cinterop
Issue #KT-42485 Fixed
2020-11-23 10:49:12 +00:00
Alexander Anisimov
37197a95cd Update ReadMe.md 2020-11-23 13:14:26 +03:00
Kristoffer Andersen
18612c1ef0 [JVM+IR] Rebase LVT test of destructuing in lambda params
The debug experiece of destructuring patterns in lambdas is different
across the two backends due to the IR backend moving local variables
to fields.

However, since the destructuring variable is never actually visible in
the debugger (no linenumbers in the live range of the variable), and
the variable is never used for anything other than hiding it from the
debugger, we propose that it is not actually necessary to include it
in the LVT (and in fact, could be left out of the LVT on the old
backend).
2020-11-23 10:54:04 +01:00
Ivan Gavrilovic
ccc272c49f KT-43489: KGP - Avoid storing build history mapping in a property
If tasks are created eagerly, it is possible for this
mapping to be initalized too early. This causes incremental
compilation to fail, as it will contain mappings only for
projects that have been evaluated thus far.

Fixes KT-43489
2020-11-23 11:45:46 +03:00
Alexander Anisimov
2c28e6556b Add JetBrains to the first part of text 2020-11-23 11:14:52 +03:00
Hollow Man
926dc085da Fix typo
inferrred -> inferred
2020-11-21 14:00:28 +01:00
Vyacheslav Gerasimov
3351887ae5 Build: Upgrade GE plugin to 3.5 2020-11-20 20:15:27 +03:00
LepilkinaElena
dd9c0c5c6e Use separate logic for filtering and skipping in collectAndFilterRealOverrides [KT-43487] (#3921) 2020-11-20 19:10:41 +03:00
Alexander Udalov
362775b6b6 JVM IR: minor, improve exception message 2020-11-20 12:43:47 +01:00
Dmitry Petrov
b495fd542f JVM, JVM_IR: KT-42281 proper array->primitive coercion 2020-11-20 14:33:20 +03:00
Dmitry Petrov
e59c8e0a5c JVM_IR KT-42137 bridges are not generated for fake overrides 2020-11-20 14:33:20 +03:00
Roman Artemev
5d5473ef08 [IR BE] Drop unused context member 2020-11-20 12:04:18 +03:00
Roman Artemev
51cff97b78 [JS IR BE] Drop implicit declaration file 2020-11-20 12:03:05 +03:00
Jinseong Jeon
67604551c5 FIR: reuse visibility checker when determining immutable property reference 2020-11-20 10:48:13 +03:00
Jinseong Jeon
463d53ee5c FIR: handle reference to property with invisible setter 2020-11-20 10:48:13 +03:00
Ilya Gorbunov
b2b2629e79 Use new kotlin.io.path API in tests 2020-11-20 09:03:25 +03:00
Ilya Gorbunov
d38e145529 Use new kotlin.io.path API in generators 2020-11-20 09:03:13 +03:00
Ilya Gorbunov
dce3e57685 Use NIO Files for creating temp files: idea plugin 2020-11-20 06:09:37 +03:00
Ilya Gorbunov
090b562db7 Use NIO Files for creating temp files: scripting, daemon, main-kts 2020-11-20 06:09:37 +03:00
Ilya Gorbunov
c9bbdf6575 Use NIO Files for creating temp files: build tools 2020-11-20 06:09:36 +03:00
Nikolay Krasko
30bb7d19c0 Revert "Build: Temporary disable capturing inputs for tasks"
Now GE server is updated and should process scans with inputs faster.

This reverts commit e331e80b
2020-11-19 23:59:16 +03:00
Nikolay Krasko
e8af601cea Mute very flaky FirPsiCheckerTestGenerated.Regression.testJet53
A very probable failure that can be reproduced locally:

```
ERROR: While resolving call checkSubtype#<R|kotlin/collections/List<kotlin/Int>?|>(Collections#.emptyList#<R|kotlin/Int|>())
java.lang.RuntimeException: While resolving call checkSubtype#<R|kotlin/collections/List<kotlin/Int>?|>(Collections#.emptyList#<R|kotlin/Int|>())
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirExpressionsResolveTransformer.transformFunctionCall(FirExpressionsResolveTransformer.kt:282)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFunctionCall(FirBodyResolveTransformer.kt:114)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFunctionCall(FirBodyResolveTransformer.kt:30)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFunctionCall(FirTransformer.kt:957)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFunctionCall(FirTransformer.kt:140)
	at org.jetbrains.kotlin.fir.expressions.FirFunctionCall.accept(FirFunctionCall.kt:31)
	at org.jetbrains.kotlin.fir.FirElement$DefaultImpls.transform(FirElement.kt:29)
	at org.jetbrains.kotlin.fir.FirPureAbstractElement.transform(FirPureAbstractElement.kt:11)
	at org.jetbrains.kotlin.fir.visitors.FirTransformerUtilKt.transformSingle(FirTransformerUtil.kt:12)
	at org.jetbrains.kotlin.fir.declarations.impl.FirPropertyImpl.transformInitializer(FirPropertyImpl.kt:104)
	at org.jetbrains.kotlin.fir.declarations.impl.FirPropertyImpl.transformInitializer(FirPropertyImpl.kt:34)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirDeclarationsResolveTransformer.transformChildrenWithoutAccessors(FirDeclarationsResolveTransformer.kt:278)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirDeclarationsResolveTransformer.access$transformChildrenWithoutAccessors(FirDeclarationsResolveTransformer.kt:42)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirDeclarationsResolveTransformer.transformProperty(FirDeclarationsResolveTransformer.kt:132)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformProperty(FirBodyResolveTransformer.kt:254)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer.access$transformProperty$s1271549241(FirImplicitBodyResolve.kt:116)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer$transformProperty$1.invoke(FirImplicitBodyResolve.kt:143)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer$transformProperty$1.invoke(FirImplicitBodyResolve.kt:116)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer.computeCachedTransformationResult(FirImplicitBodyResolve.kt:169)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer.transformProperty(FirImplicitBodyResolve.kt:142)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer.transformProperty(FirImplicitBodyResolve.kt:116)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitProperty(FirTransformer.kt:753)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitProperty(FirTransformer.kt:140)
	at org.jetbrains.kotlin.fir.declarations.FirProperty.accept(FirProperty.kt:53)
	at org.jetbrains.kotlin.fir.FirElement$DefaultImpls.transform(FirElement.kt:29)
	at org.jetbrains.kotlin.fir.FirPureAbstractElement.transform(FirPureAbstractElement.kt:11)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.visitNoTransform(FirBodyResolveTransformer.kt:358)
	at org.jetbrains.kotlin.idea.fir.low.level.api.trasformers.FirDesignatedImplicitTypesTransformerForIDE.transformDeclarationContent(FirDesignatedImplicitTypesTransformerForIDE.kt:42)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFile(FirBodyResolveTransformer.kt:66)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFile(FirBodyResolveTransformer.kt:30)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFile(FirTransformer.kt:801)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFile(FirTransformer.kt:140)
	at org.jetbrains.kotlin.fir.declarations.FirFile.accept(FirFile.kt:32)
	at org.jetbrains.kotlin.fir.FirElement$DefaultImpls.transform(FirElement.kt:29)
	at org.jetbrains.kotlin.fir.FirPureAbstractElement.transform(FirPureAbstractElement.kt:11)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.visitNoTransform(FirBodyResolveTransformer.kt:358)
	at org.jetbrains.kotlin.idea.fir.low.level.api.trasformers.FirDesignatedImplicitTypesTransformerForIDE.transformDeclarationContent(FirDesignatedImplicitTypesTransformerForIDE.kt:42)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFile(FirBodyResolveTransformer.kt:66)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFile(FirBodyResolveTransformer.kt:30)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFile(FirTransformer.kt:801)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFile(FirTransformer.kt:140)
	at org.jetbrains.kotlin.fir.declarations.FirFile.accept(FirFile.kt:32)
	at org.jetbrains.kotlin.fir.FirElement$DefaultImpls.transform(FirElement.kt:29)
	at org.jetbrains.kotlin.fir.FirPureAbstractElement.transform(FirPureAbstractElement.kt:11)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver$runLazyResolvePhase$$inlined$runPhaseWithCustomResolve$3.run(utils.kt:82)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:188)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver.runLazyResolvePhase(FirLazyDeclarationResolver.kt:246)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver.runLazyResolveWithoutLock(FirLazyDeclarationResolver.kt:127)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver.lazyResolveDeclaration(FirLazyDeclarationResolver.kt:63)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver.lazyResolveDeclaration$default(FirLazyDeclarationResolver.kt:39)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.createDeclarationStructure(FileStructure.kt:131)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.createStructureElement(FileStructure.kt:171)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.access$createStructureElement(FileStructure.kt:29)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure$getStructureElementForDeclaration$structureElement$1.apply(FileStructure.kt:48)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure$getStructureElementForDeclaration$structureElement$1.apply(FileStructure.kt:29)
	at java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1853)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.getStructureElementForDeclaration(FileStructure.kt:46)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.getStructureElementFor(FileStructure.kt:42)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.getAllDiagnosticsForFile(FileStructure.kt:71)
	at org.jetbrains.kotlin.idea.fir.low.level.api.diagnostics.DiagnosticsCollector.collectDiagnosticsForFile(DiagnosticsCollector.kt:27)
	at org.jetbrains.kotlin.idea.fir.low.level.api.FirModuleResolveStateImpl.collectDiagnosticsForFile$idea_fir_low_level_api(FirModuleResolveStateImpl.kt:63)
	at org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade.collectDiagnosticsForFile(LowLevelFirApiFacade.kt:93)
	at org.jetbrains.kotlin.idea.frontend.api.fir.components.KtFirDiagnosticProvider.collectDiagnosticsForFile(KtFirDiagnosticProvider.kt:26)
	at org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.collectDiagnosticsForFile(KtAnalysisSession.kt:63)
	at org.jetbrains.kotlin.idea.fir.highlighter.KotlinHighLevelDiagnosticHighlightingPass.doCollectInformation(KotlinHighLevelDiagnosticHighlightingPass.kt:36)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:52)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:442)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1106)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:435)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:434)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:410)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:168)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:168)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:408)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:171)
	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:163)
```
2020-11-19 23:58:02 +03:00
Steven Schäfer
7bfe2c0bbc JVM IR: Update test expectation for testSamAdapterAndInlineOnce
...and remove redundant bytecode text tests.
2020-11-19 19:46:49 +01:00
Steven Schäfer
8574cb4466 JVM IR: Don't generate line numbers and null checks in SAM wrapper constructors 2020-11-19 19:46:49 +01:00
Steven Schäfer
68e2d0d245 JVM IR: Generate synthetic final implementation methods in SAM wrappers 2020-11-19 19:46:49 +01:00
Steven Schäfer
a475fa2a21 JVM IR: Use raw types in SAM wrappers 2020-11-19 19:46:49 +01:00
Steven Schäfer
999151abac JVM IR: Generate SAM wrapper fields as synthetic final 2020-11-19 19:46:49 +01:00
Steven Schäfer
ec1d42e92b JVM IR: Generate SAM wrapper classes as non-synthetic 2020-11-19 19:46:49 +01:00
Steven Schäfer
36711a768b JVM IR: Use inline SAM wrappers inside of inline lambdas 2020-11-19 19:46:49 +01:00
Alexander Udalov
f2b8c67962 Fix JvmTarget6OnJvm11 tests after 7b5544ebd3 2020-11-19 18:49:55 +01:00
Ilmir Usmanov
c22071566e IC mangling: Use old mangling scheme when LV is 1.3
Add integration test to check, that nothing is broken with LV 1.3.
2020-11-19 17:39:34 +01:00
Ilmir Usmanov
7ee35af721 IC mangling: Use correct mangling scheme when
checking for duplicate signatures.
2020-11-19 17:39:33 +01:00
Ilmir Usmanov
7761d30365 Minor. Add test to check fallback 2020-11-19 17:39:33 +01:00
Ilmir Usmanov
7a18ab9094 IC mangling: Generate version requirements to properties as well
Generate the requirements at JVM only.
2020-11-19 17:39:32 +01:00
Ilmir Usmanov
0d79ed1077 Minor. Update test data 2020-11-19 17:39:32 +01:00
Ilmir Usmanov
9070d6d581 IC mangling: Use old mangling scheme in stdlib 2020-11-19 17:39:31 +01:00
Ilmir Usmanov
89d45bf909 IC mangling: Use old mangling scheme in FIR tests
instead of ignoring them.
This affects all unsigned tests.
2020-11-19 17:39:31 +01:00
Ilmir Usmanov
2cd9016016 IC mangling: Replace compiler hack with configuration flag 2020-11-19 17:39:30 +01:00
Ilmir Usmanov
bc1b6fef1f IC mangling: Generalize mangling algorithm between two backends 2020-11-19 17:39:29 +01:00
Ilmir Usmanov
b33774e5f2 IC mangling: Use empty list as a separator in the new mangling scheme 2020-11-19 17:39:28 +01:00
Ilmir Usmanov
20e7a77b78 IC mangling: Write version 1.4.30 requirement to functions with new mangling 2020-11-19 17:39:28 +01:00
Ilmir Usmanov
2829d37cf5 IC mangling: Use old mangling scheme for stdlib
This way, new stdlib can still be usable in 1.4.20
2020-11-19 17:39:27 +01:00
Ilmir Usmanov
488d4ab018 IC mangling: Use '_' instead of 'x' as a placeholder before hashing 2020-11-19 17:39:27 +01:00
Ilmir Usmanov
f7164404c9 IC mangling: Ignore FIR tests 2020-11-19 17:39:26 +01:00
Ilmir Usmanov
23184bae05 IC mangling: JVM_IR: Fallback to old mangling rules
if classfile does not contain functions mangled in the new way.
2020-11-19 17:39:26 +01:00
Ilmir Usmanov
546eea1982 IC mangling: Old JVM BE: Fallback to old mangling rules
if classfile does not contain functions mangled in the new way.
2020-11-19 17:39:25 +01:00
Ilmir Usmanov
c62093f54c IC mangling: Change mangling rules
1. Use 'x' for each parameter, which is not an inline class, every
possible clash is handled by signature rather than name. This change
makes more API changes binary-compatible. So, the changes are in line
with the vision of inline classes are value classes, like primitives.

2. Take return type into account when mangling a function if the return
type is inline class. Otherwise, boxing bridge will not be generated,
which leads to CCE at runtime.
2020-11-19 17:39:24 +01:00
Alexander Udalov
d21a01ef59 IR: improve "no such .. argument slot" exception message
Include the symbol signature, if it's available.
2020-11-19 16:34:03 +01:00
Kirill Shmakov
8ede19811d Make mpp tests gutters aware of different platforms run
Behaviour is similar to the test suite gutters:
- simple triangle when there is no history
- triangle + red circle if some runs failed
- triangle + green circle if all runs passed

^KMM-100 Fixed.
2020-11-19 17:20:06 +03:00
Dmitriy Dolovov
0d50ccc42d [Commonizer] Fix: Lost nullability in commonized type aliases 2020-11-19 16:47:24 +03:00
Dmitry Petrov
e17158d961 JVM_IR KT-42758 don't use 'this' for object self-reference by name 2020-11-19 16:34:04 +03:00
Dmitry Petrov
118a7d4e34 JVM_IR KT-43242 generate switch subject as primitive 'int' 2020-11-19 16:34:04 +03:00
Andrei Klunnyi
05ddbeab0a KT-42561 [Gradle Runner]: run task is created for extra modules
Approach to take classpath from 'project.sourceSets' failed because it
was applied to extra modules - those without java like plugins
(extending project model with 'sourceSets').

This commit specifies criterion of gradle-project selection - the one to
create run task for.
    
^KT-42561 fixed
2020-11-19 12:47:39 +00:00
LepilkinaElena
b0c74c841e Remove extra copyOf calls during filtering in collectRealOverrides (#3916) 2020-11-19 09:53:25 +03:00
Alexander Udalov
7b5544ebd3 Use -source/target 1.6 for Java sources in codegen tests
In cases when the test has the JVM_TARGET directive, use that one for
Java compilation as well.

Otherwise, for box tests, the corresponding test in `JvmTarget6OnJvm6`
(module `:compiler:tests-different-jdk`) will fail. However, it affects
all codegen tests, so fix a bunch of them which use Java 8+ features to
explicitly compile with JVM target 1.8. In particular, this obsoletes
the SKIP_JDK6 directive in those tests because "JVM_TARGET: 1.8" also
skips it for JDK 6.

The check for IS_SOURCE_6_STILL_SUPPORTED is needed in order to still be
able to run tests in the project while only having a single JDK > 11
installed, and having all of the env vars JDK_16, JDK_17, JDK_18
pointing to that JDK.
2020-11-18 18:43:43 +01:00
Mads Ager
7b4e0b2f5d [JVM_IR] Deal with lowering ordering issues for JvmStatic function references.
Do not destructively update the @JvmStatic function, instead
create a copy on first access, and replace the original with
the copy in the jvm static lowering. This ensures that the original
function is seen in other lowerings independently of file lowering
order.
2020-11-18 17:13:00 +01:00
Dmitry Petrov
3d2f5f4bc1 KT-42018 explicitly cast inline class values in safe-as 2020-11-18 18:51:15 +03:00
Kristoffer Andersen
edd3b457d4 [JVM+IR] Migrate/improve receiver mangling test suite 2020-11-18 15:18:10 +01:00
Kristoffer Andersen
5967e8295e [IR] Align captured receiver variable naming with old BE 2020-11-18 15:18:10 +01:00
Vladimir Dolzhenko
7732fc38e0 Add more IDE performance tests vega chart specs 2020-11-18 14:31:56 +01:00
Mikhail Glukhikh
bcf6980f67 [FIR2IR] Fix CCE in FirTypeRef.canBeNull 2020-11-18 16:26:13 +03:00
Mikhail Glukhikh
91738b7f88 [FIR] Fix broken IDE test data 2020-11-18 16:05:50 +03:00
Dmitry Petrov
ca41f733b6 KT-41841 no delegate to private $default fun in multifile facade 2020-11-18 15:04:39 +03:00
Jinseong Jeon
9a99af53ba FIR JVM: correct signature conversion for array
#KT-43339 Fixed
2020-11-18 13:06:51 +03:00
Jinseong Jeon
77ce5ea15d FIR Java: handle primitive void return type for synthetic setter 2020-11-18 13:06:50 +03:00
Jinseong Jeon
5c61079d75 FIR: reproduce KT-43339 (Throwable.stackTrace) 2020-11-18 13:06:49 +03:00
Jinseong Jeon
4cb32cd38a FIR2IR: add implicit NOT_NULL cast for @FlexibleNullability type 2020-11-18 13:06:48 +03:00
Mikhail Glukhikh
b658e99f91 FIR Java: simplify flexible nullability manipulations 2020-11-18 13:06:47 +03:00
Jinseong Jeon
fc7f589caa FIR Java: record Java types with flexible nullability 2020-11-18 13:06:46 +03:00
Jinseong Jeon
1f48092ec1 FIR Java: convert more annotations to @EnhancedNullability 2020-11-18 13:06:45 +03:00
Alexander Gorshenev
01ef41ab17 No need to explicitly deprecate -Xdisable-fake-override-validator
A warning is produced automagically
2020-11-18 12:46:40 +03:00
Alexander Gorshenev
f42b902bc8 Made -Xfake-override-validator off by default
Deprected -Xdisable-fake-override-validator
2020-11-18 12:46:40 +03:00
Steven Schäfer
4e03b1e05f JVM: Allow the JvmSynthetic annotation on file classes (KT-41884) 2020-11-17 22:06:19 +01:00
Dmitriy Dolovov
66bc142f92 [Commonizer] Empty sources/javadocs Jars 2020-11-17 19:02:18 +03:00
Dmitry Petrov
a27c6b77cf KT-43370 ACC_DEPRECATED on property accessors implemented by delegation 2020-11-17 18:16:37 +03:00
Dmitriy Novozhilov
986bdd1099 Build: replace usages of kotlin.build.useIR with kotlinBuildProperties.useIR 2020-11-17 18:14:09 +03:00
Dmitriy Novozhilov
c625a83ab5 Build: replace usages of idea.fir.plugin with kotlinBuildProperties.useFirIdeaPlugin 2020-11-17 18:14:08 +03:00
Dmitriy Novozhilov
1a3727a17c Build: advance kotlin-build-gradle-plugin version in build files 2020-11-17 18:14:08 +03:00
Dmitriy Novozhilov
f531612aa4 Build: update kotlin-build-gradle-plugin version 2020-11-17 18:14:08 +03:00
Dmitriy Novozhilov
bab08c29be Build: add several FIR flags to kotlin-build-gradle-plugin 2020-11-17 18:14:08 +03:00
Alexander Udalov
8160f579d3 Build: add useIR/useIRForLibraries to kotlin-build-gradle-plugin 2020-11-17 18:14:07 +03:00
Nikolay Krasko
e331e80b5d Build: Temporary disable capturing inputs for tasks
We are suffering from the increasing build scan queue. Try to help
the server to overcome it.
2020-11-17 15:08:44 +03:00
Ivan Gavrilovic
33a0ec9b4f KGP: Clean up configurations setup
KAPT classpath now uses extendsFrom in order to
resolve all configurations as a single graph.

Also, use Configuration.extendsFrom instead of
DependencyHandler.add that is being deprecated
in Gradle 6.7.
2020-11-17 10:44:15 +03:00
Ivan Gavrilovic
519aeeb644 KT-40140: Task configuration avoidance for Android projects
When adding Java sources to Kotlin task, avoid
force-configuring source-generating tasks in AGP.

Fixes https://youtrack.jetbrains.com/issue/KT-40140.

Test: ConfigurationAvoidanceIT.testAndroidUnrelatedTaskNotConfigured
2020-11-17 10:43:48 +03:00
Yan Zhulanow
d376585821 IDE dependencies: Publish kotlin-coroutines-experimental-compat library 2020-11-17 10:29:21 +03:00
Vyacheslav Gerasimov
d7474bb2f7 Build: Use only @Exported & whitelisted classes for tools.jar api
This makes it stable between JDK vendors and versions
2020-11-17 01:21:00 +03:00
Alexander Likhachev
ac851523d8 [Gradle, MPP] Make KotlinCompileCommon task cc-compatible with warnings
Kotlin options are accessed via compilation. Compilation field is marked as transient and so not available after deserializing task from Gradle configuration cache.
Accessing 'isCompatibilityMetadataVariantEnabled' property via project in tasks 'onlyIf' causes Gradle to project instance serialization attempt that fails
(#KT-43141, #KT-43329) Fixed
2020-11-17 00:52:30 +03:00
Denis Zharkov
c6f46598ca Set TARGET_BACKEND to JVM for failing irrelevant tests 2020-11-16 22:20:44 +03:00
Martin Petrov
68fdeaf865 Produce deterministic jar files.
This resets all timestamps present in jars produced by kotlinc.

This is important for build systems like bazel that rely on
deterministic outputs.

Before:

```
$ kotlinc ~/test.kt -d /tmp/a.jar
$ kotlinc ~/test.kt -d /tmp/b.jar
9ab80cd40c9293a7a66adf1154d4e6e9aa92d5b0  /tmp/a.jar
1ba022697317f796bd123fb4dc95418a18bcb51a  /tmp/a.jar
6d2a2683470c24928f3fbd6768a4c57f55b0d196  /tmp/b.jar
$ unzip -l /tmp/a.jar
Archive:  /tmp/a.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
       75  09-25-2020 16:48   META-INF/MANIFEST.MF
      683  09-25-2020 16:48   TestKt.class
       28  09-25-2020 16:48   META-INF/main.kotlin_module
---------                     -------
      786                     3 files
```

After:

```
$ kotlinc ~/test.kt -d /tmp/a.jar
$ kotlinc ~/test.kt -d /tmp/b.jar
$ shasum /tmp/a.jar /tmp/b.jar
9ab80cd40c9293a7a66adf1154d4e6e9aa92d5b0  /tmp/a.jar
9ab80cd40c9293a7a66adf1154d4e6e9aa92d5b0  /tmp/b.jar
$ unzip -l /tmp/a.jar
Archive:  /tmp/a.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
       75  12-31-1969 19:00   META-INF/MANIFEST.MF
      590  12-31-1969 19:00   TestKt.class
       36  12-31-1969 19:00   META-INF/main.kotlin_module
---------                     -------
      701                     3 files
```

See https://github.com/JetBrains/kotlin/pull/3226 for a similar change.
2020-11-16 19:25:20 +01:00
Alexander Udalov
a3830b2611 JVM IR: copy corresponding property+annotations for DefaultImpls methods
Instead of using methodSignatureMapper which was an obsolete hack to
make accessor names "getFoo" instead of "<get-foo>".

In particular, this keeps the `@Deprecated` annotation on the
corresponding property, which results in ACC_DEPRECATED in codegen.

 #KT-43326 Fixed
2020-11-16 19:15:49 +01:00
Alexander Udalov
5212ae6bbd JVM IR: keep property annotations for inline class replacements
In particular, `@Deprecated` is not lost anymore and accessors of
deprecated property are generated with ACC_DEPRECATED just as in the old
backend.

 #KT-43327 Fixed
2020-11-16 19:15:49 +01:00
Alexander Udalov
4ca60a2d7d Fix warnings and some inspections in buildSrc 2020-11-16 19:15:43 +01:00
Denis Zharkov
22109e97d6 FIR: Unmute passing FirPsiCheckerTestGenerated.testJet53 2020-11-16 15:50:39 +03:00
Denis Zharkov
14305d1eba FIR: Simplify callable references resolution
Also that fixes some bugs
2020-11-16 15:50:39 +03:00
Denis Zharkov
387fd895a6 FIR: Drop unused FirComposedSuperTypeRef 2020-11-16 15:50:39 +03:00
Denis Zharkov
ad35723f56 FIR: Simplify super-qualified calls resolution 2020-11-16 15:50:39 +03:00
Denis Zharkov
d4c7d4fc7c FIR: Fix callable references resolution with stub receivers
Use stubReceiver as a receiver for fake calls

See issues KT-43358 KT-43359 KT-43378
2020-11-16 15:50:39 +03:00
Denis Zharkov
f97cc0b62d FIR: Rework receivers processing in resolution
- Put extensionReceiver to candidate even if it's explicit (for sake of clarity)
- Split CheckReceiver (dispatch part should only check nullability)
2020-11-16 15:50:39 +03:00
Denis Zharkov
e2099a0307 FIR: Fix false-positive successful resolution of call with lambda receiver
Do not try to integrate/postpone receiver expression to the base system
Receiver should be resolved independently anyway
2020-11-16 15:50:39 +03:00
Denis Zharkov
396e799e5d FIR: Fix resolution for type-alias based SAM 2020-11-16 15:50:39 +03:00
Denis Zharkov
4c9a4548f2 FIR: Fix overrides binding for Java inheritor
`overriddenMembers` contract requires original (non-enhanced) function
See other usages

Ignored tests have been working accidentally

^KT-43289 Open
2020-11-16 15:50:39 +03:00
Denis Zharkov
855af08f7c Regenerate tests 2020-11-16 15:50:39 +03:00
Mikhail Glukhikh
4f7b45dfcc Fir2IrTypeConverter: simplify captured type cache 2020-11-16 15:14:26 +03:00
Jinseong Jeon
cb77b76c0d FIR2IR: convert recursive captured type properly
#KT-43346 Fixed
2020-11-16 15:14:24 +03:00
Mikhail Glukhikh
8ecf056927 [FIR2IR] Enter scope a bit earlier in createIrPropertyAccessor 2020-11-16 14:44:43 +03:00
Mikhail Glukhikh
59c86bcdc4 [FIR2IR] Provide more information for errors inside convertToIrSetCall 2020-11-16 14:44:42 +03:00
Mikhail Glukhikh
9de244515e Upgrade coroutines: 1.3.7 -> 1.3.8 2020-11-16 14:29:58 +03:00
Dmitry Petrov
93f868fb96 KT-43196 member extension property can't be "primary" in inline class 2020-11-16 13:54:19 +03:00
Vladimir Dolzhenko
b6f958f856 Do not queue bg task under read action
Relates to #EA-218701
2020-11-16 09:25:08 +00:00
Dmitriy Dolovov
6e7b5a55b3 kotlinx-metadata: Don't write flags for absent property accessors 2020-11-13 22:54:34 +03:00
Dmitriy Novozhilov
a6cbae9719 [FIR] Rename FirErrors.SYNTAX_ERROR to SYNTAX 2020-11-13 16:19:30 +03:00
Dmitriy Novozhilov
2f5b231d50 [FIR] Add default renderers to FirDiagnosticFactories 2020-11-13 16:19:30 +03:00
Dmitriy Novozhilov
dc662efcf4 [FIR] Introduce FirDiagnosticRenderers 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
ed0e5adce7 [FIR] Make FirAnalyzerFacade returns diagnostics grouped by fir file 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
dabc259ae8 [FIR] Make diagnostics collectors returns List instead of Iterable 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
20453bf0d8 [FIR] Get rid of FirSessionProvider.project property 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
82a2ecfe14 [FIR] Cleanup creating sessions in CLI FIR compiler 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
3aa8b09e31 [FIR] Add configurable language version settings to FirSessionFactories 2020-11-13 16:19:29 +03:00
Dmitry Petrov
5d76df6e1a KT-43045 mangle function name for fake override with default impl 2020-11-13 16:15:29 +03:00
Mads Ager
1ecf5943ab [JVM_IR] Determine correct type of empty varargs array.
When calling vararg methods with a generic vararg type without
passing explicit parameters, we have to allocate an empty array
of the right type. We failed to do so previously, as we did
not take the type arguments for the dispatch receiver into
account.
2020-11-13 12:13:53 +01:00
Georgy Bronnikov
ffc003c051 IR: copy IrProperty's attributes in deepCopyWithSymbols 2020-11-13 11:44:35 +03:00
Yan Zhulanow
7b98876475 Parcelize: Fix typo in diagnostic message (KT-43290) 2020-11-13 17:37:21 +09:00
Dmitriy Novozhilov
e3bfb9245c [FIR] Rename nested directory with testdata to innerClasses
This is needed to avoid clashing name of generated test class (`Nested`)
  with annotation @Nested from JUnit 5
2020-11-13 10:36:39 +03:00
Dmitriy Novozhilov
419f54259c [TEST] Change semantics of CHECK_TYPE directive and update testdata
Previously helpers from checkType.kt was in special package, and
  if directive was enabled then test runner (`AbstractDiagnosticTest`)
  injected additional imports to test files and removed them after test
  was completed.
It's very hard to support such behavior in new test infrastructure so
  there was a decision about changing `CHECK_TYPE`:
1. All helpers from `checkType.kt` now stays in default package
2. `CHECK_TYPE` only adds `checkType.kt` to set of analyzed files
      and don't modify their content

For test which are written in default package (most of tests actually)
  there are no changes. On the other hand if there is a test where dev
  want to use checkType functions in testfile with some package then he
  should explicitly import functions which he needed (`checkSubtype`,
  `checkType`, `_`)
2020-11-13 10:36:12 +03:00
Dmitry Petrov
653b26174b KT-43006 don't generate no-arg constructor with inline class parameters 2020-11-13 09:59:34 +03:00
Georgy Bronnikov
364773bf0f IR: fix IrClassSymbol.starProjectedType 2020-11-12 21:49:11 +03:00
Dmitriy Dolovov
f5329b6f1d [Commonizer] Don't publish sources and javadocs 2020-11-12 17:23:52 +03:00
Dmitriy Novozhilov
15cc979378 [FIR] Add enter contract node as exit for exceptional path to avoid compiler crashing
This fixes crashing test
 `FirDiagnosticsTestSpecGenerated.NotLinked.Contracts.Declarations.ContractBuilder.Common.Neg.test17`
2020-11-12 14:46:39 +03:00
Dmitriy Novozhilov
87380d1913 [FIR] Don't assume that exit lambda node is target for exceptional exit for inplace lambdas
#KT-39709 Fixed
#KT-43156 Fixed
2020-11-12 14:46:38 +03:00
Jinseong Jeon
440cf78884 FIR CFG: add more uncaught exception paths 2020-11-12 14:46:37 +03:00
Jinseong Jeon
7b06885348 FIR checker: reproduce KT-43156 2020-11-12 14:46:36 +03:00
Dmitriy Novozhilov
f4347a60c2 [FIR] Fix typo 2020-11-12 14:46:35 +03:00
Mikhail Glukhikh
3c48f2eb68 [FIR] Handle isProp/setProp synthetic pair properly in Java use-site scope 2020-11-12 13:37:38 +03:00
Mikhail Glukhikh
2725930460 [FIR] Code cleanup in JavaClassUseSiteMemberScope 2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
fb961f7070 [FIR] Copy also synthetic setter during fake override generation 2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
22fb620344 [FIR Java] Copy also synthetic setter during enhancement 2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
e0abf3a62c [FIR Java] More precise synthetic setter search in use-site scope
In this commit we detect both Java void & Kotlin Unit return types
2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
c515af4373 Fir2IrDeclarationStorage: extract common getIrCallableSymbol 2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
b90391ced4 [FIR2IR] Implement getIrConstructorSymbol like getIrFunctionSymbol 2020-11-12 13:37:36 +03:00
Mikhail Glukhikh
0cc57fc90c Fir2IrDeclarationStorage: reorder functions slightly 2020-11-12 13:37:36 +03:00
Mikhail Glukhikh
90f135dc3e [FIR2IR] Use computeDeclarationOrigin in getIrPropertySymbol 2020-11-12 13:37:36 +03:00
Mikhail Glukhikh
6c1f5a4513 [FIR2IR] Cache functions/properties both by symbol & signature 2020-11-12 13:37:36 +03:00
Mikhail Glukhikh
92840b8ec5 FirTypeIntersectionScope: fix typo in name 2020-11-12 13:37:35 +03:00
Mikhail Glukhikh
5b947144d4 FirTypeIntersectionScope: don't create in no-supertypes situation 2020-11-12 13:37:35 +03:00
Mikhail Glukhikh
8ace0d9ad1 [FIR] Replace local types with Any in deserializer 2020-11-12 13:37:35 +03:00
Mikhail Glukhikh
744918fb47 [FIR] Cleanup ConeIntegerLiteralTypeImpl 2020-11-12 13:37:35 +03:00
Mikhail Glukhikh
0d03e5f235 [FIR] Simplify constructStarProjectedType 2020-11-12 13:37:34 +03:00
Mikhail Glukhikh
af52232058 [FIR2IR] Use proper lookup tags in data class member generator 2020-11-12 13:37:34 +03:00
Mikhail Glukhikh
7905bc8632 Forbid creation of local ConeClassLikeLookupTagImpl 2020-11-12 13:37:34 +03:00
Bingran
5dc7964137 Optimize the way of enabling "--warning-mode=fail"
Make sure project directory is cleaned up after testing
This change is a "follow-up" PR of
https://github.com/JetBrains/kotlin/pull/3804.
2020-11-12 11:13:56 +03:00
Dmitriy Dolovov
e5539b9a9e Gradle, Native: Log raw and transformed args in KotlinToolRunner, p.2 2020-11-12 10:40:33 +03:00
Ilya Gorbunov
4767696840 Qualify replacement expression with receiver to workaround KT-42874 2020-11-12 05:29:39 +03:00
Andrey Uskov
e0655b2f96 Unmute fixed android importing tests in platform 202 2020-11-12 00:24:50 +03:00
Andrey Uskov
a0d5af8dd1 Execute gutters calculation in read action in tests 2020-11-12 00:24:44 +03:00
Andrey Uskov
e5be9601e6 Disable indexation ExternalSystem tests 2020-11-12 00:24:43 +03:00
Andrey Uskov
9318d401f7 Fix test runtime dependencies in NativeImportingTests 2020-11-12 00:24:42 +03:00
Andrey Uskov
dea383460e Add dependency on platform-images in tests 2020-11-12 00:24:41 +03:00
Yan Zhulanow
5f7d7ff9c7 Parcelize: Activate checkers only when the plugin is enabled for module (KT-43291) 2020-11-12 05:38:27 +09:00
Ilya Kirillov
9d207c2cf5 FIR IDE: temporary mute some not passing tests 2020-11-11 21:02:34 +03:00
Ilya Kirillov
3e43efb93e FIR IDE: fix working with copied file in completion 2020-11-11 21:02:33 +03:00
Igor Yakovlev
0d59656532 FIR IDE: Add resolving KtParameter in FirLazyDeclarationResolver 2020-11-11 21:02:31 +03:00
Dmitriy Novozhilov
345a0d3f89 [FIR] Implement writeGenericType in FirJvmTypeMapper 2020-11-11 21:02:31 +03:00
Ilya Kirillov
9350f7aff9 FIR IDE: remove unused method in light classes with compilation error 2020-11-11 21:02:29 +03:00
Ilya Kirillov
b42bed7b3c FIR IDE: make some access to FIR elements under read locks, resolve under write locks 2020-11-11 21:02:28 +03:00
Ilya Kirillov
12ed92cd49 FIR IDE: allow getting parent declaration for Java one 2020-11-11 21:02:27 +03:00
Ilya Kirillov
cbd1ec35ce FIR IDE: lazy resolve property accessors 2020-11-11 21:02:26 +03:00
Ilya Kirillov
fbc6f1b10f FIR IDE: introduce SOURCE_MEMBER_GENERATED declaration kind 2020-11-11 21:02:24 +03:00
Ilya Kirillov
7dcda00e1d FIR IDE: do not fail on invalid code 2020-11-11 21:02:22 +03:00
Ilya Kirillov
c646cb3d7e FIR IDE: fix deadlock in getter symbol resolve 2020-11-11 21:02:21 +03:00
Ilya Kirillov
171157ff78 FIR IDE: allow reference resolving from EDT
It may be called from some other subsystems like Find usages.
Throwing PCE every time we try to resolve some reference from EDT
may result endless try to resolving
2020-11-11 21:02:19 +03:00
Igor Yakovlev
b742a475ff [FIR IDE] Initial FIR LightClass implementation 2020-11-11 21:02:18 +03:00
Igor Yakovlev
c881cf7af6 [FIR IDE] Add when branch for new symbols in FunctionCallHighlightingVisitor 2020-11-11 21:02:14 +03:00
Igor Yakovlev
b423da106f [FIR IDE] Add fir data into symbols to support FIR LC 2020-11-11 21:02:09 +03:00
Ilya Kirillov
3d93503894 FIR IDE: introduce analyze function for with by existing module resolve state 2020-11-11 21:02:07 +03:00
Igor Yakovlev
dbb54c87bc [FIR IDE] Add Fir lightclasses tests and fix FindUsages tests 2020-11-11 21:02:00 +03:00
Igor Yakovlev
3cefef03ff Move refactoring for ifTrue and ifFalse extensions 2020-11-11 21:01:58 +03:00
Ilya Kirillov
a42674ef0e FIR IDE: add hack to allow access symbols on edt 2020-11-11 21:01:57 +03:00
Igor Yakovlev
97f062cb2a [FIR IDE] Add FirJvmTypeMapper to Ide components factory 2020-11-11 21:01:56 +03:00
Igor Yakovlev
36ffde5ca8 [FIR] Implement isArrayOrNullableArray for ConeTypeContext 2020-11-11 21:01:55 +03:00
sebastian.sellmair
06cb64bb51 Allow open callable members in expect interfaces
#KT-42094 fixed
2020-11-11 17:41:59 +00:00
Dmitriy Dolovov
bf0156f7c6 Native, Gradle IT: Fix GeneralNativeIT.testNativeArgsWithSpaces() 2020-11-11 20:29:36 +03:00
Dmitriy Dolovov
0fe842c38f Gradle, Native: Log raw and transformed arguments in KotlinToolRunner 2020-11-11 20:29:31 +03:00
Dmitriy Dolovov
ee7f3b1bfe Native: Use NIO Files.createTemp*() in favor of File.createTemp*() extension functions 2020-11-11 20:29:25 +03:00
Dmitry Petrov
47e2656ca9 JVM_IR keep track of original overrides at collection stubs generation
KT-43068
2020-11-11 18:35:41 +03:00
Yan Zhulanow
65d8e5a615 Don't publish kotlin-dist-for-ide in publishIdeArtifacts as it's now published alone 2020-11-11 18:12:26 +03:00
Roman Artemev
01f3c06ec9 Add test for KT-40412 2020-11-11 17:00:25 +03:00
Alexander Udalov
116606ecd2 JVM IR: fix class kind of created java.lang.Deprecated symbol
If it isn't ANNOTATION_CLASS, the newly added code in
`FunctionCodegen.isDeprecatedHidden` (0e91d3fcb0) ends up transforming
IR annotation constructor calls to annotation descriptors, and an
assertion fails in `IrBasedDeclarationDescriptor.toAnnotationDescriptor`
which checks that the class has kind ANNOTATION_CLASS.

Specifically, this failed in the JVM IR bootstrap on
`CallResolutionInterceptorExtension.interceptCandidates` from module
'frontend'.
2020-11-11 12:53:32 +01:00
Svyatoslav Kuzmich
c1b73f5fee [Wasm] Diable Wasm IR tests on Windows TeamCity 2020-11-11 14:30:22 +03:00
Vyacheslav Gerasimov
3feff16a77 Cleanup 193 compatibility fixes 2020-11-11 14:28:54 +03:00
Vyacheslav Gerasimov
8620d26a8a Delete 193 bunch files 2020-11-11 14:28:53 +03:00
Alexander Gorshenev
ade46ef808 Update Kotlin/Native: 1.4.30-dev-17200 2020-11-11 14:27:45 +03:00
Sergey Igushkin
3666327c81 Fix JVM maven-publish caching by not capturing state in POM rewriting
In POM rewriting logic, ensure that non-serializable entities are
accessed from within project.provider { ... } and their evaluation
results are therefore properly serialized.

Issue #KT-43054 Fixed
2020-11-11 13:55:07 +03:00
Sam Wang
d1ba2f3d46 Restore KotlinExplicitMovementProvider in as41 and as42 2020-11-11 11:37:27 +01:00
Vladimir Dolzhenko
4f76c747ec Mark org.jetbrains.kotlin.mavenProjectImportHandler as dynamic 2020-11-11 10:29:16 +00:00
Vladimir Dolzhenko
b0f6b739d0 Declare missed org.jetbrains.kotlin.defaultErrorMessages EP 2020-11-11 10:29:16 +00:00
Vladimir Dolzhenko
51a1990e50 Drop missing gradle extensions from jvm-common.xml
Similar to 0cad41bb0c

Relates to ^KT-38518
2020-11-11 10:29:15 +00:00
Kirill Shmakov
0eea3a5e95 Bump AS version
To support newest Canary and fix module wizard issues.
^KT-43188 Fixed.
2020-11-11 12:10:36 +03:00
Mikhail Glukhikh
f2f00a4654 Fix BB test to work on JDK 6 2020-11-11 12:00:18 +03:00
Dmitriy Dolovov
078963eead Native, Gradle IT: Fix assertion message 2020-11-11 11:36:51 +03:00
Alexander Likhachev
fbd8de04b8 [Gradle, K/N] Configuration cache support for run with warns
#KT-42849 Fixed
2020-11-11 10:58:37 +03:00
Alexander Likhachev
2d2042ad12 [Gradle, K/N] Configuration cache support for compile & link with warns
#KT-43151 Fixed
2020-11-11 10:58:37 +03:00
Yaroslav Chernyshev
a3b951e505 [Gradle, Cocoapods] Refactor, log process outputs with info level
Also fixed broken `stdErr` processing for `xcodebuild` commands.

#KT-42938 Fixed
2020-11-11 10:47:11 +03:00
Dmitriy Novozhilov
67b262aa34 [FIR] Move tracking candidate applicability from CheckerSink to Candidate 2020-11-11 09:52:56 +03:00
Dmitriy Novozhilov
f1ac1f177b [FIR] Extract overload by lambda return type into separate component 2020-11-11 09:52:56 +03:00
Dmitriy Novozhilov
a97c107a2b [FIR] Replace callee reference before checking completion from inference session
This is needed because in some cases inference session checks candidate
  and candidates of all sub calls and for that it uses candidate from
  callee reference of call. So we should replace reference with specific
  candidate even if we didn't choose proper candidate yet

#KT-43129
2020-11-11 09:52:56 +03:00
Dmitriy Novozhilov
9f5aadd2f4 [FIR] Implement overload resolution by lambda return type
#KT-43129 Fixed
2020-11-11 09:52:55 +03:00
Dmitriy Novozhilov
025ec8e8b1 Add FQ_NAME postfix to OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION 2020-11-11 09:52:55 +03:00
Dmitriy Novozhilov
dfad21270f [FIR] Remove workaround for #KT-43129
Revert changes from 4612f26b and a936386e
2020-11-11 09:52:55 +03:00
Vyacheslav Gerasimov
1148d527ee Build: Upgradle gradle to 6.7 2020-11-11 02:39:23 +03:00
Kris
173954b3b3 Add samples for Random.nextX() functions 2020-11-11 01:37:37 +03:00
Kris
ebdd023633 Add samples for last() and lastOrNull() functions 2020-11-11 01:37:24 +03:00
Yan Zhulanow
e83a3c3f27 Parcelize: Use @Parcelize annotations from Android Extensions instead of the copied&deprecated ones (KT-42342, KT-43150)
Dex can't merge class files from both android-extensions-runtime and parcelize-runtime, so we have to keep only one copy of each class.
Instead of @Deprecated annotations, there are new diagnostics (without quick-fixes yet).
The goal is to allow simple usages (@Parcelize alone) but forbid kotlinx.android.synthetic.Parceler usage.
2020-11-11 04:25:07 +09:00
Ilmir Usmanov
fa42a6ba58 Use non-local return target instead of inline site in suspend function
return type coercion.
 #KT-43226 Fixed
2020-11-10 20:08:45 +01:00
Mikhail Glukhikh
d4f08018ce [FIR2IR] Extract special symbol provider to make JVM extension 2020-11-10 21:07:27 +03:00
Mikhail Glukhikh
bc47a30dd3 [FIR] Handle 'EnhancedNullability' more properly
This commit includes three changes:
1. 'EnhancedNullability' is no more set for declaration types
2. It is no more used for conversion types in translator
3. Translator inserts implicit not-null cast only when enhanced type is cast to not-null type.
2020-11-10 21:07:27 +03:00
Mikhail Glukhikh
e7a84fd1ee [FIR2IR] Preserve 'EnhancedNullability' type annotation in IR 2020-11-10 21:07:26 +03:00
Jinseong Jeon
f8dc56e2bb FIR render: fix typos on RenderMode 2020-11-10 21:07:26 +03:00
Mikhail Glukhikh
f8e03786c0 Mute not relevant JS/WASM back ends for new BB tests 2020-11-10 21:07:09 +03:00
Juan Chen
9486f58fb1 [FIR] fix subtyping for definitely notnull types.
The current implementation doesn't consider Foo a subtype of Captured<in
Foo>!!, since AbstractTypeCheckerContext::checkSubtypeForSpecialCases
does not handle DefinitelyNotNullType cases. This PR adds handling of
DefinitelyNotNullType by looking at its original type.

^KT-42824 Fixed
2020-11-10 21:07:09 +03:00
Juan Chen
eb804709da [FIR] fix subtyping for nullable captured types.
The issue is the type checker doesn't consider P? a subtype of
CapturedType<in P>?, whereas P a subtype of CapturedType<in P>?. In
AbstractTypeCheckerContext::checkSubtypeForSpecialCases, it checks if
P? is a subtype of the lower type of the captured type, which is
P, and returns false.

This fix uses nullable version of the lower type when the captured
type is marked nullable. To check if P? is a subtype of Captured<in
P>?, we check the LHS, P?, against the nullable lower type of RHS,
P?.

^KT-42825 Fixed
2020-11-10 21:07:09 +03:00
Alexander Udalov
d96223a2ff Fix compiler warnings in new wasm modules
Also don't output v8ExecutablePath in js.tests on each project
configuration.
2020-11-10 18:19:41 +01:00
Alexander Udalov
84d1393711 Minor, workaround compiler exception (KT-43286) 2020-11-10 18:06:17 +01:00
Sergey Shanshin
202459531d Add support of nullable serializers to UseSerializers annotation (#3898)
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/984
2020-11-10 19:42:02 +03:00
Ilya Gorbunov
66f5c98505 Deprecate createTempFile/createTempDir functions
Document their potential permission problems.
Suppress this deprecation in tests.
2020-11-10 18:25:48 +03:00
Georgy Bronnikov
31bfc7d4e3 Fix test data 2020-11-10 17:49:55 +03:00
Georgy Bronnikov
2c404a654b JVM_IR: avoid scope violation in BridgeLowering 2020-11-10 17:49:55 +03:00
Georgy Bronnikov
d246005891 JVM_IR: fix unbound type parameters in AddContinuationLowering 2020-11-10 17:49:55 +03:00
Georgy Bronnikov
9929047f5d JVM_IR: avoid scope violation in BridgeLowering 2020-11-10 17:49:55 +03:00
Dmitry Petrov
e10d8e51b6 JVM_IR more precise superclass stub filtering
Filter out abstract members of superclasses when generating collection
stubs.

KT-43207
2020-11-10 16:41:45 +03:00
Svyatoslav Kuzmich
7f26deb5e6 [Wasm] Enable for loops optimization 2020-11-10 16:09:22 +03:00
Denis Zharkov
233bb47b99 FIR: Fix SAM conversion for raw types with non-trivial TP upper bounds 2020-11-10 14:26:54 +03:00
Denis Zharkov
ce4a11144d FIR: Correctly handle nullable/flexible captured types 2020-11-10 14:26:54 +03:00
Denis Zharkov
ed07bbc734 FIR: Fix inner type resolution during body transformation 2020-11-10 14:26:54 +03:00
Denis Zharkov
a5545b96cb FIR: Fix ambiguity between current Companion and one from supertypes
Companion as qualifier should be found at static scope not a member one
2020-11-10 14:26:54 +03:00
sebastian.sellmair
96352b9c8c Add (and disable) metadata compilation for single backend source sets
KotlinProjectStructureMetadata is created by inspecting source sets
with metadata compilation. Single backend common source sets are
currently not supported for metadata compilation and therefore
did not register one. Foreseeing to support this case with KT-42468,
metadata compilation is now created and registered, but just disabled.
This change will include android variants in
KotlinProjectStructureMetadata even when not officially published.
With those variants, the IDE can infer visibility from some module's
"jvmAndAndroidMain" source set to another modules "jvmAndAndroidMain"

KotlinMetadataTargetConfigurator: rename getPublishedCommonSourceSets to getCommonSourceSetsForMetadataCompilation

KotlinMetadataTargetConfigurator: isMetadataCompilationSupported and add comment to getPublishedCommonSourceSets

Re-use androidPluginIds in KotlinPlugin

KotlinAndroidTarget: Create KotlinComponents for non-published variants and mark them with publishable=false

JvmAndAndroidIntermediateSourceSetTest: add KotlinProjectStructureMetadata jvmAndAndroidMain exists in jvm variants test

AbstractAndroidProjectHandler: Add java sources only in post processing

KotlinAndroidTarget: Inline creation of usageContexts

KotlinAndroidTarget.doCreateComponents: filter non-publishable variants when publishLibraryVariantsGroupedByFlavor is enabled

#KT-42383 fixed
2020-11-10 10:21:40 +00:00
Svyatoslav Kuzmich
03e63f1103 [Wasm] Enable maven-publish plugin in wasm stdlib 2020-11-10 13:08:04 +03:00
Svyatoslav Kuzmich
ffe3487aa5 [Wasm] Don't generate unnecessary unreachable instructions
Helps with WAT readability
2020-11-10 13:08:04 +03:00
Svyatoslav Kuzmich
b371b61cf5 [Wasm] Indent blocks of produced WAT
Makes it more readable
2020-11-10 13:08:04 +03:00
Svyatoslav Kuzmich
4d59a58291 [Wasm] Add interop annotation @JsFun 2020-11-10 13:08:04 +03:00
Svyatoslav Kuzmich
e51a76bc4e [Wasm] Basic CLI
-Xwasm option that will produce wasm instead of JS when used with -Xir-produce-js
Does not affect klib production
2020-11-10 13:08:04 +03:00
Vladimir Dolzhenko
80f316168e Updated IDE perf tests vega visualization to handle wide time ranges with aggregation 2020-11-10 10:58:17 +01:00
Kristoffer Andersen
297c33b452 [IR] Correct line number on suspend function with implicit unit return 2020-11-10 10:58:02 +01:00
Roman Artemev
c2fec38384 [JS IR BE] Unmute fixed tests 2020-11-10 11:06:11 +03:00
Roman Artemev
94acfa50bd [IR BE] Remap dispatch receiver for inner ctor too
- do not forget to add into mapping dispatch receiver
 - fix KT-40686 (at least part of it)
 - add test
2020-11-10 11:06:11 +03:00
Roman Artemev
1ced0138ff [JS IR BE] Drop redundant marker since function doesn't use descriptors anymore. 2020-11-10 11:06:11 +03:00
Dmitriy Novozhilov
e66daf90fd Advance bootstrap to 1.4.30-dev-2196 2020-11-10 11:02:48 +03:00
Dmitry Petrov
785466acee Minor: add '// JVM_TARGET: 1.8' 2020-11-10 06:48:07 +03:00
Alexander Udalov
106ee1d1ff JVM IR: restore ability to suppress codegen-reported diagnostics
In the old backend, BindingContextSuppressCache is used (which is now
created explicitly in GenerationState), which looks up `@Suppress`
annotations on elements right before reporting the diagnostic. In JVM
IR, we clear the binding context after psi2ir, so this approach doesn't
work. This change provides another implementation of KotlinSuppressCache
which eagerly precomputes all suppressions on all annotated elements in
all source files at the point of creation of GenerationState (when the
binding context is still full).

 #KT-43047 Fixed
2020-11-09 19:55:31 +01:00
Alexander Udalov
61548a0a36 Fix inspections and slightly "kotlinify" KotlinSuppressCache 2020-11-09 19:48:04 +01:00
Alexander Udalov
9d3c9a823d Improve rendering of failures in AbstractWriteFlagsTest
When expected and actual flag values are not equal, transform them to
presentable strings according to `Opcodes.ACC_*` field values.
2020-11-09 19:47:54 +01:00
Alexander Udalov
0e91d3fcb0 JVM IR: generate ACC_SYNTHETIC for deprecated-hidden declarations correctly
Extract the logic that computes ACC_SYNTHETIC flag for deprecated
declarations, and use `DeprecationResolver` as the old backend does in
`DescriptorAsmUtil.getCommonCallableFlags`. Creating IR-based
descriptors for each function to pass it there is a bit costly though,
so as a small optimization, use `allOverridden` to check if anything in
the method hierarchy is deprecated.

Also optimize `allOverridden` for the case of linear inheritance which
is far more common.

 #KT-43199 Fixed
2020-11-09 19:47:54 +01:00
Alexander Udalov
d9efc2d922 Fix warnings in compiler code and tests 2020-11-09 19:46:10 +01:00
Roman Golyshev
ebfbc2f601 KT-43205 Ignore annotations in CallableClsStubBuilder when needed
Kotlin compiler can add `@Deprecated` annotations to the fields of
private companion objects, and if those annotations are not supposed to
be shown in decompiled code and used, the field is marked with
`HAS_ANNOTATIONS=false` flag (see KT-25009)

However, it was not taken into account in stubs building process, which
led to the 'Stubs vs PSI mismatch' exceptions

^KT-43205 Fixed

Also, restore the order of nested typealiases and classes (see KT-41859)

We didn't want to bump the version of the stubs when we fixed this
issue; now we have an opportunity to restore the order back to
match the `MemberComparator`

Also, some refactoring is done to underscore that
`createPackageDeclarationsStubs` is suitable only for packages, not
for any declarations container
2020-11-09 15:49:50 +00:00
Svyatoslav Kuzmich
fdd7fa5aea [Wasm] Mute codegen box tests 2020-11-09 16:04:43 +03:00
Svyatoslav Kuzmich
02a84fa6e1 [Wasm] Remove wasmBox tests
They are be covered by common codegen box tests.
2020-11-09 16:04:43 +03:00
Svyatoslav Kuzmich
bfd0f21e9d [Wasm] Major compiler and stdlib update 2020-11-09 16:04:43 +03:00
Svyatoslav Kuzmich
3be38d1796 [Wasm] Add Wasm IR
Intended to be used by Kotlin/Wasm compiler.

Includes:
 * IR tree: declarations, instructions, types.
 * Convertors: ir2text, ir2bin, bin2ir
 * Spec tests, to test convertors against reference Wabt tool
2020-11-09 16:04:42 +03:00
Svyatoslav Kuzmich
65cf991e84 [JS IR] Move JS-specific isInlineClass utils from common to JS compiler module 2020-11-09 16:04:42 +03:00
Vladimir Dolzhenko
e101e6762c Add uploading IDE performance benchmarks to ES 2020-11-09 14:03:58 +01:00
Alexander Gorshenev
ff7c38b2df Unmuted a test 2020-11-09 16:02:15 +03:00
Alexander Gorshenev
eea5a9102c Bump klib abi version to 1.4.2 to reflect absence of serialized fake overrides 2020-11-09 16:02:14 +03:00
Alexander Gorshenev
cb288d47ea Don't serialize fake overrides anymore 2020-11-09 16:02:14 +03:00
Alexander Gorshenev
5de7a10df0 Eliminated -Xdeserialize-fake-overrides 2020-11-09 16:02:14 +03:00
Dmitry Petrov
b9c6267a63 KT-43217 Encode @EnhancedNullability types in IdSignature 2020-11-09 15:20:46 +03:00
Stanislav Erokhin
f6df624c6b KT-43202 Fix isEap function: support RC version
Since 1.4.20 we changed rc suffix to RC.
Old variant (rc) kept just in case
#KT-43202 Fixed
2020-11-09 10:52:50 +03:00
Igor Chevdar
5e0f54a30b [IR] Fixed https://youtrack.jetbrains.com/issue/KT-43159 2020-11-09 11:37:37 +05:00
Pavel Kirpichenkov
0e8cf58a35 Minor: reformat 2020-11-08 15:33:30 +03:00
Pavel Kirpichenkov
b79b94fe75 [MPP] Allow smart casts for properties from dependsOn modules
Smartcasts for public properties from different module are not
stable because module declaring a property in general can be
compiled separately from the module using it. However, if client
module has dependsOn relation with declaring module their simultaneous
compilation is guaranteed which makes this smart cast safe.

Cache all transitive 'expected by' modules in module dependencies.
Extend test to check smart casts are allowed for properties from transitive
'expected by' dependencies and prohibited otherwise.

^KT-42754 Fixed
2020-11-08 15:33:30 +03:00
Pavel Kirpichenkov
778bbd76cb [MPP] Add test for KT-42754 2020-11-08 15:33:30 +03:00
Dmitriy Dolovov
9f0cec3443 Native, Gradle IT: Add verbosity to IT 2020-11-07 11:38:07 +03:00
Alexander Udalov
9adc1a6e9b JVM IR: generate 'main' wrappers as non-final
To replicate bytecode generated by the old backend, and thus simplify
ABI comparison.
2020-11-06 19:27:53 +01:00
Alexander Udalov
791be7c2dc JVM IR: improve ABI of properties in multifile facades
When copying top level declarations from multifile parts to facades,
also copy corresponding properties. This allows to keep their
annotations, which are later used in codegen (for example, to generate
ACC_DEPRECATED on property accessors), and allows to get rid of the hack
where the JVM name of the property accessor was computed prematurely via
methodSignatureMapper.

Also, don't copy `$annotations` methods for non-const properties to
facades because the old backend only generates them in parts (which
might be a separate problem, see KT-27644).

 #KT-40262 Fixed
2020-11-06 19:27:53 +01:00
Alexander Udalov
55974b4eda JVM IR: do not generate InlineOnly property accessors in multifile facade
#KT-37007 Fixed
2020-11-06 19:27:53 +01:00
Alexander Udalov
500b1cfbd3 JVM IR: fix flags of $default methods in multi-file facades
Do not change origin of multifile class bridges to something else
because, as it turns out, there are numerous origin-specific checks in
the codegen that start to behave differently for multifile bridges.
Instead of the method-targeted origin MULTIFILE_BRIDGE, use new class
origin JVM_MULTIFILE_CLASS to detect whether a declaration is a
multifile bridge.

 #KT-40198 Fixed
 #KT-43145 Fixed
2020-11-06 19:27:52 +01:00
Alexander Udalov
d326d6a693 Specify module name via moduleName option instead of freeCompilerArgs
This allows to get rid of warnings about duplicate module name in some
of the modules.
2020-11-06 19:27:32 +01:00
Alexander Udalov
bdb8a58b3b JVM IR: merge JvmBackendFacade into JvmIrCodegenFactory 2020-11-06 19:27:08 +01:00
Alexander Udalov
5c2c2591a1 Minor, rename file to keep git history 2020-11-06 19:27:07 +01:00
Alexander Udalov
624204c7b4 JVM IR: remove outdated code in JvmIrCodegenFactory 2020-11-06 19:27:07 +01:00
Alexander Udalov
b2d49e9615 Minor, fix whitespace in toString 2020-11-06 19:26:49 +01:00
Alexander Udalov
c1a292b01b Psi2ir: improve exception stack traces
- Do not wrap exceptions resulting from generating error expressions
  multiple times, as that could lead to stack traces where the identical
  code is wrapped many times and is printed in the exception message on
  each step, which was difficult to read
- Add element location (file name, line number & position) to the
  message, similarly to exceptions from codegen, when catching and
  rethrowing exceptions at the top level
2020-11-06 19:26:48 +01:00
Dmitriy Dolovov
3cb202f576 Gradle IT: Fix Gradle output checks in Kotlin/Native ITs 2020-11-06 19:24:31 +03:00
Alexander Likhachev
e3db96354d Add javadoc and sources artifacts to kotlin-gradle-build-metrics module
#KTI-382 Fixed
2020-11-06 16:23:32 +03:00
Alexander Gorshenev
5f2a963006 Better wording and comments for klib compatibility code 2020-11-06 16:19:43 +03:00
Alexander Gorshenev
891a4c4621 Dropped outdated klib version compatibility mechanisms 2020-11-06 16:19:43 +03:00
Alexander Gorshenev
8b2b36d61f Enabled klib abi version compatibility 2020-11-06 16:19:42 +03:00
Denis Zharkov
e434a1c892 FIR: Drop unused AbstractFirOverrideScope::create*Copy 2020-11-06 14:44:29 +03:00
Denis Zharkov
2e4c41c0d8 FIR: Drop PossiblyFirFakeOverrideSymbol 2020-11-06 14:44:28 +03:00
Denis Zharkov
7b48625b58 FIR: Remove FirCallableSymbol::overriddenSymbol 2020-11-06 14:44:27 +03:00
Denis Zharkov
78b374ec88 FIR: Do not set overriddenSymbol for KFunction::invoke
It has been probably set by mistake since overriddenSymbol is only used for
fake overrides
2020-11-06 11:32:39 +03:00
Denis Zharkov
a11b488c82 FIR: Add workaround for combination of intersection + delegated members
See org.jetbrains.kotlin.fir.Fir2IrTextTestGenerated.FirProblems#testDelegationAndInheritanceFromJava
2020-11-06 11:32:39 +03:00
Denis Zharkov
41f878e104 FIR: Adjust test data for type alias constructors
They are not SubstitutionOverrides anymore
2020-11-06 11:32:39 +03:00
Denis Zharkov
96c3436e73 FIR: Temporary adjust diagnostics test data
UPPER_BOUND_VIOLATED for type alias constructors is not supported properly
See KT-43142
2020-11-06 11:32:39 +03:00
Denis Zharkov
d58e66e79a FIR: Merge both synthetic type alias constructor kinds 2020-11-06 11:32:39 +03:00
Denis Zharkov
f9aab77ce5 FIR: Simplify ConstructorProcessing relevant to type aliases 2020-11-06 11:32:39 +03:00
Denis Zharkov
8a949b0dcf FIR: Use attribute instead of overriddenSymbol for synthetic type alias constructor 2020-11-06 11:32:39 +03:00
Denis Zharkov
4282e27d73 FIR: Get rid of usages of FirCallableSymbol::overriddenSymbol 2020-11-06 11:32:39 +03:00
Denis Zharkov
728c2a808f FIR: Do not propagate overriddenSymbol at FirObjectImportedCallableScope 2020-11-06 11:32:39 +03:00
Denis Zharkov
037ba4d973 FIR: Simplify VariableStorage::isStable 2020-11-06 11:32:39 +03:00
Denis Zharkov
317d981472 FIR: Do not use overriddenSymbol for imported from object 2020-11-06 11:32:39 +03:00
Denis Zharkov
65119adb6a FIR: Adjust test data. FakeOverride -> SubssitutionOverride 2020-11-06 11:32:39 +03:00
Denis Zharkov
3e37995004 FIR: Get rid of FirCallableSymbol::isFakeOverride and isIntersectionOverride 2020-11-06 11:32:39 +03:00
Alexey Tsvetkov
36387d97ad Add IC metrics reporting 2020-11-05 23:26:46 +03:00
Alexey Tsvetkov
5bde6457b1 Metrics reporting utils 2020-11-05 23:26:46 +03:00
Alexey Tsvetkov
97a09680d5 Remove CompositeICReporterAsync 2020-11-05 23:26:42 +03:00
Zalim Bashorov
2c1e4c1769 [IR] Use more specific type (IrSimpleFunction) for accessors in IrLocalDelegatedProperty 2020-11-05 22:25:05 +03:00
Sergey Igushkin
11bc1c0753 Revert "Fix configuration cache issue in AbstractKotlinTarget" 2020-11-05 21:02:47 +03:00
Roman Artemev
8ca9e792e9 [KLIB] Make sure that referenced local anonymous class is deserialzied.
In case if such class is used an type argument for field type make sure
that field initializer is being read.

Check type recursively.

- fix KT-41143
- update test
2020-11-05 20:28:11 +03:00
Dmitriy Dolovov
0dd329d3d4 Gradle IT: Intercept and log Gradle process output on import failures 2020-11-05 18:51:16 +03:00
Dmitriy Dolovov
4de1bf8d35 Gradle IT: Move GradleProcessOutputInterceptor to the test framework
This is necessary to make GradleProcessOutputInterceptor available for
other tests, e.g. Gradle IT.
2020-11-05 18:51:08 +03:00
Dmitriy Dolovov
fae3ba35e9 Gradle, Native: More verbose logging in KotlinToolRunner
Especially for tools executed in a separate JVM process:
JVM options, Java system properties, custom ENV variables.
2020-11-05 18:51:02 +03:00
Dmitriy Dolovov
734dff6282 [Commonizer] Use compact variants of collections to reduce memory footprint 2020-11-05 18:50:56 +03:00
Dmitriy Dolovov
30bf7b87fe Minor. Code formatted 2020-11-05 18:50:50 +03:00
Dmitriy Dolovov
f5bb60f7cd [Commonizer] Refactor CIR type representation
1. Drop CirClassifierId
2. Specialized classes for each kind of types (classes, TAs, type parameters, flexible types).
3. TypeCommonizer now returns commonized type. In case of TAs this could be a completely new type
   describing expect class or a new TA with the different underlying type.
2020-11-05 18:50:43 +03:00
Dmitriy Dolovov
2764550bbe [Commonizer] Relax conditions for TA lifting-up
Allow lifting up matching TAs with non-empty list of type parameters
and non-empty list of type arguments in the expanded type.
2020-11-05 18:50:37 +03:00
Dmitriy Dolovov
cb2e94df16 [Commonizer] Minor. Convert approximation keys back to data classes 2020-11-05 18:50:31 +03:00
nataliya.valtman
45ce0c6c11 avoid failing KotlinGradleIT.testInternalTest for Windows agent 2020-11-05 13:43:02 +03:00
Sergey Igushkin
c839282f9b Merge pull request #3878 from google/prr/hungnv/KT-43054-configurationCacheIssue
Fix configuration cache issue in AbstractKotlinTarget
2020-11-05 13:26:40 +03:00
Victor Petukhov
90ea64a0e5 Don't report warning about changing execution order for varargs if it's inside an annotation
^KT-43110 Fixed
2020-11-05 13:18:00 +03:00
Victor Petukhov
f052bc341c Don't report warning about implicitly inferred Nothing for call arguments if there is non-Nothing return type
^KT-43108 Fixed
2020-11-05 13:17:59 +03:00
Andrei Klunnyi
7859287337 [KT-40688] Inlay Hints: lambda hints removal on editing
Due to the platform API limitation lambda related hints are treated
separately to all others. Hints removal on editing is not an exclusion
and is now supported as well.
2020-11-05 10:10:19 +00:00
Jinseong Jeon
b3b09ea9b7 FIR: adjust spec testData after DFA changes:
* recording type statements for null assignments
* element-wise join by default
2020-11-04 16:35:42 +03:00
Jinseong Jeon
a5389b067b FIR DFA: use element-wise join everywhere 2020-11-04 16:35:42 +03:00
Jinseong Jeon
771c839d74 FIR DFA: element-wise join at merging points of try expression 2020-11-04 16:35:42 +03:00
Jinseong Jeon
bd173ebebc FIR DFA: isolate effects between blocks in try expression 2020-11-04 16:35:42 +03:00
Jinseong Jeon
1f1e1828a7 FIR CFG: reconfigure exception throwing paths in try expression 2020-11-04 16:35:42 +03:00
Jinseong Jeon
146036010c FIR DFA: add tests about smartcasts in/after try-catch-finally 2020-11-04 16:35:42 +03:00
Mads Ager
2c8c47399a [JVM_IR] Enable KotlinAgainstJava and remaining JavaAgainstKotlin test. 2020-11-04 14:16:37 +01:00
Yunir Salimzyanov
24345bb6b3 Prevent NPE while fetching muted tests from Teamcity server 2020-11-04 16:14:01 +03:00
MikeKulasinski-visa
bc2b396ecd kotlin.native.cocoapods.targets can be a custom list of architectures (#3861)
Co-authored-by: Mike Kulasinski <mike.kulasinski@payworks.com>
Co-authored-by: Ilya Matveev <ilya.matveev@jetbrains.com>
2020-11-04 18:21:12 +07:00
Mads Ager
0279068214 [JVM_IR] Follow old backend in bridge visibility and varargs marking.
The old backend makes bridges for protected and package-private
methods public. Also, for bridges for vararg methods, the vararg
marker is not on the bridge.

These differences seem minor but are visible via reflection, so
we might as well follow the old backend.
2020-11-04 12:03:06 +01:00
Ilmir Usmanov
326768e8b5 Minor. Update test data 2020-11-04 00:20:39 +01:00
Steven Schäfer
bd4e2a283c JVM IR: Don't generate null checks on value parameters of private operator functions
The null check on the extension receiver of private operator functions
is a special case and doesn't extend to value parameters.
2020-11-03 21:44:25 +01:00
Hung Nguyen
6d29bb5814 Fix configuration cache issue in AbstractKotlinTarget
AbstractKotlinTarget#buildAdhocComponentsFromKotlinVariants passes a
non-serializable local object to a lambda, which will fail during
serialization when configuration caching is enabled.

To fix that, this commit passes only the relevant parts of the object
to the lambda.

Bug: https://youtrack.jetbrains.com/issue/KT-43054
Test: Manually verified on
      https://android.googlesource.com/platform/tools/metalava/+/refs/heads/master/
      where the issue was detected (I haven't been able to create a mininal
      reproducible project)
2020-10-30 13:44:49 +00:00
3919 changed files with 83247 additions and 36245 deletions

View File

@@ -101,4 +101,4 @@
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
</codeStyleSettings>
</code_scheme>
</component>
</component>

View File

@@ -0,0 +1,27 @@
<component name="ProjectDictionaryState">
<dictionary name="svyatoslav.kuzmich">
<words>
<w>anyfunc</w>
<w>copysign</w>
<w>eqref</w>
<w>exnref</w>
<w>externref</w>
<w>funcref</w>
<w>jetbrains</w>
<w>kotlinx</w>
<w>ktor</w>
<w>optref</w>
<w>popcnt</w>
<w>rotl</w>
<w>rotr</w>
<w>simd</w>
<w>sqrt</w>
<w>testsuite</w>
<w>uninstantiable</w>
<w>unlinkable</w>
<w>vtable</w>
<w>wabt</w>
<w>xopt</w>
</words>
</dictionary>
</component>

View File

@@ -453,4 +453,4 @@
<option name="ignoreNonEmtpyLoops" value="false" />
</inspection_tool>
</profile>
</component>
</component>

1304
ChangeLog-1.0.X.md Normal file

File diff suppressed because it is too large Load Diff

2697
ChangeLog-1.1.X.md Normal file

File diff suppressed because it is too large Load Diff

2042
ChangeLog-1.2.X.md Normal file

File diff suppressed because it is too large Load Diff

3879
ChangeLog-1.3.X.md Normal file

File diff suppressed because it is too large Load Diff

10188
ChangeLog.md

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,10 @@
# Kotlin Programming Language
Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links:
Welcome to [Kotlin](https://kotlinlang.org/)!
It is an open-source, statically typed programming language supported and developed by [JetBrains](https://www.jetbrains.com/) and open-source contributors.
Some handy links:
* [Kotlin Site](https://kotlinlang.org/)
* [Getting Started Guide](https://kotlinlang.org/docs/tutorials/getting-started.html)

View File

@@ -40,9 +40,7 @@ dependencies {
compile(project(":compiler:cli"))
compile(intellijCoreDep()) { includeJars("intellij-core") }
compile(jpsStandalone()) { includeJars("jps-model") }
Platform[192].orHigher {
compile(intellijPluginDep("java"))
}
compile(intellijPluginDep("java"))
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
}

View File

@@ -3,9 +3,10 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.findUsages
package org.jetbrains.kotlin.build
import com.intellij.util.Processor
import java.io.Serializable
// FIX ME WHEN BUNCH 193 REMOVED
typealias ProcessorInCompat<T> = Processor<T>
enum class ExecutionStrategy : Serializable {
DAEMON, IN_PROCESS, OUT_OF_PROCESS
}

View File

@@ -0,0 +1,24 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report
import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter
import org.jetbrains.kotlin.build.report.metrics.RemoteBuildMetricsReporter
open class BuildReporter(
protected open val icReporter: ICReporter,
protected open val buildMetricsReporter: BuildMetricsReporter
) : ICReporter by icReporter, BuildMetricsReporter by buildMetricsReporter
class RemoteBuildReporter(
override val icReporter: RemoteICReporter,
override val buildMetricsReporter: RemoteBuildMetricsReporter
) : BuildReporter(icReporter, buildMetricsReporter), RemoteReporter {
override fun flush() {
icReporter.flush()
buildMetricsReporter.flush()
}
}

View File

@@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental
package org.jetbrains.kotlin.build.report
import org.jetbrains.kotlin.cli.common.ExitCode
import java.io.File
@@ -17,3 +17,5 @@ interface ICReporter {
fun reportMarkDirtyMember(affectedFiles: Iterable<File>, scope: String, name: String)
fun reportMarkDirty(affectedFiles: Iterable<File>, reason: String)
}

View File

@@ -1,9 +1,9 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental
package org.jetbrains.kotlin.build.report
import java.io.File

View File

@@ -3,9 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.projectView
package org.jetbrains.kotlin.build.report
import com.intellij.ide.util.treeView.AbstractTreeNode
// FIX ME WHEN BUNCH 193 REMOVED
typealias AbstractTreeNodeAny = AbstractTreeNode<Any>
interface RemoteICReporter : ICReporter,
RemoteReporter

View File

@@ -3,11 +3,9 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea
package org.jetbrains.kotlin.build.report
import com.intellij.openapi.project.Project
interface RemoteReporter {
fun flush()
}
// FIX ME WHEN BUNCH 193 REMOVED
fun runActivity(project: Project) {
// nothing for 193
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
enum class BuildAttributeKind : Serializable {
REBUILD_REASON;
companion object {
const val serialVersionUID = 0L
}
}
enum class BuildAttribute(val kind: BuildAttributeKind) : Serializable {
NO_BUILD_HISTORY(BuildAttributeKind.REBUILD_REASON),
CACHE_CORRUPTION(BuildAttributeKind.REBUILD_REASON),
UNKNOWN_CHANGES_IN_GRADLE_INPUTS(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNTRACKED_FILE_IS_REMOVED(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNEXPECTED_PSI(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNKNOWN_QUALIFIER(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_REMOVED_ENTRY(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_IS_NOT_FOUND(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_CANNOT_BE_READ(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_NO_KNOWN_BUILDS(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_NON_INCREMENTAL_BUILD_IN_DEP(BuildAttributeKind.REBUILD_REASON),
IN_PROCESS_EXECUTION(BuildAttributeKind.REBUILD_REASON),
OUT_OF_PROCESS_EXECUTION(BuildAttributeKind.REBUILD_REASON),
IC_IS_NOT_ENABLED(BuildAttributeKind.REBUILD_REASON);
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
import java.util.*
class BuildAttributes : Serializable {
private val myAttributes =
EnumMap<BuildAttribute, Int>(
BuildAttribute::class.java
)
fun add(attr: BuildAttribute, count: Int = 1) {
myAttributes[attr] = myAttributes.getOrDefault(attr, 0) + count
}
fun addAll(other: BuildAttributes) {
other.myAttributes.forEach { (attr, n) -> add(attr, n) }
}
fun asMap(): Map<BuildAttribute, Int> = myAttributes
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,22 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
data class BuildMetrics(
val buildTimes: BuildTimes = BuildTimes(),
val buildAttributes: BuildAttributes = BuildAttributes()
) : Serializable {
fun addAll(other: BuildMetrics) {
buildTimes.addAll(other.buildTimes)
buildAttributes.addAll(other.buildAttributes)
}
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
interface BuildMetricsReporter {
fun startMeasure(metric: BuildTime, startNs: Long)
fun endMeasure(metric: BuildTime, endNs: Long)
fun addAttribute(attribute: BuildAttribute)
fun getMetrics(): BuildMetrics
fun addMetrics(metrics: BuildMetrics?)
}
inline fun <T> BuildMetricsReporter.measure(metric: BuildTime, fn: () -> T): T {
val start = System.nanoTime()
startMeasure(metric, start)
try {
return fn()
} finally {
val end = System.nanoTime()
endMeasure(metric, end)
}
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.util.*
class BuildMetricsReporterImpl : BuildMetricsReporter {
private val myBuildTimeStartNs: EnumMap<BuildTime, Long> =
EnumMap(
BuildTime::class.java
)
private val myBuildTimes = BuildTimes()
private val myBuildAttributes = BuildAttributes()
override fun startMeasure(metric: BuildTime, startNs: Long) {
if (metric in myBuildTimeStartNs) {
error("$metric was restarted before it finished")
}
myBuildTimeStartNs[metric] = startNs
}
override fun endMeasure(metric: BuildTime, endNs: Long) {
val startNs = myBuildTimeStartNs.remove(metric) ?: error("$metric finished before it started")
val durationNs = endNs - startNs
myBuildTimes.add(metric, durationNs)
}
override fun addAttribute(attribute: BuildAttribute) {
myBuildAttributes.add(attribute)
}
override fun getMetrics(): BuildMetrics =
BuildMetrics(
buildTimes = myBuildTimes,
buildAttributes = myBuildAttributes
)
override fun addMetrics(metrics: BuildMetrics?) {
if (metrics == null) return
myBuildAttributes.addAll(metrics.buildAttributes)
myBuildTimes.addAll(metrics.buildTimes)
}
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
@Suppress("Reformat")
enum class BuildTime(val parent: BuildTime? = null) : Serializable {
GRADLE_TASK,
CLEAR_OUTPUT(GRADLE_TASK),
BACKUP_OUTPUT(GRADLE_TASK),
RESTORE_OUTPUT_FROM_BACKUP(GRADLE_TASK),
CONNECT_TO_DAEMON(GRADLE_TASK),
CLEAR_JAR_CACHE(GRADLE_TASK),
RUN_COMPILER(GRADLE_TASK),
NON_INCREMENTAL_COMPILATION_IN_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_OUT_OF_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_DAEMON(RUN_COMPILER),
INCREMENTAL_COMPILATION(RUN_COMPILER),
IC_CALCULATE_INITIAL_DIRTY_SET(INCREMENTAL_COMPILATION),
IC_ANALYZE_CHANGES_IN_DEPENDENCIES(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_FIND_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),
IC_ANALYZE_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),
IC_ANALYZE_CHANGES_IN_JAVA_SOURCES(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_ANALYZE_CHANGES_IN_ANDROID_LAYOUTS(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_DETECT_REMOVED_CLASSES(IC_CALCULATE_INITIAL_DIRTY_SET),
CLEAR_OUTPUT_ON_REBUILD(INCREMENTAL_COMPILATION),
IC_UPDATE_CACHES(INCREMENTAL_COMPILATION),
INCREMENTAL_ITERATION(INCREMENTAL_COMPILATION),
NON_INCREMENTAL_ITERATION(INCREMENTAL_COMPILATION),
IC_WRITE_HISTORY_FILE(INCREMENTAL_COMPILATION);
companion object {
const val serialVersionUID = 0L
val children by lazy {
values().filter { it.parent != null }.groupBy { it.parent }
}
}
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
import java.util.*
class BuildTimes : Serializable {
private val myBuildTimes = EnumMap<BuildTime, Long>(BuildTime::class.java)
fun addAll(other: BuildTimes) {
for ((bt, timeNs) in other.myBuildTimes) {
add(bt, timeNs)
}
}
fun add(buildTime: BuildTime, timeNs: Long) {
myBuildTimes[buildTime] = myBuildTimes.getOrDefault(buildTime, 0) + timeNs
}
fun asMap(): Map<BuildTime, Long> = myBuildTimes
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
object DoNothingBuildMetricsReporter : BuildMetricsReporter {
override fun startMeasure(metric: BuildTime, startNs: Long) {
}
override fun endMeasure(metric: BuildTime, endNs: Long) {
}
override fun addAttribute(attribute: BuildAttribute) {
}
override fun getMetrics(): BuildMetrics =
BuildMetrics(
BuildTimes(),
BuildAttributes()
)
override fun addMetrics(metrics: BuildMetrics?) {}
}

View File

@@ -3,9 +3,9 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.projectView
package org.jetbrains.kotlin.build.report.metrics
import com.intellij.ide.util.treeView.AbstractTreeNode
import org.jetbrains.kotlin.build.report.RemoteReporter
// FIX ME WHEN BUNCH 193 REMOVED
typealias AbstractTreeNodeAny = AbstractTreeNode<*>
interface RemoteBuildMetricsReporter : BuildMetricsReporter,
RemoteReporter

View File

@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.build.GeneratedFile
import org.jetbrains.kotlin.build.GeneratedJvmClass
import org.jetbrains.kotlin.build.JvmSourceRoot
import org.jetbrains.kotlin.build.isModuleMappingFile
import org.jetbrains.kotlin.build.report.ICReporter
import org.jetbrains.kotlin.config.Services
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
@@ -31,6 +32,7 @@ import org.jetbrains.kotlin.progress.CompilationCanceledStatus
import org.jetbrains.kotlin.resolve.sam.SAM_LOOKUP_NAME
import org.jetbrains.kotlin.utils.addToStdlib.flattenTo
import java.io.File
import java.nio.file.Files
import java.util.*
import kotlin.collections.HashSet
import kotlin.collections.LinkedHashSet
@@ -66,7 +68,7 @@ fun makeModuleFile(
friendDirs
)
val scriptFile = File.createTempFile("kjps", sanitizeJavaIdentifier(name) + ".script.xml")
val scriptFile = Files.createTempFile("kjps", sanitizeJavaIdentifier(name) + ".script.xml").toFile()
scriptFile.writeText(builder.asText().toString())
return scriptFile
}

View File

@@ -1,106 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.JpsPersistentHashMap
import java.io.File
class NonCachingLazyStorage<K, V>(
private val storageFile: File,
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: JpsPersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): JpsPersistentHashMap<K, V>? {
if (storage != null) return storage
if (storageFile.exists()) {
storage = createMap()
return storage
}
return null
}
@Synchronized
private fun getStorageOrCreateNew(): JpsPersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
return storage!!
}
override val keys: Collection<K>
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
override operator fun contains(key: K): Boolean =
getStorageIfExists()?.containsMapping(key) ?: false
override operator fun get(key: K): V? =
getStorageIfExists()?.get(key)
override operator fun set(key: K, value: V) {
getStorageOrCreateNew().put(key, value)
}
override fun remove(key: K) {
getStorageIfExists()?.remove(key)
}
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendDataWithoutCache(key, value)
}
@Synchronized
override fun clean() {
try {
storage?.close()
} catch (ignored: Throwable) {
}
JpsPersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized
override fun flush(memoryCachesOnly: Boolean) {
val existingStorage = storage ?: return
if (memoryCachesOnly) {
if (existingStorage.isDirty) {
existingStorage.dropMemoryCaches()
}
} else {
existingStorage.force()
}
}
@Synchronized
override fun close() {
storage?.close()
}
private fun createMap(): JpsPersistentHashMap<K, V> =
JpsPersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
}

View File

@@ -27,8 +27,9 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.20")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath(kotlin("serialization", bootstrapKotlinVersion))
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4.17.2")
}
@@ -167,9 +168,8 @@ extra["versions.junit"] = "4.12"
extra["versions.javaslang"] = "2.0.6"
extra["versions.ant"] = "1.8.2"
extra["versions.android"] = "2.3.1"
val coroutinesVersion = if (Platform[192].orHigher()) "1.3.7" else "1.1.1"
extra["versions.kotlinx-coroutines-core"] = coroutinesVersion
extra["versions.kotlinx-coroutines-jdk8"] = coroutinesVersion
extra["versions.kotlinx-coroutines-core"] = "1.3.8"
extra["versions.kotlinx-coroutines-jdk8"] = "1.3.8"
extra["versions.json"] = "20160807"
extra["versions.native-platform"] = "0.14"
extra["versions.ant-launcher"] = "1.8.0"
@@ -188,13 +188,13 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
extra["versions.ktor-network"] = "1.0.1"
if (!project.hasProperty("versions.kotlin-native")) {
extra["versions.kotlin-native"] = "1.4.30-dev-16766"
extra["versions.kotlin-native"] = "1.4.30-dev-17200"
}
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false)
val useJvmIrBackend by extra(project.getBooleanProperty("kotlin.build.useIR") ?: false)
val useJvmIrBackend by extra(project.kotlinBuildProperties.useIR)
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
@@ -292,7 +292,8 @@ extra["compilerModules"] = arrayOf(
":compiler:fir:jvm",
":compiler:fir:checkers",
":compiler:fir:entrypoint",
":compiler:fir:analysis-tests"
":compiler:fir:analysis-tests",
":wasm:wasm.ir"
)
extra["compilerModulesForJps"] = listOf(
@@ -650,8 +651,11 @@ tasks {
}
register("wasmCompilerTest") {
// TODO: fix once
// dependsOn(":js:js.tests:wasmTest")
dependsOn(":js:js.tests:wasmTest")
// Windows WABT release requires Visual C++ Redistributable
if (!kotlinBuildProperties.isTeamcityBuild || !org.gradle.internal.os.OperatingSystem.current().isWindows) {
dependsOn(":wasm:wasm.ir:test")
}
}
register("nativeCompilerTest") {
@@ -866,8 +870,8 @@ tasks {
":compiler:test",
":js:js.tests:test"
)
if (Ide.IJ193.orHigher())
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
if (Ide.AS40.orHigher())
dependsOn(":kotlin-ultimate:ide:android-studio-native:test")
@@ -901,7 +905,6 @@ tasks {
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-dist-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-gradle-statistics-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlinx-serialization-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:noarg-compiler-plugin-for-ide:publish",
@@ -922,7 +925,8 @@ tasks {
":kotlin-reflect:publish",
":kotlin-main-kts:publish",
":kotlin-stdlib-js:publish",
":kotlin-test:kotlin-test-js:publish"
":kotlin-test:kotlin-test-js:publish",
":kotlin-coroutines-experimental-compat:publish"
)
}
}

View File

@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
extra["versions.native-platform"] = "0.14"
buildscript {
@@ -22,7 +24,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.20")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
}
@@ -97,7 +99,7 @@ repositories {
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.20")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
implementation("com.gradle.publish:plugin-publish-plugin:0.12.0")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
@@ -126,6 +128,11 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs +=
listOf("-Xopt-in=kotlin.RequiresOptIn", "-Xskip-runtime-version-check")
}
tasks["build"].dependsOn(":prepare-deps:build")
allprojects {

View File

@@ -20,7 +20,7 @@ buildscript {
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.20")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
}
}

View File

@@ -5,10 +5,13 @@ import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.tasks.TaskProvider
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.*
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.project
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.register
import java.io.File
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
const val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
val packagesToRelocate =
listOf(
@@ -31,21 +34,23 @@ val packagesToRelocate =
// But due to the shadow plugin bug (https://github.com/johnrengelman/shadow/issues/262) it is not possible to use
// packagesToRelocate list to for the include list. Therefore the exclude list has to be created.
val packagesToExcludeFromDummy =
listOf("org/jetbrains/kotlin/**",
"org/intellij/lang/annotations/**",
"org/jetbrains/jps/**",
"META-INF/**",
"com/sun/jna/**",
"com/thoughtworks/xstream/**",
"javaslang/**",
"*.proto",
"messages/**",
"net/sf/cglib/**",
"one/util/streamex/**",
"org/iq80/snappy/**",
"org/jline/**",
"org/xmlpull/**",
"*.txt")
listOf(
"org/jetbrains/kotlin/**",
"org/intellij/lang/annotations/**",
"org/jetbrains/jps/**",
"META-INF/**",
"com/sun/jna/**",
"com/thoughtworks/xstream/**",
"javaslang/**",
"*.proto",
"messages/**",
"net/sf/cglib/**",
"one/util/streamex/**",
"org/iq80/snappy/**",
"org/jline/**",
"org/xmlpull/**",
"*.txt"
)
private fun ShadowJar.configureEmbeddableCompilerRelocation(withJavaxInject: Boolean = true) {
relocate("com.google.protobuf", "org.jetbrains.kotlin.protobuf")
@@ -67,8 +72,8 @@ private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Un
dependencies.add(compilerJar.name, dependencies.project(":kotlin-compiler", configuration = "runtimeJar"))
return tasks.register<ShadowJar>(taskName) {
destinationDir = File(buildDir, "libs")
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
destinationDirectory.set(project.file(File(buildDir, "libs")))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(compilerJar)
body()
}
@@ -107,8 +112,8 @@ fun Project.embeddableCompilerDummyForDependenciesRewriting(
)
return tasks.register<ShadowJar>(taskName) {
destinationDir = File(buildDir, "libs")
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
destinationDirectory.set(project.file(File(buildDir, "libs")))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(compilerDummyJar)
configureEmbeddableCompilerRelocation(withJavaxInject = false)
body()
@@ -119,7 +124,7 @@ fun Project.rewriteDepsToShadedJar(
originalJarTask: TaskProvider<out Jar>, shadowJarTask: TaskProvider<out Jar>, body: Jar.() -> Unit = {}
): TaskProvider<out Jar> {
originalJarTask.configure {
classifier = "original"
archiveClassifier.set("original")
}
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
@@ -132,7 +137,7 @@ fun Project.rewriteDepsToShadedJar(
// which leads to the content of that JAR being excluded as well:
exclude { it.file == compilerDummyJarFile }
classifier = ""
archiveClassifier.set("original")
body()
}
return shadowJarTask

View File

@@ -132,12 +132,10 @@ object IntellijRootUtils {
}
}
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project) =
includeJars(*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).toTypedArray(), rootProject = project.rootProject)
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean) =
@Suppress("UNCHECKED_CAST")
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean = { true }): Unit =
includeJars(
*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter { jarsFilterPredicate(it) }.toTypedArray(),
*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter(jarsFilterPredicate).toTypedArray(),
rootProject = project.rootProject
)

View File

@@ -18,7 +18,7 @@ import java.util.*
internal const val PLUGIN_MARKER_SUFFIX = ".gradle.plugin"
@UseExperimental(ExperimentalStdlibApi::class)
@OptIn(ExperimentalStdlibApi::class)
fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
val pluginDevelopment = extensions.getByType<PluginBundleExtension>()
val publishingExtension = extensions.getByType<PublishingExtension>()

View File

@@ -8,7 +8,6 @@ package plugins
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.attributes.Usage
import org.gradle.api.component.AdhocComponentWithVariants
import org.gradle.api.component.SoftwareComponentFactory
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.publish.PublishingExtension
@@ -23,7 +22,6 @@ import org.gradle.plugins.signing.SigningPlugin
import java.util.*
import javax.inject.Inject
class KotlinBuildPublishingPlugin @Inject constructor(
private val componentFactory: SoftwareComponentFactory
) : Plugin<Project> {
@@ -47,7 +45,7 @@ class KotlinBuildPublishingPlugin @Inject constructor(
}
}
val kotlinLibraryComponent = componentFactory.adhoc(ADHOC_COMPONENT_NAME) as AdhocComponentWithVariants
val kotlinLibraryComponent = componentFactory.adhoc(ADHOC_COMPONENT_NAME)
components.add(kotlinLibraryComponent)
kotlinLibraryComponent.addVariantsFromConfiguration(publishedCompile) { mapToMavenScope("compile") }
kotlinLibraryComponent.addVariantsFromConfiguration(publishedRuntime) { mapToMavenScope("runtime") }
@@ -139,7 +137,7 @@ class KotlinBuildPublishingPlugin @Inject constructor(
const val COMPILE_CONFIGURATION = "publishedCompile"
const val RUNTIME_CONFIGURATION = "publishedRuntime"
@UseExperimental(ExperimentalStdlibApi::class)
@OptIn(ExperimentalStdlibApi::class)
fun humanReadableName(project: Project) =
project.name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
}
@@ -163,4 +161,4 @@ fun TaskProvider<PublishToMavenRepository>.configureRepository() = configure {
}
}
}
}
}

View File

@@ -1,3 +1,4 @@
@file:Suppress("DEPRECATION")
package plugins
import org.codehaus.groovy.runtime.InvokerHelper
@@ -16,10 +17,8 @@ import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import kotlin.properties.Delegates
/**
* Configures a Kotlin module for publication.
*
*/
open class PublishedKotlinModule : Plugin<Project> {

View File

@@ -154,7 +154,7 @@ fun Project.projectTest(
var subProjectTempRoot: Path? = null
doFirst {
val teamcity = rootProject.findProperty("teamcity") as? Map<Any?, *>
val teamcity = rootProject.findProperty("teamcity") as? Map<*, *>
val systemTempRoot =
// TC by default doesn't switch `teamcity.build.tempDir` to 'java.io.tmpdir' so it could cause to wasted disk space
// Should be fixed soon on Teamcity side
@@ -180,7 +180,7 @@ fun Project.projectTest(
if (parallel) {
maxParallelForks =
project.findProperty("kotlin.test.maxParallelForks")?.toString()?.toInt()
?: Math.max(Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4, 1)
?: (Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
}
body()
}

View File

@@ -34,9 +34,7 @@ dependencies {
Platform[201].orLower {
testCompile(intellijDep()) { includeJars("groovy-all", rootProject = rootProject) }
}
Platform[192].orHigher {
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
}
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
testCompile(jpsStandalone()) { includeJars("jps-model") }
testCompile(jpsBuildTest())
}

View File

@@ -27,6 +27,9 @@ import org.junit.Assert
import java.io.File
import java.io.FileWriter
import java.io.IOException
import kotlin.io.path.ExperimentalPathApi
import kotlin.io.path.Path
import kotlin.io.path.createTempDirectory
import kotlin.test.assertTrue
data class ConfigurationKey(val kind: ConfigurationKind, val jdkKind: TestJdkKind, val configuration: String)
@@ -345,14 +348,15 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
FileWriter(file).use { fw -> fw.write("sdk.dir=$sdkRoot") }
}
@OptIn(ExperimentalPathApi::class)
@JvmStatic
fun main(args: Array<String>) {
val tmpFolder = createTempDir()
println("Created temporary folder for android tests: " + tmpFolder.absolutePath)
val rootFolder = File("")
val pathManager = PathManager(rootFolder.absolutePath, tmpFolder.absolutePath)
val tmpFolder = createTempDirectory().toAbsolutePath().toString()
println("Created temporary folder for android tests: $tmpFolder")
val rootFolder = Path("").toAbsolutePath().toString()
val pathManager = PathManager(rootFolder, tmpFolder)
generate(pathManager, true)
println("Android test project is generated into " + tmpFolder.absolutePath + " folder")
println("Android test project is generated into $tmpFolder folder")
}
}
}

View File

@@ -0,0 +1,8 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common
class BackendException(message: String, cause: Throwable?) : IllegalStateException(message, cause)

View File

@@ -232,12 +232,13 @@ object CodegenUtil {
}
@JvmStatic
fun reportBackendException(exception: Throwable, phase: String, fileUrl: String?): Nothing {
fun reportBackendException(exception: Throwable, phase: String, location: String?, additionalMessage: String? = null): Nothing {
// CompilationException (the only KotlinExceptionWithAttachments possible here) is already supposed
// to have all information about the context.
if (exception is KotlinExceptionWithAttachments) throw exception
throw IllegalStateException(
getExceptionMessage("Backend", "Exception during $phase", exception, fileUrl),
throw BackendException(
getExceptionMessage("Backend", "Exception during $phase", exception, location) +
additionalMessage?.let { "\n" + it }.orEmpty(),
exception
)
}

View File

@@ -254,14 +254,14 @@ public class ClassFileFactory implements OutputFileCollection {
public PackageCodegen forPackage(@NotNull FqName fqName, @NotNull Collection<KtFile> files) {
assert !isDone : "Already done!";
registerSourceFiles(files);
return state.getCodegenFactory().createPackageCodegen(state, files, fqName);
return new PackageCodegenImpl(state, files, fqName);
}
@NotNull
public MultifileClassCodegen forMultifileClass(@NotNull FqName facadeFqName, @NotNull Collection<KtFile> files) {
assert !isDone : "Already done!";
registerSourceFiles(files);
return state.getCodegenFactory().createMultifileClassCodegen(state, files, facadeFqName);
return new MultifileClassCodegenImpl(state, files, facadeFqName);
}
private void registerSourceFiles(Collection<KtFile> files) {

View File

@@ -26,10 +26,6 @@ import org.jetbrains.kotlin.psi.KtFile
interface CodegenFactory {
fun generateModule(state: GenerationState, files: Collection<KtFile>)
fun createPackageCodegen(state: GenerationState, files: Collection<KtFile>, fqName: FqName): PackageCodegen
fun createMultifileClassCodegen(state: GenerationState, files: Collection<KtFile>, fqName: FqName): MultifileClassCodegen
companion object {
fun doCheckCancelled(state: GenerationState) {
if (state.classBuilderMode.generateBodies) {
@@ -49,8 +45,7 @@ object DefaultCodegenFactory : CodegenFactory {
if (fileClassInfo.withJvmMultifileClass) {
filesInMultifileClasses.putValue(fileClassInfo.facadeClassFqName, file)
}
else {
} else {
filesInPackages.putValue(file.packageFqName, file)
}
}
@@ -68,23 +63,17 @@ object DefaultCodegenFactory : CodegenFactory {
}
}
override fun createPackageCodegen(state: GenerationState, files: Collection<KtFile>, fqName: FqName) =
PackageCodegenImpl(state, files, fqName)
override fun createMultifileClassCodegen(state: GenerationState, files: Collection<KtFile>, fqName: FqName) =
MultifileClassCodegenImpl(state, files, fqName)
private fun generateMultifileClass(state: GenerationState, multifileClassFqName: FqName, files: Collection<KtFile>) {
state.factory.forMultifileClass(multifileClassFqName, files).generate()
}
fun generatePackage(
state: GenerationState,
packageFqName: FqName,
jetFiles: Collection<KtFile>
state: GenerationState,
packageFqName: FqName,
ktFiles: Collection<KtFile>
) {
// We do not really generate package class, but use old package fqName to identify package in module-info.
//FqName packageClassFqName = PackageClassUtils.getPackageClassFqName(packageFqName);
state.factory.forPackage(packageFqName, jetFiles).generate()
state.factory.forPackage(packageFqName, ktFiles).generate()
}
}

View File

@@ -27,13 +27,13 @@ import org.jetbrains.kotlin.psi.KtParameter
import org.jetbrains.kotlin.psi.KtPureClassOrObject
import org.jetbrains.kotlin.psi.KtPureElement
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils.isInterface
import org.jetbrains.kotlin.resolve.calls.components.hasDefaultValue
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.annotations.findJvmOverloadsAnnotation
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKind
import org.jetbrains.kotlin.resolve.jvm.shouldHideConstructorDueToInlineClassTypeValueParameters
import org.jetbrains.org.objectweb.asm.Label
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type
@@ -268,6 +268,7 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
if (classOrObject.isLocal) return false
if (classDescriptor.isInline) return false
if (shouldHideConstructorDueToInlineClassTypeValueParameters(constructorDescriptor)) return false
if (CodegenBinding.canHaveOuter(state.bindingContext, classDescriptor)) return false

View File

@@ -44,8 +44,10 @@ import org.jetbrains.kotlin.codegen.when.SwitchCodegen;
import org.jetbrains.kotlin.codegen.when.SwitchCodegenProvider;
import org.jetbrains.kotlin.config.ApiVersion;
import org.jetbrains.kotlin.config.JVMAssertionsMode;
import org.jetbrains.kotlin.config.JVMConfigurationKeys;
import org.jetbrains.kotlin.config.LanguageFeature;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor;
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor;
import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor;
@@ -1705,26 +1707,38 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
Type returnType;
KotlinType returnKotlinType;
if (isNonLocalReturn) {
// This is inline lambda. Find inline-site and check, whether it is suspend functions returning unboxed inline class
CodegenContext<?> inlineSiteContext = this.context.getFirstCrossInlineOrNonInlineContext();
KotlinType originalInlineClass = null;
boolean invokeSuspendOfLambda = false;
FunctionDescriptor inlineSiteDescriptor = null;
if (inlineSiteContext instanceof MethodContext) {
inlineSiteDescriptor = ((MethodContext) inlineSiteContext).getFunctionDescriptor();
originalInlineClass = CoroutineCodegenUtilKt
.originalReturnTypeOfSuspendFunctionReturningUnboxedInlineClass(inlineSiteDescriptor, typeMapper);
invokeSuspendOfLambda = CoroutineCodegenUtilKt.isInvokeSuspendOfLambda(inlineSiteDescriptor);
}
if (originalInlineClass != null) {
returnType = typeMapper.mapType(originalInlineClass);
returnKotlinType = originalInlineClass;
} else if (!invokeSuspendOfLambda) {
returnType = nonLocalReturn.returnType.getType();
returnKotlinType = nonLocalReturn.returnType.getKotlinType();
} else {
FunctionDescriptor returnTarget =
nonLocalReturn.descriptor instanceof FunctionDescriptor
? (FunctionDescriptor) nonLocalReturn.descriptor
: null;
if (returnTarget == null || !returnTarget.isSuspend()) {
JvmKotlinType jvmKotlinType = nonLocalReturn.getJvmKotlinType(typeMapper);
returnType = jvmKotlinType.getType();
returnKotlinType = jvmKotlinType.getKotlinType();
} else if (returnTarget instanceof AnonymousFunctionDescriptor) {
// Suspend lambdas always return Any?
returnType = OBJECT_TYPE;
returnKotlinType = inlineSiteDescriptor.getReturnType();
returnKotlinType = state.getModule().getBuiltIns().getNullableAnyType();
} else {
// This is inline lambda, but return target is ordinary, yet suspend, function.
// Find inline-site and check, whether it is suspend functions returning unboxed inline class
CodegenContext<?> inlineSiteContext = this.context.getFirstCrossInlineOrNonInlineContext();
KotlinType originalInlineClass = null;
if (inlineSiteContext instanceof MethodContext) {
FunctionDescriptor view = CoroutineCodegenUtilKt.getOrCreateJvmSuspendFunctionView(returnTarget, state);
originalInlineClass =
CoroutineCodegenUtilKt.originalReturnTypeOfSuspendFunctionReturningUnboxedInlineClass(view, typeMapper);
}
if (originalInlineClass != null) {
// As an optimization, suspend functions, returning inline classes with reference underlying
// type return unboxed inline class. Save the type so the coercer will not box it.
returnType = typeMapper.mapType(originalInlineClass);
returnKotlinType = originalInlineClass;
} else {
JvmKotlinType jvmKotlinType = nonLocalReturn.getJvmKotlinType(typeMapper);
returnType = jvmKotlinType.getType();
returnKotlinType = jvmKotlinType.getKotlinType();
}
}
}
else {
@@ -1788,13 +1802,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
FunctionDescriptor containingFunction =
BindingContextUtils.getContainingFunctionSkipFunctionLiterals(descriptor, true).getFirst();
//FIRST_FUN_LABEL to prevent clashing with existing labels
return new NonLocalReturnInfo(
new JvmKotlinType(
typeMapper.mapReturnType(containingFunction),
containingFunction.getReturnType()
),
FIRST_FUN_LABEL
);
return new NonLocalReturnInfo(containingFunction, FIRST_FUN_LABEL);
} else {
//local
return null;
@@ -1807,10 +1815,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
assert element != null : "Expression should be not null " + expression.getText();
assert elementDescriptor != null : "Descriptor should be not null: " + element.getText();
CallableDescriptor function = (CallableDescriptor) elementDescriptor;
return new NonLocalReturnInfo(
new JvmKotlinType(typeMapper.mapReturnType(function), function.getReturnType()),
expression.getLabelName()
);
return new NonLocalReturnInfo(function, expression.getLabelName());
}
}
return null;
@@ -2680,7 +2685,21 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
fd = ArgumentGeneratorKt.getFunctionWithDefaultArguments(fd);
}
return typeMapper.mapToCallableMethod(fd, superCall, null, resolvedCall);
CallableMethod method = typeMapper.mapToCallableMethod(fd, superCall, null, resolvedCall);
if (method.getAsmMethod().getName().contains("-") &&
!state.getConfiguration().getBoolean(JVMConfigurationKeys.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME)
) {
Boolean classFileContainsMethod =
InlineClassesCodegenUtilKt.classFileContainsMethod(fd, state, method.getAsmMethod());
if (classFileContainsMethod != null && !classFileContainsMethod) {
typeMapper.setUseOldManglingRulesForFunctionAcceptingInlineClass(true);
method = typeMapper.mapToCallableMethod(fd, superCall, null, resolvedCall);
typeMapper.setUseOldManglingRulesForFunctionAcceptingInlineClass(false);
}
}
return method;
}
public void invokeMethodWithArguments(
@@ -2896,6 +2915,17 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
sourceCompiler.initializeInlineFunctionContext(functionDescriptor);
JvmMethodSignature signature = typeMapper.mapSignatureWithGeneric(functionDescriptor, sourceCompiler.getContextKind());
if (signature.getAsmMethod().getName().contains("-") &&
!state.getConfiguration().getBoolean(JVMConfigurationKeys.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME)
) {
Boolean classFileContainsMethod =
InlineClassesCodegenUtilKt.classFileContainsMethod(functionDescriptor, state, signature.getAsmMethod());
if (classFileContainsMethod != null && !classFileContainsMethod) {
typeMapper.setUseOldManglingRulesForFunctionAcceptingInlineClass(true);
signature = typeMapper.mapSignatureWithGeneric(functionDescriptor, sourceCompiler.getContextKind());
typeMapper.setUseOldManglingRulesForFunctionAcceptingInlineClass(false);
}
}
Type methodOwner = typeMapper.mapImplementationOwner(functionDescriptor);
if (isDefaultCompilation) {
return new InlineCodegenForDefaultBody(functionDescriptor, this, state, methodOwner, signature, sourceCompiler);
@@ -5427,14 +5457,18 @@ The "returned" value of try expression with no finally is either the last expres
private static class NonLocalReturnInfo {
private final JvmKotlinType returnType;
private final CallableDescriptor descriptor;
private final String labelName;
private NonLocalReturnInfo(@NotNull JvmKotlinType type, @NotNull String name) {
returnType = type;
private NonLocalReturnInfo(@NotNull CallableDescriptor descriptor, @NotNull String name) {
this.descriptor = descriptor;
labelName = name;
}
private JvmKotlinType getJvmKotlinType(@NotNull KotlinTypeMapper typeMapper) {
return new JvmKotlinType(typeMapper.mapReturnType(descriptor), descriptor.getReturnType());
}
}
@NotNull

View File

@@ -75,7 +75,7 @@ public class PackageCodegenImpl implements PackageCodegen {
}
catch (Throwable e) {
VirtualFile vFile = file.getVirtualFile();
CodegenUtil.reportBackendException(e, "file facade code generation", vFile == null ? null : vFile.getUrl());
CodegenUtil.reportBackendException(e, "file facade code generation", vFile == null ? null : vFile.getUrl(), null);
}
}
}

View File

@@ -42,9 +42,11 @@ import org.jetbrains.org.objectweb.asm.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import static org.jetbrains.kotlin.codegen.DescriptorAsmUtil.writeAnnotationData;
import static org.jetbrains.kotlin.load.java.JvmAnnotationNames.METADATA_PACKAGE_NAME_FIELD_NAME;
import static org.jetbrains.kotlin.resolve.jvm.annotations.JvmAnnotationUtilKt.JVM_SYNTHETIC_ANNOTATION_FQ_NAME;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
public class PackagePartCodegen extends MemberCodegen<KtFile> {
@@ -63,8 +65,20 @@ public class PackagePartCodegen extends MemberCodegen<KtFile> {
@Override
protected void generateDeclaration() {
boolean isSynthetic = false;
List<AnnotationDescriptor> fileAnnotationDescriptors = new ArrayList<>();
for (KtAnnotationEntry annotationEntry : element.getAnnotationEntries()) {
AnnotationDescriptor annotationDescriptor = state.getBindingContext().get(BindingContext.ANNOTATION, annotationEntry);
if (annotationDescriptor != null) {
fileAnnotationDescriptors.add(annotationDescriptor);
if (Objects.equals(annotationDescriptor.getFqName(), JVM_SYNTHETIC_ANNOTATION_FQ_NAME)) {
isSynthetic = true;
}
}
}
v.defineClass(element, state.getClassFileVersion(),
ACC_PUBLIC | ACC_FINAL | ACC_SUPER,
ACC_PUBLIC | ACC_FINAL | ACC_SUPER | (isSynthetic ? ACC_SYNTHETIC : 0),
packagePartType.getInternalName(),
null,
"java/lang/Object",
@@ -74,17 +88,6 @@ public class PackagePartCodegen extends MemberCodegen<KtFile> {
generatePropertyMetadataArrayFieldIfNeeded(packagePartType);
generateAnnotationsForPartClass();
}
private void generateAnnotationsForPartClass() {
List<AnnotationDescriptor> fileAnnotationDescriptors = new ArrayList<>();
for (KtAnnotationEntry annotationEntry : element.getAnnotationEntries()) {
AnnotationDescriptor annotationDescriptor = state.getBindingContext().get(BindingContext.ANNOTATION, annotationEntry);
if (annotationDescriptor != null) {
fileAnnotationDescriptors.add(annotationDescriptor);
}
}
Annotated annotatedFile = new AnnotatedImpl(Annotations.Companion.create(fileAnnotationDescriptors));
AnnotationCodegen.forClass(v.getVisitor(), this, state).genAnnotations(annotatedFile, null, null);
}

View File

@@ -672,8 +672,8 @@ public abstract class StackValue {
box(fromType, toType, v);
}
}
else if (fromType.getSort() == Type.OBJECT) {
//toType is primitive here
else if (fromType.getSort() == Type.OBJECT || fromType.getSort() == Type.ARRAY) {
// here toType is primitive and fromType is reference (object or array)
Type unboxedType = unboxPrimitiveTypeOrNull(fromType);
if (unboxedType != null) {
unbox(fromType, unboxedType, v);

View File

@@ -5,15 +5,28 @@
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor
import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource
import org.jetbrains.kotlin.load.kotlin.VirtualFileFinder
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
import org.jetbrains.kotlin.resolve.isInlineClassType
import org.jetbrains.kotlin.resolve.underlyingRepresentation
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedSimpleFunctionDescriptor
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.isAnyOrNullableAny
import org.jetbrains.kotlin.types.typeUtil.isTypeParameter
import org.jetbrains.org.objectweb.asm.ClassReader
import org.jetbrains.org.objectweb.asm.ClassVisitor
import org.jetbrains.org.objectweb.asm.MethodVisitor
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.commons.Method
fun KotlinType.isInlineClassWithUnderlyingTypeAnyOrAnyN(): Boolean {
if (!isInlineClassType()) return false
@@ -26,4 +39,39 @@ fun CallableDescriptor.isGenericParameter(): Boolean {
if (containingDeclaration is AnonymousFunctionDescriptor) return true
val index = containingDeclaration.valueParameters.indexOf(this)
return containingDeclaration.overriddenDescriptors.any { it.original.valueParameters[index].type.isTypeParameter() }
}
fun classFileContainsMethod(descriptor: FunctionDescriptor, state: GenerationState, method: Method): Boolean? {
if (descriptor !is DeserializedSimpleFunctionDescriptor) return null
val classId: ClassId = when {
descriptor.containingDeclaration is DeserializedClassDescriptor -> {
(descriptor.containingDeclaration as DeserializedClassDescriptor).classId ?: return null
}
descriptor.containerSource is JvmPackagePartSource -> {
(descriptor.containerSource as JvmPackagePartSource).classId
}
else -> {
return null
}
}
val bytes = VirtualFileFinder.getInstance(state.project, state.module).findVirtualFileWithHeader(classId)
?.contentsToByteArray() ?: return null
var found = false
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.API_VERSION) {
override fun visitMethod(
access: Int,
name: String?,
descriptor: String?,
signature: String?,
exceptions: Array<out String>?
): MethodVisitor? {
if (name == method.name && descriptor == method.descriptor) {
found = true
}
return super.visitMethod(access, name, descriptor, signature, exceptions)
}
}, ClassReader.SKIP_FRAMES)
return found
}

View File

@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.codegen.createFreeFakeLocalPropertyDescriptor
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.*
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapperBase
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.config.JvmDefaultMode
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.*
@@ -60,6 +61,7 @@ class JvmSerializerExtension @JvmOverloads constructor(
override val metadataVersion = state.metadataVersion
private val jvmDefaultMode = state.jvmDefaultMode
private val approximator = state.typeApproximator
private val useOldManglingScheme = state.useOldManglingSchemeForFunctionsWithInlineClassesInSignatures
override fun shouldUseTypeTable(): Boolean = useTypeTable
override fun shouldSerializeFunction(descriptor: FunctionDescriptor): Boolean {
@@ -215,6 +217,13 @@ class JvmSerializerExtension @JvmOverloads constructor(
) {
versionRequirementTable?.writeFunctionNameManglingForReturnTypeRequirement(proto::addVersionRequirement)
}
if ((requiresFunctionNameManglingForReturnType(descriptor) ||
requiresFunctionNameManglingForParameterTypes(descriptor)) &&
!DescriptorUtils.hasJvmNameAnnotation(descriptor) && !useOldManglingScheme
) {
versionRequirementTable?.writeNewFunctionNameManglingRequirement(proto::addVersionRequirement)
}
}
private fun MutableVersionRequirementTable.writeInlineParameterNullCheckRequirement(add: (Int) -> Unit) {
@@ -231,6 +240,10 @@ class JvmSerializerExtension @JvmOverloads constructor(
}
}
private fun MutableVersionRequirementTable.writeNewFunctionNameManglingRequirement(add: (Int) -> Unit) {
add(writeVersionRequirement(1, 4, 30, ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION, this))
}
private fun FunctionDescriptor.needsInlineParameterNullCheckRequirement(): Boolean =
isInline && !isSuspend && !isParamAssertionsDisabled &&
!DescriptorVisibilities.isPrivate(visibility) &&
@@ -278,6 +291,9 @@ class JvmSerializerExtension @JvmOverloads constructor(
}
if (!DescriptorUtils.hasJvmNameAnnotation(descriptor) && requiresFunctionNameManglingForReturnType(descriptor)) {
if (!useOldManglingScheme) {
versionRequirementTable?.writeNewFunctionNameManglingRequirement(proto::addVersionRequirement)
}
versionRequirementTable?.writeFunctionNameManglingForReturnTypeRequirement(proto::addVersionRequirement)
}
}

View File

@@ -17,7 +17,8 @@ class KotlinToJvmSignatureMapperImpl : KotlinToJvmSignatureMapper {
private val typeMapper = KotlinTypeMapper(
BindingContext.EMPTY, ClassBuilderMode.LIGHT_CLASSES,
JvmProtoBufUtil.DEFAULT_MODULE_NAME,
KotlinTypeMapper.LANGUAGE_VERSION_SETTINGS_DEFAULT// TODO use proper LanguageVersionSettings
KotlinTypeMapper.LANGUAGE_VERSION_SETTINGS_DEFAULT,// TODO use proper LanguageVersionSettings
useOldInlineClassesManglingScheme = false
)
override fun mapToJvmMethodSignature(function: FunctionDescriptor) = typeMapper.mapAsmMethod(function)

View File

@@ -50,12 +50,14 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
private val diagnostics: DiagnosticSink,
moduleName: String,
languageVersionSettings: LanguageVersionSettings,
useOldInlineClassesManglingScheme: Boolean,
shouldGenerate: (JvmDeclarationOrigin) -> Boolean,
) : SignatureCollectingClassBuilderFactory(builderFactory, shouldGenerate) {
private val mapAsmMethod: (FunctionDescriptor) -> Method = KotlinTypeMapper(
// Avoid errors when some classes are not loaded for some reason
bindingContext, ClassBuilderMode.LIGHT_CLASSES, moduleName, languageVersionSettings, isIrBackend = false
bindingContext, ClassBuilderMode.LIGHT_CLASSES, moduleName, languageVersionSettings, isIrBackend = false,
useOldInlineClassesManglingScheme = useOldInlineClassesManglingScheme
)::mapAsmMethod
private val reportDiagnosticsTasks = ArrayList<() -> Unit>()

View File

@@ -39,6 +39,7 @@ import org.jetbrains.kotlin.resolve.*
import org.jetbrains.kotlin.resolve.deprecation.CoroutineCompatibilitySupport
import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver
import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics
import org.jetbrains.kotlin.resolve.diagnostics.PrecomputedSuppressCache
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKind.*
@@ -178,7 +179,11 @@ class GenerationState private constructor(
}
val extraJvmDiagnosticsTrace: BindingTrace =
DelegatingBindingTrace(originalFrontendBindingContext, "For extra diagnostics in ${this::class.java}", false)
DelegatingBindingTrace(
originalFrontendBindingContext, "For extra diagnostics in ${this::class.java}", false,
customSuppressCache = if (isIrBackend) PrecomputedSuppressCache(originalFrontendBindingContext, files) else null,
)
private val interceptedBuilderFactory: ClassBuilderFactory
private var used = false
@@ -190,6 +195,10 @@ class GenerationState private constructor(
val languageVersionSettings = configuration.languageVersionSettings
val useOldManglingSchemeForFunctionsWithInlineClassesInSignatures =
configuration.getBoolean(JVMConfigurationKeys.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME) ||
languageVersionSettings.languageVersion.run { major == 1 && minor < 4 }
val target = configuration.get(JVMConfigurationKeys.JVM_TARGET) ?: JvmTarget.DEFAULT
val runtimeStringConcat =
if (target.bytecodeVersion >= JvmTarget.JVM_9.bytecodeVersion)
@@ -209,6 +218,7 @@ class GenerationState private constructor(
classBuilderMode,
this.moduleName,
languageVersionSettings,
useOldManglingSchemeForFunctionsWithInlineClassesInSignatures,
IncompatibleClassTrackerImpl(extraJvmDiagnosticsTrace),
target,
isIrBackend
@@ -313,6 +323,7 @@ class GenerationState private constructor(
else
BuilderFactoryForDuplicateSignatureDiagnostics(
it, bindingContext, diagnostics, this.moduleName, languageVersionSettings,
useOldManglingSchemeForFunctionsWithInlineClassesInSignatures,
shouldGenerate = { origin -> !shouldOnlyCollectSignatures(origin) },
).apply { duplicateSignatureFactory = this }
},

View File

@@ -83,6 +83,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
val classBuilderMode: ClassBuilderMode,
private val moduleName: String,
val languageVersionSettings: LanguageVersionSettings,
private val useOldInlineClassesManglingScheme: Boolean,
private val incompatibleClassTracker: IncompatibleClassTracker = IncompatibleClassTracker.DoNothing,
val jvmTarget: JvmTarget = JvmTarget.DEFAULT,
private val isIrBackend: Boolean = false,
@@ -91,6 +92,11 @@ class KotlinTypeMapper @JvmOverloads constructor(
) : KotlinTypeMapperBase() {
private val isReleaseCoroutines = languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines)
val jvmDefaultMode = languageVersionSettings.getFlag(JvmAnalysisFlags.jvmDefaultMode)
var useOldManglingRulesForFunctionAcceptingInlineClass: Boolean = useOldInlineClassesManglingScheme
set(value) {
require(!useOldInlineClassesManglingScheme)
field = value
}
private val typeMappingConfiguration = object : TypeMappingConfiguration<Type> {
override fun commonSupertype(types: Collection<KotlinType>): KotlinType {
@@ -636,7 +642,11 @@ class KotlinTypeMapper @JvmOverloads constructor(
// so that we don't have to repeat the same logic in reflection
// in case of properties without getter methods.
if (kind !== OwnerKind.PROPERTY_REFERENCE_SIGNATURE || descriptor.isPropertyWithGetterSignaturePresent()) {
val suffix = getManglingSuffixBasedOnKotlinSignature(descriptor, shouldMangleByReturnType)
val suffix = getManglingSuffixBasedOnKotlinSignature(
descriptor,
shouldMangleByReturnType,
useOldManglingRulesForFunctionAcceptingInlineClass
)
if (suffix != null) {
newName += suffix
} else if (kind === OwnerKind.ERASED_INLINE_CLASS) {

View File

@@ -7,8 +7,11 @@ package org.jetbrains.kotlin.codegen.state
import org.jetbrains.kotlin.codegen.coroutines.unwrapInitialDescriptorForSuspendFunction
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.name.FqNameUnsafe
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForParameterTypes
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForReturnType
@@ -17,9 +20,68 @@ import org.jetbrains.kotlin.types.typeUtil.representativeUpperBound
import java.security.MessageDigest
import java.util.*
const val NOT_INLINE_CLASS_PARAMETER_PLACEHOLDER = "_"
class InfoForMangling(
val fqName: FqNameUnsafe,
val isInline: Boolean,
val isNullable: Boolean
)
fun collectFunctionSignatureForManglingSuffix(
useOldManglingRules: Boolean,
requiresFunctionNameManglingForParameterTypes: Boolean,
fqNamesForMangling: List<InfoForMangling?>,
returnTypeInfo: InfoForMangling?,
): String? {
fun getSignatureElementForMangling(info: InfoForMangling?): String = buildString {
if (info == null) return ""
if (useOldManglingRules || info.isInline) {
append('L')
append(info.fqName)
if (info.isNullable) append('?')
append(';')
} else {
append(NOT_INLINE_CLASS_PARAMETER_PLACEHOLDER)
}
}
fun collectSignatureForMangling(): String =
fqNamesForMangling.joinToString(separator = if (useOldManglingRules) ", " else "") {
getSignatureElementForMangling(it)
}
if (useOldManglingRules) {
if (requiresFunctionNameManglingForParameterTypes) {
return collectSignatureForMangling()
}
// If a class member function returns inline class value, mangle its name.
// NB here function can be a suspend function JVM view with return type replaced with 'Any',
// should unwrap it and take original return type instead.
if (returnTypeInfo != null) {
return ":" + getSignatureElementForMangling(returnTypeInfo)
}
} else {
// If a function accepts inline class parameters, mangle its name.
if (requiresFunctionNameManglingForParameterTypes || returnTypeInfo != null) {
// If a class member function returns inline class value, mangle its name.
// NB here function can be a suspend function JVM view with return type replaced with 'Any',
// should unwrap it and take original return type instead.
val signature = collectSignatureForMangling() +
if (returnTypeInfo != null)
":" + getSignatureElementForMangling(returnTypeInfo)
else ""
return signature
}
}
return null
}
fun getManglingSuffixBasedOnKotlinSignature(
descriptor: CallableMemberDescriptor,
shouldMangleByReturnType: Boolean
shouldMangleByReturnType: Boolean,
useOldManglingRules: Boolean
): String? {
if (descriptor !is FunctionDescriptor) return null
if (descriptor is ConstructorDescriptor) return null
@@ -29,41 +91,33 @@ fun getManglingSuffixBasedOnKotlinSignature(
// Some stdlib functions ('Result.success', 'Result.failure') are annotated with '@JvmName' as a workaround for forward compatibility.
if (DescriptorUtils.hasJvmNameAnnotation(descriptor)) return null
// If a function accepts inline class parameters, mangle its name.
if (requiresFunctionNameManglingForParameterTypes(descriptor)) {
return "-" + md5base64(collectSignatureForMangling(descriptor))
}
val unwrappedDescriptor = descriptor.unwrapInitialDescriptorForSuspendFunction()
// If a class member function returns inline class value, mangle its name.
// NB here function can be a suspend function JVM view with return type replaced with 'Any',
// should unwrap it and take original return type instead.
if (shouldMangleByReturnType) {
val unwrappedDescriptor = descriptor.unwrapInitialDescriptorForSuspendFunction()
if (requiresFunctionNameManglingForReturnType(unwrappedDescriptor)) {
return "-" + md5base64(":" + getSignatureElementForMangling(unwrappedDescriptor.returnType!!))
}
}
return null
val resultNew = collectFunctionSignatureForManglingSuffix(
useOldManglingRules = useOldManglingRules,
requiresFunctionNameManglingForParameterTypes = requiresFunctionNameManglingForParameterTypes(descriptor),
fqNamesForMangling =
(listOfNotNull(descriptor.extensionReceiverParameter?.type) + descriptor.valueParameters.map { it.type })
.map { getInfoForMangling(it) },
returnTypeInfo =
if (shouldMangleByReturnType && requiresFunctionNameManglingForReturnType(unwrappedDescriptor))
getInfoForMangling(unwrappedDescriptor.returnType!!)
else null
)
return resultNew?.let { "-" + md5base64(it) }
}
private fun collectSignatureForMangling(descriptor: CallableMemberDescriptor): String {
val types = listOfNotNull(descriptor.extensionReceiverParameter?.type) + descriptor.valueParameters.map { it.type }
return types.joinToString { getSignatureElementForMangling(it) }
}
private fun getSignatureElementForMangling(type: KotlinType): String = buildString {
val descriptor = type.constructor.declarationDescriptor ?: return ""
when (descriptor) {
is ClassDescriptor -> {
append('L')
append(descriptor.fqNameUnsafe)
if (type.isMarkedNullable) append('?')
append(';')
}
private fun getInfoForMangling(type: KotlinType): InfoForMangling? {
val descriptor = type.constructor.declarationDescriptor ?: return null
return when (descriptor) {
is ClassDescriptor -> InfoForMangling(descriptor.fqNameUnsafe, descriptor.isInline, type.isMarkedNullable)
is TypeParameterDescriptor -> {
append(getSignatureElementForMangling(descriptor.representativeUpperBound))
getInfoForMangling(descriptor.representativeUpperBound)
}
else -> null
}
}

View File

@@ -57,14 +57,9 @@ dependencies {
testCompileOnly(project(it))
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
Platform[193].orLower {
testCompileOnly(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
testCompileOnly(intellijDep()) { includeJars("idea", "idea_rt", "util", "asm-all", rootProject = rootProject) }
Platform[192].orHigher {
testRuntimeOnly(intellijPluginDep("java"))
}
testRuntimeOnly(intellijPluginDep("java"))
testRuntime(project(":kotlin-reflect"))
testRuntime(androidDxJar())

View File

@@ -71,5 +71,7 @@
interface="org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.DescriptorSerializerPlugin"
interface="org.jetbrains.kotlin.serialization.DescriptorSerializerPlugin"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.defaultErrorMessages"
interface="org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages.Extension"/>
</extensionPoints>
</idea-plugin>

View File

@@ -352,12 +352,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var explicitApi: String by FreezableVar(ExplicitApiMode.DISABLED.state)
@Argument(
value = "-Xdeserialize-fake-overrides",
description = "Fallback to deserializing fake overrides"
)
var deserializeFakeOverrides: Boolean by FreezableVar(false)
@Argument(
value = "-Xinference-compatibility",
description = "Enable compatibility changes for generic type inference algorithm"

View File

@@ -125,6 +125,9 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xir-dce-print-reachability-info", description = "Print declarations' reachability info to stdout during performing DCE")
var irDcePrintReachabilityInfo: Boolean by FreezableVar(false)
@Argument(value = "-Xir-property-lazy-initialization", description = "Perform lazy initialization for properties")
var irPropertyLazyInitialization: Boolean by FreezableVar(false)
@Argument(value = "-Xir-only", description = "Disables pre-IR backend")
var irOnly: Boolean by FreezableVar(false)
@@ -172,12 +175,15 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xenable-js-scripting", description = "Enable experimental support of .kts files using K/JS (with -Xir only)")
var enableJsScripting: Boolean by FreezableVar(false)
@Argument(value = "-Xdisable-fake-override-validator", description = "Disable IR fake override validator")
var disableFakeOverrideValidator: Boolean by FreezableVar(false)
@Argument(value = "-Xfake-override-validator", description = "Enable IR fake override validator")
var fakeOverrideValidator: Boolean by FreezableVar(false)
@Argument(value = "-Xerror-tolerance-policy", description = "Set up error tolerance policy (NONE, SEMANTIC, SYNTAX, ALL)")
var errorTolerancePolicy: String? by NullableStringFreezableVar(null)
@Argument(value = "-Xwasm", description = "Use experimental WebAssembly compiler backend")
var wasm: Boolean by FreezableVar(false)
override fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
if (!isIrBackendEnabled()) return
@@ -196,4 +202,4 @@ fun K2JSCompilerArguments.isPreIrBackendDisabled(): Boolean =
irOnly || irProduceJs || irProduceKlibFile
fun K2JSCompilerArguments.isIrBackendEnabled(): Boolean =
irProduceKlibDir || irProduceJs || irProduceKlibFile
irProduceKlibDir || irProduceJs || irProduceKlibFile || wasm

View File

@@ -377,6 +377,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
)
var noKotlinNothingValueException: Boolean by FreezableVar(false)
@Argument(
value = "-Xno-reset-jar-timestamps",
description = "Do not reset jar entry timestamps to a fixed date"
)
var noResetJarTimestamps: Boolean by FreezableVar(false)
@Argument(
value = "-Xno-unified-null-checks",
description = "Use pre-1.4 exception types in null checks instead of java.lang.NPE. See KT-22275 for more details"
@@ -406,6 +412,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
)
var useOldSpilledVarTypeAnalysis: Boolean by FreezableVar(false)
@Argument(
value = "-Xuse-14-inline-classes-mangling-scheme",
description = "Use 1.4 inline classes mangling scheme instead of 1.4.30 one"
)
var useOldInlineClassesManglingScheme: Boolean by FreezableVar(false)
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
val result = super.configureAnalysisFlags(collector)
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics

View File

@@ -12,6 +12,7 @@ dependencies {
compile(project(":compiler:ir.backend.common"))
compile(project(":compiler:ir.serialization.js"))
compile(project(":compiler:backend.js"))
compile(project(":compiler:backend.wasm"))
compile(project(":js:js.translator"))
compile(project(":js:js.serializer"))
compile(project(":js:js.dce"))

View File

@@ -8,7 +8,10 @@ package org.jetbrains.kotlin.cli.js
import com.intellij.openapi.Disposable
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.util.text.StringUtil
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataVersion
import org.jetbrains.kotlin.backend.wasm.compileWasm
import org.jetbrains.kotlin.backend.wasm.wasmPhases
import org.jetbrains.kotlin.cli.common.*
import org.jetbrains.kotlin.cli.common.ExitCode.COMPILATION_ERROR
import org.jetbrains.kotlin.cli.common.ExitCode.OK
@@ -24,7 +27,10 @@ import org.jetbrains.kotlin.cli.common.messages.MessageUtil
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.IncrementalCompilation
import org.jetbrains.kotlin.config.Services
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.incremental.js.IncrementalDataProvider
@@ -34,6 +40,7 @@ import org.jetbrains.kotlin.ir.backend.js.*
import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrFactory
import org.jetbrains.kotlin.js.config.*
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.serialization.js.ModuleKind
import org.jetbrains.kotlin.util.Logger
@@ -216,6 +223,33 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
MainModule.SourceFiles(sourcesFiles)
}
if (arguments.wasm) {
val res = compileWasm(
projectJs,
mainModule,
AnalyzerWithCompilerReport(config.configuration),
config.configuration,
PhaseConfig(wasmPhases),
allDependencies = resolvedLibraries,
friendDependencies = friendDependencies,
exportedDeclarations = setOf(FqName("main"))
)
val outputWasmFile = outputFile.withReplacedExtensionOrNull(outputFile.extension, "wasm")!!
outputWasmFile.writeBytes(res.wasm)
val outputWatFile = outputFile.withReplacedExtensionOrNull(outputFile.extension, "wat")!!
outputWatFile.writeText(res.wat)
val runner = """
const wasmBinary = read(String.raw`${outputWasmFile.absoluteFile}`, 'binary');
const wasmModule = new WebAssembly.Module(wasmBinary);
const wasmInstance = new WebAssembly.Instance(wasmModule, { runtime, js_code });
wasmInstance.exports.main();
""".trimIndent()
outputFile.writeText(res.js + "\n" + runner)
return OK
}
val compiledModule = try {
compile(
projectJs,
@@ -230,7 +264,8 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
generateDceJs = arguments.irDce,
dceDriven = arguments.irDceDriven,
multiModule = arguments.irPerModule,
relativeRequirePath = true
relativeRequirePath = true,
propertyLazyInitialization = arguments.irPropertyLazyInitialization,
)
} catch (e: JsIrCompilationError) {
return COMPILATION_ERROR
@@ -333,7 +368,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
}
configuration.put(JSConfigurationKeys.PRINT_REACHABILITY_INFO, arguments.irDcePrintReachabilityInfo)
configuration.put(JSConfigurationKeys.DISABLE_FAKE_OVERRIDE_VALIDATOR, arguments.disableFakeOverrideValidator)
configuration.put(JSConfigurationKeys.FAKE_OVERRIDE_VALIDATOR, arguments.fakeOverrideValidator)
}
override fun executableScriptFileName(): String {

View File

@@ -27,7 +27,6 @@ fun <A : CommonCompilerArguments> CompilerConfiguration.setupCommonArguments(
put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, arguments.expectActualLinker)
putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot)
put(CommonConfigurationKeys.REPORT_OUTPUT_FILES, arguments.reportOutputFiles)
put(CommonConfigurationKeys.DESERIALIZE_FAKE_OVERRIDES, arguments.deserializeFakeOverrides)
val metadataVersionString = arguments.metadataVersion
if (metadataVersionString != null) {

View File

@@ -87,6 +87,7 @@ class CliLightClassGenerationSupport(
ClassBuilderMode.LIGHT_CLASSES,
moduleName,
languageVersionSettings,
useOldInlineClassesManglingScheme = false,
jvmTarget = JvmTarget.JVM_1_8,
typePreprocessor = KotlinType::cleanFromAnonymousTypes,
namePreprocessor = ::tryGetPredefinedName

View File

@@ -31,11 +31,15 @@ import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
import org.jetbrains.kotlin.utils.PathUtil;
import java.io.*;
import java.util.*;
import java.util.jar.*;
import static org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.ERROR;
public class CompileEnvironmentUtil {
public static long DOS_EPOCH = new GregorianCalendar(1980, Calendar.JANUARY, 1, 0, 0, 0).getTimeInMillis();
@NotNull
public static ModuleChunk loadModuleChunk(File buildFile, MessageCollector messageCollector) {
if (!buildFile.exists()) {
@@ -51,7 +55,11 @@ public class CompileEnvironmentUtil {
// TODO: includeRuntime should be not a flag but a path to runtime
private static void doWriteToJar(
OutputFileCollection outputFiles, OutputStream fos, @Nullable FqName mainClass, boolean includeRuntime
OutputFileCollection outputFiles,
OutputStream fos,
@Nullable FqName mainClass,
boolean includeRuntime,
boolean resetJarTimestamps
) {
try {
Manifest manifest = new Manifest();
@@ -61,13 +69,25 @@ public class CompileEnvironmentUtil {
if (mainClass != null) {
mainAttributes.putValue("Main-Class", mainClass.asString());
}
JarOutputStream stream = new JarOutputStream(fos, manifest);
JarOutputStream stream = new JarOutputStream(fos);
JarEntry manifestEntry = new JarEntry(JarFile.MANIFEST_NAME);
if (resetJarTimestamps) {
manifestEntry.setTime(DOS_EPOCH);
}
stream.putNextEntry(manifestEntry);
manifest.write(new BufferedOutputStream(stream));
for (OutputFile outputFile : outputFiles.asList()) {
stream.putNextEntry(new JarEntry(outputFile.getRelativePath()));
JarEntry entry = new JarEntry(outputFile.getRelativePath());
if (resetJarTimestamps) {
entry.setTime(DOS_EPOCH);
}
stream.putNextEntry(entry);
stream.write(outputFile.asByteArray());
}
if (includeRuntime) {
writeRuntimeToJar(stream);
writeRuntimeToJar(stream, resetJarTimestamps);
}
stream.finish();
}
@@ -76,11 +96,13 @@ public class CompileEnvironmentUtil {
}
}
public static void writeToJar(File jarPath, boolean jarRuntime, FqName mainClass, OutputFileCollection outputFiles) {
public static void writeToJar(
File jarPath, boolean jarRuntime, boolean resetJarTimestamps, FqName mainClass, OutputFileCollection outputFiles
) {
FileOutputStream outputStream = null;
try {
outputStream = new FileOutputStream(jarPath);
doWriteToJar(outputFiles, outputStream, mainClass, jarRuntime);
doWriteToJar(outputFiles, outputStream, mainClass, jarRuntime, resetJarTimestamps);
outputStream.close();
}
catch (FileNotFoundException e) {
@@ -94,21 +116,24 @@ public class CompileEnvironmentUtil {
}
}
private static void writeRuntimeToJar(JarOutputStream stream) throws IOException {
private static void writeRuntimeToJar(JarOutputStream stream, boolean resetJarTimestamps) throws IOException {
File stdlibPath = PathUtil.getKotlinPathsForCompiler().getStdlibPath();
if (!stdlibPath.exists()) {
throw new CompileEnvironmentException("Couldn't find kotlin-stdlib at " + stdlibPath);
}
copyJarImpl(stream, stdlibPath);
copyJarImpl(stream, stdlibPath, resetJarTimestamps);
}
private static void copyJarImpl(JarOutputStream stream, File jarPath) throws IOException {
private static void copyJarImpl(JarOutputStream stream, File jarPath, boolean resetJarTimestamps) throws IOException {
try (JarInputStream jis = new JarInputStream(new FileInputStream(jarPath))) {
while (true) {
JarEntry e = jis.getNextJarEntry();
if (e == null) {
break;
}
if (resetJarTimestamps) {
e.setTime(DOS_EPOCH);
}
if (FileUtilRt.extensionEquals(e.getName(), "class")) {
stream.putNextEntry(e);
FileUtil.copy(jis, stream);

View File

@@ -1,150 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.cli.jvm.compiler;
import com.intellij.codeInsight.ContainerProvider;
import com.intellij.codeInsight.JavaContainerProvider;
import com.intellij.codeInsight.folding.JavaCodeFoldingSettings;
import com.intellij.codeInsight.folding.impl.JavaCodeFoldingSettingsBase;
import com.intellij.codeInsight.folding.impl.JavaFoldingBuilderBase;
import com.intellij.codeInsight.runner.JavaMainMethodProvider;
import com.intellij.core.CoreApplicationEnvironment;
import com.intellij.core.CoreJavaDirectoryService;
import com.intellij.core.CorePsiPackageImplementationHelper;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.ide.highlighter.JavaClassFileType;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.lang.LanguageASTFactory;
import com.intellij.lang.MetaLanguage;
import com.intellij.lang.folding.LanguageFolding;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.lang.java.JavaParserDefinition;
import com.intellij.navigation.ItemPresentationProviders;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.ExtensionsArea;
import com.intellij.openapi.fileTypes.FileTypeExtensionPoint;
import com.intellij.openapi.fileTypes.PlainTextFileType;
import com.intellij.openapi.fileTypes.PlainTextLanguage;
import com.intellij.openapi.fileTypes.PlainTextParserDefinition;
import com.intellij.openapi.projectRoots.JavaVersionService;
import com.intellij.openapi.vfs.VirtualFileSystem;
import com.intellij.psi.*;
import com.intellij.psi.augment.PsiAugmentProvider;
import com.intellij.psi.augment.TypeAnnotationModifier;
import com.intellij.psi.compiled.ClassFileDecompilers;
import com.intellij.psi.impl.LanguageConstantExpressionEvaluator;
import com.intellij.psi.impl.PsiExpressionEvaluator;
import com.intellij.psi.impl.PsiSubstitutorFactoryImpl;
import com.intellij.psi.impl.compiled.ClassFileStubBuilder;
import com.intellij.psi.impl.file.PsiPackageImplementationHelper;
import com.intellij.psi.impl.search.MethodSuperSearcher;
import com.intellij.psi.impl.source.tree.JavaASTFactory;
import com.intellij.psi.impl.source.tree.PlainTextASTFactory;
import com.intellij.psi.meta.MetaDataContributor;
import com.intellij.psi.presentation.java.*;
import com.intellij.psi.search.searches.SuperMethodsSearch;
import com.intellij.psi.stubs.BinaryFileStubBuilders;
import com.intellij.util.QueryExecutor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem;
/**
* adapted from com.intellij.core.JavaCoreApplicationEnvironment
* TODO: initiate removal original from com.intellij.core since it seems that there are no usages left
*/
public class KotlinCoreApplicationEnvironment extends CoreApplicationEnvironment {
public static KotlinCoreApplicationEnvironment create(@NotNull Disposable parentDisposable, boolean unitTestMode) {
return new KotlinCoreApplicationEnvironment(parentDisposable, unitTestMode);
}
private KotlinCoreApplicationEnvironment(@NotNull Disposable parentDisposable, boolean unitTestMode) {
super(parentDisposable, unitTestMode);
registerExtensionPoints();
registerExtensions();
}
private void registerExtensionPoints() {
ExtensionsArea area = Extensions.getRootArea();
CoreApplicationEnvironment.registerExtensionPoint(area, BinaryFileStubBuilders.EP_NAME, FileTypeExtensionPoint.class);
CoreApplicationEnvironment.registerExtensionPoint(area, FileContextProvider.EP_NAME, FileContextProvider.class);
CoreApplicationEnvironment.registerExtensionPoint(area, MetaDataContributor.EP_NAME, MetaDataContributor.class);
CoreApplicationEnvironment.registerExtensionPoint(area, PsiAugmentProvider.EP_NAME, PsiAugmentProvider.class);
CoreApplicationEnvironment.registerExtensionPoint(area, JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider.class);
CoreApplicationEnvironment.registerExtensionPoint(area, ContainerProvider.EP_NAME, ContainerProvider.class);
CoreApplicationEnvironment.registerExtensionPoint(area, ClassFileDecompilers.EP_NAME, ClassFileDecompilers.Decompiler.class);
CoreApplicationEnvironment.registerExtensionPoint(area, TypeAnnotationModifier.EP_NAME, TypeAnnotationModifier.class);
CoreApplicationEnvironment.registerExtensionPoint(area, MetaLanguage.EP_NAME, MetaLanguage.class);
IdeaExtensionPoints.INSTANCE.registerVersionSpecificAppExtensionPoints(area);
}
private void registerExtensions() {
registerFileType(JavaClassFileType.INSTANCE, "class");
registerFileType(JavaFileType.INSTANCE, "java");
registerFileType(ArchiveFileType.INSTANCE, "jar;zip");
registerFileType(PlainTextFileType.INSTANCE, "txt;sh;bat;cmd;policy;log;cgi;MF;jad;jam;htaccess");
addExplicitExtension(LanguageASTFactory.INSTANCE, PlainTextLanguage.INSTANCE, new PlainTextASTFactory());
registerParserDefinition(new PlainTextParserDefinition());
addExplicitExtension(FileTypeFileViewProviders.INSTANCE, JavaClassFileType.INSTANCE, new ClassFileViewProviderFactory());
addExplicitExtension(BinaryFileStubBuilders.INSTANCE, JavaClassFileType.INSTANCE, new ClassFileStubBuilder());
addExplicitExtension(LanguageASTFactory.INSTANCE, JavaLanguage.INSTANCE, new JavaASTFactory());
registerParserDefinition(new JavaParserDefinition());
addExplicitExtension(LanguageConstantExpressionEvaluator.INSTANCE, JavaLanguage.INSTANCE, new PsiExpressionEvaluator());
addExtension(ContainerProvider.EP_NAME, new JavaContainerProvider());
myApplication.registerService(PsiPackageImplementationHelper.class, new CorePsiPackageImplementationHelper());
myApplication.registerService(PsiSubstitutorFactory.class, new PsiSubstitutorFactoryImpl());
myApplication.registerService(JavaDirectoryService.class, createJavaDirectoryService());
myApplication.registerService(JavaVersionService.class, new JavaVersionService());
addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiPackage.class, new PackagePresentationProvider());
addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiClass.class, new ClassPresentationProvider());
addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiMethod.class, new MethodPresentationProvider());
addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiField.class, new FieldPresentationProvider());
addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiLocalVariable.class, new VariablePresentationProvider());
addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiParameter.class, new VariablePresentationProvider());
registerApplicationService(JavaCodeFoldingSettings.class, new JavaCodeFoldingSettingsBase());
addExplicitExtension(LanguageFolding.INSTANCE, JavaLanguage.INSTANCE, new JavaFoldingBuilderBase() {
@Override
protected boolean shouldShowExplicitLambdaType(@NotNull PsiAnonymousClass anonymousClass, @NotNull PsiNewExpression expression) {
return false;
}
@Override
protected boolean isBelowRightMargin(@NotNull PsiFile file, int lineLength) {
return false;
}
});
registerApplicationExtensionPoint(SuperMethodsSearch.EP_NAME, QueryExecutor.class);
addExtension(SuperMethodsSearch.EP_NAME, new MethodSuperSearcher());
}
// overridden in upsource
protected CoreJavaDirectoryService createJavaDirectoryService() {
return new CoreJavaDirectoryService();
}
@Nullable
@Override
protected VirtualFileSystem createJrtFileSystem() {
return new CoreJrtFileSystem();
}
}

View File

@@ -102,6 +102,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
import org.jetbrains.kotlin.serialization.DescriptorSerializerPlugin
import org.jetbrains.kotlin.utils.PathUtil
import java.io.File
import java.nio.file.FileSystems
import java.util.zip.ZipFile
class KotlinCoreEnvironment private constructor(
@@ -536,7 +537,11 @@ class KotlinCoreEnvironment private constructor(
"(cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})"
)
registerExtensionPointAndExtensionsEx(pluginRoot, configFilePath, Extensions.getRootArea())
CoreApplicationEnvironment.registerExtensionPointAndExtensions(
FileSystems.getDefault().getPath(pluginRoot.path),
configFilePath,
Extensions.getRootArea()
)
}
@JvmStatic

View File

@@ -106,6 +106,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
import org.jetbrains.kotlin.serialization.DescriptorSerializerPlugin
import org.jetbrains.kotlin.utils.PathUtil
import java.io.File
import java.nio.file.FileSystems
import java.util.zip.ZipFile
class KotlinCoreEnvironment private constructor(
@@ -534,7 +535,11 @@ class KotlinCoreEnvironment private constructor(
"(cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})"
)
registerExtensionPointAndExtensionsEx(pluginRoot, configFilePath, Extensions.getRootArea())
CoreApplicationEnvironment.registerExtensionPointAndExtensions(
FileSystems.getDefault().getPath(pluginRoot.path),
configFilePath,
Extensions.getRootArea()
)
}
@JvmStatic

View File

@@ -25,12 +25,12 @@ import com.intellij.psi.search.DelegatingGlobalSearchScope
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.search.ProjectScope
import org.jetbrains.kotlin.analyzer.AnalysisResult
import org.jetbrains.kotlin.analyzer.ModuleInfo
import org.jetbrains.kotlin.asJava.FilteredJvmDiagnostics
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection
import org.jetbrains.kotlin.backend.common.output.SimpleOutputFileCollection
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
import org.jetbrains.kotlin.backend.jvm.JvmGeneratorExtensions
import org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory
import org.jetbrains.kotlin.backend.jvm.jvmPhases
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
@@ -55,13 +55,13 @@ import org.jetbrains.kotlin.container.get
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.diagnostics.*
import org.jetbrains.kotlin.fir.FirPsiSourceElement
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.analysis.FirAnalyzerFacade
import org.jetbrains.kotlin.fir.analysis.diagnostics.*
import org.jetbrains.kotlin.fir.backend.jvm.FirJvmBackendClassResolver
import org.jetbrains.kotlin.fir.backend.jvm.FirMetadataSerializer
import org.jetbrains.kotlin.fir.checkers.registerExtendedCommonCheckers
import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider
import org.jetbrains.kotlin.fir.session.FirJvmModuleInfo
import org.jetbrains.kotlin.fir.session.FirSessionFactory
import org.jetbrains.kotlin.ir.backend.jvm.jvmResolveLibraries
import org.jetbrains.kotlin.javac.JavacWrapper
@@ -69,16 +69,11 @@ import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
import org.jetbrains.kotlin.modules.Module
import org.jetbrains.kotlin.modules.TargetId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.CompilerEnvironment
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
import org.jetbrains.kotlin.resolve.diagnostics.SimpleDiagnostics
import org.jetbrains.kotlin.resolve.jvm.KotlinJavaPsiFacade
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
import org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProviderFactory
import org.jetbrains.kotlin.utils.newLinkedHashMapWithExpectedSize
import java.io.File
@@ -94,7 +89,8 @@ object KotlinToJVMBytecodeCompiler {
val messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE)
if (jarPath != null) {
val includeRuntime = configuration.get(JVMConfigurationKeys.INCLUDE_RUNTIME, false)
CompileEnvironmentUtil.writeToJar(jarPath, includeRuntime, mainClassFqName, outputFiles)
val resetJarTimestamps = !configuration.get(JVMConfigurationKeys.NO_RESET_JAR_TIMESTAMPS, false)
CompileEnvironmentUtil.writeToJar(jarPath, includeRuntime, resetJarTimestamps, mainClassFqName, outputFiles)
if (reportOutputFiles) {
val message = OutputMessageUtil.formatOutputMessage(outputFiles.asList().flatMap { it.sourceFiles }.distinct(), jarPath)
messageCollector.report(OUTPUT, message)
@@ -326,43 +322,26 @@ object KotlinToJVMBytecodeCompiler {
val scope = GlobalSearchScope.filesScope(project, ktFiles.map { it.virtualFile })
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(project))
val provider = FirProjectSessionProvider(project)
val provider = FirProjectSessionProvider()
class FirJvmModuleInfo(override val name: Name) : ModuleInfo {
constructor(moduleName: String) : this(Name.identifier(moduleName))
val librariesModuleInfo = FirJvmModuleInfo.createForLibraries()
val librariesScope = ProjectScope.getLibrariesScope(project)
FirSessionFactory.createLibrarySession(
librariesModuleInfo, provider, librariesScope,
project, environment.createPackagePartProvider(librariesScope)
)
val dependencies: MutableList<ModuleInfo> = mutableListOf()
override val platform: TargetPlatform
get() = JvmPlatforms.unspecifiedJvmPlatform
override val analyzerServices: PlatformDependentAnalyzerServices
get() = JvmPlatformAnalyzerServices
override fun dependencies(): List<ModuleInfo> {
return dependencies
}
}
val moduleInfo = FirJvmModuleInfo(module.getModuleName())
val session: FirSession = FirSessionFactory.createJavaModuleBasedSession(moduleInfo, provider, scope) {
val moduleInfo = FirJvmModuleInfo(module.getModuleName(), listOf(librariesModuleInfo))
val session = FirSessionFactory.createJavaModuleBasedSession(moduleInfo, provider, scope, project) {
if (extendedAnalysisMode) {
registerExtendedCommonCheckers()
}
}.also {
val dependenciesInfo = FirJvmModuleInfo(Name.special("<dependencies>"))
moduleInfo.dependencies.add(dependenciesInfo)
val librariesScope = ProjectScope.getLibrariesScope(project)
FirSessionFactory.createLibrarySession(
dependenciesInfo, provider, librariesScope,
project, environment.createPackagePartProvider(librariesScope)
)
}
val firAnalyzerFacade = FirAnalyzerFacade(session, moduleConfiguration.languageVersionSettings, ktFiles)
firAnalyzerFacade.runResolution()
val firDiagnostics = firAnalyzerFacade.runCheckers()
val firDiagnostics = firAnalyzerFacade.runCheckers().values.flatten()
AnalyzerWithCompilerReport.reportDiagnostics(
SimpleDiagnostics(
firDiagnostics.map { it.toRegularDiagnostic() }
@@ -378,7 +357,8 @@ object KotlinToJVMBytecodeCompiler {
performanceManager?.notifyGenerationStarted()
performanceManager?.notifyIRTranslationStarted()
val (moduleFragment, symbolTable, sourceManager, components) = firAnalyzerFacade.convertToIr()
val extensions = JvmGeneratorExtensions()
val (moduleFragment, symbolTable, sourceManager, components) = firAnalyzerFacade.convertToIr(extensions)
performanceManager?.notifyIRTranslationFinished()
@@ -414,7 +394,7 @@ object KotlinToJVMBytecodeCompiler {
performanceManager?.notifyIRGenerationStarted()
generationState.beforeCompile()
codegenFactory.generateModuleInFrontendIRMode(
generationState, moduleFragment, symbolTable, sourceManager
generationState, moduleFragment, symbolTable, sourceManager, extensions
) { context, irClass, _, serializationBindings, parent ->
FirMetadataSerializer(session, context, irClass, serializationBindings, parent)
}

View File

@@ -1,61 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.cli.jvm.compiler
import com.intellij.codeInsight.ExternalAnnotationsManager
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.*
class MockExternalAnnotationsManager : ExternalAnnotationsManager() {
override fun chooseAnnotationsPlace(element: PsiElement): AnnotationPlace = AnnotationPlace.NOWHERE
override fun isExternalAnnotationWritable(listOwner: PsiModifierListOwner, annotationFQN: String): Boolean = false
override fun isExternalAnnotation(annotation: PsiAnnotation): Boolean = false
override fun findExternalAnnotationsFiles(listOwner: PsiModifierListOwner): List<PsiFile>? = null
override fun findExternalAnnotation(listOwner: PsiModifierListOwner, annotationFQN: String): PsiAnnotation? = null
override fun findExternalAnnotations(listOwner: PsiModifierListOwner): Array<out PsiAnnotation>? = null
override fun annotateExternally(
listOwner: PsiModifierListOwner,
annotationFQName: String,
fromFile: PsiFile,
value: Array<out PsiNameValuePair>?
) {
throw UnsupportedOperationException("not implemented")
}
override fun deannotate(listOwner: PsiModifierListOwner, annotationFQN: String): Boolean {
throw UnsupportedOperationException("not implemented")
}
override fun editExternalAnnotation(
listOwner: PsiModifierListOwner,
annotationFQN: String,
value: Array<out PsiNameValuePair>?
): Boolean {
throw UnsupportedOperationException("not implemented")
}
override fun hasAnnotationRootsForFile(file: VirtualFile): Boolean = false
override fun findDefaultConstructorExternalAnnotations(aClass: PsiClass, annotationFQN: String): List<PsiAnnotation> = emptyList()
override fun findDefaultConstructorExternalAnnotations(aClass: PsiClass): List<PsiAnnotation> = emptyList()
override fun findExternalAnnotations(listOwner: PsiModifierListOwner, annotationFQN: String): List<PsiAnnotation> = emptyList()
}

View File

@@ -1,9 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.cli.jvm.compiler
fun setupIdeaStandaloneExecution() {
}

View File

@@ -1,18 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.cli.jvm.compiler
import com.intellij.core.CoreApplicationEnvironment
import com.intellij.openapi.extensions.ExtensionsArea
import java.io.File
import java.nio.file.FileSystems
// FIX ME WHEN BUNCH 193 REMOVED
fun registerExtensionPointAndExtensionsEx(pluginFile: File, fileName: String, area: ExtensionsArea) {
val pluginRoot = FileSystems.getDefault().getPath(pluginFile.path)
@Suppress("MissingRecentApi")
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginRoot, fileName, area)
}

View File

@@ -1,16 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.cli.jvm.compiler
import com.intellij.core.CoreApplicationEnvironment
import com.intellij.openapi.extensions.ExtensionsArea
import java.io.File
// FIX ME WHEN BUNCH 193 REMOVED
fun registerExtensionPointAndExtensionsEx(pluginFile: File, fileName: String, area: ExtensionsArea) {
@Suppress("MissingRecentApi")
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginFile, fileName, area)
}

View File

@@ -61,8 +61,8 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
}
} else {
messageCollector.report(
ERROR, "Unknown `string-concat` mode: ${arguments.jvmTarget}\n" +
"Supported versions: ${JvmStringConcat.values().joinToString { it.name.toLowerCase() }}"
ERROR, "Unknown -Xstring-concat mode: ${arguments.jvmTarget}\n" +
"Supported versions: ${JvmStringConcat.values().joinToString { it.description }}"
)
}
}
@@ -185,6 +185,7 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
put(JVMConfigurationKeys.EMIT_JVM_TYPE_ANNOTATIONS, arguments.emitJvmTypeAnnotations)
put(JVMConfigurationKeys.NO_OPTIMIZED_CALLABLE_REFERENCES, arguments.noOptimizedCallableReferences)
put(JVMConfigurationKeys.NO_KOTLIN_NOTHING_VALUE_EXCEPTION, arguments.noKotlinNothingValueException)
put(JVMConfigurationKeys.NO_RESET_JAR_TIMESTAMPS, arguments.noResetJarTimestamps)
put(JVMConfigurationKeys.NO_UNIFIED_NULL_CHECKS, arguments.noUnifiedNullChecks)
if (!JVMConstructorCallNormalizationMode.isSupportedValue(arguments.constructorCallNormalizationMode)) {
@@ -230,6 +231,7 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
put(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE, arguments.allowKotlinPackage)
put(JVMConfigurationKeys.USE_SINGLE_MODULE, arguments.singleModule)
put(JVMConfigurationKeys.USE_OLD_SPILLED_VAR_TYPE_ANALYSIS, arguments.useOldSpilledVarTypeAnalysis)
put(JVMConfigurationKeys.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME, arguments.useOldInlineClassesManglingScheme)
arguments.declarationsOutputPath?.let { put(JVMConfigurationKeys.DECLARATIONS_JSON_PATH, it) }
}

View File

@@ -129,9 +129,15 @@ public class JVMConfigurationKeys {
public static final CompilerConfigurationKey<Boolean> NO_KOTLIN_NOTHING_VALUE_EXCEPTION =
CompilerConfigurationKey.create("Do not use KotlinNothingValueException available since 1.4");
public static final CompilerConfigurationKey<Boolean> NO_RESET_JAR_TIMESTAMPS =
CompilerConfigurationKey.create("Do not reset timestamps in jar entries");
public static final CompilerConfigurationKey<Boolean> NO_UNIFIED_NULL_CHECKS =
CompilerConfigurationKey.create("Use pre-1.4 exception types in null checks instead of java.lang.NPE");
public static final CompilerConfigurationKey<Boolean> USE_OLD_SPILLED_VAR_TYPE_ANALYSIS =
CompilerConfigurationKey.create("Use old, SourceInterpreter-based analysis for fields, used for spilled variables in coroutines");
public static final CompilerConfigurationKey<Boolean> USE_OLD_INLINE_CLASSES_MANGLING_SCHEME =
CompilerConfigurationKey.create("Use old, 1.4 version of inline classes mangling scheme");
}

View File

@@ -48,9 +48,6 @@ object CommonConfigurationKeys {
@JvmField
val EXPECT_ACTUAL_LINKER = CompilerConfigurationKey.create<Boolean>("Experimental expext/actual linker")
@JvmField
val DESERIALIZE_FAKE_OVERRIDES = CompilerConfigurationKey.create<Boolean>("Deserialize fake overrides")
@JvmField
val USE_FIR_EXTENDED_CHECKERS = CompilerConfigurationKey.create<Boolean>("fir extended checkers")
}

View File

@@ -25,6 +25,7 @@ import java.io.File
import java.io.Serializable
import java.net.SocketException
import java.nio.channels.ClosedChannelException
import java.nio.file.Files
import java.rmi.ConnectException
import java.rmi.ConnectIOException
import java.rmi.UnmarshalException
@@ -422,7 +423,7 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
report: (DaemonReportCategory, String) -> Unit
): Deferred<Pair<CompileServiceAsync?, DaemonJVMOptions>> = GlobalScope.async {
registryDir.mkdirs()
val timestampMarker = createTempFile("kotlin-daemon-client-tsmarker", directory = registryDir)
val timestampMarker = Files.createTempFile(registryDir.toPath(), "kotlin-daemon-client-tsmarker", null).toFile()
val aliveWithMetadata = try {
walkDaemonsAsync(registryDir, compilerId, timestampMarker, report = report)
} finally {

View File

@@ -26,6 +26,7 @@ import java.io.File
import java.io.OutputStream
import java.io.PrintStream
import java.net.SocketException
import java.nio.file.Files
import java.rmi.ConnectException
import java.rmi.ConnectIOException
import java.rmi.UnmarshalException
@@ -347,7 +348,7 @@ object KotlinCompilerClient {
private fun tryFindSuitableDaemonOrNewOpts(registryDir: File, compilerId: CompilerId, daemonJVMOptions: DaemonJVMOptions, report: (DaemonReportCategory, String) -> Unit): Pair<CompileService?, DaemonJVMOptions> {
registryDir.mkdirs()
val timestampMarker = createTempFile("kotlin-daemon-client-tsmarker", directory = registryDir)
val timestampMarker = Files.createTempFile(registryDir.toPath(), "kotlin-daemon-client-tsmarker", null).toFile()
val aliveWithMetadata = try {
walkDaemons(registryDir, compilerId, timestampMarker, report = report).toList()
}

View File

@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.daemon.common
import java.io.File
import java.nio.file.Files
import java.rmi.registry.LocateRegistry
@@ -106,7 +107,12 @@ private inline fun tryConnectToDaemon(port: Int, report: (DaemonReportCategory,
private const val validFlagFileKeywordChars = "abcdefghijklmnopqrstuvwxyz0123456789-_"
fun makeAutodeletingFlagFile(keyword: String = "compiler-client", baseDir: File? = null): File {
val flagFile = File.createTempFile("kotlin-${keyword.filter { validFlagFileKeywordChars.contains(it.toLowerCase()) }}-", "-is-running", baseDir?.takeIf { it.isDirectory && it.exists() })
val prefix = "kotlin-${keyword.filter { validFlagFileKeywordChars.contains(it.toLowerCase()) }}-"
val flagFile = if (baseDir?.isDirectory == true)
Files.createTempFile(baseDir.toPath(), prefix, "-is-running").toFile()
else
Files.createTempFile(prefix, "-is-running").toFile()
flagFile.deleteOnExit()
return flagFile
}

View File

@@ -29,6 +29,7 @@ enum class CompilationResultCategory(val code: Int) {
IC_COMPILE_ITERATION(0),
BUILD_REPORT_LINES(1),
VERBOSE_BUILD_REPORT_LINES(2),
BUILD_METRICS(3)
}
interface CompilationResultsAsync {

View File

@@ -35,7 +35,10 @@ import java.io.ByteArrayOutputStream
import java.io.File
import java.io.PrintStream
import java.net.URLClassLoader
import java.nio.file.Path
import kotlin.io.path.*
@OptIn(ExperimentalPathApi::class)
class CompilerApiTest : KotlinIntegrationTestBase() {
private val compilerLibDir = getCompilerLib()
@@ -119,7 +122,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
verbose = true,
reportPerf = true)
val logFile = createTempFile("kotlin-daemon-test.", ".log")
val logFile: Path = createTempFile("kotlin-daemon-test.", ".log")
val daemonJVMOptions = configureDaemonJVMOptions("D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${logFile.loggerCompatiblePath}\"",
inheritMemoryLimits = false, inheritOtherJvmOptions = false, inheritAdditionalProperties = false)
@@ -137,7 +140,8 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
}
finally {
KotlinCompilerClient.shutdownCompileService(compilerId, daemonOptions)
logFile.delete()
runCatching { logFile.deleteIfExists() }
.onFailure { e -> println("Failed to delete log file: $e") }
}
}
}
@@ -158,7 +162,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
verbose = true,
reportPerf = true)
val logFile = createTempFile("kotlin-daemon-test.", ".log")
val logFile: Path = createTempFile("kotlin-daemon-test.", ".log")
val daemonJVMOptions = configureDaemonJVMOptions("D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${logFile.loggerCompatiblePath}\"",
inheritMemoryLimits = false, inheritOtherJvmOptions = false, inheritAdditionalProperties = false)
@@ -174,7 +178,8 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
}
finally {
KotlinCompilerClient.shutdownCompileService(compilerId, daemonOptions)
logFile.delete()
runCatching { logFile.deleteIfExists() }
.onFailure { e -> println("Failed to delete log file: $e") }
}
}
}

View File

@@ -36,10 +36,13 @@ import java.lang.management.ManagementFactory
import java.net.URL
import java.net.URLClassLoader
import java.nio.charset.Charset
import java.nio.file.Path
import java.rmi.server.UnicastRemoteObject
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import kotlin.concurrent.thread
import kotlin.io.path.ExperimentalPathApi
import kotlin.io.path.invariantSeparatorsPath
import kotlin.script.dependencies.Environment
import kotlin.script.dependencies.ScriptContents
import kotlin.script.experimental.dependencies.DependenciesResolver
@@ -997,9 +1000,12 @@ internal inline fun withLogFile(prefix: String, suffix: String = ".log", printLo
// if file path is given in windows form (using backslash as a separator); the reason is unknown
// this function makes a path with forward slashed, that works on windows too
internal val File.loggerCompatiblePath: String
get() =
if (OSKind.current == OSKind.Windows) absolutePath.replace('\\', '/')
else absolutePath
get() = invariantSeparatorsPath
@OptIn(ExperimentalPathApi::class)
internal val Path.loggerCompatiblePath: String
get() = invariantSeparatorsPath
open class TestKotlinScriptDummyDependenciesResolver : DependenciesResolver {

View File

@@ -28,13 +28,16 @@ import org.junit.Assert
import org.junit.runner.RunWith
import java.io.File
import java.net.URLClassLoader
import java.nio.file.Path
import java.util.logging.LogManager
import java.util.logging.Logger
import kotlin.io.path.*
private val logFiles = arrayListOf<String>()
// TODO: remove ignore annotation from tests.
@OptIn(ExperimentalPathApi::class)
@RunWith(IgnoreAll::class)
class CompilerApiTest : KotlinIntegrationTestBase() {
@@ -43,7 +46,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
private val compilerLibDir = getCompilerLib()
private fun createNewLogFile(): File {
private fun createNewLogFile(): Path {
println("creating logFile")
val newLogFile = createTempFile("kotlin-daemon-experimental-test.", ".log")
println("logFile created (${newLogFile.loggerCompatiblePath})")
@@ -51,7 +54,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
return newLogFile
}
private val currentLogFile: File by lazy {
private val currentLogFile: Path by lazy {
val newLogFile = createNewLogFile()
val cfg: String =
"handlers = java.util.logging.FileHandler\n" +
@@ -67,7 +70,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
newLogFile
}
private val externalLogFile: File by lazy { createNewLogFile() }
private val externalLogFile: Path by lazy { createNewLogFile() }
private val log by lazy {
currentLogFile

View File

@@ -3,6 +3,8 @@
* that can be found in the license/LICENSE.txt file.
*/
@file:OptIn(ExperimentalPathApi::class)
package org.jetbrains.kotlin.daemon.experimental.integration
import junit.framework.TestCase
@@ -38,6 +40,7 @@ import java.net.URL
import java.net.URLClassLoader
import java.nio.channels.ClosedChannelException
import java.nio.charset.Charset
import java.nio.file.Path
import java.rmi.ConnectException
import java.rmi.ConnectIOException
import java.rmi.UnmarshalException
@@ -46,6 +49,7 @@ import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import java.util.logging.LogManager
import kotlin.concurrent.thread
import kotlin.io.path.*
import kotlin.script.dependencies.Environment
import kotlin.script.dependencies.ScriptContents
import kotlin.script.experimental.dependencies.DependenciesResolver
@@ -64,7 +68,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
val kotlinCompilerClientInstance = KotlinCompilerDaemonClient.instantiate(DaemonProtocolVariant.SOCKETS)
private fun createNewLogFile(): File {
private fun createNewLogFile(): Path {
println("creating logFile")
val newLogFile = createTempFile("kotlin-daemon-experimental-test.", ".log")
println("logFile created (${newLogFile.loggerCompatiblePath})")
@@ -595,8 +599,8 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
shutdownDelayMilliseconds = 1,
runFilesPath = File(tmpdir, getTestName(true)).absolutePath
)
val clientFlag = createTempFile(getTestName(true), "-client.alive")
val sessionFlag = createTempFile(getTestName(true), "-session.alive")
val clientFlag = createTempFile(getTestName(true), "-client.alive").toFile()
val sessionFlag = createTempFile(getTestName(true), "-session.alive").toFile()
try {
withLogFile("kotlin-daemon-test") { logFile ->
val daemonJVMOptions = makeTestDaemonJvmOptions(logFile)
@@ -635,8 +639,8 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
shutdownDelayMilliseconds = 1,
runFilesPath = File(tmpdir, getTestName(true)).absolutePath
)
val clientFlag = createTempFile(getTestName(true), "-client.alive")
val sessionFlag = createTempFile(getTestName(true), "-session.alive")
val clientFlag = createTempFile(getTestName(true), "-client.alive").toFile()
val sessionFlag = createTempFile(getTestName(true), "-session.alive").toFile()
try {
withLogFile("kotlin-daemon-test") { logFile ->
val daemonJVMOptions = makeTestDaemonJvmOptions(logFile)
@@ -678,8 +682,8 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
shutdownDelayMilliseconds = 3000,
runFilesPath = File(tmpdir, getTestName(true)).absolutePath
)
val clientFlag = createTempFile(getTestName(true), "-client.alive")
val clientFlag2 = createTempFile(getTestName(true), "-client.alive")
val clientFlag = createTempFile(getTestName(true), "-client.alive").toFile()
val clientFlag2 = createTempFile(getTestName(true), "-client.alive").toFile()
try {
withLogFile("kotlin-daemon-test") { logFile ->
val daemonJVMOptions = makeTestDaemonJvmOptions(logFile)
@@ -769,8 +773,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
assertEquals("Compilation failed:\n$resOutput", 0, resCode)
println("OK")
} finally {
if (clientAliveFile.exists())
clientAliveFile.delete()
clientAliveFile.deleteIfExists()
}
}
@@ -1427,7 +1430,7 @@ fun restoreSystemProperty(propertyName: String, backupValue: String?) {
}
internal inline fun withFlagFile(prefix: String, suffix: String? = null, body: (File) -> Unit) {
val file = createTempFile(prefix, suffix)
val file = createTempFile(prefix, suffix).toFile()
try {
body(file)
} finally {
@@ -1436,7 +1439,7 @@ internal inline fun withFlagFile(prefix: String, suffix: String? = null, body: (
}
internal inline fun withLogFile(prefix: String, suffix: String = ".log", printLogOnException: Boolean = true, body: (File) -> Unit) {
val logFile = createTempFile(prefix, suffix)
val logFile = createTempFile(prefix, suffix).toFile()
println("LOG FILE : ${logFile.path}")
try {
body(logFile)
@@ -1449,13 +1452,6 @@ internal inline fun withLogFile(prefix: String, suffix: String = ".log", printLo
}
}
// java.util.Logger used in the daemon silently forgets to log into a file specified in the config on Windows,
// if file path is given in windows form (using backslash as a separator); the reason is unknown
// this function makes a path with forward slashed, that works on windows too
internal val File.loggerCompatiblePath: String
get() =
if (OSKind.current == OSKind.Windows) absolutePath.replace('\\', '/')
else absolutePath
open class TestKotlinScriptDummyDependenciesResolver : DependenciesResolver {

View File

@@ -24,6 +24,7 @@ import java.io.ObjectInputStream
import java.io.ObjectOutputStream
import java.net.InetSocketAddress
import java.util.logging.Logger
import kotlin.io.path.*
@OptIn(KtorExperimentalAPI::class)
class TestServer(val serverPort: Int = 6999) {
@@ -44,6 +45,7 @@ val testServer = TestServer()
@RunWith(IgnoreAll::class)
@Suppress("UNCHECKED_CAST")
@OptIn(ExperimentalPathApi::class)
class ClientSerializationTest : KotlinIntegrationTestBase() {
val file = createTempFile()

View File

@@ -31,11 +31,14 @@ import java.io.ByteArrayOutputStream
import java.io.File
import java.io.IOException
import java.io.PrintStream
import java.nio.file.Path
import java.util.*
import java.util.logging.LogManager
import java.util.logging.Logger
import kotlin.concurrent.schedule
import kotlin.io.path.*
@OptIn(ExperimentalPathApi::class)
@RunWith(IgnoreAll::class)
class ConnectionsTest : KotlinIntegrationTestBase() {
@@ -247,15 +250,15 @@ class ConnectionsTest : KotlinIntegrationTestBase() {
extraAction
)
private val clientFiles = arrayListOf<File>()
private val clientFiles = mutableListOf<Path>()
private fun generateClient(): String {
val file = createTempFile(getTestName(true), ".alive")
clientFiles.add(file)
return file.absolutePath
return file.toAbsolutePath().toString()
}
private fun deleteClients() {
clientFiles.forEach { it.delete() }
clientFiles.forEach { it.deleteIfExists() }
}
private fun endTest() {

View File

@@ -21,6 +21,9 @@ import com.intellij.openapi.util.Disposer
import com.intellij.openapi.vfs.impl.ZipHandler
import com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem
import org.jetbrains.kotlin.build.DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS
import org.jetbrains.kotlin.build.report.BuildReporter
import org.jetbrains.kotlin.build.report.RemoteBuildReporter
import org.jetbrains.kotlin.build.report.RemoteReporter
import org.jetbrains.kotlin.cli.common.CLICompiler
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
@@ -286,7 +289,7 @@ abstract class CompileServiceImplBase(
createMessageCollector: (ServicesFacadeT, CompilationOptions) -> MessageCollector,
createReporter: (ServicesFacadeT, CompilationOptions) -> DaemonMessageReporter,
createServices: (JpsServicesFacadeT, EventManager, Profiler) -> Services,
getICReporter: (ServicesFacadeT, CompilationResultsT?, IncrementalCompilationOptions) -> RemoteICReporter
getICReporter: (ServicesFacadeT, CompilationResultsT?, IncrementalCompilationOptions) -> RemoteBuildReporter
) = kotlin.run {
val messageCollector = createMessageCollector(servicesFacade, compilationOptions)
val daemonReporter = createReporter(servicesFacade, compilationOptions)
@@ -514,7 +517,7 @@ abstract class CompileServiceImplBase(
args: K2JSCompilerArguments,
incrementalCompilationOptions: IncrementalCompilationOptions,
compilerMessageCollector: MessageCollector,
reporter: RemoteICReporter
reporter: RemoteBuildReporter
): ExitCode {
val allKotlinFiles = arrayListOf<File>()
val freeArgsWithoutKotlinFiles = arrayListOf<String>()
@@ -554,7 +557,7 @@ abstract class CompileServiceImplBase(
k2jvmArgs: K2JVMCompilerArguments,
incrementalCompilationOptions: IncrementalCompilationOptions,
compilerMessageCollector: MessageCollector,
reporter: RemoteICReporter
reporter: RemoteBuildReporter
): ExitCode {
val allKotlinExtensions = (DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS +
(incrementalCompilationOptions.kotlinScriptExtensions ?: emptyArray())).distinct()
@@ -784,7 +787,7 @@ class CompileServiceImpl(
createMessageCollector = ::CompileServicesFacadeMessageCollector,
createReporter = ::DaemonMessageReporter,
createServices = this::createCompileServices,
getICReporter = { a, b, c -> getICReporter(a, b!!, c)}
getICReporter = { a, b, c -> getBuildReporter(a, b!!, c)}
)
override fun leaseReplSession(

View File

@@ -8,10 +8,12 @@ package org.jetbrains.kotlin.daemon.report
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.daemon.common.CompilationResultCategory
import org.jetbrains.kotlin.daemon.common.CompilationResults
import org.jetbrains.kotlin.incremental.ICReporterBase
import org.jetbrains.kotlin.build.report.ICReporterBase
import org.jetbrains.kotlin.build.report.RemoteICReporter
import java.io.File
import java.util.HashMap
import java.util.*
// todo: sync BuildReportICReporterAsync
internal class BuildReportICReporter(
private val compilationResults: CompilationResults,
rootDir: File,

View File

@@ -9,7 +9,8 @@ import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.daemon.common.CompilationResultCategory
import org.jetbrains.kotlin.daemon.common.CompilationResults
import org.jetbrains.kotlin.daemon.common.CompileIterationResult
import org.jetbrains.kotlin.incremental.ICReporterBase
import org.jetbrains.kotlin.build.report.ICReporterBase
import org.jetbrains.kotlin.build.report.RemoteICReporter
import java.io.File
internal class CompileIterationICReporter(

View File

@@ -5,11 +5,11 @@
package org.jetbrains.kotlin.daemon.report
import org.jetbrains.kotlin.build.report.RemoteICReporter
import org.jetbrains.kotlin.cli.common.ExitCode
import java.io.File
internal class CompositeICReporter(private val reporters: Iterable<RemoteICReporter>) :
RemoteICReporter {
internal class CompositeICReporter(private val reporters: Iterable<RemoteICReporter>) : RemoteICReporter {
override fun report(message: () -> String) {
reporters.forEach { it.report(message) }
}

View File

@@ -7,7 +7,8 @@ package org.jetbrains.kotlin.daemon.report
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.daemon.common.*
import org.jetbrains.kotlin.incremental.ICReporterBase
import org.jetbrains.kotlin.build.report.ICReporterBase
import org.jetbrains.kotlin.build.report.RemoteICReporter
import java.io.File
internal class DebugMessagesICReporter(

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.daemon.report
import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter
import org.jetbrains.kotlin.build.report.metrics.RemoteBuildMetricsReporter
import org.jetbrains.kotlin.daemon.common.CompilationResultCategory
import org.jetbrains.kotlin.daemon.common.CompilationResults
class RemoteBuildMetricsReporterAdapter(
private val delegate: BuildMetricsReporter,
private val shouldReport: Boolean,
private val compilationResults: CompilationResults
) :
BuildMetricsReporter by delegate,
RemoteBuildMetricsReporter {
override fun flush() {
if (shouldReport) {
val metrics = delegate.getMetrics()
compilationResults.add(CompilationResultCategory.BUILD_METRICS.code, metrics)
}
}
}

View File

@@ -1,12 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.daemon.report
import org.jetbrains.kotlin.incremental.ICReporter
interface RemoteICReporter : ICReporter {
fun flush()
}

View File

@@ -5,25 +5,29 @@
package org.jetbrains.kotlin.daemon.report.experimental
import kotlinx.coroutines.*
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import org.jetbrains.kotlin.build.report.ICReporterBase
import org.jetbrains.kotlin.build.report.RemoteBuildReporter
import org.jetbrains.kotlin.build.report.RemoteICReporter
import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter
import org.jetbrains.kotlin.build.report.metrics.DoNothingBuildMetricsReporter
import org.jetbrains.kotlin.build.report.metrics.RemoteBuildMetricsReporter
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.daemon.common.*
import org.jetbrains.kotlin.daemon.report.RemoteICReporter
import org.jetbrains.kotlin.incremental.ICReporter
import org.jetbrains.kotlin.incremental.ICReporterBase
import org.jetbrains.kotlin.daemon.report.CompositeICReporter
import java.io.File
import java.io.Serializable
internal class DebugMessagesICReporterAsync(
private val servicesFacade: CompilerServicesFacadeBaseAsync,
rootDir: File,
private val isVerbose: Boolean
private val servicesFacade: CompilerServicesFacadeBaseAsync,
rootDir: File,
private val isVerbose: Boolean
) : ICReporterBase(rootDir), RemoteICReporter {
override fun report(message: () -> String) {
GlobalScope.async {
servicesFacade.report(
ReportCategory.IC_MESSAGE,
ReportSeverity.DEBUG, message()
ReportCategory.IC_MESSAGE,
ReportSeverity.DEBUG, message()
)
}
}
@@ -42,13 +46,13 @@ internal class DebugMessagesICReporterAsync(
}
internal class CompileIterationICReporterAsync(
private val compilationResults: CompilationResultsAsync?
private val compilationResults: CompilationResultsAsync?
) : ICReporterBase(), RemoteICReporter {
override fun reportCompileIteration(incremental: Boolean, sourceFiles: Collection<File>, exitCode: ExitCode) {
GlobalScope.async {
compilationResults?.add(
CompilationResultCategory.IC_COMPILE_ITERATION.code,
CompileIterationResult(sourceFiles, exitCode.toString())
CompilationResultCategory.IC_COMPILE_ITERATION.code,
CompileIterationResult(sourceFiles, exitCode.toString())
)
}
}
@@ -64,9 +68,9 @@ internal class CompileIterationICReporterAsync(
}
internal class BuildReportICReporterAsync(
private val compilationResults: CompilationResultsAsync?,
rootDir: File,
private val isVerbose: Boolean = false
private val compilationResults: CompilationResultsAsync?,
rootDir: File,
private val isVerbose: Boolean = false
) : ICReporterBase(rootDir), RemoteICReporter {
private val icLogLines = arrayListOf<String>()
private val recompilationReason = HashMap<File, String>()
@@ -103,42 +107,11 @@ internal class BuildReportICReporterAsync(
}
}
internal class CompositeICReporterAsync(private val reporters: Iterable<RemoteICReporter>) :
RemoteICReporter {
override fun report(message: () -> String) {
reporters.forEach { it.report(message) }
}
override fun reportVerbose(message: () -> String) {
reporters.forEach { it.reportVerbose(message) }
}
override fun reportCompileIteration(incremental: Boolean, sourceFiles: Collection<File>, exitCode: ExitCode) {
reporters.forEach { it.reportCompileIteration(incremental, sourceFiles, exitCode) }
}
override fun reportMarkDirtyClass(affectedFiles: Iterable<File>, classFqName: String) {
reporters.forEach { it.reportMarkDirtyClass(affectedFiles, classFqName) }
}
override fun reportMarkDirtyMember(affectedFiles: Iterable<File>, scope: String, name: String) {
reporters.forEach { it.reportMarkDirtyMember(affectedFiles, scope, name) }
}
override fun reportMarkDirty(affectedFiles: Iterable<File>, reason: String) {
reporters.forEach { it.reportMarkDirty(affectedFiles, reason) }
}
override fun flush() {
reporters.forEach { it.flush() }
}
}
fun getICReporterAsync(
servicesFacade: CompilerServicesFacadeBaseAsync,
compilationResults: CompilationResultsAsync?,
compilationOptions: IncrementalCompilationOptions
): RemoteICReporter {
servicesFacade: CompilerServicesFacadeBaseAsync,
compilationResults: CompilationResultsAsync?,
compilationOptions: IncrementalCompilationOptions
): RemoteBuildReporter {
val root = compilationOptions.modulesInfo.projectRoot
val reporters = ArrayList<RemoteICReporter>()
@@ -148,23 +121,32 @@ fun getICReporterAsync(
}
val requestedResults = compilationOptions
.requestedCompilationResults
.mapNotNullTo(HashSet()) { resultCode ->
CompilationResultCategory.values().getOrNull(resultCode)
}
requestedResults.mapTo(reporters) { requestedResult ->
.requestedCompilationResults
.mapNotNullTo(HashSet()) { resultCode ->
CompilationResultCategory.values().getOrNull(resultCode)
}
for (requestedResult in requestedResults) {
when (requestedResult) {
CompilationResultCategory.IC_COMPILE_ITERATION -> {
CompileIterationICReporterAsync(compilationResults)
reporters.add(CompileIterationICReporterAsync(compilationResults))
}
CompilationResultCategory.BUILD_REPORT_LINES -> {
BuildReportICReporterAsync(compilationResults, root)
reporters.add(BuildReportICReporterAsync(compilationResults, root))
}
CompilationResultCategory.VERBOSE_BUILD_REPORT_LINES -> {
BuildReportICReporterAsync(compilationResults, root, isVerbose = true)
reporters.add(BuildReportICReporterAsync(compilationResults, root, isVerbose = true))
}
CompilationResultCategory.BUILD_METRICS -> {
}
}
}
return CompositeICReporterAsync(reporters)
}
val icReporter = CompositeICReporter(reporters)
val metricsReporter = DoNothingRemoteBuildMetricsReporter
return RemoteBuildReporter(icReporter, metricsReporter)
}
object DoNothingRemoteBuildMetricsReporter : BuildMetricsReporter by DoNothingBuildMetricsReporter, RemoteBuildMetricsReporter {
override fun flush() {
}
}

View File

@@ -16,15 +16,18 @@
package org.jetbrains.kotlin.daemon.report
import org.jetbrains.kotlin.build.report.RemoteBuildReporter
import org.jetbrains.kotlin.build.report.RemoteICReporter
import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporterImpl
import org.jetbrains.kotlin.build.report.metrics.DoNothingBuildMetricsReporter
import org.jetbrains.kotlin.daemon.common.*
import java.io.File
import java.util.*
fun getICReporter(
fun getBuildReporter(
servicesFacade: CompilerServicesFacadeBase,
compilationResults: CompilationResults,
compilationOptions: IncrementalCompilationOptions
): RemoteICReporter {
): RemoteBuildReporter {
val root = compilationOptions.modulesInfo.projectRoot
val reporters = ArrayList<RemoteICReporter>()
@@ -38,21 +41,25 @@ fun getICReporter(
.mapNotNullTo(HashSet()) { resultCode ->
CompilationResultCategory.values().getOrNull(resultCode)
}
requestedResults.mapTo(reporters) { requestedResult ->
for (requestedResult in requestedResults) {
when (requestedResult) {
CompilationResultCategory.IC_COMPILE_ITERATION -> {
CompileIterationICReporter(compilationResults)
reporters.add(CompileIterationICReporter(compilationResults))
}
CompilationResultCategory.BUILD_REPORT_LINES -> {
BuildReportICReporter(compilationResults, root)
reporters.add(BuildReportICReporter(compilationResults, root))
}
CompilationResultCategory.VERBOSE_BUILD_REPORT_LINES -> {
BuildReportICReporter(compilationResults, root, isVerbose = true)
reporters.add(BuildReportICReporter(compilationResults, root, isVerbose = true))
}
CompilationResultCategory.BUILD_METRICS -> {
}
}
}
val areBuildMetricsNeeded = CompilationResultCategory.BUILD_METRICS in requestedResults
val metricsReporter =
(if (areBuildMetricsNeeded) BuildMetricsReporterImpl() else DoNothingBuildMetricsReporter)
.let { RemoteBuildMetricsReporterAdapter(it, areBuildMetricsNeeded, compilationResults) }
return CompositeICReporter(reporters)
return RemoteBuildReporter(CompositeICReporter(reporters), metricsReporter)
}

View File

@@ -25,10 +25,8 @@ dependencies {
testRuntime(project(":kotlin-reflect"))
testRuntime(project(":core:descriptors.runtime"))
Platform[192].orHigher {
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
sourceSets {

View File

@@ -1,5 +1,5 @@
public/*package*/ open class ArraysUtilJVM : R|kotlin/Any| {
public/*package*/ open static fun <T : R|ft<kotlin/Any, kotlin/Any?>!|> asList(p0: ):
public/*package*/ open static fun <T : R|ft<@FlexibleNullability kotlin/Any, kotlin/Any?>!|> asList(p0: ):
public/*package*/ constructor(): R|kotlin/collections/ArraysUtilJVM|

View File

@@ -3,9 +3,9 @@
}
public open class NonNullNever : R|kotlin/Any| {
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) public open field field: R|kotlin/String?|
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) public open field field: R|@FlexibleNullability kotlin/String?|
@R|MyNullable|() public open fun foo(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) x: R|kotlin/String?|, @R|MyNullable|() y: R|kotlin/CharSequence?|): R|kotlin/String?|
@R|MyNullable|() public open fun foo(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) x: R|@FlexibleNullability kotlin/String?|, @R|MyNullable|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String?|
public constructor(): R|NonNullNever|

View File

@@ -1,9 +1,9 @@
public open class Simple : R|kotlin/Any| {
@R|javax/annotation/Nullable|() public open field field: R|kotlin/String?|
@R|javax/annotation/Nullable|() public open field field: R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nullable|() public open fun foo(@R|javax/annotation/Nonnull|() x: R|kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|kotlin/CharSequence?|): R|kotlin/String?|
@R|javax/annotation/Nullable|() public open fun foo(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nonnull|() public open fun bar(): R|kotlin/String|
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|
public constructor(): R|Simple|

View File

@@ -1,9 +1,9 @@
public open class Strange : R|kotlin/Any| {
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) public open field field: R|ft<kotlin/String, kotlin/String?>!|
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) public open field field: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) public open fun foo(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.ALWAYS|()) x: R|kotlin/String|, @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) y: R|kotlin/CharSequence?|): R|kotlin/String?|
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) public open fun foo(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.ALWAYS|()) x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String?|
@R|javax/annotation/Nonnull|() public open fun bar(): R|kotlin/String|
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|
public constructor(): R|Strange|

Some files were not shown because too many files have changed in this diff Show More