Commit Graph

3045 Commits

Author SHA1 Message Date
Alexander Udalov dcbb8045bd Disallow function types with big arity on JVM if LV < 1.3 or API < 1.3
The implementation is a bit obscure because this worked on JS since
Kotlin 1.0 and we should not break that; however, on JVM, a diagnostic
will be reported with old language/API version

 #KT-25241 Fixed
2018-07-16 10:41:27 +02:00
Nikolay Krasko 5e35fd1758 Check created javaFileFacadeFqName short name (EA-122324) 2018-07-13 20:00:05 +03:00
Denis Zharkov 89d99e3989 Refine diagnostics for nullability migration warnings
#KT-24911 Fixed
2018-07-13 17:51:21 +03:00
Alexander Udalov e937fe8258 Move PackagePartProvider to module descriptors.jvm 2018-07-10 15:16:49 +02:00
Alexander Udalov 2cb4b7c6d4 Extract MetadataPartProvider out of PackagePartProvider 2018-07-10 15:16:49 +02:00
Alexander Udalov e25bc2865f Remove PackagePartProvider from ResolverForProjectImpl
To be able to move it to JVM-specific modules, and to provide a
replacement for common module analysis
2018-07-10 15:16:49 +02:00
Denis Zharkov 170086250b Support new Continuation API in JVM BE
#KT-24863 Fixed
2018-07-09 15:27:19 +03:00
Alexander Udalov 959c2f4843 Get rid of split packages in descriptors, descriptors.jvm, deserialization
Also move some other files to related packages and reformat moved files
2018-07-06 14:08:35 +02:00
Denis Zharkov 22a9cecfe0 Optimize KotlinPropertyAccessorsReferenceSearcher for case of no kt-files
Property names by accessors can be computed without resolving
java descriptors

 #KT-11477 Fixed
 #KT-16890 Fixed
2018-07-04 14:03:28 +03:00
Denis Zharkov 2d50ad82a5 Optimize SyntheticJavaPropertyDescriptor.Companion::findByGetterOrSetter
Do not force getContributedDescriptors call when we need to request
at most three names
2018-07-04 14:03:28 +03:00
Denis Zharkov 5e6a3673c8 Reformat SyntheticJavaPropertiesScope.kt 2018-07-04 14:03:28 +03:00
Denis Zharkov 3b968351bb Load Java overrides of Kotlin suspend functions as suspend, too
There's still some blind spots:
- Covariant overrides in Java (KT-25036)
- Current implementation assumes that when language version is 1.3 every suspend function
reference only release-coroutines-package Continuation
(we need to check if it's a correct statement)

 #KT-24848 Fixed
 #KT-25036 Open
2018-07-02 14:14:59 +03:00
Alexander Udalov 984e37c7f1 Prohibit explicit usage of kotlin.Metadata as annotation 2018-06-27 12:37:18 +02:00
Dmitry Petrov d35a92a81d Generate accessor for private companion object 2018-06-22 16:53:07 +03:00
Mikhael Bogdanov 7c615eb7ab Minor. Reformat 2018-06-21 11:18:40 +02:00
Mikhail Zarechenskiy 7d5fdb660d Treat number with unsigned literal as UByte & UShort & UInt & ULong 2018-06-04 18:37:36 +03:00
Stanislav Erokhin 8f0b073c08 [NI] Prototype for SAM-conversion.
Supported:
- conversion in resolution parts. Also sam-with-receiver is supported automatically
- separate flag for kotlin function with java SAM as parameters

TODO:
- fix overload conflict error when function type is the same byte origin types is ordered
- consider case when parameter type is T, T <:> Runnable
- support vararg of Runnable

[NI] Turn off synthetic scope with SAM adapter functions if NI enabled
2018-06-04 12:21:56 +03:00
Ilya Gorbunov 1a290d0c73 Refactor: make JvmMemberSignature a sealed class
Use JvmMemberSignature.asString instead of toString
2018-06-01 06:43:48 +03:00
Ilya Gorbunov 36c658fd8b Introduce JvmMemberSignature to represent name and desc of jvm methods and fields
Return member name and desc in a class in order not to parse that information
from concatenated string when required.
2018-06-01 06:43:48 +03:00
Mikhael Bogdanov 419218b9cf Rename 'jvm-default-mode' to 'jvm-default'. Add description 2018-05-29 11:26:36 +02:00
Mikhael Bogdanov 065780de4c Switch enableJvmDefault to jvmDefaultMode 2018-05-28 22:15:42 +02:00
Dmitry Savvinov da7b59984f Move importsDumper to compiler plugin 2018-05-28 13:02:48 +03:00
Ilmir Usmanov df4dcc0f8e Ignore data flow info from assert calls
if assertions mode is not LEGACY.

This is done since assertions can be disabled (in both compile time and
runtime) and thus, the data flow info is not reliable anymore.
 #KT-24529: Fixed
2018-05-25 18:58:49 +03:00
Ilmir Usmanov f568149863 Implement new assert semantics in back-end
Previously, assert was just a regular function and its argument used to
be computed on each call (even if assertions are disabled on JVM).
This change adds support for 3 new behaviours of assert:
* always-enable (independently from -ea on JVM)
* always-disable (independently from -ea JVM)
* runtime/jvm (compile the calls like javac generates assert-operator)
* legacy (leave current eager semantics) - this already existed

Default behaviour is legacy for now.

The behavior is changed based on -Xassertions flag.
 #KT-7540: Fixed
2018-05-21 20:43:37 +03:00
Nikolay Krasko 580e2972db Initial settings for incompatible API inspection 2018-05-17 12:27:30 +03:00
Nikolay Krasko a95ec598f2 Refactoring: move accessor name generators to companion object for reuse 2018-05-17 12:27:28 +03:00
Dmitry Savvinov 70622ff668 Introduce -Xoutput-imports mode of JVM compiler
In this mode, instead of analyzing files and generating bytecode for
them, compiler just saves imports of each file in JSON map of form

'<path to file> -> [<import1>, <import2>, ...]'

It is needed for some external tools, notably for Google3 toolchain.
2018-05-15 15:36:14 +03:00
Alexander Udalov 1719eecb67 Minor, init slice debug names for FilesByFacadeFqNameIndexer 2018-05-04 13:48:24 +02:00
Ilya Chernikov 15f9ad9531 Implement quick non-script detection and lazy script discovery..
so ".kt" and ".java" files are not considered as scripts and quickly
filtered out, and for the other files the the checks are implemented
using sequences, mechanisms provided to supply script definitions
lazily, and script discovery is implemented using this mechanisms.
2018-05-03 22:15:09 +02:00
Ilya Chernikov a29411a211 Process script templates everywhere properly:
- add options to disable scripting plugin and standard script definition
- move standard definition adding logic into appropriate place
- fix logic of scripting plugin loading
- add standard script definition on the environment creation to
  ensure compatibility with all usages
- fix testdata
- some minor fixes
2018-05-03 22:15:09 +02:00
Alexander Udalov adb15d2d1a Do not report JvmOverloads warning on actual function with expected defaults
#KT-23910
2018-04-30 15:26:50 +02:00
Denis Zharkov 96ab705de1 Use PsiField::computeConstantValue to avoid building AST 2018-04-28 17:12:52 +03:00
Denis Zharkov 0788afe92c Avoid computing AST for IdentifierChecker
Basically, it's unnecessary to check anything when analysing stubs,
but it's complicated now to avoid that, so we just postpone
computing AST until reporting happens
2018-04-28 17:12:52 +03:00
Alexander Udalov 361f686124 Move ModuleMapping and BinaryModuleData to metadata.jvm 2018-04-23 18:42:32 +02:00
Alexander Udalov d0544a148a Minimize dependencies of ModuleMapping
Prepare it to be moved to metadata.jvm
2018-04-23 18:42:32 +02:00
Vyacheslav Gerasimov 4299455dc1 as32: Update to AS 3.2 C10 2018-04-13 21:33:03 +03:00
Dmitry Savvinov 934c56a4da Wire StorageManager into a ClassTypeConstructorImpl and ClassDescriptorImpl 2018-04-12 13:44:10 +03:00
Nicolay Mitropolsky e7c3086db7 182: dep javax.annotation:jsr250-api:1.0 added to compiler/frontend.java 2018-04-11 16:28:43 +03:00
Alexey Sedunov a9cdccc6de as31: Misc: Fix compilation 2018-04-11 16:28:18 +03:00
Mikhael Bogdanov b785aca98e 172: Fix compilation 2018-04-11 16:28:12 +03:00
Mikhael Bogdanov 56d1184515 Restrict conditions for @JvmDefault super calls
Condition was too strict
  if @JvmDefault implicitly hidden by class in inheritance.
  Diagnostic is redundant cause there isn't breaking
  change depending on interface method generation strategy and
  delegating stub generation in inheriting class.
2018-04-10 16:33:26 +02:00
Mikhael Bogdanov e23c406285 Minor. Avoid recursion 2018-04-10 16:33:25 +02:00
Mikhael Bogdanov 6d1af263ba Restrict conditions for @JvmDefault super calls
Condition was too strict if we actually make super call
  through super class. Diagnostic is redundant cause there isn't breaking
  change depending on interface method generation strategy.
2018-04-10 16:33:25 +02:00
Mikhael Bogdanov d788b3b6f9 Add warning on overriding java default by non @JvmDefault method 2018-04-09 18:13:35 +02:00
Mikhael Bogdanov cb9c1ae104 Support default method super calls within @JvmDefault ones 2018-04-09 18:13:34 +02:00
Mikhael Bogdanov 942dd8a67c Properly calculate this for super call 2018-04-09 18:13:34 +02:00
Mikhael Bogdanov 2c56f0bfd3 Require 'jvmDefaultFlag' for default super calls 2018-04-03 19:18:19 +02:00
Mikhael Bogdanov db59e916fb Inline utility method 2018-04-03 19:18:18 +02:00
Mikhael Bogdanov 3f5fea05de Write 'RequireKotlin' annotation on @JvmDefault members 2018-04-03 19:18:17 +02:00
Mikhael Bogdanov 23e8adb793 Add custom diagnostic checker for @JvmDefault annotation 2018-04-03 19:18:17 +02:00