Commit Graph

38497 Commits

Author SHA1 Message Date
Alexey Sedunov 358b5fe548 Move: Force package name change when moving Java files
Package statement in Java file is updated too late
when moving the entire containing directory, so we force it
with intercepting MoveFileHandler implementation
2017-04-11 11:45:08 +03:00
Alexey Sedunov 3007b11973 Move: Use MoveFilesWithDeclarationProcessor for files & directories 2017-04-11 11:45:07 +03:00
Alexey Sedunov 22a56a81b9 Move: Drop obsolete code 2017-04-11 11:45:06 +03:00
Alexey Sedunov f5d106a68f Refactoring: Drop obsolete KotlinFileReferencesResolver class 2017-04-11 11:45:05 +03:00
Alexey Sedunov 7f115343f9 Kotlin Facet: Drop Gradle/Maven-based version info providers
They are obsolete since compiler/library version can be detected
based on module dependencies generated on external model import
2017-04-11 11:45:04 +03:00
Denis Zharkov aaddc34b54 Optimize control-flow analysis algorithm
There's no need to recalculate results if all of the
previous instructions' results remain unchanged.

It's a crucial optimizations because otherwise algorithm
can degrate to O(n * m) [n - instructions number, m - variables number]
even in a linear code like this:
var a_1 = 1
var a_2 = 1
...
var a_m = 1

We perform analysis iteration once, then we repeat it to be sure
that no changes happened and here for each instruction we're
starting to check if recomputed value is the same, that basically
compares maps of all the variables, so it works O(n * m)

After this change on the second iteration we won't recompute new values
as none of predecessor has been changed
2017-04-11 11:26:11 +03:00
Denis Zharkov 5e449fdc02 Optimize control-flow analysis by use of persistent maps
The case that it's worth to optimize is functions
with a lot of variables.

After debugging it's recovered that control-flow works nearly
O(n * m) where n is pseudocode size and m is a number of variables:
the algorithm performs O(n) copies of hashmap of size O(m)

Persistent maps should help because we don't need to perform a
copy of them, so the expected performance after the change is applied
is O(n log m)

We've tried pcollections and javaslang, and the latter one has demonstrated
better results

See results before and after optimizations
before:
https://github.com/dzharkov/kotlin-compiler-benchmarks/blob/3da7ba45a704969653d70b50995f730e968540d8/reports/benchmarks-many-vars-2017-03-14.txt

after with pcollections:
https://github.com/dzharkov/kotlin-compiler-benchmarks/blob/3da7ba45a704969653d70b50995f730e968540d8/reports/benchmarks-many-vars-persistent-optimizations-2017-03-17.txt

after with javaslang:
https://github.com/dzharkov/kotlin-compiler-benchmarks/blob/d22a871b175b291fb337b51ef6465ba70bbfd96c/reports/benchmarks-many-vars-javaslang-2017-04-07.txt
2017-04-11 11:26:11 +03:00
Yan Zhulanow 9e61eea758 Support inline properties in debugger class search 2017-04-10 23:25:55 +03:00
Yan Zhulanow cb9e90183a Debugger: Fix AbstractPositionManagerTest
MockReferenceType can't be used anymore because the new DebuggerClassNameProvider requires much more from it.
The new SmartMockReferenceType implements methods such as nestedTypes() or allLineLocations() properly.

Also, as PositionManager can return more than one class, we should check if any of the classes it returned matches the pattern.
2017-04-10 23:25:54 +03:00
Yan Zhulanow 622430a296 Debugger: Fix AbstractPositionManagerTest
MockReferenceType can't be used anymore because the new DebuggerClassNameProvider requires much more from it.
The new SmartMockReferenceType implements methods such as nestedTypes() or allLineLocations() properly.

Also, as PositionManager can return more than one class, we should check if any of the classes it returned matches the pattern.
2017-04-10 23:25:53 +03:00
Yan Zhulanow fe3c1aff8b Debugger: Classes for callable references should be treated as synthetic 2017-04-10 23:25:52 +03:00
Natalia Ukhorskaya 42e14961de Debugger: Find classes using its inner classes (initial implementation) 2017-04-10 23:25:51 +03:00
Yan Zhulanow 3ee65ac499 Kapt: Support specifying javac options (KT-17245) 2017-04-10 22:48:17 +03:00
Sergey Igushkin 8cdb08cbfe Fixed duplicated kapt options caused by multiple call to args setup
Separated kapt args from other plugin options.

Issues: #KT-16965 Fixed

Fix indentation
2017-04-10 20:59:23 +03:00
Sergey Igushkin ea3adb0629 Implemented resolving the compiler jar using the class loader
Added resolving the compiler jar using the class loader urls as the
first step with the fallback to the original resolution method. Also
helps if the compiler is not present in the classpath dependencies.

Issues: #KT-16580 Fixed

Changed to getting plugin version from the applied plugin instead of
the plugin JAR name.

Removed unnecessary working with version of AbstractKotlinPlugin.
2017-04-10 20:55:19 +03:00
Sergey Igushkin bda59e58d5 Filling in and reverting annotationProcessor
Added reverting processor path back.
Appending processor path instead of setting it.

Issues: #KT-17255 Fixed

(cherry picked from commit 843844b)

Added a test checking that -processorpath is set for all Gradle versions
2017-04-10 20:50:34 +03:00
Sergey Igushkin 64278a06cc Refactoring in AnnotationProcessingManager.kt. 2017-04-10 20:45:03 +03:00
Sergey Igushkin 80daae90e3 Partial fix for the processor path not being set up properly.
Issues: #KT-17255
2017-04-10 20:44:12 +03:00
Alexey Tsvetkov e7e29f2651 Avoid changing java.rmi.server.hostname property 2017-04-10 20:39:34 +03:00
Alexey Tsvetkov 54ee779ba1 Import 'implement' dependency of platform project transitively
#KT-16926 fixed
2017-04-10 20:25:48 +03:00
Ilya Gorbunov e9c47d6498 Minor: validate required environment variables are set. 2017-04-10 19:46:06 +03:00
Ilya Gorbunov 3425f6d3af Remove dist-quick as it fails on terminal steps anyway.
Add compiler-for-maven packing step to dist-quick-compiler-only.
2017-04-10 19:46:06 +03:00
Ilya Gorbunov 37e046f6cd Provide shortcuts for producing quick compiler for maven and rebuilding stdlib-js from ant. 2017-04-10 19:46:06 +03:00
Ilya Gorbunov afba967fcf Use kotlin-stdlib.jar instead of kotlin-runtime.jar as runtime during build 2017-04-10 19:46:06 +03:00
Dmitry Jemerov 655fe87d43 Remove obsolete code for deleting script/kotlin.js 2017-04-10 17:34:13 +02:00
Dmitry Jemerov 62eb9e9909 Check jar name before calling getVirtualFileForJar()
#KT-17331 Fixed
2017-04-10 17:32:30 +02:00
Dmitry Jemerov 406714a1f4 Remove warning for running the compiler under Java 6/7
Now the compiler won't even start, so no need to check this manually.
2017-04-10 17:30:03 +02:00
Dmitry Jemerov 5a7278b856 Fix test: update Android build tools to release version 2017-04-10 16:13:31 +02:00
Mikhail Zarechenskiy 438f318d3e Minor, update test data 2017-04-10 16:35:00 +03:00
Mikhael Bogdanov b51cb9a911 Delete clean reference instructions on dereferencing captured variables
Codegen generates clean instructions for ref values (captured vars)
on block exit so we should delete them on dereferencing captured values.

  #KT-17200 FIXED
2017-04-10 16:35:03 +05:00
Mikhael Bogdanov f3e2abfd5f Don't eliminate redundant casts to multi-dimension arrays
Dex doesn't recognize ANEWARRAY [Ljava/lang/Object; types as Object [][], but Object [].
It's not clear is it bug in dex or not

 #KT-17200 InProgress
2017-04-10 16:35:01 +05:00
Mikhail Zarechenskiy 86c4ad1165 Drop erroneously used @Deprecated annotation from parameter
Annotation @native is deprecated itself and @deprecated on parameter doesn't have message, which cause compilation error after 3c4afcd
2017-04-10 12:48:10 +03:00
Mikhail Zarechenskiy 682fe9e9ca Don't forget to resolve annotations from constructor parameter
#KT-12245 Fixed
2017-04-10 12:48:10 +03:00
Mikhail Zarechenskiy c9b468581a Fix type checking of local return inside return expression
#KT-16426 Fixed
2017-04-10 12:48:09 +03:00
Mikhail Zarechenskiy 7f287a4230 Support warning about useless cast on safe cast
#KT-13348 Fixed
2017-04-10 12:48:09 +03:00
Vyacheslav Gerasimov 107879a78a Implement getTypeElement for UastKotlinPsiVariable
#KT-16849 Fixed
2017-04-10 12:40:33 +03:00
Vyacheslav Gerasimov 1d134ffc72 Register Android api quickfixes for inlined api inspection
#KT-14857 Fixed
2017-04-10 12:39:40 +03:00
Vyacheslav Gerasimov 70d24d0108 Fix NoSwingUnderWriteActionException in KotlinAndroidAddStringResource 2017-04-10 12:38:34 +03:00
Pavel V. Talanov 2f159bb64b Light classes: do not rely on dummy context when data class autogenerated members conflict with declared members
Fix related issues with nested classes
2017-04-09 15:10:29 +03:00
Pavel V. Talanov 69c250a1b7 Light class test: avoid checking method visibility when NoLaziness is not specified
Allows to avoid putting NoLaziness flag on every test that mentions 'override' modifier
2017-04-09 15:09:15 +03:00
Pavel V. Talanov 32d3a1b4c9 Light classes: generate ACC_STATIC for DefaultImpls classes
To provide consistency between light classes and their delegates

IdeLightClass#testExtendingInterfaceWithDefaultImpls still failing since
    we do not generate implementations delegating to DefaultImpls of superinterfaces
2017-04-09 15:09:13 +03:00
Pavel V. Talanov 5e351061e8 Light classes: test consistency for inner classes 2017-04-09 15:09:10 +03:00
Pavel V. Talanov 4f701285b1 Light class builder: do not generate methods delegating to DefaultImpls in kotlin classes
Class APIs from java point of view stays the same so we can avoid generating those methods
Otherwise we have to calculate all supertypes when getMethods() is called,
    which imposes severe performance penalties
We have to pretend these methods are not 'abstract' (also we consider them 'default' for safety)
    so java highlighting does not report "class should be abstract" for all inheritors
We have to manually report "class should be abstract" on some of the java inheritors,
    specifically those that are implementing interfaces directly
	    as opposed to extending kotlin classes implementing those interfaces
2017-04-09 15:09:01 +03:00
Pavel V. Talanov db294da24d Minor, refactor: Move hasBody() to KtProperty 2017-04-09 15:07:50 +03:00
Pavel V. Talanov 922fde9986 LazyLightClassDataHolder: minor, improve diagnostics 2017-04-09 15:07:48 +03:00
Pavel V. Talanov 8fbd75ce27 AbstractIdeLightClassTest: minor, refactor 2017-04-09 15:07:45 +03:00
Alexey Tsvetkov 0a42a1c104 Minor: fix maven IC tests with custom local repository 2017-04-08 21:14:49 +03:00
Ilya Gorbunov e7dc7ec005 Rebuild sources for kotlin-daemon-client and compiler-client-embeddable in maven build
Do not build these sources in ant.
Do not require them as artifact dependencies.
2017-04-08 19:07:54 +03:00
Ilya Gorbunov 5aabcb6ea3 Update build instructions in ReadMe to include gradle build step.
Also update links and overall readme structure.
2017-04-08 08:37:12 +03:00
Ilya Gorbunov f5647fb27f Delete temporary proguard configuration for gradle, change the primary one. 2017-04-08 08:32:05 +03:00