Commit Graph

2666 Commits

Author SHA1 Message Date
Ilmir Usmanov
4a7703ed66 Implement correct is check for SuspendFunction
Let callable references implement SuspendFunction
Do not generate CHECKCAST SuspendFunction when LV is 1.2

 #KT-25825: Fixed
2018-08-22 16:21:27 +03:00
Alexander Udalov
852760b3b0 Report error on incompatible .kotlin_module files in classpath
Also remove obsolete test wrongAbiVersionNoErrors

 #KT-25973 Fixed
 #KT-26266 Open
2018-08-21 17:12:02 +02:00
Alexander Udalov
cd12772bc5 Remove unneeded bunch files related to PsiJavaModule
PSI for modules and related classes are already available in AS3.1
2018-08-10 00:10:37 +02:00
Mikhail Zarechenskiy
fa2d159e3f Refactoring: move JVM related diagnostic to ErrorsJvm 2018-08-08 15:47:26 +03:00
Mikhail Zarechenskiy
34cd0e9f6c Do not report warning about useless annotations for JvmStatic properties
#KT-25745 Fixed
2018-08-08 15:47:25 +03:00
Denis Zharkov
e3bdde45de Intern canonical classes and parameters names in BinaryClassSignatureParser
Otherwise, a lot of duplicated strings are generated
2018-08-08 15:17:25 +07:00
Denis Zharkov
782f221ab5 Optimize memory-footprint for ClassifierResolutionContext
Use immutable maps for inner classes/type parameters
in nested contexts instead of making copies for each of them
2018-08-08 15:17:25 +07:00
Alexander Udalov
f9ed8e7aaf Minor, make org.jetbrains.kotlin.fileClasses.LOG private
To prevent it from being suggested in auto-import
2018-08-07 13:38:30 +02:00
Alexander Udalov
5da8ce844a Minor, move ContentRoot and KotlinSourceRoot to module 'cli'
Also move CONTENT_ROOTS from JVMConfigurationKeys to
CLIConfigurationKeys since it's used on all platforms, not just JVM
2018-08-07 13:38:30 +02:00
Vyacheslav Gerasimov
53b1a8bd37 Remove hacks introduced for 172 platform compatibility 2018-08-02 19:32:18 +03:00
Vyacheslav Gerasimov
0103c0d2fd Switch to 182 platform 2018-08-02 18:17:06 +03:00
Dmitry Petrov
566b5856ec Constructor call normalization mode depends on language version 2018-07-27 09:52:29 +03:00
Dmitry Petrov
44962b00b2 Introduce SyntheticPropertyDescriptor interface 2018-07-19 12:34:45 +03:00
Alexander Udalov
1464a4ac58 Load Java parameter names correctly in BinaryJavaMethod
PSI-based implementation (accessible via
`-Xuse-old-class-files-reading`) loads parameter names from the
"MethodParameters" attribute if it's present, so our own implementation
should as well.

This metadata doesn't seem supported in the java.lang.model.element API
though, so SymbolBasedValueParameter (which is used in `-Xuse-javac`)
will continue to have incorrect behavior for now

 #KT-25193 Fixed
2018-07-18 18:15:09 +02:00
Alexander Udalov
4122021090 Add BinaryVersion to DeserializationContext
This will be useful to implement version-dependent deserialization,
which is needed for gradual fixes of issues in metadata

 #KT-25120 In Progress
2018-07-18 17:58:46 +02:00
Alexander Udalov
1e675bdc01 Simplify implementation of JvmField property in interface companion
Move parts of the logic to the only places where they're needed:
checking for public/final/val is only needed in
JvmFieldApplicabilityChecker, checking the proto flag is only needed in
reflection, checking the JvmField annotation presence is only needed in
backend
2018-07-18 13:24:45 +02:00
Mikhail Zarechenskiy
b6db8971e4 Warn about annotations that targets non-existing accessors
#KT-15453 In Progress
2018-07-17 00:22:53 +03:00
Mikhael Bogdanov
1d283d243e Support @JvmField on interface properties
#KT-15807 Fixed
2018-07-16 16:13:15 +02:00
Mikhael Bogdanov
f3b419377b Minor. Reformat 2018-07-16 16:13:14 +02:00
Alexander Udalov
ce34deb9af Delete DefaultImportProvider, refactor TargetPlatform.defaultImports 2018-07-16 13:45:11 +02:00
Alexander Udalov
1f0fb4823f Simplify DefaultImportProvider, introduce "low priority imports"
Previously, packages `java.lang` and `kotlin.jvm` were imported on JVM
by default on the same rights, causing problems when the same classifier
existed both in `java.lang` and `kotlin.jvm`. Since the only known case
of such conflict were type aliases to JVM classes, the corresponding
classes (expansions of those type aliases) were manually excluded from
default imports. This made the code in DefaultImportProvider complicated
and resulted in multiple problems, regarding both correctness and
performance (see 82364ad3e5, a9f2f5c7d0, dd3dbda719).

This change adds a new concept, a "low priority import", and treats
`java.lang` as such. Since these imports are now separated from the rest
of default imports in LazyImportScope via secondaryClassImportResolver,
conflicts between classifiers are handled naturally: the one from
`kotlin.jvm` always wins (unless the one from `java.lang` is imported
explicitly, of course). This approach is simpler, safer and does not
require any memory to cache anything.

Skip ResolveToJava.kt test for javac-based resolve; it now fails because
of a weird issue which I didn't have time to investigate (this is OK
because it's a corner case of an experimental functionality)
2018-07-16 13:45:11 +02:00
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