Commit Graph

1741 Commits

Author SHA1 Message Date
Yan Zhulanow bc0f10449a Kapt: Fix source root importing in MPP projects 2019-06-13 17:33:24 +09:00
Yan Zhulanow 9eab9f386d Activate Kapt importer only for JVM compilations (KT-30578) 2019-06-13 17:33:24 +09:00
Leonid Startsev b78d84c120 Add some tests for kotlinx.serialization plugin:
- declaration checker
- bytecode listings
- JVM IR

Improve @Transient redundant reporting
2019-06-11 19:32:40 +03:00
Leonid Startsev 414c116d93 Fix too strict serializer lookup for generic type parameters 2019-06-10 16:49:19 +03:00
Vyacheslav Gerasimov 5bde9720b7 Build: Fix dependencies on :kotlin-compiler project
Dependencies on :kotlin-compiler should never be used in configurations
which are imported transitively because ide fails to import it as
project dependency. When :kotlin-compiler dependency is imported as
kotlin-compiler.jar dependency ide re-indexes it on every change. This
behaviour is super annoying.

 #KT-31120 Fixed
2019-06-08 19:36:28 +03:00
Mikhail Zarechenskiy 42b7552d17 Fix exception on attempt to map inner non-fixed type variable
#KT-31842 Fixed
2019-06-07 01:18:47 +03:00
Ilya Chernikov e542c9ea84 Refactor script definitions and resolving/refining infrastructure:
- implement wrappers to wrap old and new API providers and resolvers
- make old API deprecated (with error where possible)
- drop old internal classes related to the old API
- refactor usages accordingly
- fix and add missing features to the scripting API where necessary
2019-06-06 17:21:00 +02:00
Leonid Startsev 3792c44378 Make short path for non-serializable classes and other improvements:
Adjust some error messages
Add 'fallbackElement' to report on when property is implicitly typed
Split findTypeSerializerOrContext into checked and unchecked versions
2019-06-05 19:13:03 +03:00
Leonid Startsev dc79b99dd2 Implement inspection about no-arg constructor in non-serializable supertype 2019-06-05 19:11:18 +03:00
Leonid Startsev 8f77b55ada Retrieve serializable properties from binding context in most of the places
Remove unused record 'SERIALIZER_FOR_PROPERTY'
2019-06-05 19:11:18 +03:00
Leonid Startsev fe1f36bc02 Report an error on @Serializable inline classes and missing @Transient initializers 2019-06-05 19:12:34 +03:00
Leonid Startsev e6d96f1de9 Implement diagnostic about nullable serializer for non-nullable type 2019-06-05 19:12:00 +03:00
Leonid Startsev 6895184b84 Implement basics diagnostics reporting from the serialization plugin similarly to noArg and allOpen plugins 2019-06-05 19:11:20 +03:00
Leonid Startsev d3a596e3c2 Correctly copy init blocks code to deserialization constructor
Fixes https://github.com/JetBrains/kotlin-native/issues/3019

Workaround problem with proguard and inline reified functions
2019-06-05 17:44:34 +03:00
Leonid Startsev 6370f0b3be Correctly reference deserialization constructor added by plugin
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/472
2019-06-05 17:43:46 +03:00
Ivan Gavrilovic 55ba985cd2 KAPT: do not discover incremental APs only if cache is not set
KaptFlag.INCREMENTAL_APT is used to indicate that KAPT run
should try to be incremental because changes to input files and
classpath have been detected. However, first run of the Gradle
task will set this flag to false, which means that all APs will be
detected as non-incremental in the first run. Further on, this means
that the dependency caches will be invalid, and all subsequent runs
will be non-incremental as well.

This commit uses existence of dependency cache to determine if incremental
APs should be discovered. The regression was introduced in
72fdc648ff.

Test: ./gradlew :kotlin-gradle-plugin-integration-tests:testAdvanceGradleVersion --tests *KaptIncrementalWith*\
 && ./gradlew :kotlin-gradle-plugin-integration-tests:test --tests *KaptIncrementalWith*
2019-06-05 18:19:50 +09:00
Ivan Gavrilovic 1fa990b063 Support isolating APs that report multiple originating elements from the same file
It is possible for isolating annotation processor to report two or more
originating elements from the same source file when generating
sources/classes/resources. This commit makes sure the source file are
de-duped, so assertion that there is a single source file does not fail.

Test: IsolatingIncrementalProcessorsTest.testIsolatingWithMultipleOriginatingElements

This is improvement to https://youtrack.jetbrains.com/issue/KT-23880
2019-06-05 18:19:49 +09:00
Ivan Gavrilovic 76f62da6ae Improve constants analysis in KAPT
When analyzing source files in KAPT for incremental annotation processing,
avoid creating TreePath instances for initializers that are literals. E.g.
if it is just a boolean/int literal, we do not need to visit the tree nor
create expensive TreePath instance.

For classes that contain only constants (such as R.java for Android projects)
this is a significant improvement. Class that contains 16000 constants took
more than 10 seconds to analyze, now it is 70ms.
2019-06-05 18:19:49 +09:00
Mikhail Zarechenskiy e15cb67e29 Fix exception from UAST on attempt to map non-fixed type variable
#KT-31723 Fixed
 #EA-126269 Fixed
 #EA-143705 Fixed
 #EA-143703 Fixed
 #EA-143694 Fixed
2019-06-03 02:04:56 +03:00
Mikhail Zarechenskiy 91bd11a6db Fix UAST tests for new-inference: adapt SAM-converted descriptors 2019-06-03 02:04:55 +03:00
Mikhail Zarechenskiy 010ac50243 Enable new type inference for UAST tests as for IDE tests 2019-06-03 02:04:53 +03:00
Vyacheslav Gerasimov cf3a98123f 192: Fix uast tests compilation for 192 platform 2019-05-31 16:32:10 +03:00
Vyacheslav Gerasimov 979df225a7 192: Fix uast-kotlin for 192 platform 2019-05-31 16:32:09 +03:00
Ilya Chernikov e95569a273 Report definition-related error diagnostic on the whole script file
#KT-31452 fixed
2019-05-31 13:34:17 +02:00
Alexander Udalov ceecbfdcea Minor, fix kapt test data on comments
ClassFileToSourceStubConverter relies on JvmDeclarationOrigin which is
used in the codegen, and that origin has slightly changed for the
synthetic '$annotations' method (see
`MemberCodegen.generateSyntheticAnnotationsMethod`) in e9b50157
2019-05-30 19:30:46 +02:00
Dmitry Savvinov d5fbe59a3e [Platform API] Introduce fundamental abstraction of Platform
This is a large commit, which introduces general API for working with
abstraction of Platform.

- Add new abstraction to 'core' - SimplePlatform - which represents
exactly one platform
  - Clients are strongly prohibited to create instances of SimplePlatform
  by hand, instead, corresponding *Platforms abstraction should be used
  (e.g. JvmPlatforms, JsPlatforms, KonanPlatforms)

- Move TargetPlatform to 'core', it represents now a collection of
SimplePlatforms
  - Clients are strongly encouraged to use TargetPlatform
    (not SimplePlatform) in API, to enforce checks for multiplatform

- Provide a helper-extensions to work with TargetPlatform
(in particular, for getting a specific component platform)

- Remove MultiTargetPlatform in favour of TargetPlatform
  - Notably, this commit leaves another widely used duplicated abstraction,
    namely, IdePlatform. For the sake sanity, removal of IdePlatform is
    extracted in the separate commit.
2019-05-28 13:08:07 +03:00
Ilya Chernikov e7c99cd494 Fix scripting-compiler tests, add them to the global scriptingTest task 2019-05-25 10:10:34 +02:00
Ilya Chernikov 46915df56f Implement "legacy" REPL wrappers on top of the "new" scripting infrastructure 2019-05-25 10:10:29 +02:00
Ilya Chernikov 89006f16cd Prepare scripting infrastructure for REPL:
- refactor script compiler to simplify extending it for repl
- add repl snippet compilation functions to the new scripting compiler
- extract util functions into appropriate files
- extract repl part into separate class
- extract bridge definition and related definitions into separate file
2019-05-25 10:10:28 +02:00
Ilya Chernikov a4c049d26e Replace message collector with reporting lambda
to simplify usages and slightly reduce dependencies
2019-05-25 10:10:28 +02:00
Ilya Chernikov 61c1312f1a Add another method for fetching classpath from classloader, refactor 2019-05-25 10:10:27 +02:00
Alexander Udalov 55f4c067e2 Fix compilation of uast-kotlin-idea for 182
Caused by 4e15b95d17
2019-05-24 18:06:57 +02:00
Alexander Udalov 0fb33b82ff Fix compilation of uast-kotlin for 182
Caused by 4e15b95d17
2019-05-24 17:02:28 +02:00
Alexander Udalov 4e15b95d17 Minor, inline JvmAbi.DEFAULT_MODULE_NAME 2019-05-24 14:42:25 +02:00
Leonid Startsev b5c4f3ecc8 Coerce property value from correct type after retrieving it
#KT-25497 fixed
 Fixes https://github.com/Kotlin/kotlinx.serialization/issues/434
2019-05-23 14:21:09 +03:00
Leonid Startsev 9ce1f843e3 Remove non-type annotations from type serializer analysis
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/450
2019-05-23 14:21:09 +03:00
Ivan Gavrilovic 72fdc648ff If incremental KAPT is disabled, do not analyze classpath
When incremental apt mode in KAPT is disabled, do not analyze
classpath to determine the type of the annotation processors. Instead,
just mark them all as non-incremental.
2019-05-23 19:09:28 +09:00
Ivan Gavrilovic b609fe529c Handle return result of dir creation/deletion in kapt
#KT-31322
2019-05-23 19:09:27 +09:00
Ivan Gavrilovic f60bfc34c0 Remove generated sources and classes for full KAPT build
When running incremental annotation processing in KAPT,
even if incremental flag is enabled, and full rebuild should
be performed (e.g. in presence of dynamic non-incremental APs),
make sure generated sources and classes are removed.

 #KT-31322 fixed
2019-05-23 19:09:27 +09:00
Yan Zhulanow a0778ad703 Revert "Kapt: Always use raw types for annotation parameter types (KT-30346)"
This reverts commit 66754e62
2019-05-23 19:09:27 +09:00
Vadim Brilyantov d5be5bd96e Fix obsolete compiler classpath in SourceSectionsTest 2019-05-20 14:23:34 +03:00
Vadim Brilyantov 01a05a5495 Move daemon jar from compiler 2019-05-17 15:51:52 +03:00
Alexander Udalov b602c08773 Remove javaFilesDir parameter of CodegenTestCase.doMultiFileTest
Create TestFile instances for .java sources similarly to .kt sources,
and write them to a temporary directory via writeJavaFiles in each test
where this is needed
2019-05-15 13:25:14 +02:00
Alexander Udalov 7fdb9c990e Reformat and cleanup most JVM codegen test classes 2019-05-15 13:25:14 +02:00
Andrey Uskov 52315106e8 Create source sets for generated by kapt sources during import
#KT-30739 Fixed
2019-05-13 18:43:11 +03:00
Natalia Selezneva ba7d66eb4b Fix 'Invalid file' Exception during script definition search (EA-125840)
EA-125840 - assert: FileManagerImpl.findFile
2019-05-08 15:17:12 +03:00
Mikhail Zarechenskiy 97a6b3436c Add diagnostics from NI for SAM with receiver tests 2019-05-06 13:59:30 +03:00
Leonid Startsev 0ecf20bd62 Revert back visibility in deserialization ctor to public so inheritors can access it from other modules.
Fix instantiating of polymorphic serializer with generics.
Move context creation below as asked.
2019-04-30 17:53:40 +03:00
Vyacheslav Gerasimov 0ec1df89fa Build: use configuration for dependency on android-extensions-runtime
`evaluationDependsOn` may lead to obscure gradle errors on project configuration
2019-04-29 16:23:16 +03:00
Nicolay Mitropolsky 0794ab9432 Uast: cleaunp warnings (but some still remains) 2019-04-28 16:36:43 +03:00