Compare commits

...

2283 Commits

Author SHA1 Message Date
Yan Zhulanow
364c8af076 Update changelog for Kotlin 1.2.41 2018-04-28 04:08:27 +03:00
Mikhael Bogdanov
7b2b1f9f7d Skip @JvmDefault in UnimplementedKotlinInterfaceMemberAnnotator
#KT-23967 Fixed

(cherry picked from commit ec0b9aa)
2018-04-26 15:39:16 +02:00
Mikhael Bogdanov
3d3be3dc78 Revert "Get rid of 'BRIDGE' flag on $default functions"
Removed bridge flag triggers problem with Spring Boot: KT-23973
 This reverts commit cdcb651

 #KT-23973 Fixed

(cherry picked from commit 5efc9f2)
2018-04-26 15:39:10 +02:00
Alexey Tsvetkov
8209a50764 Fix incremental compilation with Java 9+
#KT-23901 fixed
2018-04-25 17:44:49 +03:00
Raluca Sauciuc
d4f25e1043 More fixes for Android Studio 3.2 compatibility
(cherry picked from commit 258cba2)
2018-04-24 16:59:53 +03:00
Mikaël Peltier
73b9685f38 KT-23931 Avoid infinite loop into RedundantGotoMethodTransformer
- Follow-up of 9fb0f59813 to avoid
infinite loop during redundant goto otpimization.

Fix of https://youtrack.jetbrains.com/issue/KT-23931

(cherry picked from commit b1ef670)
2018-04-23 20:27:56 +03:00
Mikhail Zarechenskiy
fdfe801c92 Render unwrapped suspend function in backend
Hierarchy of specially wrapped suspend function may have inconsistent
 overridden descriptors: some of them may be wrapped, some unwrapped.
 To mitigate this problem, currently it's proposed to render only
 unwrapped functions, which are always have stable overridden descriptors

 #KT-23809 Fixed
2018-04-23 18:04:40 +03:00
Dmitry Petrov
8b446a1649 Use correctElementType to determine array element type for withIndex
Rather unkind "gotcha" in ASM API.
2018-04-23 17:56:16 +03:00
Yan Zhulanow
6037b04f89 Minor: Fix typo in changelog 2018-04-19 17:38:22 +03:00
Pavel V. Talanov
80fd1ac8ab Do not throw when trying to resolve java outside project model
#KT-23444 Fixed
 #KT-22825 Fixed
2018-04-17 18:10:58 +02:00
Yan Zhulanow
c4ce4ac450 Update changelog for 1.2.40 2018-04-16 17:48:44 +03:00
Alexey Sedunov
5184edea5f Configuration: Put 'buildscript' block before 'plugins' in build.gradle
#KT-23588 Fixed

(cherry picked from commit 6c7959d)
2018-04-16 15:38:12 +03:00
Yan Zhulanow
66be4ccb5e Update changelog (1.2.40 Golden RC) 2018-04-13 21:11:49 +03:00
Raluca Sauciuc
1227ade91e Support androidx packages
... in the IDE plugin and the Android extensions compiler.

Change-Id: Iffd58351b0592e12ffc937c06d871d26958fe161

(cherry picked from commit 89d61ee)
2018-04-12 16:30:44 +03:00
Alexey Tsvetkov
8f30017405 Use KotlinCoreEnvironment for parsing Kotlin in IC
Creating and disposing CoreApplicationEnvironment on each call leads to
problems with parallel builds, while KotlinCoreEnvironment
avoids disposing application environment in case of parallel builds.

    #KT-23694 fixed
2018-04-11 21:47:48 +03:00
Alexey Tsvetkov
883a7fd2dc Move parseFileUtils to incremental-compilation-impl 2018-04-11 21:47:44 +03:00
Alexander Podkhalyuzin
f1e395c1d9 Do not show duplicated names in variables completion list
#KT-23546 Fixed

(cherry picked from commit e4dfa58)
2018-04-11 17:08:24 +03:00
Alexander Podkhalyuzin
b0d09109c4 Do not show autopopup variable name completion if it was closed
#KT-23546 Comment

(cherry picked from commit 0231a3a)
2018-04-11 17:07:53 +03:00
Natalia Selezneva
94532db659 Fix Repl stopping after first line. Do not exit after readLine in user code
Revert previous workaround from commit 8e88820
^KT-23622 Fixed
2018-04-11 08:46:37 +03:00
Anton Bannykh
4e0af21df4 Revert "Clean up test skips after KT-17137"
This reverts commit 715d5e9

(cherry picked from commit cc1c7dcb04c98bfb70a852e2a4d3456573015682)
2018-04-10 20:46:00 +03:00
Anton Bannykh
39809cedba Revert "JS: remove -XtypedArraysEnabled flag (always true now)"
This reverts commit 4a5e9bb

(cherry picked from commit 7863b7741ebf713e5388852b6ad49c72e63a2b7e)
2018-04-10 20:46:00 +03:00
Mikhael Bogdanov
625bfd8adb 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.

(cherry picked from commit 56d1184)
2018-04-10 16:43:28 +02:00
Mikhael Bogdanov
d3017a8071 Minor. Avoid recursion
(cherry picked from commit e23c406)
2018-04-10 16:43:26 +02:00
Mikhael Bogdanov
b45a5a8ca7 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.

(cherry picked from commit 6d1af26)
2018-04-10 16:43:23 +02:00
Mikhael Bogdanov
fd97d56bc4 Update documentation for @JvmDefault
(cherry picked from commit 5f235a8)
2018-04-10 16:43:20 +02:00
Mikhael Bogdanov
3801410d1c Support custom options in quick fix test framework
(cherry picked from commit ea407ab)
2018-04-10 14:36:46 +02:00
Mikhael Bogdanov
916c5e2260 Add quick fix for adding @JvmDefault annotation
(cherry picked from commit c5d4f22)
2018-04-10 14:36:43 +02:00
Mikhael Bogdanov
23708991fe Fix misspelling in test data
(cherry picked from commit 31e459d)
2018-04-10 14:36:40 +02:00
Mikhael Bogdanov
26c8f32390 Add warning on overriding java default by non @JvmDefault method
(cherry picked from commit d788b3b)
2018-04-10 14:36:37 +02:00
Mikhael Bogdanov
e3d5021799 Support default method super calls within @JvmDefault ones
(cherry picked from commit cb9c1ae)
2018-04-10 14:36:34 +02:00
Mikhael Bogdanov
e5d903bc20 Properly calculate this for super call
(cherry picked from commit 942dd8a)
2018-04-10 14:36:31 +02:00
Ilya Chernikov
42950a9993 Use script compiler options on script dependencies in the IDE as well
further fixes #KT-19120
2018-04-09 15:29:45 +02:00
Nikolay Krasko
d69c627205 Add hard dependency to Java module in plugin.xml
Otherwise resulting plugin will be installable to PyCharm, WebStorm and
other Intellij IDE without Java.

It can be resolved with `xi:include`, but it should be done with care,
because some declarations in `jvm.xml` should be placed after some
declarations in `plugin.xml` (action groups suffer from this issue for
sure).
2018-04-09 12:32:35 +03:00
Yan Zhulanow
54f03aeaf9 Update the changelog for 1.2.40 2018-04-06 15:18:41 +03:00
Yan Zhulanow
8e8882065c REPL: Fix REPL stopping after the first line (#KT-23622) 2018-04-05 18:17:06 +03:00
Alexander Udalov
fbb2ae4ef1 Disable packing module-info to libraries until Android issue is fixed
https://issuetracker.google.com/issues/77587908

 #KT-21266 Open
2018-04-04 21:53:50 +02:00
Yan Zhulanow
2283366076 Revert "Debugger: Fix breakpoints and stepping for inline-only function lambda arguments (#KT-23064)"
This reverts commit aa75d88
2018-04-04 19:23:00 +03:00
Mikhael Bogdanov
7f8efc6dab Add @RequireKotlin(1.2.40) on interface with @JvmDefaults and its subinterfaces
(cherry picked from commit 4aec949)
2018-04-04 16:18:41 +02:00
Mikhael Bogdanov
da097a312b Update test data
(cherry picked from commit be33a9b)
2018-04-04 14:58:09 +02:00
Mikhael Bogdanov
b3399a6529 Update @JvmDefault documentation
(cherry picked from commit a27d1b7)
2018-04-04 14:58:06 +02:00
Natalia Selezneva
da4d4153de Rearrange script definition contributors to avoid old EP appear before new EP
Fix highlighting of build.gradle.kts files with LivePlugin enabled
^KT-23571 Fixed

(cherry picked from commit a6019cc)
2018-04-04 13:56:22 +03:00
Vyacheslav Gerasimov
73676d7a9e Upgrade shadow plugin to 2.0.2
Fixes warning 'Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.'

(cherry picked from commit f55d137790)
2018-04-04 10:35:06 +02:00
Alexander Udalov
ff3da15cde Check that kotlin.stdlib is explicitly required in module-info
Writing a Jigsaw-modular Kotlin program which doesn't require
kotlin.stdlib doesn't make sense because it most likely will fail at
runtime, on access to anything from the standard library. Previously, we
checked that kotlin.stdlib was in the module graph, but that's not
enough, we should also check that the source module requires it.
'-Xallow-kotlin-package' can be used to disable the error.

Add a test checking that an indirect (transitive) dependency is also OK

(cherry picked from commit 0439abba46)
2018-04-03 22:04:24 +02:00
Ilya Gorbunov
696bff31f4 Make JDK 9 required to build the project
(cherry picked from commit 7501d2ad69)
2018-04-03 22:04:22 +02:00
Ilya Gorbunov
a8b561be15 Use default compileJava9Java task to build java9 source set
(cherry picked from commit 299d6fa772)
2018-04-03 22:04:19 +02:00
Ilya Gorbunov
3e8dab05f7 Improve JDK discovery for JDK9+ on Windows
(cherry picked from commit bd4abaa8bf)
2018-04-03 22:04:17 +02:00
Alexander Udalov
d67201aae2 Add module-info.java for kotlin-reflect
The standard way of loading resources with built-ins metadata from the
current class loader no longer works in the modular mode on Java 9
because the current class loader is for module 'kotlin.reflect', but the
metadata is located in the module 'kotlin.stdlib'. On Java 9, we now use
the class loader of 'kotlin.stdlib' to load these resources.

 #KT-21266 Fixed

(cherry picked from commit 828cc6dbf3)
2018-04-03 22:04:15 +02:00
Alexander Udalov
01fc60fab3 Add module-info.java for standard Kotlin libraries
Using the new multi-release jar feature, store compiled
module-info.class files into META-INF/versions/9 instead of the artifact
root. Hopefully, this will break fewer tools which do not support
module-info.class files because any sane tool should not do anything
with files in META-INF because before Java 9 that directory only
contained resources.

Upgrade some Maven plugins to newer versions which do not fail on
module-info.class files

 #KT-21266 In Progress

(cherry picked from commit 2d41c7d462)
2018-04-03 22:04:13 +02:00
Alexander Udalov
48140586b9 Fix warning about kotlin-reflect-api bundling Kotlin Runtime
This fixes the "Some JAR files in the classpath have the Kotlin Runtime
library bundled into them" warning when compiling all modules that
depend on kotlin-reflect-api. This warning is reported on jars in the
classpath which look like standard library artifacts, but in fact are
not because their manifest does not say so. With this change, we're now
writing the manifest of standard library artifacts to the resulting jar
of kotlin-reflect-api, with the standard library component name
"internal" (in fact, it doesn't affect anything here, any name would be
OK) to make the compiler believe that this is actually a standard
library jar

(cherry picked from commit 964bf503a6)
2018-04-03 22:04:09 +02:00
Alexey Tsvetkov
8e66f6af9b Temporarily turn off source map generation in JS IC tests
Until IncrementalJsCompilerRunnerTestGenerated$ClassHierarchyAffected.testEnumEntryRemoved 
is fixed
2018-04-03 21:14:18 +03:00
Alexey Tsvetkov
686e8bc06a Use daemon if available for parsing files in JPS 2018-04-03 21:14:13 +03:00
Alexey Tsvetkov
3cab8b4f41 Invalidate usages of removed classes before round
#KT-23165 fixed
2018-04-03 21:14:08 +03:00
Alexey Tsvetkov
18310d9b4c Convert KotlinSourceFileCollector: simplify after conversion 2018-04-03 21:14:03 +03:00
Alexey Tsvetkov
b393d78520 Convert KotlinSourceFileCollector: actual conversion 2018-04-03 21:14:00 +03:00
Alexey Tsvetkov
720bba5bba Convert KotlinSourceFileCollector: rename file 2018-04-03 21:13:55 +03:00
Alexey Tsvetkov
3d72966469 Remove usages of deprecated API 2018-04-03 21:13:50 +03:00
Alexey Tsvetkov
458bd709c9 Replace reflection with direct call 2018-04-03 21:13:46 +03:00
Alexey Tsvetkov
5cd044691b Convert CompilerRunnerUtil: actual conversion 2018-04-03 21:13:41 +03:00
Alexey Tsvetkov
1776dc6de2 Convert CompilerRunnerUtil: rename file 2018-04-03 21:13:37 +03:00
Alexey Tsvetkov
b538e01889 Reformat jps-plugin module 2018-04-03 21:13:33 +03:00
Mikhael Bogdanov
2cd5bd4d83 Update test data
(cherry picked from commit 08ff1de)
2018-04-03 19:47:12 +02:00
Mikhael Bogdanov
db722b468f Require 'jvmDefaultFlag' for default super calls
(cherry picked from commit 2c56f0b)
2018-04-03 19:47:08 +02:00
Mikhael Bogdanov
ba4858dde9 Inline utility method
(cherry picked from commit db59e91)
2018-04-03 19:47:05 +02:00
Mikhael Bogdanov
8037619a51 Write 'RequireKotlin' annotation on @JvmDefault members
(cherry picked from commit 3f5fea0)
2018-04-03 19:47:02 +02:00
Mikhael Bogdanov
522be915c5 Add custom diagnostic checker for @JvmDefault annotation
(cherry picked from commit 23e8adb)
2018-04-03 19:46:59 +02:00
Mikhael Bogdanov
e7b8279dcd Relocate @JvmDefault to stdlib module
(cherry picked from commit 89f22e6)
2018-04-03 19:46:55 +02:00
Mikhael Bogdanov
7a1aa8ac81 Update test data. Use simple ''@JvmDefault' instead full qualifier
(cherry picked from commit 38f8924)
2018-04-03 19:46:50 +02:00
Mikhael Bogdanov
9e88b3d691 Check method abstractness during bridge generation per method not interface
(cherry picked from commit 2a8041e)
2018-04-03 19:46:45 +02:00
Mikhael Bogdanov
6e903333a6 Remove @JvmDefault members from delegation
(cherry picked from commit f290b32)
2018-04-03 19:46:40 +02:00
Mikhael Bogdanov
a51181b009 Support inline for private @JvmDefault members
(cherry picked from commit d84a15c)
2018-04-03 19:46:36 +02:00
Mikhael Bogdanov
69c635e7c3 Minor.Reformat
(cherry picked from commit affe445)
2018-04-03 19:46:33 +02:00
Mikhael Bogdanov
5ba37fdff7 Support synthetic accessors for @JvmDefault members
(cherry picked from commit 308283e)
2018-04-03 19:46:29 +02:00
Mikhael Bogdanov
4a0037850b Minor.Reformat
(cherry picked from commit 1acd564)
2018-04-03 19:46:26 +02:00
Mikhael Bogdanov
3bbffa38ab Add @JvmDefault diagnostics
(cherry picked from commit 1d3e57a)
2018-04-03 19:46:23 +02:00
Mikhael Bogdanov
75b3a662f3 Remove unused parameters, compiler keys and obsolete code
(cherry picked from commit 63afd37)
2018-04-03 19:46:19 +02:00
Mikhael Bogdanov
a28a0beaea Initial support of @JvmDefault
(cherry picked from commit fe45eb2)
2018-04-03 19:46:16 +02:00
Mikhael Bogdanov
33577b4078 Add @JvmDefault annotation
(cherry picked from commit e885195)
2018-04-03 19:46:12 +02:00
Mikhael Bogdanov
4664f7c55d Remove unused test data
(cherry picked from commit 5830f99)
2018-04-03 19:46:08 +02:00
Mikhael Bogdanov
995156b801 Remove wrong directive
Similar test exists under 'defaults' foldes

(cherry picked from commit c143480)
2018-04-03 19:46:05 +02:00
Mikhael Bogdanov
38a8959356 Specify idea.home.path for java 8 tests
Default discovery mechanism points to wrong location

(cherry picked from commit b337b9e)
2018-04-03 19:46:00 +02:00
Mikhail Glukhikh
b0da004779 Fix handling of characters in "convert to string template"
So #KT-23045 Fixed
So #KT-23046 Fixed

(cherry picked from commit 6d94578)
2018-04-03 18:27:12 +03:00
Dmitry Savvinov
df6ed491f5 Don't throw exception on recursion for class header scope
The root issue here is that when we have some cycle in scopes, the place
where we detect a loop depends on where we've entered that cycle.

Previously, we didn't know about cases where we enter scopes loop
through `ClassResolutionScopesSupport.scopeForClassHeaderResolution` =>
there were no need to handle recursion on `scopeForClassHeaderResolution`
carefully.

It seems that in some very narrow cases (launch of specific
inspection on specficic code with specific caches state), we do manage
to enter loop exactly through `scopeForClassHeaderResolution` (see
KT-23033), which causes exception.

^KT-23033 Fixed

(cherry-picked from 5b216a0270)
2018-04-03 18:24:12 +03:00
Alexander Udalov
02f4a02fbe Fix NPE from JarURLConnection.getUseCaches when loading compiler plugins
#KT-22513 Fixed

(cherry picked from commit d0e99e9a3f)
2018-04-03 16:57:07 +02:00
Mikhail Glukhikh
6c0afb25fb Fix several false positives and make safer "redundant companion ref"
Don't report it on an import directive #KT-23520 Fixed
Don't report it if companion nested class is referenced #KT-23519 Fixed
Check companion reference both by descriptor and by name

(cherry picked from commit ab973b2)
2018-04-03 17:48:33 +03:00
Mikhail Glukhikh
075533595e Optimization: RedundantCompanionReferenceInspection
(cherry picked from commit 23488fa)
2018-04-03 17:48:22 +03:00
Alexey Sedunov
65365ac88b JS: Use the same output paths for JPS and Maven-based builds
#KT-22586 Fixed

(cherry picked from commit ae37cc3)
2018-04-03 12:35:57 +03:00
Yan Zhulanow
be9614793b Kapt: Find the right annotation descriptor in case of repeatable annotations (#KT-23427)
(cherry picked from commit dc3cd01fad)
2018-04-03 03:22:47 +03:00
Yan Zhulanow
6ea5b79223 Pill: Add marker option for JUnit3RunnerWithInners test runner
(cherry picked from commit 4cab250f72)
2018-04-03 03:22:43 +03:00
Yan Zhulanow
584bf7d70d Kapt: Do not escape cyrillic letters in stubs (#KT-23286)
(cherry picked from commit 46973bf1fe)
2018-04-03 03:22:39 +03:00
Yan Zhulanow
e69f45b895 Pill: Support Android tests
(cherry picked from commit ae3d574473)
2018-04-03 03:22:36 +03:00
Yan Zhulanow
91882262fc Minor: Fix Parcelable test data
(cherry picked from commit ead7653f84)
2018-04-03 03:22:32 +03:00
Yan Zhulanow
b422471683 Pill: Add idea-android-output-parser module to JPS model
(cherry picked from commit 78f2fe1eab)
2018-04-03 03:22:28 +03:00
Yan Zhulanow
46eb8854c2 Tests: Disable inspections after test as Platform test framework requires
(cherry picked from commit 5d9bdbec10)
2018-04-03 03:22:25 +03:00
Yan Zhulanow
b4f90a90d9 Android: Extract dependencies to Android plugin to extensions
(cherry picked from commit 8f02d338a6)
2018-04-03 03:22:22 +03:00
Yan Zhulanow
a92bd947af Kapt: Support 'kapt.kotlin.generated' option in Maven
(cherry picked from commit 39e9d28c63)
2018-04-03 03:22:16 +03:00
Yan Zhulanow
76365e01eb Kapt: Annotation processors should not be discovered when the processor fqNames are set by user (#KT-22939)
(cherry picked from commit b1d7935)
2018-04-03 03:22:09 +03:00
Yan Zhulanow
eee3dcc9e1 Kapt, minor: make Gradle API a bit cleaner
(cherry picked from commit dc8eb7446f)
2018-04-03 03:21:03 +03:00
Yan Zhulanow
a573b748a3 Fix EA-117939: Add a read action
(cherry picked from commit b3fbec9ec3)
2018-04-03 03:21:00 +03:00
Yan Zhulanow
59ec96e02b Evaluate: Fix annotation value evaluation (#KT-23058)
(cherry picked from commit 81f3346329)
2018-04-03 03:20:54 +03:00
Yan Zhulanow
5d236f7f85 Show warning alert when the installed Kotlin plugin version is incompatible with the IDE platform version
(cherry picked from commit 4d13e38948)
2018-04-03 03:20:50 +03:00
Yan Zhulanow
1e30cd822c EA-100549: Throw an exception with an additional data instead of Java assertion
(cherry picked from commit b664177bd5)
2018-04-03 03:20:47 +03:00
Yan Zhulanow
ceadec3c1b Fix EA-79206: Process only valid layout .xml files in Android Extensions
(cherry picked from commit ec0abb0854)
2018-04-03 03:20:43 +03:00
Yan Zhulanow
39d89fba95 Fix EA-113820: Accept also nullable elements in 'getRelevantElement()'
(cherry picked from commit c8a1517190)
2018-04-03 03:20:40 +03:00
Yan Zhulanow
5a72c8272e Fix compatibility for compiler API in DeclarationAttributeAltererExtension (EA-114961)
(cherry picked from commit 2b0489529d)
2018-04-03 03:20:37 +03:00
Yan Zhulanow
30beab4376 Remove "New Kotlin Activity" action as Android plugin can generate it by itself (#KT-22845, EA-114706)
(cherry picked from commit ff4cdfb43e)
2018-04-03 03:20:33 +03:00
Yan Zhulanow
4394fe26ce Debugger: A dirty fix for setting breakpoints inside finally {} in case if exception is thrown from try {} (#KT-22654)
(cherry picked from commit 966480a155)
2018-04-03 03:20:29 +03:00
Yan Zhulanow
aa75d887dc Debugger: Fix breakpoints and stepping for inline-only function lambda arguments (#KT-23064)
(cherry picked from commit eec9c6b)
2018-04-03 03:20:15 +03:00
Elifarley C
642611c43c toBigDecimal: Avoid creating new BigDecimal instance for some values
Avoid creating new `BigDecimal` instance by calling `BigDecimal.valueOf(this)`, which doesn't create a new instance if the argument falls in the range [0..10].
(there's a `private static final BigDecimal[] zeroThroughTen` cache in BigDecimal.java with 11 BigDecimal instances)

(cherry picked from commit 1b3d539)
2018-04-02 15:32:09 +03:00
Ilya Gorbunov
431504234d Minor code improvements, add more test cases #KT-11208
Compare new readLine with the reference implementation in BufferedReader.

(cherry picked from commit d2a235b)
2018-04-02 15:31:22 +03:00
meztihn
cfd92593c6 KT-11208 Remove readLine's new charset parameter
It can't be introduced in a patch release.

(cherry picked from commit 12e427b)
2018-04-02 15:31:12 +03:00
meztihn
2835f497b8 KT-11208 Improve readLine's tests readability
(cherry picked from commit cca7a59)
2018-04-02 15:31:00 +03:00
meztihn
129f6bebd9 KT-11208 Remove readLine's lineSeparator parameter
(cherry picked from commit 68cb66f)
2018-04-02 15:30:49 +03:00
meztihn
d5aa7f227f KT-11208 Remove stream buffering
(cherry picked from commit f6c1886)
2018-04-02 15:30:38 +03:00
Ilya Gorbunov
5692c1b086 kotlin-stdlib-js: do not import experimental sourceset in IDEA
Temporary workaround to prevent multiple IDEA modules sharing the same content root error.

(cherry picked from commit f45e3ac)
2018-04-02 15:30:29 +03:00
Alexey Sedunov
ffe7a58bf9 Move Out Of Object Intention: Fix assertion error
#KT-22983 Fixed

(cherry picked from commit b0a99c7)
2018-04-02 14:40:12 +03:00
Alexey Sedunov
82d8a3610a Extract Function: Drop extra space in modifier list
#KT-23274 Fixed

(cherry picked from commit 2104a0f)
2018-04-02 14:39:58 +03:00
Alexey Sedunov
4ec406fa6f Convert Function to Property: Forbid for properties with both initializer and getter
#KT-23293 Fixed

(cherry picked from commit 0a0043a)
2018-04-02 14:39:44 +03:00
Alexey Sedunov
80086c46e4 Rename: Increase precedence of RenameSyntheticDeclarationByReferenceHandler
Otherwise it's not applicable references to Java declarations

 #KT-20241 Fixed

(cherry picked from commit 43b4a49)
2018-04-02 14:39:29 +03:00
Alexey Sedunov
1e07f9aafa JS: Fix NodeJS run configuration support
#KT-16710 Fixed

(cherry picked from commit f4936d3)
2018-04-02 14:38:25 +03:00
Alexey Sedunov
7bcb11c94a Move: Support "Search references" option in dialogs
(cherry picked from commit e604707)
2018-04-02 14:38:15 +03:00
Vyacheslav Gerasimov
279befb46b Build: Fix dependency on markdown in :prepare:idea-plugin
org.jetbrains:markdown brings kotlin-stdlib dependency transitively, which resolves to default configuration of :kotlin-stdlib project. But we need to pack jar from distJar configuration. Also sourceSets.builtins.output is copied to plugin because :kotlin-stdlib has compile dependency on it. Probably we should also refactor :kotlin-stdlib to avoid such confusions in future.
2018-03-30 20:22:26 +03:00
Natalia Selezneva
545430ce98 Do not reload dependencies for scripts that wasn't recently touched
(cherry picked from commit 27f1eb1)
2018-03-30 14:45:51 +03:00
Natalia Selezneva
6d59778970 Do not show "Gradle Project needs to be imported" notification for gradle script if only spaces are added 2018-03-30 14:45:27 +03:00
Alexander Udalov
c52d6ad98f Sanitize compiler version for version requirement checks
Strip everything after (and including) the first '-' character.

The previous approach of skipping the checks if "SNAPSHOT" is in the
version, is subsumed by the new one because "1.2-SNAPSHOT" now becomes
"1.2" with regards to the version requirement checks, which allows the
compiler to use the 1.2-only API

(cherry picked from commit 5d9348eea1)
2018-03-29 17:12:46 +02:00
Alexander Podkhalyuzin
6000827eca Fixed aliased imports cache #KT-23430 Fixed
(cherry picked from commit b78869e)
2018-03-29 16:06:25 +02:00
Zalim Bashorov
675c1df26c [JS BE] Fix the crash on compound operations with a qualified call on left side
#KT-22001 Fixed

(cherry picked from commit 9349b9b)
2018-03-28 22:51:57 +03:00
Ilmir Usmanov
2a859144d1 Do not generate beforeInlineMarker on tailrec jump
Before this change, the codegen used to generate beforeInlineMarker
in order to spill variables later. However, since the tailrec call
is replaced with jump, no afterInlineMarker is generated, leading to
inconsistency of these markers. Thus, the spilling fails.
This change disables generating of beforeInlineMarker.

 #KT-21521: Fixed
2018-03-28 16:29:32 +03:00
Ilmir Usmanov
420b313920 Fix transforming of coroutine's create when it is suspend lambda with receiver
Unlike ordinary lambdas suspend lambdas has create method which invokes
the constructor of the lambda object (continuation).
The inliner could not cope with this.
The previous change fixed the case of suspend lambda without receiver.
This change adds support of suspend lambdas with receiver.

 #KT-21605: Fixed
2018-03-28 16:29:26 +03:00
Toshiaki Kameyama
e889c69226 Fix false positive in redundant companion reference #KT-23435 Fixed
(cherry picked from commit e96b5f3)
2018-03-28 13:30:02 +02:00
Mikhail Glukhikh
a14b079c8f Fix more broken QF tests
(cherry picked from commit 804d340)
2018-03-27 09:33:22 +02:00
Mikhail Glukhikh
e671879954 Fix broken QF tests
(cherry picked from commit e937a35)
2018-03-27 09:33:10 +02:00
Toshiaki Kameyama
8e04ecfd74 Add intentions for specifying use-site targets for an annotation
So #KT-19871 Fixed

(cherry picked from commit e06c137)
2018-03-27 09:32:59 +02:00
Toshiaki Kameyama
903c3a7b57 Fix two exceptions in "Convert concatenation to template
So #KT-23045 Fixed
So #KT-23045 Fixed

(cherry picked from commit 26dc584)
2018-03-27 09:32:44 +02:00
Toshiaki Kameyama
686b8e85ee Don't suggest 'Redundant semicolon' before lambda extension call
So #KT-23152 Fixed

(cherry picked from commit 7328f75)
2018-03-27 09:32:32 +02:00
Toshiaki Kameyama
86c27ef944 Suggest "Add annotation target" quick fix also for field use-site
So #KT-23227 Fixed

(cherry picked from commit a67068d)
2018-03-27 09:32:02 +02:00
Toshiaki Kameyama
cedeb86303 Suggest "Remove braces" in nested if correctly #KT-14270 Fixed
(cherry picked from commit e328d2d)
2018-03-27 09:31:49 +02:00
Toshiaki Kameyama
2afdb5a773 Fix "Add braces to if" when semicolon is used instead of a new line
So #KT-23123 Fixed

(cherry picked from commit 8082a5d)
2018-03-27 09:31:37 +02:00
Mikhail Glukhikh
01161b2dcb Fix parameter handling in "Move suspicious reference into parentheses"
Related to KT-21743

(cherry picked from commit b739db3)
2018-03-27 09:31:10 +02:00
Toshiaki Kameyama
09ac5ac1bb Fix "move suspicious reference into parentheses" for functional types
So #KT-21743 Fixed

(cherry picked from commit fbd06dc)
2018-03-27 09:30:58 +02:00
Toshiaki Kameyama
b542cc680b Add inspection to highlight unnecessary explicit companion references
So #KT-22971 Fixed

(cherry picked from commit 3fbf85d)
2018-03-27 09:30:45 +02:00
Alexander Udalov
e76ae20190 Report warnings on usages of kotlin-stdlib-jre7/kotlin-stdlib-jre8
#KT-21347 Fixed

(cherry picked from commit 46a1109910)
2018-03-26 19:08:14 +02:00
Nikolay Krasko
c8ab37e8ea Minor: another message fix (KT-23309)
#KT-23309 Fixed
2018-03-26 16:23:06 +03:00
Nikolay Krasko
c8b68d6ad1 Minor: typo fix (KT-23309)
#KT-23309 Fixed
2018-03-26 16:23:06 +03:00
Nikolay Krasko
06c3d7888f Fix generating cls stubs when is metadata using type tables (KT-23345)
Affected cases:
 - return type for suspend lambda
 - aliased type in type alias declaration
 - using type alias instead of aliased type in declarations

 #KT-23345 Fixed
2018-03-26 16:23:06 +03:00
Nikolay Krasko
21f26de894 Add -Xuse-type-table to jvm compiler options 2018-03-26 16:23:05 +03:00
Nikolay Krasko
1c5f1e152a Use stringValue for getting version of *jre usage in Maven (KT-23271)
#KT-23271 Fixed
2018-03-26 16:23:05 +03:00
Toshiaki Kameyama
e8a5f068fa KT-20282 'Move statement up' works incorrectly for statement after 'finally' block if 'try' block contains closure 2018-03-26 16:23:05 +03:00
Roman Artemev
71bc8633c8 Fixed handling of default params in declaration (KT-23239) 2018-03-26 15:44:21 +03:00
Roman Artemev
7d0087c55e Added test to check default params in declaration (issue KT-23239) 2018-03-26 15:44:13 +03:00
Denis Zharkov
6d29519dc3 Add a cache for PsiBasedClassResolver instances
The PsiBasedClassResolver constructor isn't very cheap to call
because it runs computation of conflicting names each time

Again, this is helpful for Spring-interop because PsiBasedClassResolver
is used very frequently there

 #KT-23380 Fixed
2018-03-26 08:00:48 +03:00
Denis Zharkov
5fffc1b268 Add a cache for KtImportDirective::importedFqName
It's very useful for Spring users because KotlinAnnotatedElementsSearcher
calls PsiBasedClassResolver::canBeTargetReference rather frequently
on a file and the latter function retreives importedFqName for each
import in the file that becomes a problem because computing fq-name
from PSI is a heavy computation

 #KT-23380 In Progress
2018-03-26 08:00:35 +03:00
Denis Zharkov
a0838fde35 Fix a memory leak of old resolve session from light classes
The problem is that diagnostics might indirectly retain a reference to an
obsolete ResolverForProject (it becomes outdated after out of block
modification).

At the same time light class instances may survive afer OOM when they
are leaked somewhere (e.g. to Java resolve)

The idea is to store the Diagnostics instance inside a
ResolverForProject component which will be collected once
ResolverForProject is collected itself.

 #KT-23380 In Progress
2018-03-26 08:00:22 +03:00
Mikhail Zarechenskiy
957f9c2a21 Prohibit incorrect annotations with use-site targets more precisely
#KT-21696 Fixed

The problem is coming from the fact that `AnnotationTarget.VALUE_PARAMETER` is mapped to receiver parameter and to value parameter, but annotation with use-site target `receiver` can be used only on type reference of receiver parameter
2018-03-25 18:25:19 +03:00
Mikhail Zarechenskiy
84cbada35b Minor, remove unused method, add TODO 2018-03-25 18:25:09 +03:00
Mikhail Zarechenskiy
fed1c0e476 Prohibit non-const expressions through varargs in annotations
Fixes #KT-23153 for Kotlin 1.3

 The problem was in the type check of expression type against expected type. When feature `AssigningArraysToVarargsInNamedFormInAnnotations` (KT-20171) appeared, expected type could be wrong, which led to failed type check
2018-03-25 18:24:58 +03:00
Mikhail Zarechenskiy
bbf5e08990 Refactoring: rename parameter to argument for annotation diagnostics 2018-03-25 18:24:48 +03:00
Mikhail Zarechenskiy
6054645508 Refactor and prettify checkCompileTimeConstant method 2018-03-25 18:24:37 +03:00
Alexey Tsvetkov
ba33de6665 IC: add destination dir to start of classpath instead of end
Otherwise IC fails when a project declares a class with the same name
as in one of its dependencies.
The issue is relevant only for non-JPS IC (Gradle, Maven, etc.),
but I added the test for JPS too.

  #KT-20516 fixed
2018-03-24 23:10:11 +03:00
Alexey Tsvetkov
1264c4c048 Do not exclude :ultimate:generateTests in "Generate All Tests"
:ultimate is excluded by default now,
so `-x :ultimate:generateTests` fails
2018-03-24 23:10:07 +03:00
Ilmir Usmanov
aaf56ddbbc Do not ignore copy operations while finding source instructions
in redundant locals elimination.

Since IgnoringCopySourceInterpreter ignores ALOADs and ASTOREs,
the source instruction of ALOAD K in {ALOAD N, ASTORE K, ALOAD K}
sequence is not ASTORE K. In this case we cannot simply replace K
with N, since there can be multiple {ALOAD N, ASTORE K} sequences
in separate branches. After replacement we get different stack
frames.
This change resolves this.

However, in ReturnUnitMethodTransformer we want to ignore copies
of the same GETSTATIC kotlin/Unit.INSTANCE, since we do not mess
with local variables and just replace ASTORE with ARETURN to help
tail-call optimization.
 #KT-23373: Fixed
2018-03-23 22:02:21 +03:00
Ilmir Usmanov
6a2b9c33fc Raise deprecation level to ERROR of coroutineContext
inside kotlin.coroutines.experimental.intrinsics package
 #KT-22400
2018-03-23 22:02:11 +03:00
Yan Zhulanow
6fd4b0d4ab Update changelog for Kotlin 1.2.40 2018-03-23 21:13:25 +03:00
Natalia Selezneva
44ab7c49af Fix compatibility with LivePlugin
^KT-23371 Fixed

(cherry picked from commit c7513b5)
2018-03-22 17:23:09 +03:00
Yan Zhulanow
f0433b7ec1 Android modules should not be imported as common modules (#KT-23367) 2018-03-22 04:54:09 +03:00
Yan Zhulanow
a96e61c96c Minor: Add Android Studio platform prefix in Android patchset branches to fix 'runIde' task for them 2018-03-22 04:54:02 +03:00
Yan Zhulanow
73e255c97c Minor: Fix bundled Kotlin plugin removal in Android Studio bundle for macOS 2018-03-22 04:53:56 +03:00
Natalia Selezneva
3559ed669d Set FATAL severity for errors from GradleScriptTemplateProvider
(cherry picked from commit 3b11b89)
2018-03-21 19:38:13 +03:00
Alexander Podkhalyuzin
089a7eed11 Fixed broken exception reporter
(cherry picked from commit 7d72fe0)
2018-03-21 17:40:37 +03:00
Denis Zharkov
fdb7995a3f Avoid retaining whole KotlinClassHeader in IDEKotlinBinaryClassCache
Before this change there was a retention chain
VirtualFile -> KotlinBinaryData -> KotlinBinaryHeaderData -> KotlinClassHeader

The latter one contains all binary metadata (a lot of String[])
while only a small part of it is used.

The used parts are moved straight to KotlinBinaryClassHeaderData
in this change.

 #KT-19484 Fixed
2018-03-20 10:46:44 +03:00
Alexey Tsvetkov
fb8759dc8c Set up idea.home.path in :incremental-compilation-impl
To avoid warnings in stderr
2018-03-19 19:01:13 +03:00
Alexey Tsvetkov
dad2274ff1 Report correct source to output mapping for kjsm files
Now IC can correctly remove kjsm files when source files are changed
2018-03-19 19:01:08 +03:00
Alexey Tsvetkov
e1e139fb02 Remove all kjsm files before writing new ones 2018-03-19 19:01:03 +03:00
Alexey Tsvetkov
1b699c5039 Compare diverged .meta.js files in a human readable way 2018-03-19 19:00:59 +03:00
Alexey Tsvetkov
fda9d5d5bb Fix comparing directories after IC test
A directory-after-rebuild should correspond to expectedDir parameter,
a directory-after-IC should correspond to actualDir parameter.
Also we should not forgive extra directories.
2018-03-19 19:00:55 +03:00
Alexey Tsvetkov
bf5e67cad3 Generate meta info in JS IC tests 2018-03-19 19:00:50 +03:00
Alexey Tsvetkov
4def41144b Avoid serializing JS metadata twice per compilation 2018-03-19 19:00:45 +03:00
Alexey Tsvetkov
d9191a0ace Sort package fragments by fq-name for JS serialization 2018-03-19 19:00:41 +03:00
Alexey Tsvetkov
4092608ff6 Optimize serializing JS metadata
This makes JS IC tests twice as fast
2018-03-19 19:00:37 +03:00
Alexey Tsvetkov
f711fc8406 Avoid reading JS libraries twice per compilation 2018-03-19 19:00:33 +03:00
Alexey Tsvetkov
355a0f8859 Improve JS inliner performance 2018-03-19 19:00:29 +03:00
Alexey Tsvetkov
eb01d9aaaf Ensure all output directories are cleared on IC rebuild
In some cases IC needs to perform a rebuild.
Before this change IC was not clearing output directories
besides destination dir for classes, so for example
kapt stubs were not cleared.

Stalled stubs might lead to compile errors.
For example:
1. foo/XGen.java is generated from annotated class foo/X (XGen also
references X).
2. foo/X is moved to bar/X and some other change forces IC to rebuild.
3. kapt generates bar/X stub, but foo/X stub
was not removed because stubs dir is not cleared.
4. kapt runs annotation processors, foo/XGen.java is generated from
foo/X stub, bar/XGen.java is generated from bar/X stub.
5. kotlinc rebuilds. Since destination dir is cleared properly,
only bar/X.class exists.
6. javac tries to compile foo/XGen and fails, because it
compiles against actual Kotlin classes, not stubs.

This commit fixes the issue by passing all output directories
of a task from Gradle to Kotlin IC.

   #KT-21735 fixed
2018-03-19 17:43:53 +03:00
Alexey Tsvetkov
3cbd842b8b Fix unresolved references in kotlin-gradle-plugin in Idea 2018-03-19 17:43:48 +03:00
Ilya Chernikov
f960ca38eb Implement support for additional compiler arguments for scripts in IDE
fixes #KT-19120
2018-03-19 11:51:14 +01:00
Ilya Chernikov
dff4cfd1fc Refactor language feature settings processing for exposing it outside of the CLI compiler 2018-03-19 11:50:50 +01:00
Natalia Selezneva
1a2f4223c3 Add test for fatal severity in scripts
(cherry picked from commit 58edab3)
2018-03-19 12:55:04 +03:00
Natalia Selezneva
7c8dcdee62 Add FATAL severity to ScriptExternalHighlightingPass
(cherry picked from commit f957b30)
2018-03-19 12:54:42 +03:00
Natalia Selezneva
b3af085cfd Add FATAL severity to script dependencies resolve result
(cherry picked from commit dcea9d0)
2018-03-19 12:54:14 +03:00
Natalia Selezneva
4844176f49 Restore old package for ScriptTemplatesProvider.
Note that this is EP used in another plugins (ex. LivePlugin https://plugins.jetbrains.com/plugin/7282-liveplugin)

(cherry picked from commit 82481b4)
2018-03-19 12:53:53 +03:00
Natalia Selezneva
0bcb6851e9 Don't highlight gradle scripts during gradle import.
Show warning on the top panel for these files

(cherry picked from commit 1f75eae)
2018-03-19 12:52:05 +03:00
Natalia Selezneva
4645884785 Don't highlight scripts if resolver returns Failure.
Note that we don't highlight script when ScriptDependenciesFileAttribute is not set.

(cherry picked from commit 5f1118e)
2018-03-19 12:49:59 +03:00
Natalia Selezneva
576974f7ad Scripts: display errors from external resolver in panel if text range is empty
(cherry picked from commit 4b4acfe)
2018-03-19 12:49:33 +03:00
Natalia Selezneva
923716e38f Introduce default ScriptTemplate for Gradle scripts
^KT-23228 Fixed

(cherry picked from commit 26a4b67)
2018-03-19 12:49:09 +03:00
Natalia Selezneva
41dc8b6263 Minor: reformat
(cherry picked from commit 9f02664)
2018-03-19 12:47:04 +03:00
Vyacheslav Gerasimov
042873fa2c Build: add maven.repository.mirror property
May be used to add additional repository to all projects

(cherry picked from commit d8407b9)
2018-03-16 20:07:31 +03:00
Nikolay Krasko
79d9ea6716 Check module is from given set of modules before passing it to callbacks
`module` variable is fetched from `moduleInfoByDescriptor`, and this map
is filled in `createModuleDescriptor`, witch is called in
`doGetDescriptorForModule` only for modules from the given set.
2018-03-16 18:19:52 +03:00
Nikolay Krasko
7f501e3a78 Minor: document fields usages in ResolverForProjectImpl 2018-03-16 18:03:21 +03:00
Nikolay Krasko
03459eb808 Protect resolverByModuleDescriptor collection with storageManager lock
Read access from isResolverFromModuleDescriptorComputed was exposed through
DelegatingPackageFragmentProvider.
2018-03-16 16:40:38 +03:00
Nikolay Krasko
9145470f79 Minor: remove "JVM" constant usages in multi target platform 2018-03-16 16:40:38 +03:00
Nikolay Krasko
34569c2541 Minor: hasTopLevelCallables rename 2018-03-16 16:40:37 +03:00
Nikolay Krasko
14a0434737 Remove reference to binding context from LazyLightClassDataHolder cache
The ultimate goal is to remove references to binding context and resolve
result from light classes. There still can be references from `diagnostics`
field, but `bindingContext` is unneeded and can be removed.

Relates to snapshots from IDEA-187395.
2018-03-16 16:40:37 +03:00
Nikolay Krasko
481a5bc28d Update JUnit3RunnerWithInners.java for Gradle 4.6 (KT-23292)
Update after "Executer -> Executor" rename
3f1487e800

 #KT-23292 Fixed
2018-03-16 16:40:37 +03:00
Yan Zhulanow
e2ed77354f Pill: Update module structure, add missing modules metadata and metadata.jvm 2018-03-16 16:31:55 +03:00
Ilmir Usmanov
826d667398 Remove redundant locals
Do not transform already transformed suspend lambdas
Ignore duplicates of continuation in local variable table during redundant locals elimination.
2018-03-16 16:26:14 +03:00
Ilmir Usmanov
81f3e39f29 Do not generate ACONST_NULL as continuation of crossinline suspend lambda 2018-03-16 16:26:13 +03:00
Ilmir Usmanov
6b7173ba13 Forbid default inline/crossinline suspend parameters 2018-03-16 16:26:12 +03:00
Ilmir Usmanov
7224b99928 Add intention to remove suspend from parameter on suspend inline function 2018-03-16 16:26:11 +03:00
Ilmir Usmanov
6854135077 Support crossinline suspend lambda as parameter of inline function
Use fake continuation instead of ALOAD 0 while inlining
Do not generate state machine for inner lambdas and inner objects,
which capture crossinline suspend lambda.

 #KT-19159: Fixed
2018-03-16 16:26:11 +03:00
Ilmir Usmanov
042ca55be7 Do not generate suspension points for crossinline lambdas 2018-03-16 16:26:10 +03:00
Ilmir Usmanov
e6a353e590 Remove returns unit markers in suspend lambdas 2018-03-16 16:26:09 +03:00
Ilmir Usmanov
e169383f76 Fix problem with transforming suspend lambda instantiation by itself
#KT-21605: Fixed
2018-03-16 16:26:09 +03:00
Svyatoslav Scherbina
f3bc8d179c Add one more IR text test case 2018-03-16 14:47:20 +03:00
Svyatoslav Scherbina
aac940415f Fix psi2ir when type parameter bound goes after the type parameter 2018-03-16 14:47:18 +03:00
Simon Ogorodnik
c0b0f6d1ca Extract PSI to separate module 2018-03-16 13:32:14 +03:00
Toshiaki Kameyama
55c93bc8b6 Fix NPE on conversion: run/apply with explicit signature -> let/also
So #KT-22949 Fixed
2018-03-16 12:17:24 +03:00
Toshiaki Kameyama
f93b21eaa2 Fix "Add function to supertype" braces #KT-23215 Fixed 2018-03-16 12:11:26 +03:00
Alexander Udalov
404bcc58e5 Update bootstrap to 1.2.40-dev-967 2018-03-15 20:47:35 +01:00
Alexander Udalov
4484335eac Update light classes test data after d0ed0c4049 2018-03-15 18:23:16 +01:00
Alexander Udalov
a23af6306c Update test data of log tag consistency test on lint
The reason is that UastUtils.tryResolveNamed (in
LogDetector.checkTagConsistent) started to refer to the field of the
property in the companion after d0ed0c4049 instead of its getter
2018-03-15 18:19:43 +01:00
Denis Zharkov
21932b5824 Use mockJDK as a bootClasspath for AbstractCompileKotlinAgainstJavaTest
Otherwise JAVA_HOME is being used that lead to test result depending
on minor JDK version used on a computer

 #KT-21047 Fixed
2018-03-15 19:00:31 +03:00
Denis Zharkov
1766812bf3 Minor. Reformat AbstractCompileKotlinAgainstJavaTest 2018-03-15 19:00:31 +03:00
Denis Zharkov
c334f46825 Avoid retaining reference to ProtoBuf.Package in JvmPackagePartSource
Otherwise, 2e933a165a doesn't help
2018-03-15 18:59:44 +03:00
Denis Zharkov
4b78abaa7a Minor. Reformat JvmPackagePartSource 2018-03-15 18:59:44 +03:00
yukuku
6f6b0baf3b Fix wrong example on the docs of @PurelyImplements 2018-03-15 18:56:26 +03:00
Alexey Tsvetkov
baa20e2677 Ensure absolute paths are written to module xml file
Since d0ca0dca2b
first IC build uses CompilationMode.Rebuild instead of Incremental
to avoid unnecessary work (computing API difference etc.).

However there is a branch that does not transform source files
paths to absolute ones before writing them to module xml file.

In our plugins we have always transformed files to absolute ones before
passing them to IncrementalJvmCompilerRunner, so there is no problem.

But third party build systems could pass relative paths to IncrementalJvmCompilerRunner
(namely Kobalt does so).
It turned out to break builds because KotlinToJVMBytecodeCompiler takes
module xml file's (which is a temporary file itself) parent as a base
for relative source files (see KotlinToJVMBytecodeCompiler.getAbsolutePaths).

This change ensures that makeModuleFile always uses absolute files.

    #KT-22542 fixed
2018-03-15 18:06:13 +03:00
Anton Bannykh
e377a30929 Use mocha instead of QUnit for debugging stdlib tests in browser 2018-03-15 17:54:17 +03:00
Anton Bannykh
338bde23fc JS stdlib: run kotlin.test library tests 2018-03-15 17:54:17 +03:00
Vyacheslav Gerasimov
f0ec073bf6 Build: Include ultimate projects only if intellijUltimateEnabled 2018-03-15 16:35:20 +03:00
Vyacheslav Gerasimov
ef018d2ac1 Make dependencies on Android gradle plugin non-transitive
com.android.tools.build:gradle brings about 50 unused transitive dependencies including idea-core and uast, sometimes it breaks IDE features like navigation to declarations and debugging.

Inline contents of ReflectionUtil.findMethod to remove dependency on idea-core
2018-03-15 15:20:22 +03:00
Anton Bannykh
04cbea4956 JS: fix Long constant translation (KT-19228 fixed) 2018-03-15 14:58:10 +03:00
Alexey Sedunov
b7d79cc146 Gradle: Do not resolve sourcesets in projects with Android module 2018-03-15 13:17:43 +03:00
Denis Zharkov
e1c29ad3fd Regenerate tests for androidx support annotations 2018-03-15 10:34:33 +03:00
Denis Zharkov
7d8e7f481d Add a reference to third-party/annotations/androidx in license 2018-03-15 10:34:33 +03:00
Jake Wharton
b22f051edb Add support for nullability annotations in androidx package. 2018-03-15 10:34:33 +03:00
Toshiaki Kameyama
a3b35cbfe0 Reformat: ConvertToStringTemplateIntention 2018-03-15 10:32:07 +03:00
Toshiaki Kameyama
66906e2c80 Process '$' correctly in "Convert concatenation to template"
So #KT-12226 Fixed
2018-03-15 10:29:58 +03:00
Alexey Belkov
3b2bbee595 Standardize and improve descriptions of intentions/inspections 2018-03-15 09:56:47 +03:00
Nikolay Krasko
bc7ccbc39b Fix stub mismatch for top level declaration with JvmPackageName (KT-21831)
ClassId stores jvm name and it differs from kotlin name in that case.

 #KT-21831 Fixed
2018-03-14 21:16:58 +03:00
Toshiaki Kameyama
c1f43558b9 Unwrap: function parameter (KT-14788)
#KT-14788 Fixed
2018-03-14 21:16:58 +03:00
Ilya Chernikov
6838873a93 Fix local build problem - task compileJava not found
The problem is happening because our plugin deletes the task from
common projects, which may lead to such errors. The proper fix is
planned in our gradle plugin.
2018-03-14 15:39:30 +01:00
Ilya Chernikov
755f05e669 Switch to gradle 4.6 2018-03-14 15:39:30 +01:00
Ilya Chernikov
07b82ff1cc Fix noDefaultJar helper - remove the disabled jar from archives
before this fix switching to the gradle 4.6-rc1 caused the problem on
local publish task - kotlin-compiler.jar not found
2018-03-14 15:39:30 +01:00
Mikaël Peltier
d0ed0c4049 KT-14258 Optimize accesses to properties defined into companion
- Use direct access to property defined into companion object when
it is possible rather than always use an accessor to access the
property.
- Use direct access will speedup runtime performance.
- Avoid to generate useless accessors for companion properties.

Fix of https://youtrack.jetbrains.com/issue/KT-14258
2018-03-14 15:30:40 +01:00
Anton Bannykh
fd244be9ca JS: add tests to make sure KT-22019 is fixed 2018-03-14 17:15:16 +03:00
Natalia Selezneva
a5ac8abc7c Run Script Action should add script dependencies to classpath 2018-03-14 16:09:03 +03:00
Natalia Selezneva
7d76554966 Run script action in IDE should use kotlin compiler from plugin
^KT-22647 Fixed
2018-03-14 16:08:57 +03:00
Natalia Selezneva
2486be0f86 'Configure kotlin' should set 1.2-SNAPSHOT version in build.gradle for snapshot version of kotlin plugin 2018-03-14 16:08:33 +03:00
Mikhael Bogdanov
cdcb651c8e Get rid of 'BRIDGE' flag on $default functions 2018-03-14 13:57:49 +01:00
Zalim Bashorov
ac5ef57876 Regenerate tests 2018-03-14 15:06:35 +03:00
Zalim Bashorov
055b900d8a Add generating tests using "whitelist" of target backend; add new target backends: JS_IR and JVM_IR 2018-03-14 15:06:31 +03:00
Zalim Bashorov
82f41a1125 J2K TargetBackend 2018-03-14 15:06:31 +03:00
Zalim Bashorov
9970dd051f Fix copyright's start year in generated tests 2018-03-14 15:04:58 +03:00
Zalim Bashorov
814be1810c Don't write copyright to *.gradle.kts and *.gradle files 2018-03-14 15:04:57 +03:00
Zalim Bashorov
c0ce3f849d Fix copyright's start year 2018-03-14 15:04:57 +03:00
Alexander Udalov
e21c73229c Throw exceptions explicitly in protoTypeTableUtil
Previously, if both type and typeId messages were missing (for example,
ProtoBuf.Function.returnType/returnTypeId) because of some bug, the
behavior was unpredictable because a type with id 0 from the type table
would be returned, which could be a completely irrelevant type. This is
an incorrect situation and we should report a diagnostic instead.
Temporarily throw an exception instead, since this only affects how the
compiler works on bad metadata
2018-03-14 12:25:23 +01:00
Alexander Udalov
0a78fe8ae3 Move some serialization helpers to metadata/metadata.jvm 2018-03-14 12:25:22 +01:00
Alexander Udalov
779290be0c J2K Interner: convert and prettify 2018-03-14 12:25:22 +01:00
Alexander Udalov
bda7514b43 J2K Interner: rename .java -> .kt 2018-03-14 12:25:21 +01:00
Alexander Udalov
acf357e9b5 Extract descriptor-related behavior in StringTable to separate interface
Descriptor-related code is only needed to be able to compute
"replacement" names for local classes, which are different in JVM and JS
2018-03-14 12:25:20 +01:00
Alexander Udalov
043f4c3d01 Increase patch number of metadata versions
After adding inline classes in 915455ebe9
2018-03-14 12:25:19 +01:00
Alexander Udalov
407de206a3 Minor corrections in proto schemas, mostly in comments
Also set up code style for the protobuf plugin
2018-03-14 12:25:19 +01:00
Alexander Udalov
9d8d4b837b Minor, move JavaFlexibleTypeDeserializer.id to JvmProtoBufUtil
To be able to read platform types with metadata.jvm
2018-03-14 12:25:18 +01:00
Alexander Udalov
241673c6a1 Add forgotten SinceKotlin to Metadata.pn
kotlin.Metadata is internal, so it shouldn't have any visible effect
2018-03-14 12:25:17 +01:00
Alexander Udalov
3f3e05a9d2 Move essential metadata-related classes to 'metadata' and 'metadata.jvm' 2018-03-14 12:25:16 +01:00
Alexander Udalov
88dea9aa70 Move NameResolver to module 'metadata' and J2K
Also move NameResolverImpl to 'metadata' and JvmNameResolver to
'metadata.jvm'
2018-03-14 12:25:16 +01:00
Alexander Udalov
0ba42850f9 Drop ClassData and PackageData, rename ClassDataWithSource -> ClassData
Use pairs in JvmProtoBufUtil for simplicity
2018-03-14 12:25:15 +01:00
Alexander Udalov
5ed5ac8291 Minor, use stdlib instead of ifEmpty 2018-03-14 12:25:14 +01:00
Alexander Udalov
a5a69c5099 Remove dependency of ClassMapperLite on JavaToKotlinClassMap
There are two reasons for this. First, this class will be used in the
metadata reading library which should not have dependencies on lots of
compiler stuff JavaToKotlinClassMap depends on.

Second, it was easy to accidentally break the deserialization in old
compilers by adding another mapping to JavaToKotlinClassMap. This was
possible because ClassMapperLite is used to decide whether or not the
JVM signature is "trivial" and should be written to the metadata (at
JvmSerializerExtension.SignatureSerializer.requiresSignature). If the
signature is trivial but mentions a type added in JavaToKotlinClassMap
in the new compiler, the old compiler will not be able to load the
signature correctly. See the comment on ClassMapperLite for more
information
2018-03-14 12:25:14 +01:00
Alexander Udalov
070effc69d Minor, drop unnecessary ClassDescriptor.classId implementation 2018-03-14 12:25:13 +01:00
Alexander Udalov
b07c6086cd Remove dependency of NameResolverImpl on FqName
Remove AbstractJsProtoComparisonTest.getProtoData in favor of
(apparently copy-pasted) IncrementalJsCache.getProtoData
2018-03-14 12:25:12 +01:00
Alexander Udalov
4f81e572c7 Make NameResolver.getName extension instead of member
To get rid of dependency of NameResolver on Name
2018-03-14 12:25:11 +01:00
Alexander Udalov
e31f286444 Make NameResolver.getClassId extension instead of member
To get rid of dependency of NameResolver on ClassId
2018-03-14 12:25:11 +01:00
Alexander Udalov
27ad4f7d5d Move ProtoBuf classes to package org.jetbrains.kotlin.metadata 2018-03-14 12:25:10 +01:00
Alexander Udalov
575a388b11 Move core protobuf schemas to 'metadata' and 'metadata.jvm' 2018-03-14 12:25:09 +01:00
Alexander Udalov
368af867b8 Add modules metadata and metadata.jvm 2018-03-14 12:25:08 +01:00
Alexander Udalov
54d6710923 Regenerate gradle/project-schema.json 2018-03-14 12:25:07 +01:00
Alexander Udalov
99964cd030 Move descriptor-related utilities from Flags to ProtoEnumFlags 2018-03-14 12:25:07 +01:00
Alexander Udalov
ec67a878a0 Minor, rename Deserialization -> ProtoEnumFlags
Also fix warnings and remove unneeded JvmStatic
2018-03-14 12:25:06 +01:00
Alexander Udalov
7e1b1db7cc Minor, don't use BitEncoding where it's not necessary 2018-03-14 12:25:05 +01:00
Alexey Tsvetkov
ceb243c096 Don't pack kotlin-daemon-client and daemon-common into kotlin-compiler-runner jar 2018-03-14 13:29:32 +03:00
Alexey Tsvetkov
c736f229ce Always depend on runtimeJar of kotlin-daemon-client 2018-03-14 13:29:32 +03:00
Sergey Igushkin
0039be6972 Fix binary incompatibility with Android Gradle plugin 3.2.0-alpha06
Remove a non-reflective usage of the ResourceSet class, which has been
moved to a different package between versions. Access it through
reflection instead. This is a workaround. We can introduce a proper
fix once we have a public API in the Android plugin.

The test case that could detect the compatibility issue is
`testAndroidExtensionsManyVariants` (it uses experimental Android
extensions), but we did not run it with 3.2.0-alpha6. This commit
adds a test class with the same tests for 3.2.0-alpha6.

Issue #KT-23192 Fixed
2018-03-14 04:11:35 +03:00
Alexey Tsvetkov
3a7a34cc4e Add all necessary compile dependencies to 'pill:generate-all-tests'
Before this change running the pill:generate-all-tests:testClasses
task (which is run by Intellij on "Build" invocation) led to compile error
2018-03-13 21:26:28 +03:00
Alexey Tsvetkov
0deec7983d Revert "Provide custom ConstantAffectionResolver in JPS"
This reverts commit 772a935de6.

The API in Intellij was changed, now the issue can be fixed only in
182.* branches.
2018-03-13 21:26:11 +03:00
Vyacheslav Gerasimov
d831d35869 Add readme for including kotlin-compiler into composite build 2018-03-13 18:29:26 +03:00
Vyacheslav Gerasimov
0e879896e0 Add include/kotlin-compiler project
Needed to include kotlin compiler project into a composite build (kotlin native + cotlin compiler)
2018-03-13 18:29:24 +03:00
Vyacheslav Gerasimov
361e8e065c Remove unused xpp3 & xstream from IntellijCoreDependencies
They are 'fatjared' into kotlin-compiler but proguard removes them from resulting jar afterwards
2018-03-13 17:50:15 +03:00
Nikolay Krasko
7174b31756 Fix GradleConfiguratorTest.kt compilation 2018-03-13 17:42:40 +03:00
Nikolay Krasko
48f2fd8607 Add explicit set of supported file types to KotlinPositionManager 2018-03-13 15:52:21 +03:00
Nikolay Krasko
674fbc9871 Process dependencyManagement during stdlib-jre* deprecation check (KT-21745, KT-23161)
#KT-23161 Fixed
 #KT-21745 Fixed
2018-03-13 15:52:20 +03:00
Nikolay Krasko
57aaf0444f Add support for "implementation" gradle directive (KT-21746)
#KT-21746 Fixed
2018-03-13 15:52:19 +03:00
Nikolay Krasko
9004cdfa45 Reformat: idea-gradle module 2018-03-13 15:52:18 +03:00
Denis Zharkov
cff88a3f8b Fix false positive unreachable code in case of Nothing!-typed calls
Note, that this change potentially has some other effects in corner cases
(like the changed test data that is rather sensible because `bar`
in the example is not effectively projected out and can be called
with nulls)

Probably, we need to consider rewriting all other isSomeType methods
in KotlinBuiltins, but now it seems to be a rather dangerous change

 #KT-16424 Fixed
2018-03-13 14:40:05 +03:00
Denis Zharkov
a7854bc0ce Fix SAM detection algorithm for case of default overrides
#KT-22652 Fixed
2018-03-13 14:39:35 +03:00
Dmitry Jemerov
b4fb0e0305 Further reduce number of calls to getConfigurableModulesWithKotlinFiles
Also handle INRE and requeue check
2018-03-13 12:29:16 +01:00
Dmitry Jemerov
a29d693dc5 Fix inverted logic of isNotConfiguredNotificationRequired 2018-03-13 12:29:16 +01:00
Dmitry Jemerov
fa39cec94b Avoid duplicate scan of modules with Kotlin files (KT-23183) 2018-03-13 12:29:16 +01:00
Alexey Sedunov
1be33b91fa MPP: Do not report ACTUAL_WITHOUT_EXPECT if compatibility is null for all modules
This fixes diagnostic tests
2018-03-13 14:18:36 +03:00
Sergey Igushkin
c0a17f72a7 Fix bad property name introduced in the fix for #KT-23085 2018-03-13 14:17:12 +03:00
Simon Ogorodnik
48fb3db7ba Fix inserting variable name suggestion on non-enter char typing
#KT-21933 fixed
2018-03-13 12:51:29 +03:00
Mikhail Glukhikh
d5d9aa0329 GotoSuperActionHandler: minor refactoring 2018-03-13 10:58:24 +03:00
Mikhail Glukhikh
ab30275f14 Navigation: add expect declarations as supers #KT-16892 Fixed 2018-03-13 10:40:54 +03:00
Mikhail Glukhikh
849f9fc5c1 Navigation: add actual declarations as implementations (KT-16892) 2018-03-13 10:40:52 +03:00
Ilya Gorbunov
3530d9b4c7 Download org.jetbrains:markdown:0.1.25 from bintray 2018-03-13 09:50:10 +03:00
Svyatoslav Scherbina
d3ab86db48 Fix access to scoped symbol table when inserting implicit casts to IR 2018-03-13 09:46:32 +03:00
Dmitry Petrov
d38258d7a0 Use specified comparison generator for chars in optimized ranges
Otherwise if Char value is a result of some erased generic call,
coercing it to I (primitive int) causes CCE at run-time.

 #KT-23104 Fixed Target versions 1.2.40
2018-03-13 09:34:10 +03:00
Ilya Gorbunov
2891a6c954 Do not use java.home system property to locate JDK dependencies
It may point either to JDK/bin or to JRE/bin. Instead use JDK_16 and JDK_18 paths.
2018-03-13 08:52:15 +03:00
Ilya Gorbunov
6955cabbba Improve KPropertyN documentation
Provide missing documentation for Getter and Setter of KProperty1/2.
Fix the link to the 'getExtensionDelegate' extension.
2018-03-12 23:17:38 +03:00
Sergey Igushkin
07b811460a Deal with unnamed Gradle inputs/outputs
Fix the only unnamed input added to a Gradle task at runtime.
Add a test that checks for unnamed task inputs.

Issue #KT-23085 Fixed
2018-03-12 21:54:03 +03:00
Alexey Tsvetkov
97700316f5 Replace compileOnly with testCompileOnly in :generators
In Gradle testCompileOnly configuration does not extend compileOnly.

Since :generators project does not have main source set,
compileOnly dependencies have never worked.

Instead "kotlin-reflect" was resolved transitevely trough
:compiler:frontend.script module (a runtime dependency becomes
a compile transitive dependency).

In ccd6263787 I replaced `runtime` dependency
on "kotlin-reflect" with `runtimeOnly` breaking `:generators:compileTestKotlin`.
2018-03-12 20:07:31 +03:00
Sergey Igushkin
32df9c00ee Update literals in the grammar reference
Add missing long literal suffix
Add binary integer literals
Introduce IntegerLiteral lexer rule, which is closer to the actual lexer

Issue #KT-22713 Fixed
2018-03-12 18:02:22 +03:00
Sergey Igushkin
41044cd277 Fix the rule for valueArguments 2018-03-12 18:02:08 +03:00
Alexey Belkov
4b5b9b40e7 Grammar: Fix "object" rule (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
d98c454806 Grammar: Fix "LabelName" rule (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
4ffd4f8060 Grammar: Fix "labelDefinition" rule in precedence table (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
2b9f26a0da Grammar: Fix "functionType" rule (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
d0f3001fd5 Grammar: Fix "optionalProjection" rule (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
d6496814b2 Grammar: Fix "enumEntry" rule (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
8f88bc0a3c Grammar: Fix broken link (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
3cb952df5d Grammar: Add terminating semicolons (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
6fa87f98ca Grammar: Improve wording (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
c0866e7ba2 Grammar: Fix rule headings in section "Lexical structure" (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Tsvetkov
e8f8488d54 Add diagnostic task to print all shadow jars in compile classpaths 2018-03-12 17:31:11 +03:00
Alexey Tsvetkov
ccd6263787 Use runtimeOnly dependency in kotlin-reflect
"kotlin-reflect" is a shadow jar which breaks incremental compilation
to avoid non-incremental builds, project should add
* `compileOnly` dependency on ":kotlin-reflect-api"
* `runtimeOnly` dependency on ":kotlin-reflect"
* `runtime` dependency is not recommended because it leaks into compile
* classpath
through transitive dependencies
2018-03-12 16:09:04 +03:00
Pavel V. Talanov
dc27a3f6d0 Minor: lightClassUtils, less specific return type 2018-03-12 12:05:08 +01:00
Pavel V. Talanov
32516a3f33 Refactor: split *LightClassGenerationSupport into separate files
Move cli binding trace implementation to top level
2018-03-12 12:05:05 +01:00
Pavel V. Talanov
f421181e16 Split LightClassGenerationSupport into separate entities
LightClassGenerationSupport:
    Includes utilities related to generating light classes
    Primary client of this service are KtLight* implementation classes
KotlinAsJavaSupport:
    Provides APIs to transform kotlin code into Psi* entities
    Primary client of this service is JavaElementFinder
2018-03-12 12:04:59 +01:00
Ilya Gorbunov
62d409a9ba Use dex-method-list:3.0 from maven central
Update changed API usages and reformat code according to code style.
2018-03-09 19:39:42 +03:00
Mikhael Bogdanov
95a7e6c2d5 Minor.Reformat 2018-03-08 11:50:09 +01:00
Mikhael Bogdanov
c1c8660e55 Don't try to transform sam wrappers in same module
#KT-22304 Fixed
2018-03-08 11:50:08 +01:00
Mikhail Glukhikh
2a6f1d7731 Regenerate tests 2018-03-07 19:24:56 +03:00
Mikhail Glukhikh
cc5821382c Compilation fix 2018-03-07 19:15:17 +03:00
Mikhail Glukhikh
71a6827b1c MPP wizard step refactoring: use UI layout DSL 2018-03-07 19:07:56 +03:00
Mikhail Glukhikh
ea4b04780c MPP wizard fix: remove non-existing modules from settings.gradle 2018-03-07 19:07:56 +03:00
Mikhail Glukhikh
1d0c5413de MPP wizard: add combobox selecting common module position + extra checks
So #KT-23097 Fixed
2018-03-07 19:07:55 +03:00
Mikhail Glukhikh
879779ec0d MPP wizard: take default JDK from default project template
Related to KT-23097
2018-03-07 19:07:55 +03:00
Mikhail Glukhikh
4f2701385d MPP wizard: set sourceCompatibility / jvmTarget for JVM module
Related to KT-23097
2018-03-07 19:07:55 +03:00
Alexey Sedunov
d9aa1796cd MPP: Support multiple 'expectedBy' dependencies for single module
#KT-22865 Fixed
2018-03-07 18:34:03 +03:00
Toshiaki Kameyama
e3a69d118f Disable "Add labeled return" for suspend lambdas #KT-23126 Fixed 2018-03-07 16:10:44 +03:00
Toshiaki Kameyama
5d1f5d9bca "Remove redundant 'if'" now works correctly with labeled return
So #KT-23109 Fixed
2018-03-07 16:01:38 +03:00
Toshiaki Kameyama
733cb42ced Make implicit this inspection work for lambda invocation #KT-22970 Fixed 2018-03-07 15:58:23 +03:00
Toshiaki Kameyama
a87f652591 Reformat intentions/Utils 2018-03-07 15:41:39 +03:00
Toshiaki Kameyama
dd4ceb8c0f Move getCallableDescriptor function declaration to Utils 2018-03-07 15:41:07 +03:00
Toshiaki Kameyama
f48eacfbd4 Add inspection (INFORMATION) to convert Pair constructor into to call
So #KT-22933 Fixed
2018-03-07 15:40:19 +03:00
Toshiaki Kameyama
963e430b42 Make "Add annotation target" available on use-site annotation
So #KT-22861 Fixed
So #KT-22862 Fixed
2018-03-07 15:33:28 +03:00
Mikhail Glukhikh
442a89bc6c ModuleDescriptor now sees internals of its expected by #KT-15739 Fixed 2018-03-07 13:58:31 +03:00
Mikhail Glukhikh
0c4c9251d6 Sort modifiers: process visibility & modality after others
Related to KT-22954
2018-03-07 13:57:16 +03:00
Toshiaki Kameyama
b9e7e8fca3 Sort modifiers: process final modifier correctly #KT-22954 fixed 2018-03-07 13:34:25 +03:00
Felix Guo
e88d5b2a76 Fix typo in README (#1547)
`qualify` -> `quality`
2018-03-07 10:37:40 +01:00
Dmitry Jemerov
81adbcb7e6 Support for implicit package prefixes
Now, if all Kotlin files directly under a source root have the same
package statement, it's used as an implicit package prefix for that
source root. It's honored by the package name/directory name mismatch
inspection and by new file creation actions;
support in refactorings is TODO.

 #KT-17306 Fixed
2018-03-07 10:31:57 +01:00
Yan Zhulanow
753319a89d Pill: Rewrite existing "idea.home.path" option if already set 2018-03-06 22:27:55 +03:00
Yan Zhulanow
799c0f28b7 Pill: Fix platform home directory (this fixes IDE tests) 2018-03-06 22:27:55 +03:00
Yan Zhulanow
d1a4acb81f Pill: Add "IDEA (No ProcessCancelledException)" run configuration 2018-03-06 22:27:54 +03:00
Yan Zhulanow
8e2ef6bedd J2K: Script Codegen (step 2) 2018-03-06 22:27:53 +03:00
Yan Zhulanow
7711624308 J2K: Script Codegen (step 1) 2018-03-06 22:27:51 +03:00
Yan Zhulanow
fa8a3b55f3 REPL, Refactoring: A number of trivial renames/moves 2018-03-06 22:27:51 +03:00
Yan Zhulanow
82c72f228a REPL, Refactoring, Minor: Lower property visibility 2018-03-06 22:27:50 +03:00
Yan Zhulanow
bceb138ed1 REPL, Refactoring: Get rid of nasty enum-like String literals 2018-03-06 22:27:49 +03:00
Yan Zhulanow
96dda8de6b REPL, Refactoring: Make ReplFromTerminal and ReplInterpreter not to implement ReplConfiguration 2018-03-06 22:27:48 +03:00
Yan Zhulanow
07363f2904 REPL, Refactoring: Replace strange callback function with an execution interceptor 2018-03-06 22:27:48 +03:00
Yan Zhulanow
b35676c1bd Minor: Delete an unused class 2018-03-06 22:27:47 +03:00
Yan Zhulanow
da35ded090 Minor: Add "repl" to dictionary 2018-03-06 22:27:46 +03:00
Yan Zhulanow
54251ddac0 REPL, Refactoring: Rename ReplErrorLogger to ReplExceptionReporter
ReplErrorLogger is not really a class that logs errors, ReplWriter exists for that purpose (I don't think ReplWriter has a good API as well, though). The only thing it does is that is passes exceptions got from the compiler to IDE. So, in my opinion, the old name is rather confusing and it doesn't describe what the class actually do.

Also rethrow exceptions explicitly.
2018-03-06 22:27:45 +03:00
Svyatoslav Scherbina
5abade0e32 Fix missing type parameters of property accessors in external IR stubs 2018-03-06 16:43:20 +03:00
Alexey Sedunov
e145a64d50 Rename: Forbid rename of synthetic declaration references
#KT-20241 Fixed
2018-03-06 15:15:44 +03:00
Alexey Sedunov
9761e33110 Refactor: Use RefactoringErrorHintException to report errors in test mode 2018-03-06 15:15:44 +03:00
Alexey Sedunov
df4c80f43a Shorten References: Allow import insertion when function and property have the same name
#KT-22745 Fixed
2018-03-06 15:15:44 +03:00
Alexey Sedunov
df4cd14161 Move: Relax private/protected visibility checks for usages in Java code 2018-03-06 15:15:43 +03:00
Alexey Sedunov
4fd221fc0c Rename: Filter out destructuring references to parameters
They shouldn't be renamed in any case

 #KT-15039 Fixed
2018-03-06 15:15:43 +03:00
Alexey Sedunov
85b381db7c Rename: Identify elements with the same origin when checking import ambiguity
#KT-13284 Fixed
2018-03-06 15:15:43 +03:00
Alexey Sedunov
6c17bbe42c Rename: Check redeclaration for local variables
Also add tests for other local declarations

 #KT-13255 Fixed
2018-03-06 15:15:42 +03:00
Alexey Sedunov
4609b2ae37 Navigation: Resolve typealiased SAM-references to type alias declaration
#KT-15302 Fixed
2018-03-06 15:15:42 +03:00
Alexey Sedunov
5bff4b9f39 Rename: Allow deleting name of companion object
#KT-20178 Fixed
2018-03-06 15:15:42 +03:00
Alexey Sedunov
0e3e387446 Rename: Adapt VariableInplaceRenameHandler to Kotlin
#KT-16510 Fixed
2018-03-06 15:15:42 +03:00
Alexey Sedunov
7149a0855a Rename: Use OverloadChecker for redeclaration conflict analysis
#KT-19561 Fixed
 #KT-22812 Fixed
 #KT-13907 Fixed
2018-03-06 15:15:41 +03:00
Alexey Sedunov
12d5a72697 Move: Show more accurate message when moving subclass of a sealed class
#KT-23065 Fixed
2018-03-06 15:15:41 +03:00
Alexey Sedunov
5f43bd56b4 Extract Function: Use 'public' visibility for function extracted from public inline
#KT-15228 Fixed
2018-03-06 15:15:41 +03:00
Alexey Sedunov
d690aedb89 References: Fix resolution of delegate reference for local variables
#KT-22229 Fixed
2018-03-06 15:15:40 +03:00
Alexey Sedunov
96de29dfcb Create from Usage: Support accessors for local delegated properties
#KT-19730 Fixed
2018-03-06 15:15:40 +03:00
Mikhail Glukhikh
2eddce57ff MPP wizard: add combo-box with JDK for JVM platform, if any
Related to KT-23097
2018-03-06 14:32:31 +03:00
Mikhail Glukhikh
2108634ddb MPP wizard: add check-boxes to create JVM / JS module
Related to KT-23097
2018-03-06 14:32:31 +03:00
Mikhail Glukhikh
cc8a2b3123 MPP wizard: add common module at the same level with platform ones
Related to KT-23097
2018-03-06 14:32:31 +03:00
Mikhail Glukhikh
720c84d1d6 Fix style: KotlinGradleMultiplatformWizardStep 2018-03-06 14:32:31 +03:00
Mikhail Glukhikh
fe7b7fb0bd Create actual fix: add empty brackets for classes in super-type lists
Related to KT-21082
2018-03-06 14:32:30 +03:00
Mikhail Glukhikh
ef3e0b01c4 Create actual fix: use target module instead of target platform 2018-03-06 14:32:30 +03:00
Mikhail Glukhikh
90e4413fc9 Create actual: put top-level actual declarations in the same file
When multiple expect declarations are in the same file,
and some of them already have actual declarations for this platform,
then "Create actual fix" put other declarations into the same file
with existing actual declarations

So #KT-17058 Fixed
So #KT-21082 Fixed
2018-03-06 14:32:30 +03:00
Mikhail Glukhikh
3ec2dac10b Create actual fix: reformat 2018-03-06 14:32:30 +03:00
Pavel V. Talanov
27d7bb595f CliLightClassGenerationSupport: correctly find facade files
This fixes a problem where JvmPackageName annotation could force file
    facades to be in the package different to declared kotlin package
2018-03-06 12:07:12 +01:00
Pavel V. Talanov
00ee5e3d16 Refactor: extract mapping package to files to a separate component
Make it extensible
2018-03-06 12:07:08 +01:00
Pavel V. Talanov
fae0f611a0 Test java resolve against kotlin file with JvmPackageName annotation 2018-03-06 12:07:07 +01:00
Pavel V. Talanov
498431311c Light classes: test "JvmPackageName" and actual declarations 2018-03-06 12:06:59 +01:00
Pavel V. Talanov
d2b90b84f8 KotlinFileStubForIde: save full facadeFqName
Prefix is not necessarily same as packageFqName since JvmPackageName was introduced
2018-03-06 12:05:53 +01:00
Nikolay Krasko
9e061555af Use anchor for element to avoid working with invalid element (KT-22631)
Element in constructor can be invalidated when dumb mode begins/ends.
Working with invalid elements can produce nodes without icons and bad
presentation.

 #KT-22631 Fixed
2018-03-06 13:04:26 +03:00
Nikolay Krasko
bb9933a8f9 Reformat: structureView package 2018-03-06 13:04:25 +03:00
Pavel V. Talanov
6c4537accc Create InvalidLightClassDataHolder for expect classes
This fixes an exception from duplicateJvmSignature reporter
Fixes "QuickFixTestGenerated$Override.testDontOfferToImplementMembersForExpectedClass" on teamcity
2018-03-05 18:07:38 +01:00
Pavel V. Talanov
89c82a85d0 Do not build light classes for expect classes
#KT-15482 Fixed
2018-03-05 18:07:36 +01:00
Toshiaki Kameyama
3f96e1dabc Move statement up/down fails for multiline declarations with lambdas (KT-21013)
#KT-21013 Fixed
2018-03-05 16:10:59 +03:00
Alexander Udalov
f41165c566 Minor, use elvis in deprecationUtil.kt 2018-03-05 13:43:10 +01:00
Alexander Udalov
e92e7c6f80 Do not report RequireKotlin-related diagnostics in snapshot compilers
Otherwise it's difficult to use a newly added API annotated with
RequireKotlin with the latest, not yet released, version.

For example, suppose there's a new function added in kotlin-stdlib,
since Kotlin 1.3, which requires 1.3 (Kotlin < 1.3 is supposed to report
an error on usages):

    @SinceKotlin("1.3")
    @RequireKotlin("1.3", COMPILER_VERSION, message = ...)
    fun foo() {}

Until Kotlin 1.3 is released, the latest available compiler in Maven has
the version 1.3-SNAPSHOT, which is _less_ than 1.3 according to Maven
rules which are used in getDeprecationByVersionRequirement. Therefore,
errors will be reported on usages of foo, and there's no Kotlin compiler
version which can be used to verify if the function works correctly,
which is inconvenient.

Since SNAPSHOT versions are effectively "pre-release" in a way, it's OK
for them to skip reporting these diagnostics
2018-03-05 13:39:13 +01:00
Alexander Udalov
bbaea6a062 Refactor deprecation by version requirement
- Get rid of ApiVersion in favor of MavenComparableVersion
- Don't crash on invalid versions in RequireKotlin
- Extract to a separate function
2018-03-05 13:39:13 +01:00
Nikolay Krasko
90802f2d7c Refactoring: remove ModuleResolverProvider, inline createModuleResolverProvider 2018-03-05 15:20:53 +03:00
Nikolay Krasko
de68607d5f Refactoring: move JavaResolveExtension.kt to util package 2018-03-05 15:20:53 +03:00
Svyatoslav Scherbina
7a2d761a7d Add minor improvements to psi2ir and IR utilities:
* Generate missing IR parameter declarations in external stubs
* Use origin = FAKE_OVERRIDE in external IR stubs for fake overrides
* Set .parent in external IR stubs
* Set .parent in IR generated by some utility methods
2018-03-02 15:41:48 +03:00
Dmitry Petrov
13a7270129 Generate type parameter declarations for property accessors
This requires "scoped" type parameter symbols, because in the ugly world
of descriptors property accessors have no type parameters of their own.
2018-03-02 14:35:35 +03:00
Dmitry Petrov
31996f1139 Update "defaultness" for property accessor with inherited visibility
Property accessor that overrides a non-default property accessor with
visibility different from the property visibility was incorrectly
considered "default". Corresponding metadata was written incorrectly,
and 'internal' setter call caused NSME

 #KT-23044 Fixed Target versions 1.2.40
2018-03-02 10:54:32 +03:00
Dmitry Petrov
8e8c5fae01 Minor: reformat code 2018-03-02 10:54:32 +03:00
Yan Zhulanow
6950c256ce Pill: Replace most of the hardcoded library coordinates with info from Gradle 2018-03-02 03:15:33 +03:00
Yan Zhulanow
6e65a4810e Make a project-wide embeddedComponents configuration for embedding external binaries to project artifacts 2018-03-02 03:15:32 +03:00
Yan Zhulanow
3c06dd7464 Pill, Minor: Move run configurations to the resources source set 2018-03-02 03:15:31 +03:00
Yan Zhulanow
3894afcf0b Pill, Minor: Remove the hardcoded repository, use the available utilities 2018-03-02 03:15:30 +03:00
Yan Zhulanow
b24d87f7ed Pill: Merge two "root" and "non-root" Pill plugins 2018-03-02 03:15:30 +03:00
Yan Zhulanow
3da479c1d5 Pill, Small: Pass libraries to 'parse()' directly 2018-03-02 03:15:29 +03:00
Yan Zhulanow
07ede20dc5 Pill: Import KotlinPlugin artifact 2018-03-02 03:15:28 +03:00
Yan Zhulanow
bc78d2c417 Pill: Move .iml files out of the module structure 2018-03-02 03:15:27 +03:00
Yan Zhulanow
4c12a4cb11 Pill: Add 'unpill' task 2018-03-02 03:15:25 +03:00
Yan Zhulanow
df88acaefd Get rid of test-to-production dependencies as it's not supported in plain IDEA projects 2018-03-02 03:15:24 +03:00
Yan Zhulanow
e7a2743dcf Pill: Add "Generate All Tests" run configuration 2018-03-02 03:15:23 +03:00
Yan Zhulanow
55164660a8 Pill: Attach asm sources 2018-03-02 03:15:22 +03:00
Yan Zhulanow
ad5a42459a Pill: Apply required changes to the default JUnit configuration on import 2018-03-02 03:15:21 +03:00
Yan Zhulanow
868ef262b8 Pill: Add JPS run configurations 2018-03-02 03:15:20 +03:00
Yan Zhulanow
a0c105adbe Fixes to make the project compile when using Pill 2018-03-02 03:15:19 +03:00
Yan Zhulanow
8dad2d30f5 Move the compiler.xml back to IDEA (this fixes almost all IDE tests when running on JPS) 2018-03-02 03:15:18 +03:00
Yan Zhulanow
34d1611ed4 Add Pill support to compiler and IDE modules 2018-03-02 03:15:17 +03:00
Yan Zhulanow
af60bcfb47 Initial Pill implementation
Pill is a Gradle-to-JPS model generator for compiler + compiler plugins + IDE project parts.
The generated project model does not know anything about Gradle and is fully operable using only JPS.
2018-03-02 03:15:16 +03:00
Yan Zhulanow
0ebcd0ad40 Remove inline function usages that break JPS compilation 2018-03-01 21:30:51 +03:00
Ilmir Usmanov
07ec704228 Fix modifiers generation for companion objects
when language verion is 1.3

 #KT-23002: Fixed
2018-03-01 20:03:26 +03:00
Alexey Sedunov
30314d43d9 Shorten Reference: Disable ${...} shortening inside completion insert handler 2018-03-01 17:41:10 +03:00
Mikhail Glukhikh
68757fff2e Downgrade "Type parameter can have ... variance" to INFORMATION level 2018-03-01 16:19:21 +03:00
Nikolay Krasko
a03470d151 Fix test data for JavaMethodUsedInKotlin.kt test after 173.3.4 update
- Ignore empty lines in actual test data
- Don't generate additional //INFO: in final file diff
2018-03-01 15:41:10 +03:00
Renaud Paquay
94ee78c0ca Hitting breakpoint in Kotlin sometimes doesn't work (KT-22205)
Fix KT-22205 and https://issuetracker.google.com/issues/71556313

Hitting breakpoints in Kotlin JUnit test with an Android Gradle
project sometimes(*) does not work in Android Studio 3.1 beta.

(*) The issue is related to various threads running concurrently
with "dumb" mode background code, so the issue reproduces only
on certain configurations.

In a nutshell, the issue is as follows

* On one hand, gradle build finishes, fires an event ("buildFinished")
  that is processed "later" and that causes the IDE to enter "dumb" mode
  for a shot amount of time (about 300-500 msec on a somewhat up to date
  multi-core computer).

* On the other hand, once the JVM of the debuggee is started, breakpoints
  need to be resolved (on the debugger thread, through a call to
  com.intellij.debugger.engine.CompoundPositionManager.createPrepareRequests.
  This code calls into the "KotlinPositionManager.createPrepareRequests",
  which in turns calls into "PerFileAnalysisCache.analyze". That method
  returns "AnalysisResult.EMPTY" is the project is in dumb mode.
  This return value prevents callers from successfully resolving
  the source location into a breakpoint.

Given that the 2 code paths above execute on separate threads without
explicit synchronization, the "failed to resolve breakpoint" issue
occurs sporadically, to the point it happens 100% of the time on
certain configuration.

The fix is so wrap the kotlin breakpoint resolution code inside
a "runReadActionInSmartMode" so that the debugger thread "waits"
for "dumb" mode to terminates before trying to resolve breakpoint
locations.

 #KT-22205 Fixed
2018-03-01 15:41:09 +03:00
Nikolay Krasko
b1bcadd762 Add mandatory dependency to com.intellij.modules.remoteServers
Android studio doesn't have this bundled module, so this should
prevent installing plugins for Intellij to AS.

This patch should be reverted in AS branches.
2018-03-01 15:41:07 +03:00
Egor Neliuba
715d5e90ba Clean up test skips after KT-17137
We need to clean these up since primitive array `is` checks work now

(cherry picked from commit b413e9ef51606c51ebfb21bd7ff646b0fb75470a)
2018-03-01 14:26:13 +03:00
Anton Bannykh
4a5e9bbc7f JS: remove -XtypedArraysEnabled flag (always true now) 2018-03-01 14:26:13 +03:00
Dmitry Savvinov
60aae55233 Update changelog for 1.2.30 2018-03-01 14:15:42 +03:00
Pavel V. Talanov
a6aea5625a Dsl completion: fix completion when multiple receivers are in scope 2018-02-28 19:48:45 +01:00
Ilya Chernikov
65af137117 (minor) Fix script templates from setting processing 2018-02-28 19:29:05 +01:00
Ilya Chernikov
a5278c2184 Get rid of PathUtil dependency in the script_util
reduces transitive dependencies required for the script_util
2018-02-28 19:29:05 +01:00
Ilya Chernikov
db7e06aaa4 Make dependencies to the script-runtime directly to the project...
instead to vie projectDist. With the current project bootstrap scheme a
dependency to the simply built script-runtime project via dist is not
needed anymore, but it breaks proper sources navigation in IDEA.
2018-02-28 19:29:05 +01:00
Nicolay Mitropolsky
fa1d2a891b KotlinLanguageInjector: getNameReference extracted to work with annotations 2018-02-28 17:19:46 +03:00
Nicolay Mitropolsky
08c41474af KotlinLanguageInjector: "kotlin" injections in annotations handled by injectWithCall 2018-02-28 17:19:46 +03:00
Nicolay Mitropolsky
fd4f4ef853 KotlinLanguageInjector: support for nested annotations (#KT-21753) 2018-02-28 17:19:46 +03:00
Mikaël Peltier
5c04264218 Remove unnecessary dependencies from AbstractBoundedValue
- Bounded value is a low-level abstraction for bounded ranges that is
used to generate specialized contains checks and for loop. It only
needs to contains StackValue that will be used to generate code.
- SimpleBoundedValue already have a constructor supporting StackValue
but having only one constructor avoid to pass extra argument that
will be used to only compute another information.
2018-02-28 15:20:03 +03:00
Anton Bannykh
ed80252ba8 JS: fix double compareTo behaviour for NaN and +-0 (KT-22723) 2018-02-28 15:01:58 +03:00
Alexander Podkhalyuzin
12c01ef80a Kotlin SDK auto-creation is disabled now #KT-23059 Fixed
(cherry picked from commit f5d8479)
2018-02-28 14:38:29 +03:00
Mikhail Glukhikh
0f029d8f51 Scope function conversion: remove 'can' from description to fix tests 2018-02-28 14:30:32 +03:00
Alexey Sedunov
d06f23f2ba Move: Fix replacement of non-code usages with backquoted names
#KT-13986 Fixed
2018-02-28 14:03:43 +03:00
Alexey Sedunov
a194eb94cf Remove Redundant Backticks: Fix inspection applicability
#KT-22804 Fixed
2018-02-28 14:03:43 +03:00
Alexey Sedunov
f65fe0dd5f Minor: Fix NPE
#KT-22724 Fixed
2018-02-28 14:03:43 +03:00
Alexey Sedunov
883558a4c7 Move/Copy: Fix 'protected' conflict reporting for references in super type entries
#KT-22678 Fixed
2018-02-28 14:03:43 +03:00
Alexey Sedunov
27f5ddcf83 Rename: Report redeclaration conflict between class and type alias
#KT-22751 Fixed
2018-02-28 14:03:42 +03:00
Alexey Sedunov
a341392524 Move: Search Java usages when top-level declaration moves to new facade
#KT-22747 Fixed
2018-02-28 14:03:42 +03:00
Alexey Sedunov
91fdc0e967 Move: Drop ${...} around shortened qualified expression
#KT-22692 Fixed
2018-02-28 14:03:42 +03:00
Alexey Sedunov
e63e48933d Move: Add import for top-level declarations moved to the default package
#KT-22661 Fixed
2018-02-28 14:03:42 +03:00
Alexey Sedunov
96132a686a Type Hierarchy: Support Kotlin class constructors
#KT-22925 Fixed
 #KT-22926 Fixed
2018-02-28 14:03:41 +03:00
Mikhail Glukhikh
66f3126b20 Scope function conversion: remove forced INFORMATION highlight type 2018-02-28 13:17:39 +03:00
Nicolay Mitropolsky
2f6fb4091b making LambdaArgument methods nullable
overridden `LambdaArgument.getArgumentExpression` removed because it is already nullable in parent

#EA-117013
2018-02-28 12:13:12 +03:00
Mikhail Glukhikh
664a25ce81 Polish KT-22011 inspection: message, level, group, range, etc. 2018-02-28 12:10:24 +03:00
Toshiaki Kameyama
7d6cb7805c Add inspection: Java mutator method used on immutable Kotlin Collections
In particular, fill, reverse, shuffle, sort calls are reported
So #KT-22011 Fixed
2018-02-28 11:52:44 +03:00
Mikhail Glukhikh
bec28c8388 Replace with for-each: add new-lines using comment saver
Related to KT-15858
2018-02-28 11:29:44 +03:00
Toshiaki Kameyama
7f880bf58c Replace with for-each: add new-line if necessary #KT-15858 Fixed 2018-02-28 11:18:21 +03:00
Dmitry Petrov
ae7f60a96e Update IR testData after rebase on master 2018-02-28 10:35:13 +03:00
Dmitry Petrov
b206bf199f Add type operand symbol for type operator expression 2018-02-28 10:35:13 +03:00
Dmitry Petrov
e89047d2cc Generate super classes and overridden functions in proper scope
Such references require proper scope so that local symbols are bound.
Example:

```
fun <T> outer() {
    abstract class ALocal<S : T> {
        abstract fun bar()
    }

    class Local<S : T> : ALocal<S>() {
        override fun bar() {}
    }
}
```

Here local classes have type parameters with upper bounds depending on
function type parameters, and members overriding members in other local
classes.
2018-02-28 10:35:13 +03:00
Dmitry Petrov
8fef0f0535 Make IrDeclaration#parent a var 2018-02-28 10:35:13 +03:00
Dmitry Petrov
02f01efaac Update testData 2018-02-28 10:35:13 +03:00
Dmitry Petrov
d29a47ec7f Generate references to superclasses 2018-02-28 10:35:13 +03:00
Dmitry Petrov
e5295d0f78 Generate references to overridden declarations as a separate pass
NB currently it relies on overriddenDescriptors in a FunctionDescriptor,
thus maybe incorrect for transformed declarations.
2018-02-28 10:35:13 +03:00
Dmitry Petrov
9570b64953 Add 'parent' to IrDeclaration, initialize it with a hack (for migration) 2018-02-28 10:35:13 +03:00
Mikhail Glukhikh
24622c0139 Fix two broken tests (missing actions) 2018-02-28 10:31:27 +03:00
Mikhail Glukhikh
dd106cb65c Add braces: use CommentSaver to save/restore comments
Related to KT-16332
2018-02-27 18:25:38 +03:00
Toshiaki Kameyama
4726b44371 Add braces to 'if' statement: save/restore comments correctly
So #KT-16332 Fixed
2018-02-27 18:25:22 +03:00
Mikhail Glukhikh
b436ee6e19 Replace some of RESOLVED_CALL & REFERENCE_TARGET usages to resolveToCall 2018-02-27 18:24:55 +03:00
Anton Bannykh
a7d980a890 JS: use Mocha + NodeJs instead of Karma + PhantomJs to run stdlib tests (again) 2018-02-27 16:41:00 +03:00
Mikhail Glukhikh
a3f88165cd Make add / remove labeled return: extract 'getParentLambdaLabelName'
Related to KT-20439
2018-02-27 14:47:11 +03:00
Mikhail Glukhikh
86e6f3c5e3 Make add / remove labeled return working for hierarchical blocks
Related to KT-20439
2018-02-27 14:47:10 +03:00
shiraji
59f6dc07cf Implement intention to add labeled return to last expression in a lambda
So #KT-20439 Fixed
2018-02-27 14:47:04 +03:00
shiraji
769e28519e Implement intention to remove labeled return from last lambda expression
So #KT-20439 Fixed
2018-02-27 14:46:50 +03:00
Nicolay Mitropolsky
35ce30aedc Uast: better reports for failed method conversions in KotlinUClass 2018-02-27 11:23:04 +03:00
Nicolay Mitropolsky
795516269d Uast: don't run resolve if not inside KtFile 2018-02-27 11:22:40 +03:00
Dmitry Petrov
8fbdf52d34 Chars are not promoted to Int on comparisons 2018-02-27 10:09:17 +03:00
Dmitry Petrov
4bb6c61a5a Don't generate enum entry initializers for 'expect enum class' 2018-02-27 10:08:12 +03:00
Nikolay Krasko
4c7e46cbf8 Support prefix and suffix in Kotlin injection with comments and annotations (KT-23005)
#KT-23005 Fixed
2018-02-26 18:42:59 +03:00
Nikolay Krasko
9026582352 Minor: rename file 2018-02-26 18:42:58 +03:00
Nikolay Krasko
c5fc195754 Refactoring: move collectAllModuleInfosFromIdeaModel function 2018-02-26 18:42:58 +03:00
Nikolay Krasko
60af145170 Refactoring: move package ../caches/resolve/lightClasses -> ../caches/lightClasses 2018-02-26 18:42:58 +03:00
Nikolay Krasko
08a46c1396 Refactoring: move idea source modules classes to caches/project package 2018-02-26 18:42:58 +03:00
Nikolay Krasko
287ad512fb Refactoring: extract project structure caches to separate package 2018-02-26 18:42:57 +03:00
Nikolay Krasko
a67ae0bf9f Refactoring: remove defaults values 2018-02-26 18:42:57 +03:00
Nikolay Krasko
9b8e550f3b Refactoring: move util files 2018-02-26 18:42:57 +03:00
Nikolay Krasko
931dec9cd8 Refactoring: move MapPsiToAsmDesc.kt to lightClasses package 2018-02-26 18:42:57 +03:00
Nikolay Krasko
47f4c79204 Reformat caches package 2018-02-26 18:42:57 +03:00
Stanislav Erokhin
77b146a51a Minor. Fixed output path for builtIns generator 2018-02-26 17:58:06 +03:00
Ilya Gorbunov
0f828a5107 Update paths of the moved sources for building the documentation 2018-02-26 17:11:12 +03:00
Ilya Gorbunov
5c0cc5f799 Move deprecated kotlin-runtime and reduced runtime for tests into stdlib
Rename mock-runtime-for-test project to kotlin-stdlib:jvm-minimal-for-test
2018-02-26 17:11:11 +03:00
Ilya Gorbunov
c796e5338b Move runtime.jvm sources to stdlib/jvm/runtime
Update path in kotlin-runtime
Update path in kotlin-mock-runtime-for-tests
2018-02-26 17:11:10 +03:00
Ilya Gorbunov
00b23a0fe9 Rearrange kotlin-stdlib-js library sources
Move kotlin.* api inside kotlin directory.
Update copyright paths.
2018-02-26 17:11:08 +03:00
Simon Ogorodnik
57e47d1830 Propose convert to string template as inspection more frequent 2018-02-26 12:11:18 +03:00
Zalim Bashorov
4c15642e2c Add missed references to license/README.md 2018-02-26 12:09:28 +03:00
Nicolay Mitropolsky
be961b458d make "IDEA Ultimate" run-configuration use -P intellijUltimateEnabled 2018-02-26 11:21:38 +03:00
Pavel V. Talanov
cf6fd4da81 Completion: prevent lookup elements from being duplicated correctly
This code prevents completion items from being submitted several times for the same descriptors
But some contributors actually do contribute extra items for already processed descriptors

Fixes a problem introduced in 1796d40118
2018-02-22 20:32:54 +01:00
Pavel V. Talanov
10f6d65e03 IdeStubIndexService: do not index annotations without name
Fixes NPE after changes introduced in 8f8cbfcfa5
2018-02-22 20:29:00 +01:00
Alexey Tsvetkov
d7644559eb Perform a test lookup before build
#KT-22535 fixed
   #KT-22995 fixed
2018-02-22 18:21:37 +03:00
Alexey Tsvetkov
7c9412a0b3 Avoid instanciating LookupStorage when clearing it
#KT-22535
  #KT-22995
2018-02-22 18:21:37 +03:00
Alexey Tsvetkov
140ba0681a Throw BuildDataCorruptedException when lookup operation cannot be performed
That is expected to force a rebuild (but it does not seem to be the case
in case of parallel build).

  #KT-22535
  #KT-22995
2018-02-22 18:21:37 +03:00
Alexey Tsvetkov
8ab9366ae5 Synchronize access to lookup storage in JPS
Storage operations are synchronized already,
but BuildDataManager.getStorage is not synchronized,
so maybe it is possible to create multiple LookupStorage
instances.

    #KT-22535
    #KT-22995
2018-02-22 18:21:37 +03:00
Nicolay Mitropolsky
3a609a9472 Assertions to catch EA-114080 2018-02-22 12:51:50 +03:00
Denis Zharkov
5a591be25f Convert SwitchCodegen to Kotlin, prettify and optimize codegen 2018-02-22 11:42:18 +03:00
Natalia Selezneva
806faf86b7 Tests: allow file modification during highlighting for scripts 2018-02-22 10:00:21 +03:00
Natalia Selezneva
de76d75f03 Drop caches for synthetic files when dependencies changed 2018-02-22 10:00:15 +03:00
Natalia Selezneva
8367aea624 Run update dependencies task in background 2018-02-22 10:00:10 +03:00
Natalia Selezneva
790cf1aa58 Show notification "Gradle projects need to be imported" when build.gradle.kts file changed
^KT-19165 Fixed
2018-02-22 10:00:02 +03:00
Natalia Selezneva
63aeaf9cd5 Do not highlight kts files outside source roots if not all definitions are initialized
^KT-20521 Fixed
^KT-21420 Fixed
2018-02-22 09:59:43 +03:00
Natalia Selezneva
e62412398c Reload dependencies for kts files after Gradle Sync
^KT-21721 In Progress
2018-02-22 09:59:08 +03:00
Natalia Selezneva
af4c1ce0e9 Minor: reformat 2018-02-22 09:59:02 +03:00
Alexey Tsvetkov
7881a305d9 Compare JS output files against file instead of hardcoded set
A difference is not obvious when two sets are compared:
there might be just one different element, but
sets would be printed in one line in iteration order
(which is non-fixed for hashsets).

Also the properties:
  EXPECTED_JS_FILES_IN_OUTPUT_FOR_STDLIB_ONLY,
  EXPECTED_JS_FILES_IN_OUTPUT_FOR_MODULE_STDLIB_ONLY,
  EXPECTED_JS_FILES_IN_OUTPUT_NO_COPY,
  EXPECTED_JS_FILES_IN_OUTPUT_WITH_ADDITIONAL_LIB_AND_DEFAULT_DIR,
  EXPECTED_JS_FILES_IN_OUTPUT_WITH_ADDITIONAL_LIB_AND_CUSTOM_DIR
are hard to distinguish in code and are not convenient to edit.
2018-02-22 01:13:09 +03:00
Ilmir Usmanov
9fdd34ce6e Minor. Add regression test for KT-15930
#KT-15930: Obsolete
2018-02-21 19:32:50 +03:00
Ilmir Usmanov
bcf29d106d Minor. Add regression test for KT-18292
#KT-18292: Obsolete
2018-02-21 19:32:41 +03:00
Ilmir Usmanov
a0186224b2 Do not report NOTHING_TO_INLINE on suspend inline functions
#KT-22260: Fixed
2018-02-21 19:19:09 +03:00
Alexey Tsvetkov
772a935de6 Provide custom ConstantAffectionResolver in JPS
#KT-16091 fixed
2018-02-21 19:12:12 +03:00
Anton Bannykh
eabe21726c JS: improve switch elimination 2018-02-21 18:39:19 +03:00
Pavel V. Talanov
92070d132e Completion: do not force dsl members to the top if some type is expected 2018-02-21 14:44:14 +01:00
Pavel V. Talanov
1796d40118 Completion: assign highest priority to dsl members in dsl context
Use the same style as for dsl for lookup items that belong to dsl
2018-02-21 14:44:13 +01:00
Pavel V. Talanov
8f8cbfcfa5 KtAnnotationEntry#name is stubbed and is nullable 2018-02-21 14:44:09 +01:00
Pavel V. Talanov
8600add7f7 Refactor: extract utils related to DslMarker to a separate object 2018-02-21 14:44:08 +01:00
Dmitry Savvinov
d570b863ce Introduce deprecation of companion objects nested classes
Introdude deprecation as per KT-21515. Warning is reported on type
usage, that soon will became invisible. Quickfix by adding explicit
import is added.

Idea behind implementation is to mark scopes that are deprecated (see
ClassResolutionScopesSupport).

Then, during walk along hierarchy of scopes, look at deprecation status
of the scope that has provided this classifier.
Note that we also have to check if there are *some* non-deprecated
visibility paths (because we can see classifier by two paths, e.g. if
we've added explicit import) -- then this type reference shouldn't be
treated as deprecated.
2018-02-21 16:04:49 +03:00
Mikhail Glukhikh
acd8edaa9c WEAK_WARNING -> GENERIC_ERROR_OR_WARNING in three inspections
Now there inspection use configured highlight level instead of
forced weak warning: null check to safe call, reformat, sort modifiers
2018-02-21 15:59:59 +03:00
Alexey Sedunov
17e64ebae0 Move: Fix processing of callable references to nested Java classes and static methods
#KT-17827 Fixed
2018-02-21 13:21:20 +03:00
Alexey Sedunov
441f88c144 Move: Fix processing of callable references to nested Kotlin classes
#KT-17827 In Progress
2018-02-21 13:21:19 +03:00
Alexey Sedunov
bdfc814389 Move: Fix scope of internal reference recovery in the case of file move
#KT-22282 Fixed
2018-02-21 13:21:19 +03:00
Alexey Sedunov
4537192e86 Move: Check if sealed class is moved with its subclasses
#KT-22769 Fixed
2018-02-21 13:21:18 +03:00
Alexey Sedunov
27d4593fc4 Move: Fix lengthening of qualified type references
KT-14519 Fixed
2018-02-21 13:21:18 +03:00
Alexey Sedunov
1af21dd160 Move: Warn about moving public declaration to non-public class
#KT-22771 Fixed
2018-02-21 13:21:18 +03:00
Alexey Sedunov
acf6408474 Create from Usage: Fix "Create class" applicability check for when entries
#KT-22329 Fixed
2018-02-21 13:21:17 +03:00
Alexey Sedunov
0934859718 Create from Usage: Revert suggested container order for "Create Class"
#KT-22917 Fixed
2018-02-21 13:21:17 +03:00
Dmitry Jemerov
9e30ede998 Fix ISE in KotlinPairMatcher.getCodeConstructStart() 2018-02-21 10:13:08 +01:00
Yan Zhulanow
2fdadb0f5a Evaluator: Send class bytecode array in loop with a limited chunk size (#KT-22967)
JDI in Android has a limited byte buffer size (8192), and we must not exceed it.
2018-02-20 23:19:59 +03:00
Yan Zhulanow
dfc007ebd3 Use thread-safe WeakHashMap implementation in annotation-based IDE plugins (#KT-22514) 2018-02-20 23:19:35 +03:00
Mikhail Glukhikh
84993ec3a0 Resolution API: introduce and use KtElement.resolveToCall() 2018-02-20 20:25:42 +03:00
Mikhail Glukhikh
513376e5f0 Introduce KtNamedFunction.resolveToDescriptorIfAny() 2018-02-20 20:25:42 +03:00
Mikhail Glukhikh
5848bc9a44 Introduce KtClassOrObject.resolveToDescriptorIfAny() 2018-02-20 20:25:42 +03:00
Mikhail Glukhikh
bd0cbb716c Rename: analyzeWithDeclarations --> analyzeWithContent() 2018-02-20 20:25:41 +03:00
Mikhail Glukhikh
f6513cd17e Introduce resolveToParameterDescriptorIfAny(), drop reified version 2018-02-20 20:25:41 +03:00
Mikhail Glukhikh
7a1b3cd224 Introduce & use resolveToDescriptorIfAny<DescriptorType>
This allows to omit casts after resolveToDescriptorIfAny() call,
get different descriptors for different receivers (in future),
distinguish parameter / property situation for primary constructor
2018-02-20 20:25:41 +03:00
Mikhail Glukhikh
8c97f8cbb5 Deprecate KtElement.analyzeFullyAndGetResult(), use analyzeAndGetResult 2018-02-20 20:25:41 +03:00
Mikhail Glukhikh
cd1745d354 Light classes: analyzeFully() --> analyzeWithDeclarations() 2018-02-20 20:25:41 +03:00
Mikhail Glukhikh
eabc7c9ba8 Replace some KtDeclaration.analyze() with resolveToDescriptorIfAny()
Also, enhance comment on KtElement.analyze()
2018-02-20 20:25:40 +03:00
Mikhail Glukhikh
88b8652ed2 J2K: convert + get rid of analyzeFully (3 files) 2018-02-20 20:25:40 +03:00
Mikhail Glukhikh
50ce8d68bf J2K: rename *.java --> *.kt (3 files) 2018-02-20 20:25:40 +03:00
Mikhail Glukhikh
1ca1a6dddc KotlinFrameExtraVariablesProvider: add analyze / analyzeFully comment 2018-02-20 20:25:40 +03:00
Mikhail Glukhikh
135c06dc96 Android goto tests: analyzeFully --> analyze 2018-02-20 20:25:39 +03:00
Mikhail Glukhikh
c1f7303fa3 CanBePrimaryConstructorProperty: analyzeFully --> analyze 2018-02-20 20:25:39 +03:00
Mikhail Glukhikh
57d0da9843 MoveMemberOutOfCompanionObject: reformat 2018-02-20 20:25:39 +03:00
Mikhail Glukhikh
d4dbd4cd6a MoveMemberOutOfCompanionObject: analyzeFully --> analyze 2018-02-20 20:25:39 +03:00
Mikhail Glukhikh
8986b8a1a2 Introduce analyzeWithContent() & analyzeWithDeclarations()
These functions have more clear names & receivers.
Old analyzeFully() applied on KtElement made deprecated
because for general KtElement it's unclear what is "full analysis"
2018-02-20 20:25:38 +03:00
Mikhail Glukhikh
e78bd73ba3 LeakingThisInspection: add comment about analyzeFully 2018-02-20 20:25:38 +03:00
Mikhail Glukhikh
2038a5567d ResolveElementCache: remove dead branch 2018-02-20 20:25:38 +03:00
Mikhail Glukhikh
52166646bb Reformat: ResolveElementCache 2018-02-20 20:25:37 +03:00
Alexey Sedunov
ba71e732a9 Misc: Extract "KotlinSdkAdded" test to separate test case
This is needed due to application being initialized only once per test case,
while Kotlin SDK is configured during PluginStartupComponent initialization
2018-02-20 19:27:23 +03:00
gzoritchak
1c1fe10e12 Add samples for take* and drop* extensions (KT-20357)
- Add samples for take, takeLast, takeWhile, takeLastWhile
- Add samples for drop, dropLast, dropWhile, dropLastWhile
2018-02-20 19:24:27 +03:00
Mikhail Glukhikh
fda40723dc Downgrade LoopToCallChainInspection to INFORMATION level 2018-02-20 19:08:01 +03:00
Vyacheslav Gerasimov
9b4f1156d8 Generate dependencies.properties used by dokka build
was missing after migration to custom-build
2018-02-20 17:56:57 +03:00
Nikolay Krasko
d1eabb3e67 Wrap Kotlin exception filter call to read action (EA-116446)
See IDEA-186950 for details.
2018-02-20 17:36:54 +03:00
Sergey Igushkin
5901c2163f Add the expectedBy dependency to the compile configuration
Enable its propagation through transitive dependencies (including
POMs generated by Gradle)

Issue #KT-22824 Fixed
2018-02-20 17:24:22 +03:00
Sergey Igushkin
3836dcab85 Fix -Xmulti-platform dropped from args when freeCompilerArgs is assigned
in user build script

Issue #KT-15371 Fixed
2018-02-20 17:23:10 +03:00
Sergey Igushkin
37b34cff25 Allow multiple expectedBy dependencies in Gradle MPP support
Issue #KT-22864 Fixed
2018-02-20 17:23:10 +03:00
Mikhail Zarechenskiy
f23b5103ec Avoid non-null assertions for inline classes based on nullable types
Note that there are more places where assertions for inline classes should refined:
  - lateinit vars
  - values that come from Java
  - type casts (interfaces to inline class type)
2018-02-20 14:41:48 +03:00
Natalia Selezneva
e3c58eced1 Fix ConfigureKotlinInTempDirTest.testKotlinSdkAdded 2018-02-20 14:28:09 +03:00
Vyacheslav Gerasimov
b831b8ab92 Introduce intellijEnforceCommunitySdk flag to disable ultimate repo 2018-02-20 14:26:12 +03:00
Mikhail Glukhikh
02ee641daa Add CommonModuleResolveScopeEnlarger providing correct scope for commons
So #KT-22873 Fixed
So #KT-22858 Fixed
So #KT-22853 Fixed
2018-02-20 13:14:45 +03:00
Dmitry Savvinov
e071d054c9 Refactor DataFlowValueFactory implementation into several separate files 2018-02-20 13:11:33 +03:00
Dmitry Savvinov
0929673576 Refactor DataFlowValueFactory into proper component 2018-02-20 13:11:33 +03:00
Denis Zharkov
03567a1c01 Add @SinceKotlin("1.2") to kotlin.suspend 2018-02-20 11:59:39 +03:00
Mikhail Zarechenskiy
413e2d7fa1 Fix KotlinType of constructor call for inline classes 2018-02-20 11:58:18 +03:00
Mikhail Zarechenskiy
530dd01ca6 Fix unboxing values of inline class type from type parameters 2018-02-20 11:45:49 +03:00
Dmitry Petrov
99cea07bf4 Correctly map container element type in intrinsic for withIndex
In case of arrays, we couldn't distinguish array of boxed Ints
from array of primitive Ints.

 #KT-22904 Fixed Target versions 1.2.40
2018-02-20 09:18:25 +03:00
Ilya Gorbunov
2028ec3ce8 Minor improvements in all/any/none samples
Extract variables to make assertion expression shorter.
2018-02-19 18:44:28 +03:00
Yuta Sakata
4926b5a4c0 Add samples for any, all and none
Rewrite samples to make them working on sample generator

Move location of the class that contains samples of Aggregates.kt
2018-02-19 18:44:28 +03:00
Igor Chevdar
a2897a29b5 Added tests on default arguments of fake overridden functions 2018-02-19 18:39:08 +03:00
Igor Chevdar
a648b9676c Fixes in IR lowerings:
DeepCopyIrTree: typo fix.
Default arguments: made proper overridden descriptor selection.
Local declarations: made proper determination whether a function is locally defined.
2018-02-19 18:39:08 +03:00
Alexey Sedunov
aa4a5b75c7 UAST: Fall back to JVM platform if element doesn't have a module 2018-02-19 18:11:56 +03:00
Denis Zharkov
5edfc0f5cd Prohibit labeled returns inside kotlin.suspend argument lambdas
Probably, it would be more correct to skip such lambdas when resolving
the returns' references, but it'd be more complicated and still useless
since non-local returns are impossible in such lambdas
(relevant parameter is noinline)

 #KT-22900 Fixed
2018-02-19 17:30:26 +03:00
Mikhail Zarechenskiy
bc2e81a1e4 Improve message for exception about absence of common supertype
Relates to #KT-16253
2018-02-19 17:16:24 +03:00
Mikhael Bogdanov
cc4ab832b7 Properly calculate outermost parent class for sam wrapper
#KT-22906 Fixed
2018-02-19 13:29:56 +01:00
Ilya Gorbunov
6d035f1d28 Fix unresolved references to SortedSet in docs 2018-02-19 15:25:03 +03:00
Ilya Gorbunov
2eba8efb80 Do not refer to Cloneable in documentation
There's no source for Cloneable and it can't be resolved yet.
2018-02-19 15:14:25 +03:00
Nicolay Mitropolsky
bc543b4cdf LightAnnotations: wrapping all PsiLiterals (not only Strings) 2018-02-19 15:08:02 +03:00
Alexey Sedunov
99fca79bdc UAST: Do not create UElements in non-JVM modules 2018-02-19 13:01:38 +03:00
Ilya Chernikov
c9a0d7c624 Add missing reflect dependency to the gradle plugin
fixes #KT-22895
2018-02-19 10:20:17 +01:00
Denis Zharkov
cef7205f14 Fix CCE caused by KotlinPackageSourcesMemberNamesIndex
FileContentImpl::getPsiFile is not-nullable and at the same time
it contains an explicit case of its fileType to LanguageFileType
that leads to the following exception in case when kt-file is marked as plain text:

java.lang.ClassCastException: com.intellij.openapi.file.exclude.EnforcedPlainTextFileTypeFactory$1 cannot be cast to com.intellij.openapi.fileTypes.LanguageFileType
	at com.intellij.util.indexing.FileContentImpl.createFileFromText(FileContentImpl.java:135)
	at com.intellij.util.indexing.FileContentImpl.getPsiFile(FileContentImpl.java:104)

 #EA-114338 Fixed
2018-02-19 10:31:46 +03:00
gzoritchak
f790635b30 Add samples for joinTo
KT-20357
2018-02-18 20:12:05 +03:00
gzoritchak
40e3159463 Add samples for joinToString
KT-20357
2018-02-18 20:12:05 +03:00
Toshiaki Kameyama
a36e8c86f1 KT-22428 Create member function from usage shouldn't present type parameters as options (#1509)
* KT-22428 Create member function from usage shouldn't present type parameters as options

* Reformat & cleanup
2018-02-17 14:09:44 +03:00
Alexey Belkov
ea6582dd7d Minor: Fix typos and wording in NameResolution.adoc (#1523) 2018-02-17 13:51:08 +03:00
Alexander Udalov
96e33dabcf Fix JS stdlib file names in KotlinJpsBuildTest
Add "kotlin-experimental.js", "kotlin-experimental.meta.js" and refactor
surroundings
2018-02-16 17:09:34 +01:00
Mikhael Bogdanov
d732f0e160 Never delete types from inline functions during inline transformations
#KT-19399 Fixed
2018-02-16 16:48:53 +01:00
Mikhael Bogdanov
729c866f47 Code clean 2018-02-16 16:48:52 +01:00
Nicolay Mitropolsky
47f3a0ce0a Revert "Light annotations made strictly non-physical (KT-22565)"
This reverts commit cf6e21d
2018-02-16 16:24:15 +03:00
Mikhael Bogdanov
cc7bd80099 Enable multidex in android box tests 2018-02-16 14:22:04 +01:00
Mikhael Bogdanov
31c63dea50 Add jvm target 10 tests on jdk 10 2018-02-16 14:22:04 +01:00
Mikaël Peltier
2de0b2a9ef Cleaning into RedundantGotoMethodTransformer
- Use val when it is possible
- Use filterIsIstance
- Replace takeif + ?.let by an if instruction
2018-02-16 15:15:52 +03:00
Mikaël Peltier
9fb0f59813 KT-17110 Rewrite branches targeting other branches
- Rewrite branches targeting other branches to target directly the
final destination to avoid runtime performance penalties.

Fix of https://youtrack.jetbrains.com/issue/KT-17110
2018-02-16 15:15:52 +03:00
Mikhael Bogdanov
c9624ce0f9 Update gradle to 4.5.1 2018-02-16 12:31:18 +01:00
Alexey Sedunov
994d6ab4f9 Temporarily revert "UAST: Do not create UElements in non-JVM modules" 2018-02-16 14:05:16 +03:00
Nikolay Krasko
ae0bd9cc8c Additional diagnostic for incorrect stub type in Kotlin file (EA-111617) 2018-02-16 13:29:54 +03:00
Nikolay Krasko
866129984e Expression can be parenthesized on replace with if (KT-22874, EA-91186)
#KT-22874 Fixed
2018-02-16 13:29:53 +03:00
Nikolay Krasko
67183ad3b0 Fix class cast exception in KotlinFunctionParameterInfoHandler (EA-91186) 2018-02-16 13:29:50 +03:00
Nikolay Krasko
d868c01671 Disable outdate runtime check for developers builds
We can't update them properly anyway.
2018-02-16 13:29:49 +03:00
Nikolay Krasko
86dfc1ae2c Add internal action for reactivating post-open project activity 2018-02-16 13:29:48 +03:00
Nikolay Krasko
8a655b70e0 Fix isModified check in Kotlin compiler tab (KT-22851)
outputPostfix and outputPrefix is saved with nullize in apply, but
modification check was without it.

 #KT-22851 Fixed
2018-02-16 13:29:47 +03:00
Mikhail Glukhikh
6c328e7845 Fix IdeModuleInfoTests (related to KT-21771) 2018-02-16 13:15:02 +03:00
Alexey Sedunov
d5df8c60fc UAST: Do not create UElements in non-JVM modules 2018-02-15 20:37:44 +03:00
Alexander Udalov
a2835fe0d3 Do not report old runtime warnings for unstable API version
These warnings are technically correct but are too noisy and have little
value in case a user explicitly specifies unstable API version: it's
unlikely that seeing these warnings, the user will choose to rollback to
an earlier API version, since new API is probably one of the reasons
that user specified that unstable version to begin with.

So, in "kotlinc -language-version 1.3 -api-version 1.3 -cp
kotlin-stdlib-1.2.jar", we will no longer report a warning that the
attached stdlib has a version older than explicit API version (so long
as 1.3 remains unstable).

Note that we _could_ have reported these warnings in "kotlinc
-language-version 1.3 -cp kotlin-stdlib-1.2.jar", because in this case
the user might've not even be concerned with the new API in 1.3 and was
only looking for new language features. However, we still think that
it'd be unnecessary and one opt-in to the experimental world (with
LV=1.3 in this case) is enough

 #KT-22777 Fixed
2018-02-15 17:30:50 +01:00
Alexander Udalov
007248620c Disable API version inference when "-language-version" is specified
API version inference happens in
JvmRuntimeVersionsConsistencyChecker.checkCompilerClasspathConsistency
only in the case when API version is specified explicitly (with
"-api-version ..."). However, if the user specifies "-language-version
1.3", what's likely meant is "-language-version 1.3 -api-version 1.3",
and it would be unwise to infer API version to 1.2 (which is the version
of the attached stdlib) in this case.

Therefore, API version is now considered to be specified explicitly if
_either_ -language-version or -api-version is specified on the command
line

 #KT-22777 In Progress
2018-02-15 17:30:42 +01:00
Alexander Udalov
3f6aeb6dca Refactor API version inference/checking code
The behavior is not changed in this commit
2018-02-15 17:30:01 +01:00
Alexander Udalov
749773aa36 Remove -Xskip-runtime-version-check from error messages 2018-02-15 17:28:47 +01:00
Alexander Podkhalyuzin
d940546a10 Added optional dependency to Kotlin/Native Java plugin 2018-02-15 18:58:53 +03:00
Alexander Udalov
213df24644 Fix Java9ModulesIntegrationTest.testAutomaticModuleNames on Windows
Do not use '*' in the file name since it's forbidden on Windows
2018-02-15 18:48:08 +03:00
Mikhail Glukhikh
427d7fd1cc Fix compilation 2018-02-15 18:16:58 +03:00
Alexander Podkhalyuzin
898b31cb83 Merge pull request #1516 from JetBrains/always_fallback_to_hardcoded_plugin_id
Use hardcoded plugin ID when loaded in the main classloader
2018-02-15 17:03:29 +03:00
Dmitry Petrov
8bfbbe456f Use NoScopeRecordCliBindingTrace for codegen tests 2018-02-15 16:40:26 +03:00
Dmitry Petrov
10916b2046 Minor: reformat code 2018-02-15 16:40:13 +03:00
Alexander Udalov
f8424624ca Minor, check compiler output in ExperimentalIntegrationTest 2018-02-15 13:14:38 +01:00
Alexander Udalov
4a370e9dba Don't break the "API <= LV" rule in compiler tests
Stability of the language version is used for example to determine
whether the PRE_RELEASE_CLASS diagnostic should be reported. Now that
there are pre-release classes in the standard library (Experimental et
al.), we'd like to avoid this error on their usages in diagnostic tests
which are using the "!API_VERSION: 1.3" directive
2018-02-15 13:14:37 +01:00
Alexander Udalov
31e762c679 Move 1.3-specific part of stdlib to another source set 2018-02-15 13:14:37 +01:00
Mikaël Peltier
ef6b6cd261 Fix NPE into isArraySizeAccess 2018-02-15 12:41:33 +03:00
Mikaël Peltier
3c2f137fd5 Exclude tests from JS backend due to a bug into it 2018-02-15 12:41:33 +03:00
Mikaël Peltier
be07a348ea Reformat tests 2018-02-15 12:41:33 +03:00
Mikaël Peltier
8676ca34d7 KT-22334 Specialized loops using range such as integer..array.size-1
- Into PrimitiveNumberRangeLiteralRangeValue modifies how bounded
value are created by checking if the high bound range can be modified
to be exclusive instead of inclusive such as the generated code will
be optimized.
- Add black box tests checking that the specialization does not fail
on any kind of arrays.
- Add a bytecode test checking that the code is correctly optimized.

Fix of https://youtrack.jetbrains.com/issue/KT-22334
2018-02-15 12:41:33 +03:00
Ilya Gorbunov
8c8caa4707 kotlin-test: change actual package name for test annotation typealiases
to avoid potential split package situation
2018-02-14 23:50:30 +03:00
Ilya Gorbunov
dfa6fc7d48 IDEA settings: add pattern for upsource review links 2018-02-14 19:29:41 +03:00
Vyacheslav Gerasimov
6959f6af75 Exclude lib subdirs from inlellij module
When lib/rt is added to test runtime some tests break
2018-02-14 18:42:10 +03:00
Sergey Igushkin
14e9930f94 Apply shading/relocation to the subplugin example 2018-02-14 17:43:05 +03:00
Alexey Tsvetkov
1dadf84c40 Check Java interop in Maven IC tests 2018-02-14 16:31:30 +03:00
Alexey Tsvetkov
07c94a5586 Check output in Maven IC tests 2018-02-14 16:31:30 +03:00
Alexey Tsvetkov
42c433f950 Avoid removing target/classes dir during IC in Maven
#KT-21581 fixed
2018-02-14 16:31:30 +03:00
Sergey Igushkin
fa3ca0cddb Merge pull request #1517 from JetBrains/igushkin/gradle-it-readme
Update Readme.md for Gradle plugin IT
2018-02-14 16:28:04 +03:00
Sergey Igushkin
ad30e898c2 Create Readme.md 2018-02-14 16:27:11 +03:00
Sergey Igushkin
f9191ff210 Update ReadMe.md 2018-02-14 16:23:08 +03:00
Alexey Tsvetkov
67a5cab343 Fix IC test data
Test data was broken starting from 0954d1ab1b
2018-02-14 16:09:07 +03:00
Mikhail Glukhikh
3f500a1655 Add "expectedBy" to module descriptor and use it in checker
Now ExpectActualDeclarationChecker in IDE context
uses common module descriptors for relevant checks.
Compiler still uses own module instead (see comment in checker)
So #KT-21771 Fixed
2018-02-14 15:09:14 +03:00
Mikhail Glukhikh
78136fbb07 IDE facet refactoring, ModuleInfo.expectedBy introduced.
Part of facet classes was extracted to idea-analysis module
Related to KT-21771
2018-02-14 15:09:14 +03:00
Mikhail Zarechenskiy
694f5690f9 [NI] Improve diagnostic about unresolved receiver for many candidates 2018-02-14 14:58:05 +03:00
Mikhail Zarechenskiy
3afd4a2f4a [NI] Record all diagnostics from subcalls resolution results 2018-02-14 14:58:04 +03:00
Mikhail Zarechenskiy
6a7a07bf9d [NI] Don't forget to report about unresolved callable reference 2018-02-14 14:58:04 +03:00
Sergey Igushkin
a3aefac111 (minor) Fix testAndroidKaptChangingDependencies 2018-02-14 14:53:14 +03:00
Alexander Udalov
ecc441a642 Minor, remove obsolete JDK 6-related workaround 2018-02-14 12:50:16 +01:00
Alexander Udalov
60a551404a Refine modality of fake overrides inherited from abstract expected members
In an open expected class inheriting an expected interface, abstract
members are now inherited as _open_ fake overrides, not final. Final was
technically safer but also stricter and thus could be unexpected by the
user. In a final class, abstract members are still inherited as _final_
fake overrides. So, the general rule is now the following: the modality
of an expected fake override, which overrides only abstract members, in
a non-abstract class is equal to the modality of that class

 #KT-22031 Fixed
2018-02-14 12:45:45 +01:00
Sergey Igushkin
fe3ce1ec7c (minor) Fix testKaptKt15814, slightly modify temp dir path. 2018-02-14 14:43:23 +03:00
Natalia Selezneva
50c0c5a747 Throw exception when it's not possible to run evaluate expression with compilation 2018-02-14 14:40:38 +03:00
Natalia Selezneva
19e7002d02 Evaluate Expression: fix ClassNotFoundException for primitives and arrays 2018-02-14 14:40:31 +03:00
Natalia Selezneva
2f61bd41d5 Fix comparision of java versions during class loading in evaluate expression.
Do not catch EvaluateException during class loading to show more useful error to user.
^KT-22830 Fixed
2018-02-14 14:40:24 +03:00
Sergey Igushkin
3214fb8611 Fix testAnnotationProcessorAsFqName 2018-02-14 14:28:42 +03:00
Nikolay Krasko
71043821da Check idea with apiVersion instead of BUILD_NUMBER
BUILD_NUMBER is probably rewritten in tests from KotlinCoreEnvironment.
2018-02-14 13:27:10 +03:00
Nikolay Krasko
882913c773 Fix getting fields after introducing KotlinCommonCodeStyleSettings 2018-02-14 13:27:10 +03:00
Dmitry Savvinov
2f855a993e Update changelog for 1.2.30 2018-02-14 13:24:17 +03:00
Vyacheslav Karpukhin
cbb75d0bcd Use hardcoded plugin ID when loaded in the main classloader 2018-02-14 11:11:18 +01:00
Mikhail Glukhikh
d56902983e Add forgotten generated tests 2018-02-14 13:03:30 +03:00
Mikaël Peltier
8ab7e5c406 KT-10057 Use lcmp instead of Intrinsics.compare
Fix of https://youtrack.jetbrains.com/issue/KT-10057
2018-02-14 09:46:29 +01:00
Denis Zharkov
c47c1c5ffd Fix runtime CCE in case of out-projected SAM
Probably, when NI is there this fix will become unnecessary because
there will be no approximation applied, thus the value parameter
will remain Hello<#Captured> instead of Nothing

 #KT-17171 Fixed
2018-02-14 10:29:14 +03:00
Mikhail Zarechenskiy
6baf937a52 Update test files with dumped declarations for NI 2018-02-13 19:50:25 +03:00
Sergey Igushkin
6eaee8b250 Require no specific version for ExecutionStrategyIT 2018-02-13 17:43:11 +03:00
Sergey Igushkin
c3946d98f2 Update Gradle test version to 4.5.1, fix kapt1 multiversion and IC tests
that were not correctly tweaked for kapt1
2018-02-13 17:43:11 +03:00
Sergey Igushkin
d0416bea03 Use Gradle 3.5 for kapt1 IT because of the separate classes dirs bug in
kapt1.
2018-02-13 17:43:11 +03:00
Sergey Igushkin
b5195d36bc Use Gradle 3.4 for testCleanBuildLib because of classpath normalization 2018-02-13 17:43:11 +03:00
Sergey Igushkin
6e51ada36b Override system-wide cache, simplify version checks, 2018-02-13 17:43:11 +03:00
Sergey Igushkin
99e731f6a6 Transform the new tests after rebase; Fix issues from KOTLIN-CR-1546 2018-02-13 17:43:10 +03:00
Sergey Igushkin
f9dc892c42 Do not stop Gradle daemons with the same version as that of the build. 2018-02-13 17:43:10 +03:00
Sergey Igushkin
a223870e7a Exclude JPS tests from normal run. Log Gradle version when advancing it. 2018-02-13 17:43:10 +03:00
Sergey Igushkin
ae1ef06de2 Fix a few tests failing due to Gradle version change. 2018-02-13 17:43:10 +03:00
Sergey Igushkin
ced5bf6e2c Fix getOutputForTask for newer Gradle versions 2018-02-13 17:43:10 +03:00
Sergey Igushkin
c394b50cb8 Implement logic for classes directories in Gradle IT across versions.
Also add a workaround for console type set in user's gradle.properties.
2018-02-13 17:43:10 +03:00
Sergey Igushkin
5905b23bf9 Change existing literal Gradle versions to GradleVersionRequirement
Also add workaround for kotlin-test-common not seen in the IDE
2018-02-13 17:43:09 +03:00
Sergey Igushkin
5bd52311dc Introduce GradleVersionRequirement and logic for version for each test 2018-02-13 17:43:09 +03:00
Alexander Udalov
fd52deb9c1 Remove unneeded dependencies of module 'generators'
Previously, the classpath of this module was used to run all tests in
the project. This is why it depended on almost all modules in the
project. Now, in the Gradle build, these dependencies are no longer
needed
2018-02-13 15:42:16 +01:00
Mikhail Zarechenskiy
c4cfd07fe9 [NI] Fix infinite completion of arguments in AllCandidates mode
See AutoImports#testFactoryFunctionFromLambda for example
2018-02-13 15:06:34 +03:00
Mikhail Zarechenskiy
e017e9cb5f Support passing inline class values with spread operator 2018-02-13 13:16:45 +03:00
Mikhail Zarechenskiy
3919dc94e1 Box values of inline class types when passing to function as varargs 2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy
6687751cf5 Generate as check for inline classes using wrapper
Should be improved when inline class is based on non-null reference
2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy
a88dbefcd9 Generate is check for inline classes same as for primitives
Should be improved when inline class is based on non-null reference
2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy
d606e5bc89 Correct boxing for functional types containing inline classes 2018-02-13 13:16:43 +03:00
Mikhail Zarechenskiy
a8a9f774d0 Map inline classes in generic argument position to theirs wrap classes 2018-02-13 13:16:43 +03:00
Mikhail Zarechenskiy
1d16d21dbb Fix boxing for non-local and labeled returns with inline classes 2018-02-13 13:16:42 +03:00
Mikhail Zarechenskiy
80dd5c106e Propagate KotlinType through call generator, fix boxing on arguments 2018-02-13 13:16:42 +03:00
Mikhail Zarechenskiy
22b9c25dd0 Add KotlinType info about this inside inline class 2018-02-13 13:16:41 +03:00
Mikhail Zarechenskiy
c86d3e354b Skip call to the underlying value of inline class 2018-02-13 13:16:41 +03:00
Mikhail Zarechenskiy
2c279978c8 Fix generation of property accessor to the underlying value 2018-02-13 13:16:40 +03:00
Mikhail Zarechenskiy
ce601bebbe Fix detection of erased this for inline class 2018-02-13 13:16:40 +03:00
Mikhail Zarechenskiy
b361d0e9c0 Add test and check that iterator over UInt folds to a simple for-loop 2018-02-13 13:16:40 +03:00
Mikhail Zarechenskiy
059f1e9eed Support inline classes working with collection elements (get/set) 2018-02-13 13:16:39 +03:00
Mikhail Zarechenskiy
8015295059 Desugar constructor call of inline class to the underlying value
Also add information about KotlinType to the constant stack values
2018-02-13 13:16:39 +03:00
Mikhail Zarechenskiy
6320368609 Add KotlinType to the Coercion stack value 2018-02-13 13:16:38 +03:00
Toshiaki Kameyama
e35ec8ee08 Introduce intention 'expr.unsafeCast<Type>()' <- -> 'expr as Type'
So #KT-16382 Fixed
2018-02-13 13:05:52 +03:00
Mikhail Glukhikh
085c7d30ed Specify expl. lambda signature: derive from offset independent intention
Related to KT-22492
2018-02-13 12:28:56 +03:00
Toshiaki Kameyama
5499078fcc Make "Specify explicit lambda signature" available on whole lambda
So #KT-22492 Fixed
2018-02-13 12:28:50 +03:00
Toshiaki Kameyama
059a797e10 Don't report redundant semicolon for a call before lambda expression
So #KT-22719 Fixed
2018-02-13 11:52:04 +03:00
Toshiaki Kameyama
f9555f3f64 Join with assignment: remove comment from target range #KT-22110 Fixed 2018-02-13 11:45:31 +03:00
Dmitry Petrov
36128ba66f Don't generate primary constructor body for expect classes 2018-02-13 10:09:28 +03:00
Dmitry Petrov
839ebba157 ProperNumberComparisons is disabled by default (until LDC decision) 2018-02-13 09:26:00 +03:00
Dmitry Petrov
af79bbd247 Minor: reformat code 2018-02-13 09:25:40 +03:00
Dmitry Petrov
a790195808 Implement "proper numeric comparisons" support in JVM BE 2018-02-13 09:25:40 +03:00
Dmitry Petrov
e23a48e8d0 Minor: reformat code 2018-02-13 09:25:40 +03:00
Nikita Skvortsov
b1419e2a8c fix import of expectedBy scope dependencies inside composite builds 2018-02-12 19:29:12 +03:00
Pavel V. Talanov
8ac7f0b592 Minor: remove error marker from commented out test code 2018-02-12 16:46:16 +01:00
Pavel V. Talanov
fd4e262b1f Minor: modify test for KT-22819 to unmute it on teamcity
#KT-22819 Open
2018-02-12 16:35:56 +01:00
Pavel V. Talanov
9e69c73387 Minor: comment out test for KT-22594 to unmute it on teamcity
#KT-22594 Open
2018-02-12 16:35:51 +01:00
Vyacheslav Karpukhin
53946456cf Do not use hardcoded plugin ID for update checks
When Kotlin plugin is bundled into another plugin, there won't be a plugin with ID org.jetbrains.kotlin registered in PluginManager, which leads to runtime exceptions. To fix that let's determine the plugin ID dynamically instead.
2018-02-12 17:33:54 +03:00
Nikolay Krasko
f5e78a89bc Collect statistics of used defaults set in formatting (KT-22252)
^KT-22252 In Progress
2018-02-12 17:33:54 +03:00
Anton Bannykh
cd3a797f2a JS: fix corner case in when translation (fix crash in KT-22544) 2018-02-12 17:15:48 +03:00
Alexey Sedunov
b315e0c113 Gradle: Fix dependency import when "module per sourceset" is disabled
#KT-22360 Fixed
2018-02-12 15:10:19 +03:00
Alexey Sedunov
e1aec46300 Configuration: Set up Kotlin SDK (if necessary) on plugin startup
#KT-22590 Fixed
2018-02-12 15:10:16 +03:00
Ilya Gorbunov
99fd66137c Update the instruction how to run the stdlib generator
Use relative paths in urls
2018-02-12 14:32:51 +03:00
Yanis Batura
9c8c1cdc18 Fix a couple of typos in docs and ReadMe
* Fix a couple of typos
- In the main ReadMe.md
- In onEach template's doc

* Update generated source code
2018-02-12 14:22:47 +03:00
Simon Ogorodnik
470a4bb615 Fix Missing documentation inspection for primary ctor properties
#KT-20954 fixed
#KT-21005 fixed
2018-02-12 13:41:50 +03:00
Ilya Gorbunov
0f130a0a5a Add documentation for kotlin-test-testng artifact 2018-02-12 08:11:23 +03:00
Ilya Gorbunov
5e3edf4bd7 Select the asserter based on test framework presence in classpath
Simplify asserter lookup: enumerate all AsserterContributors when
the file class with lookupAsserter function is initialized.

It's assumed that AsserterContributor initialization should be fast.

#KT-21154 Fixed
2018-02-12 07:59:54 +03:00
Ilya Gorbunov
9dfa54eb62 Include kotlin-test-testng into dist, setup JDK 7 required to run tests 2018-02-12 07:58:29 +03:00
Ilya Gorbunov
d1f00a95e0 Minor: kotlin-test reformat sources, fix test package names 2018-02-12 07:58:28 +03:00
Valeriy Zhirnov
ad7701922c TestNG support in kotlin.test #KT-22620 2018-02-12 07:58:21 +03:00
Nikolay Krasko
1e567438a2 Store selected set of defaults in code style settings (KT-22252)
#KT-22252 In Progress
2018-02-11 16:50:20 +03:00
Nikolay Krasko
5d25b8b476 Control serialize/deserialize of CommonCodeStyleSettings 2018-02-11 16:50:19 +03:00
Mikhail Zarechenskiy
9e22761262 Fix type parameters indexes of MockClassDescriptor
Exception was thrown during mapping of arguments to parameters in `computeSupertypeProjections`

 #KT-18522 Fixed
2018-02-11 16:21:23 +03:00
Yan Zhulanow
310ee67c35 REPL, minor: Ignore empty lines (#KT-21611) 2018-02-09 19:24:57 +03:00
Yan Zhulanow
edcf0aef53 Kapt: Allow Kotlin @Repeatable annotations (KT-22451)
We don't generate a wrapper for repeatable annotations, and Javac complains to it.
2018-02-09 19:11:03 +03:00
Vyacheslav Gerasimov
a3a46fe259 Fix test runtime and set idea.home.path for sam with receiver plugin 2018-02-09 15:04:30 +03:00
Dmitry Petrov
5a85bf36a5 Check for type parameter supertypes in primitive numeric comparisons 2018-02-09 14:41:54 +03:00
Alexey Sedunov
e5e583e3e5 Configuration: Show Koltin plugin path as "home path" of Kotlin SDK
#KT-22640 Fixed
2018-02-09 14:17:40 +03:00
Alexey Sedunov
84fed8071c Create from Usage: Support target directory selection for "Create class"
#KT-22152 Fixed
2018-02-09 14:17:40 +03:00
Alexey Sedunov
695a2a4098 Rename: Support retargeting/shadowing conflict checking for functions
#KT-22564 Fixed
2018-02-09 14:17:40 +03:00
Alexey Sedunov
5c6bba9f14 Rename: Fix qualified expression replacement for the case 'invoke' <-> 'get'
#KT-22705 Fixed
2018-02-09 14:17:39 +03:00
Alexey Sedunov
fffd74f002 Refactor: Move canMoveLambdaOutsideParentheses() function to idea-core module 2018-02-09 14:17:39 +03:00
Alexey Sedunov
48705865bd J2K: KtArrayAccessReference 2018-02-09 14:17:38 +03:00
Alexey Sedunov
9150322bed J2K: KtArrayAccessReference (rename to .kt) 2018-02-09 14:17:38 +03:00
Alexey Sedunov
e88f1467eb Rename: Add quotes to declaration name if necessary
#KT-22708 Fixed
2018-02-09 14:17:38 +03:00
Alexey Sedunov
428b086458 Refactor: Move 'isIdentifier' and 'quoteIfNeeded' functions to frontend 2018-02-09 14:17:37 +03:00
Alexey Sedunov
fddfbf225f Change Signature: Support implicit calls of 'invoke' and 'get'
Also drop 'operator' keyword when necessary

 #KT-22718 Fixed
2018-02-09 14:17:37 +03:00
Ilya Chernikov
e38d5395df Pass previous dependencies to the legacy script dependency resolvers
fixes #KT-22753
2018-02-09 11:03:43 +01:00
Dmitry Jemerov
3aaad0c21d Indent default parameter values
#KT-22508 Fixed
2018-02-09 10:49:02 +01:00
Dmitry Jemerov
5bb195df9b No space between label and lambda in labeled expressions
#KT-22301 Fixed
2018-02-09 10:49:01 +01:00
Dmitry Jemerov
8f9b818e43 Do not indent closing bracket of array access expression
#KT-22641 Fixed
2018-02-09 10:49:00 +01:00
Dmitry Jemerov
36f5525b12 Call chain indentation logic that actually makes sense
#KT-22346 Fixed
2018-02-09 10:48:51 +01:00
Dmitry Jemerov
2c88b26034 Group all call chain-related tests in a single directory 2018-02-09 10:48:48 +01:00
Mikhael Bogdanov
d7e5eb24ee Update android test dependencies 2018-02-09 09:45:14 +01:00
Mikhael Bogdanov
b666a2da5f Increase android test timeout 2018-02-09 09:45:13 +01:00
Denis Zharkov
f6c6f67566 Minor. Remove irrelevant JAVAC_EXPECTED_FILE directive in tests
This change fixes these tests
2018-02-09 10:54:28 +03:00
Rodrigo B. de Oliveira
de57951b58 Make Kotlin Idea plugin aware of the Gradle initscript template
See gradle/kotlin-dsl#662
2018-02-09 08:32:14 +01:00
Mikaël Peltier
e1f44d6237 Move tests to the right place 2018-02-09 09:10:53 +03:00
Mikaël Peltier
9274241c0e KT-22714 Avoid to generate unecessary checkcast
- StackValue already avoid to generate checkcast from a type or an
array to java.lang.Object. Add a new case to avoid to generate a
checkcast from an array to an array of java.lang.Object when arrays
have the same dimensions.

Fix of https://youtrack.jetbrains.com/issue/KT-22714
2018-02-09 09:10:53 +03:00
Mikhail Zarechenskiy
0ecb3afdf7 Refactoring: rename AsmTypeAndKotlinType -> JvmKotlinType 2018-02-09 05:06:34 +03:00
Mikhail Zarechenskiy
913e4b42bb Support inline classes as last expression in lambda 2018-02-09 05:06:32 +03:00
Mikhail Zarechenskiy
396cc7d02b Support unboxing of inline classes in elvis 2018-02-09 05:06:31 +03:00
Mikhail Zarechenskiy
fefcddc803 Support boxing/unboxing for captured vars of inline class types 2018-02-09 05:06:29 +03:00
Mikhail Zarechenskiy
9f24bbd980 Support unboxing of inline classes after assertion operator 2018-02-09 05:06:27 +03:00
Mikhail Zarechenskiy
30c79ffadc Support generating computable properties inside inline classes 2018-02-09 04:57:20 +03:00
Mikhail Zarechenskiy
47aeeb36e4 Get accessors for companion object properties through wrapper class 2018-02-09 04:56:46 +03:00
Mikhail Zarechenskiy
70cd1cfcdf Fix generation of companion object inside inline classes 2018-02-09 04:56:45 +03:00
Mikhail Zarechenskiy
e1d3b21201 Skip bridge methods generation for inline classes 2018-02-09 04:56:43 +03:00
Mikhail Zarechenskiy
4eb64fb4b9 Support mapping for inline classes based on type variables 2018-02-09 04:56:41 +03:00
Mikhail Zarechenskiy
0fd80ce980 Unbox inline classes after safe calls if needed 2018-02-09 04:56:40 +03:00
Mikhail Zarechenskiy
c5c8d84719 Support boxing/unboxing for method return types 2018-02-09 04:56:36 +03:00
Mikhail Zarechenskiy
390c214943 Support boxing for inline classes on function calls 2018-02-09 04:56:08 +03:00
Mikhail Zarechenskiy
0d682879f5 Initial boxing for inline classes: local variable assignments 2018-02-09 04:55:44 +03:00
Mikhail Zarechenskiy
b0ee61620c Add KotlinType to methods coerceTo & coerceFrom 2018-02-09 02:08:11 +03:00
Mikhail Zarechenskiy
1ac4e9755a Generate synthetic unbox method for each wrapper of inline class 2018-02-09 02:08:11 +03:00
Mikhail Zarechenskiy
a59917b6f8 Generate synthetic box method for each erased inline class 2018-02-09 02:08:10 +03:00
Mikhail Zarechenskiy
f856455841 Introduce stateless methods to map types without predefined mapping 2018-02-09 02:08:10 +03:00
Mikhail Zarechenskiy
1cdad65b9b Refactoring: propagate KotlinType through hierarchy of StackValue
Mainly, this is needed to introduce boxing over inline classes
2018-02-09 02:08:10 +03:00
Mikhail Zarechenskiy
9d05fac771 Don't generate backing field for erased inline class 2018-02-09 02:08:09 +03:00
Mikhail Zarechenskiy
b08a32af2f Fix local variables table for inline classes 2018-02-09 02:08:09 +03:00
Cuihtlauac ALVARADO
35c454f53f Filter out "Picked Up" messages from stderr
KT-22340 Fixed
2018-02-08 18:48:25 +01:00
Yan Zhulanow
46c2adda4e REPL: Fix crash on trying to :load with incorrect filename (KT-12037)
(cherry picked from commit 0238575a36)
2018-02-08 20:44:15 +03:00
Yan Zhulanow
a25e93d82a Debugger: (EA-112731) Do not crash miserably if we don't know the anonymous class name
Continue to log the exception, avoid breaking UX
2018-02-08 19:36:38 +03:00
Yan Zhulanow
2a3bab0a0f Kapt: Register additional source directories without modifying the raw Gradle model
Unfortunately, this works only for the newer Android Studio versions, so we need to keep the old code until IDEA will migrate at least to AS 3.1.
2018-02-08 19:36:38 +03:00
Yan Zhulanow
6c4a2db34b Kapt: Enums inside enum values should be forbidden (KT-22582) 2018-02-08 19:36:38 +03:00
Yan Zhulanow
510d5ece0f Android Extensions: Support '.', '-' and ':' in View identifiers (KT-22700) 2018-02-08 19:36:37 +03:00
Yan Zhulanow
ba61a93dc7 Kapt: Forbid using the deprecated (original) kapt 2018-02-08 19:36:37 +03:00
Yan Zhulanow
bdd7ab3a09 Kapt: Mute Java 9 tests temporarily on Windows 2018-02-08 19:36:37 +03:00
Yan Zhulanow
03a20384ef Uast: Fix an exception while converting type alias KotlinType to PsiType (KT-21874) 2018-02-08 19:36:37 +03:00
Yan Zhulanow
1cc4744345 Kapt: Map URLs to absolute file paths properly, also add some logging 2018-02-08 19:36:37 +03:00
Ilmir Usmanov
87bbac9d43 Take coroutineContext into account in RedundantSuspendModifierInspection
#KT-22651: Fixed
2018-02-08 19:34:20 +03:00
Alexander Udalov
e19ed1e001 Add test on experimental const val in annotation argument
This test checks that a usage inside an annotation argument is a
signature usage, which may be too restricting but easier to support at
the moment (and the restriction can be lifted in the future)
2018-02-08 17:08:34 +01:00
Alexander Udalov
a4af9dd5d1 Always consider container's experimentality in ExperimentalUsageChecker
This results in more diagnostics usually, but allows library authors to
avoid annotating everything in each experimental class with the marker
(only the class needs to be annotated now)

 #KT-22759
2018-02-08 17:08:34 +01:00
Alexander Udalov
7123202670 Add getExtensionOrNull utility for protobuf messages 2018-02-08 17:08:33 +01:00
Alexander Udalov
65a6171782 Add test on Experimental in scripts 2018-02-08 17:08:33 +01:00
Alexander Udalov
21e2a3c0b4 Load module annotations in IDE
#KT-22759 Fixed
2018-02-08 17:08:33 +01:00
Alexander Udalov
890374a42a Load module annotations for JVM and JS modules in compiler
#KT-22759 In Progress
2018-02-08 17:08:33 +01:00
Alexander Udalov
396a5ab352 JS: write/read module annotation FQ names to/from metadata
#KT-22759 In Progress
2018-02-08 17:07:23 +01:00
Alexander Udalov
ff33e0bad3 Write/read module annotation FQ names to/from metadata on JVM
#KT-22759 In Progress
2018-02-08 17:07:23 +01:00
Alexander Udalov
b4ac852392 Add packageProto/nameResolver to JvmPackagePartSource
May be useful for loading platform-specific protobuf extensions (such as
package_module_name on JVM) when analyzing deserialized top level
members
2018-02-08 17:07:22 +01:00
Alexander Udalov
ec6b49b8b8 Check experimental API markers for deprecation
#KT-22759 In Progress
2018-02-08 17:07:22 +01:00
Alexander Udalov
5e78adb501 Support -Xexperimental/-Xuse-experimental in ExperimentalUsageChecker
#KT-22759 In Progress
2018-02-08 17:07:22 +01:00
Alexander Udalov
77625831f7 Support -Xexperimental and -Xuse-experimental, validate their values
#KT-22759 In Progress
2018-02-08 17:07:22 +01:00
Alexander Udalov
153c86c069 Report diagnostic on overrides of experimental members
Unless they're experimental themselves

 #KT-22759 In Progress
2018-02-08 17:07:22 +01:00
Alexander Udalov
29c35e6686 Do not require experimental propagation for body usages in same module
Unless it's a usage inside the body of an effectively public inline
function

 #KT-22759 In Progress
2018-02-08 17:07:22 +01:00
Alexander Udalov
6d4e8f3781 Add some validation for Experimental/UseExperimental usages
#KT-22759 In Progress
2018-02-08 17:07:22 +01:00
Alexander Udalov
0bf0a315ed Introduce Experimental and UseExperimental annotations
#KT-22759 In Progress
2018-02-08 17:07:21 +01:00
Simon Ogorodnik
366f630236 Fix J2K ObjectLiteral.testMyFrame by updating incorrect testData 2018-02-08 19:01:13 +03:00
Mikaël Peltier
126afbb8ac Avoid to generate unecessary checkcast
StackValue already avoid to generate checkcast from a type or an
 array to java.lang.Object. Add a new case to avoid to generate a
 checkcast from an array to an array of java.lang.Object when arrays
 have the same dimensions.

 #KT-22714 Fixed
2018-02-08 16:38:46 +01:00
Denis Zharkov
9a9452f73a Add @RequireKotlin(1.2.30) for kotlin.suspend
#KT-22562 Fixed
2018-02-08 17:47:37 +03:00
Alexander Udalov
b6a55f74f4 Support patch versions in RequireKotlin with kind=COMPILER_VERSION 2018-02-08 17:47:37 +03:00
Denis Zharkov
72222c718a Highlight callees resolved to kotlin.suspend as a keywords
#KT-22562 In Progress
2018-02-08 17:47:37 +03:00
Denis Zharkov
99c7d8d4d5 Add call checks related to suspend lambda modifier's introduction
- Prohibit non-modifier-like calls on kotlin.suspend
- Add warning on modifier-like calls to anything but kotlin.suspend

 #KT-22766 In Progress
 #KT-22562 In Progress
2018-02-08 17:47:37 +03:00
Denis Zharkov
ef01f641f3 Imitate support for suspend modifier on parameterless lambdas
#KT-22766 In Progress
2018-02-08 17:47:37 +03:00
Denis Zharkov
5c81d9fd6b Minor. Make function private 2018-02-08 17:47:37 +03:00
Denis Zharkov
342a532416 Minor. Inline parameters 2018-02-08 17:47:37 +03:00
Pavel V. Talanov
229184dd78 Dsl line marker: provide simple tooltip
Test dsl line marker
2018-02-08 15:36:42 +01:00
Pavel V. Talanov
519ea12bb2 Test, dsl highlighter: test custom highlighting applied to calls 2018-02-08 15:36:41 +01:00
Mikhail Glukhikh
d554a4234d Redundant object type check: fix problem highlighting #KT-22484 Fixed 2018-02-08 17:10:44 +03:00
Mikhail Glukhikh
901ae087bc Redundant object type check: use referential equality, forbid for when
So #KT-22538 Fixed
2018-02-08 17:10:43 +03:00
Mikhail Glukhikh
fbe6929903 Reformat: RedundantObjectTypeCheckInspection 2018-02-08 17:10:41 +03:00
Mikhail Glukhikh
c715387773 Reformat & cleanup: KotlinGradleSourceSetDataService 2018-02-08 17:10:40 +03:00
Mikhail Glukhikh
198b054a6f Detect library kind in Gradle if name looks like non-JVM
Related to KT-20971
2018-02-08 17:10:39 +03:00
Mikhail Glukhikh
dcbb29e947 Search for source of platform binary also in common sources
So #KT-20971 Fixed
2018-02-08 17:10:37 +03:00
Mikhail Glukhikh
76976f7e52 SourceNavigationHelper: reformat + style fix 2018-02-08 17:10:36 +03:00
Alexander Udalov
80a7f92309 Extract logic to get function parameters for default value generation
For some reason, this logic was a bit different in JVM (FunctionCodegen)
and JS (FunctionBodyTranslator). For example, in JS the
EXPECTED_FUNCTION_SOURCE_WITH_DEFAULT_ARGUMENTS_NOT_FOUND diagnostic was
reported even in the case when no expected function was found for the
actual function at all, which made it quite difficult to write
multiplatform sources for JS stdlib where it both should be compiled as
a part of the multiplatform project, and by itself (suppressing
NO_ACTUAL_FOR_EXPECT): in the latter case, the new error must have been
suppressed everywhere as well

 #KT-21913
2018-02-08 14:14:10 +01:00
Alexander Udalov
97314d010d Serialize default argument values presence for actual declarations correctly
When default argument value was present in the expected declaration, we
did not correctly serialize that fact to the metadata for the actual
declaration (`declaresDefaultValue` was used). Therefore, it was
impossible to use that actual declaration without passing all parameter
values in another module, where it was seen as a deserialized descriptor

 #KT-21913
2018-02-08 14:11:57 +01:00
Alexander Udalov
22595acbfd Fix AssertionError on overloading function with property in actual class
#KT-22352 Fixed
2018-02-08 14:11:56 +01:00
Alexander Udalov
56be83cdd3 Improve fake override construction for expected classes
Fake overrides for abstract members from expected classes should become
non-abstract (final, in fact) in non-abstract expected subclasses

 #KT-22031 Fixed
2018-02-08 14:11:55 +01:00
Denis Zharkov
88a23c73c7 Ignore @Nullable annotation for vararg parameter
See the comment in code for clarification

 #KT-19786 Fixed
2018-02-08 13:36:10 +03:00
Denis Zharkov
cfd612e2c1 Minor. Reformat signatureEnhancement.kt 2018-02-08 13:36:10 +03:00
Mikhail Glukhikh
8edf8b9e4d MemberInfoUtils: when no facade is available, use resolutionApi methods 2018-02-08 13:03:41 +03:00
Mikhail Glukhikh
8b8cb0abba KotlinRunConfigurationProducer: get rid of resolve via facade 2018-02-08 13:03:40 +03:00
Denis Zharkov
2ad93a0330 Use extension registry when unpacking serialized type alias
It's funny here that "extension" here means protobuf extensions
while initial issue is about extension function types

 #Fixed KT-22728
2018-02-08 12:39:26 +03:00
Denis Zharkov
fbef21bf17 Remove setting usePreciseJavaTracking in gradle.properties
It's already true by default since 9b28d1a21c
2018-02-08 12:38:19 +03:00
Alexander Udalov
bb013ec2bf Update bootstrap to 1.2.40-dev-165 2018-02-08 10:15:30 +01:00
Mikhael Bogdanov
0954d1ab1b Don't generate hash in sam wrapper class name
#KT-17091 Fixed
2018-02-08 10:11:48 +01:00
Alexander Udalov
ba5cc65792 Rename JvmPackageTable -> JvmModuleProtoBuf, PackageTable -> Module
This protobuf message is going to contain more information about the
module than just the table of package parts
2018-02-07 17:25:43 +01:00
Mikhael Bogdanov
5d6d1bf182 Explicitly specify 'idea.home.path' in android tests 2018-02-07 15:33:54 +01:00
Dmitry Petrov
5678b3d52a Handle nullable case in '==' with smart cast using safe call 2018-02-07 14:30:59 +03:00
Dmitry Petrov
00325ae539 Handle equality checks for 'when' and data classes 2018-02-07 14:30:59 +03:00
Dmitry Petrov
299eb24ca9 Minor: simplify OperatorExpressionGenerator#invokeConversionFunction 2018-02-07 14:30:59 +03:00
Dmitry Petrov
22d59bb709 Minor: include descriptor itself in exception from DependenciesCollector 2018-02-07 14:30:59 +03:00
Dmitry Petrov
4776535205 Implement IR primitives for number comparisons in JVM BE 2018-02-07 14:30:59 +03:00
Dmitry Petrov
bf18186045 More precise implicit cast generation
If an expression 'x' has a definitely non-null type 'T1',
and is used in position with an expected type 'T2',
cast 'x' to 'T2!!' (most common non-null type T*: T* <: T2).
2018-02-07 14:30:59 +03:00
Dmitry Petrov
9137e68d4e Implement special desugaring for numeric comparisons in PSI2IR
This introduces the following IR built-in functions required for proper
implementation of the number comparisons:

- ieee754Equals(T, T): Boolean,
    for each T in {Float?, Double?}

- less(T, T): Boolean
  lessOrEqual(T, T): Boolean
  greater(T, T): Boolean
  greaterOrEqual(T, T): Boolean
    for each T in {Int, Long, Float, Double}
2018-02-07 14:30:59 +03:00
Dmitry Petrov
f4ed4ec9d9 Distinguish numeric comparisons in FE, store info in BindingContext
When we an equality or comparison operator expression
with both arguments "statically known to be of primitive numeric types"
(that is, either inferred type T for an operand is a primitive numeric
type, or a smart cast to a primitive numeric type T is possible in the
corresponding context), comparisons should be performed on primitive
numbers with corresponding widening conversions.

This differs from default 'equals' and 'compareTo' implementations in
case of floating-point numbers: for Float and Double, IEEE 754
comparisons are used instead of total order implemented by j.l.Float and
j.l.Double.

Examples:

fun ex1(x: Double, y: Double) = x < y
-- will use IEEE 754 comparison for Double, because
   both 'x' and 'y' have type Double

fun ex2(x: Double, y: Any) = y is Double && x < y
-- will use IEEE 754 comparison for Double, because
   smart cast to Double is possible for 'y'

fun ex3(x: Comparable<Double>, y: Double) = x is Double && x < y
-- will use IEEE 754 comparison for Double, because
   smart cast to Double is possible for 'x',
   even though corresponding operator convention is resolved to
   'Comparable<Double>#compareTo(Double)' (which would use total order)

fun ex4(x: Any, y: Any) = x is Double && y is Int && x < y
-- will use IEEE 754 comparison for Double with 'y' promoted to Double,
   because smart cast to Double is possible for 'x',
   and smart cast to Int is possible for 'y',
   and least common primitive numeric type for Double and Int is Double.
2018-02-07 14:30:59 +03:00
Alexey Sedunov
930e51e30e Misc: Update test data due to changes in 'actual' constructor checking
Now actual class constructor is considered an implementation
only if it has 'actual' modifier itself
2018-02-07 14:13:16 +03:00
Nicolay Mitropolsky
91a4bbed2e Uast: KotlinUNestedAnnotation with light annotation (IDEA-185890) 2018-02-07 10:17:40 +03:00
Nicolay Mitropolsky
cb05baa02b LightAnnotations: wrapping nested annotations with KtLightAnnotationForSourceEntry 2018-02-07 10:17:40 +03:00
Nicolay Mitropolsky
48ea52def1 Uast: KotlinUNestedAnnotation for processing nested annotations (IDEA-185890) 2018-02-07 10:17:40 +03:00
Yan Zhulanow
1f81c0cdfe Kapt: Fix compilation errors when the referenced class has '$' in the beginning of its name (KT-22493) 2018-02-06 22:16:01 +03:00
Yan Zhulanow
5fc9c5671c Kapt: Escape nested comments in doc comments (KT-22469) 2018-02-06 22:16:01 +03:00
Yan Zhulanow
abda4bfb57 Kapt: Remove comments inside enum values (KT-22350) 2018-02-06 22:16:01 +03:00
Yan Zhulanow
a171874b2f Fix "Illegal Android Identifier" inspection reports non-instrumentation unit tests (KT-22168) 2018-02-06 22:16:00 +03:00
Yan Zhulanow
4e8969e1c2 Kapt: Fix array of anonymous type handling (KT-22468) 2018-02-06 22:16:00 +03:00
Yan Zhulanow
144ec9285f Minor: Get rid of duplicating option descriptions in Kapt plugin 2018-02-06 22:16:00 +03:00
Yan Zhulanow
e38a41d2f2 Evaluate: Fix compiling evaluator issues led to improper expression caching
1. Do not save a ClassLoader reference inside the context, as we don't use it anyway after evaluation.
This is to avoid custom ClassLoader nesting.

2. Do not use 'findClass()' as it caches the loaded classes and always returns the first evaluated class if it's in cache.
2018-02-06 22:16:00 +03:00
Yan Zhulanow
da74bcbcc0 Evaluate: Support dex in newer Android build tools 2018-02-06 22:16:00 +03:00
Yan Zhulanow
7c7c929b0e Kapt: Disable location mapping by default, allow to enable it manually 2018-02-06 22:16:00 +03:00
Yan Zhulanow
5668a7af92 Kapt: Replace original Javac diagnostic messages with those with Kotlin location mapped
There is no Messages dialog in newer versions of IDEA/Android Studio in which the error messages were mapped before. The new Build window shows only the original locations, so now we need to replace Java file diagnostics with ones mapped to Kotlin source files.

The side effect is that diagnostics on the same locations are automatically merged.
2018-02-06 22:16:00 +03:00
Yan Zhulanow
b0e97de8a8 Kapt: Move line metadata to .kaptMetadata external files (KT-22386)
Placing location table inside .java file triggers annotation processor to run on each line table modification (even when the stub declarations themselves are the same). So we move it to the separate file.
2018-02-06 22:16:00 +03:00
Yan Zhulanow
bf9eed931b Parcelable: Fix 'Simple' test (new boolean serializer) 2018-02-06 22:15:59 +03:00
Yan Zhulanow
145ddf3b1f Parcelable: Add CREATOR field (and other generated declarations) in light classes (KT-19300, KT-19853) 2018-02-06 22:15:59 +03:00
Ilya Gorbunov
90dff281ba Actualize ReadMe files
- Actualize build requirements and steps
- Extract Gradle plugin readme to the corresponding folder
- Rewrite Libraries and Maven Tools readme

#KT-20995 Fixed
2018-02-06 21:17:58 +03:00
Ilya Gorbunov
aa74f163f7 Minor: improve table formatting 2018-02-06 21:17:57 +03:00
Ilmir Usmanov
ad385f42a9 Fix continuaion retrieval on generated coroutineContext intrinsic code
Use fake continuation instead on real one in JVM BE.
Pass continuation parameter to closure generator in JS BE.

 #KT-22577: Fixed
2018-02-06 21:14:37 +03:00
Sergey Igushkin
e8cd8b566e Delay kapt dependencies resolution from configuration phase
Store kapt configurations instead of classpath files in the tasks
Delay wrapping kapt subplugin options to task execution (when the
classpath can be safely resovled)

Issue #KT-18821 Fixed
2018-02-06 21:01:57 +03:00
Nicolay Mitropolsky
8ac95b54a2 Uast: support for Kotlin array literals 2018-02-06 17:53:17 +03:00
Alexey Sedunov
358bc62fc1 Minor: Regenerate tests 2018-02-06 17:06:03 +03:00
Alexander Udalov
12e31cedfd Write lambdaClassOriginName for lambdas copied during inline
Similarly to anonymousObjectOriginName which is written for copied
anonymous objects

 #KT-21320
2018-02-06 13:05:22 +01:00
Alexander Udalov
6da3f37fc3 Write anonymousObjectOriginName for classes copied during inline
#KT-21320
2018-02-06 13:05:22 +01:00
Mikhail Glukhikh
81122ed236 Fix a pack of broken IDE action tests
Related to KT-20281.
For Java resolve we can use also resolve with 'null' platform,
which is possible situation in tests.
2018-02-06 15:02:38 +03:00
Alexander Podkhalyuzin
09d167eafb Ask just extensions, not in some area #KT-21978 Fixed 2018-02-06 14:58:18 +03:00
Alexey Sedunov
c602c51642 Slicer: Sort tree nodes to produce stable test data 2018-02-06 14:23:20 +03:00
Alexey Sedunov
adca8eb7f1 Rename: Substitute synthetic expression parent before analysis
This fixes rename conflicts test
2018-02-06 14:23:20 +03:00
Alexey Sedunov
049439ce1d Rename: Update test data (follow-up for unnecessary reformatting fix) 2018-02-06 14:23:20 +03:00
Alexey Sedunov
d51da8bafd Misc: Fix Android SDK path in Gradle import tests 2018-02-06 14:23:19 +03:00
Mikhail Glukhikh
7995ae05c5 Introduce inspection for redundant not-null extension receiver of inline
Related to KT-22303
2018-02-06 14:17:01 +03:00
Mikhael Bogdanov
ad48099ca6 Move java 8 tests to java8 folder 2018-02-06 10:32:14 +01:00
Dmitry Savvinov
7e512ba018 Enable contracts in the 'compiler' module 2018-02-06 10:58:47 +03:00
Mikhail Glukhikh
19beaf57a7 JVM facade: for Java resolve, always use JvmPlatform resolver
So #KT-20281 Fixed
2018-02-06 09:50:10 +03:00
Mikhail Glukhikh
c90056f8c4 Introduce inspection for nullable extension receiver of inline function
So #KT-22303 Fixed
2018-02-06 09:50:09 +03:00
Mikhail Glukhikh
08d3f20e09 Reformat: AbstractMultiModuleHighlightingTest 2018-02-06 09:50:08 +03:00
Mikhail Glukhikh
3ba6b70f73 Show expect / actual gutter even for incomplete compatibility
So #KT-18445 Fixed
So #KT-21115 Fixed
2018-02-06 09:50:00 +03:00
Mikaël Peltier
a2a3043607 KT-18731 Use reference equality to compare enums
Fix of https://youtrack.jetbrains.com/issue/KT-18731
2018-02-05 18:34:44 +03:00
Pavel V. Talanov
bc54c95bc3 JavaResolveExtension: create facade by original element
Fixes semantic difference erroneously introduced in c030a047aa
 #KT-22593 Fixed
2018-02-05 16:26:47 +01:00
Pavel V. Talanov
7b8d501670 Dsl highlighting: Provide gutter for marker annotation definition
Allows to jump to corresponding page in 'color and font' settings
2018-02-05 16:22:23 +01:00
Pavel V. Talanov
0d5d826bc5 Dsl highlighting: reasonable default colors 2018-02-05 16:22:22 +01:00
Pavel V. Talanov
b9c832a952 Implement custom highlighting for dsls
A declaration is considered a part of dsl if it's marked with
    a marker annotation (which is in turn must be marked as @DslMarker)
Highlighting attributes are then chosen randomly from a preset list
    based on marker annotation fqname
2018-02-05 16:22:20 +01:00
Pavel V. Talanov
5ab00ee9f7 HighlighterExtension can provide custom highlighting for calls 2018-02-05 16:22:19 +01:00
Alexander Udalov
91a9038b2f Regenerate Gradle options
After f9e195351a
2018-02-05 16:17:30 +01:00
kenji tomita
1875d129ea Inspection to get rid of unnecessary ticks in references #KT-18124 Fixed 2018-02-05 17:31:08 +03:00
Alexander Udalov
9e500831dd Allow expect/actual annotation constructors to have default values
When a parameter has a default argument value both in the expected
annotation and in the actual annotation, they must be equal. This check
has been only implemented for the case when actual annotation is Kotlin
source code, and NOT a Java class coming from an actual typealias. The
latter case would require a bit more work in passing a platform-specific
annotation-value-reading component to ExpectedActualDeclarationChecker,
and is therefore postponed.

For now, Java annotations that are visible through actual type aliases
cannot have default argument values for parameters which already have
default values in the expected annotation declaration

 #KT-22703 Fixed
 #KT-22704 Open
2018-02-05 14:13:32 +01:00
Alexander Udalov
71fe8c02a3 Fix rendering of type aliases
- render 'actual' modifier if it's present
- do not render a space after type parameter list
2018-02-05 13:38:06 +01:00
Zalim Bashorov
e0245a9dc7 KJS: support default arguments for expected declarations 2018-02-05 13:38:06 +01:00
Alexander Udalov
db4ce703a6 Support default arguments for expected declarations
#KT-21913 Fixed
2018-02-05 13:38:05 +01:00
Alexander Udalov
d356f52873 JS: remove MULTIPLATFORM directive from box tests
Move all sources into one module and use "!LANGUAGE:
+MultiPlatformProjects" instead
2018-02-05 13:38:05 +01:00
Alexander Udalov
d465f5fd8e Extract ExpectedActualResolver out of ExpectedActualDeclarationChecker
The point is that it's placed in module 'resolution' where it can be
accessed for example in ArgumentsToParametersMapper to load default
argument values from expected function
2018-02-05 13:38:05 +01:00
Alexander Udalov
ea30388ae5 Minor, use another way to check that descriptor is from sources
This way this function can be moved to module 'resolution', where
DescriptorToSourceUtils is not available
2018-02-05 13:38:04 +01:00
Alexander Udalov
ac5444ef7c Add declaresOrInheritsDefaultValue, move hasDefaultValue to 'resolution'
'hasDefaultValue' needs to be adapted to support locating default values
in 'expect' functions, and this is not possible in module 'descriptors',
where it was originally declared. Therefore, move it to module
'resolution' and copy its current logic to a separate function
'declaresOrInheritsDefaultValue' which is used in 5 places.
'hasDefaultValue' itself is updated in subsequent commits.

Besides changing imports, also use a simpler declaresDefaultValue in
some places, which does not include default values inherited from
supertypes: this is OK for constructors, and in LazyJavaClassMemberScope
for functions from built-ins which do not have default argument values
at all
2018-02-05 13:38:04 +01:00
Alexander Udalov
7eb66f2579 Minor, support 'expect'-only files in codegen tests 2018-02-05 13:38:04 +01:00
Alexander Udalov
f75b774d80 Do not report unused parameters for actual constructors
Extract common part for functions and constructors in
processUnusedParameter
2018-02-05 13:38:04 +01:00
Alexander Udalov
1bdec829ea Treat constructors as actual only if the 'actual' modifier is present
Exactly as this is done for functions in
FunctionDescriptorResolver.initializeFunctionDescriptorAndExplicitReturnType

 #KT-21906 Fixed
2018-02-05 13:38:04 +01:00
Alexander Udalov
f198a28276 Fix type parameter bound check in expect-actual checker
Also make TypeParameterUpperBounds a "strong" incompatibility, meaning
that non-actual members from platform module are _not_ going to be
matched to the expected members if this incompatibility exists between
them, and therefore NO_ACTUAL_FOR_EXPECT will be reported on the
expected declaration, instead of ACTUAL_MISSING on the platform member.
This is needed because the difference in type parameter upper bounds can
have effect on the function signature on the platform (e.g. on JVM,
Array<T> -> T[], but Array<T> -> Comparable[] if T : Comparable<T>), and
it would be incorrect to report ACTUAL_MISSING on the member that has
nothing to do with the expected declaration that happens to coincide
with it in everything except type parameter bounds

 #KT-21864 Fixed
2018-02-05 13:38:04 +01:00
Alexander Udalov
8c6b140865 Simplify diagnostic message for ACTUAL_MISSING
#KT-21939 Fixed
2018-02-05 13:38:03 +01:00
Mikhael Bogdanov
1530fbee1b Fix ir test execution 2018-02-05 12:07:36 +01:00
Mikhail Zarechenskiy
5dacfae793 Support calling inline functions inside inline classes 2018-02-05 12:07:41 +03:00
Mikhail Zarechenskiy
2536eb4d45 Generate argument expression instead of constructor for inline classes 2018-02-05 12:07:40 +03:00
Mikhail Zarechenskiy
928a342ace Initial version of codegen for inline classes 2018-02-05 12:07:40 +03:00
Mikhail Zarechenskiy
fbc02dee58 Refactoring: extract method to generate suspend method out 2018-02-05 12:07:40 +03:00
Mikhail Zarechenskiy
d1049e5553 Refine type mapping for nullable inline class types 2018-02-05 12:07:39 +03:00
Mikhail Zarechenskiy
d5400f11a3 Basic inline class mapping to the underlying representation 2018-02-05 12:07:39 +03:00
Mikhail Zarechenskiy
4b4525ec17 Support !LANGUAGE directive in signature tests 2018-02-05 12:07:39 +03:00
Mikhail Zarechenskiy
d1a8ec06dd Reformat typeSignatureMapping.kt file 2018-02-05 12:07:38 +03:00
Mikhail Zarechenskiy
a463fb1d5e Add basic declaration checker for inline classes 2018-02-05 12:07:38 +03:00
Mikhail Zarechenskiy
915455ebe9 Introduce InlineClasses language feature
Allow to write `inline` modifier in front of class declaration
2018-02-05 12:07:38 +03:00
Denis Zharkov
9b28d1a21c Make precise java classes tracking in Gradle enabled by default
#KT-22192 Fixed
2018-02-05 11:54:53 +03:00
Natalia Selezneva
74a9881e9d Fix "Virtual pointer hasn't been disposed" exception in tests. Add sdk to ProjectJdkTable. 2018-02-05 09:46:57 +03:00
Nikolay Krasko
f05e926670 Update idea to 173.3.4 (173.4548.28) 2018-02-03 00:15:45 +03:00
Nikolay Krasko
5a9ea89e9c Collect statistics about used Kotlin formatter 2018-02-03 00:15:45 +03:00
Nikolay Krasko
d1e6a61197 Fix testInGlobalPropertyWithGetter test in 173 branch
Workaround for IDEA-185462. It was introduced in 173 idea and
fixed in 181.
2018-02-03 00:15:45 +03:00
Vyacheslav Gerasimov
5b0d908d85 Add log4j & jdom to tests-common testCompile
Fixes NCDFEs in IrBlackBoxCodegenTestGenerated
2018-02-02 19:54:27 +03:00
Ilya Gorbunov
c06204d0d4 Remove obsolete test classpath helpers 2018-02-02 17:59:29 +03:00
Ilya Gorbunov
381344141f Drop StdlibTest from compiler tests
Reason: stdlib built with the fresh compiler is going to be tested in Compiler Bootstrap Test configuration.
2018-02-02 17:59:27 +03:00
Ilya Gorbunov
8f78d73cd7 Use fqnames for SortedSet and TreeSet from java.util
Remove internal typealiases for SortedSet and TreeSet
2018-02-02 17:56:56 +03:00
Ilya Gorbunov
b456c52902 Import kotlin.coroutines.experimental for generated sequences on all platforms
This will add import to common generated sources
2018-02-02 17:56:56 +03:00
Natalia Selezneva
cdbe0b8fa9 Scratch tests: delete scratch file after creation 2018-02-02 17:44:42 +03:00
Natalia Selezneva
6ca1b10f41 Use correct logger for debugging scratch files 2018-02-02 17:44:35 +03:00
Natalia Selezneva
847990a4f6 Tests: call super.teardown from finally block in android tests 2018-02-02 17:44:28 +03:00
Vyacheslav Gerasimov
36167c7b8f Add annotations to lint plugin dependencies
Fixes `warning: unknown enum constant` during lint plugin build
2018-02-02 16:58:43 +03:00
Alexey Tsvetkov
6c4f3df851 Remove intellij-core usages from kotlin-gradle-plugin-integration-tests
We can use only relocated intellij-core from kotlin-compiler-embeddable.
Non-source usages do not resolve in IDE (which also breaks debugger).
2018-02-02 15:40:11 +03:00
Alexey Tsvetkov
8f144fc57a Fix red code in IDE in kotlin-gradle-plugin-integration-tests 2018-02-02 15:40:10 +03:00
Alexey Tsvetkov
7c329b59b6 Shade test jars from compiler used in Gradle tests
This fixes `VerifyError` for all integration tests calling
`KotlinTestUtils.findAndroidSdk()`.
The exception was thrown because `:kotlin-gradle-plugin-integration-tests`
was depending on both relocated intellij-core (from kotlin-compiler-embeddable)
and non-relocated intellij-core (transitevely through tests jars from compiler).

A call to `findAndroidSdk()` was triggering classloading
for `KotlinTestUtils` which had bytecode references to
`org.jetbrains.kotlin.idea.KotlinLanguage` loaded from the embeddable compiler
and to `com.intellij.lang.Language` loaded from non-relocated intellij-core.

`KotlinLanguage` from the embeddable compiler was a subclass of relocated
`org.jetbrains.kotlin.com.intellij.lang.Language` thus it was not
assignable to `com.intellij.lang.Language` causing `VerifyError`.

The solution is to create relocated jar combining the necessary test jars
from the compiler.
2018-02-02 15:40:10 +03:00
Alexey Tsvetkov
7cba035f80 Ensure tasks using android sdk or android jar have proper dependencies
A test task, that uses android dependency but does not depend on
a corresponding configuration, would fail when it was run after
'clean' task.
I've extracted 'useAndroidSdk', 'useAndroidJar' extensions
making it harder for a developer to forget to set up task dependencies.
2018-02-02 15:40:10 +03:00
Anton Bannykh
3ead464671 JS: fix callable reference with implicit extension receiver (KT-22638 fixed) 2018-02-02 14:34:34 +03:00
Alexander Udalov
f4e2102787 Minor, remove extra empty lines from -X arguments help 2018-02-01 19:38:32 +01:00
Alexander Udalov
5338df6960 Do not depend on Shadow plugin in subprojects
Since buildSrc depends on the Shadow plugin, it's already in the
classpath of all build scripts
2018-02-01 19:38:31 +01:00
Alexander Udalov
ad0cd7c176 Use the same JVM args for buildSrc as for main project 2018-02-01 19:38:30 +01:00
Alexander Udalov
f9e195351a Minor, rephrase usage help for -no-stdlib/-no-reflect compiler arguments 2018-02-01 19:38:30 +01:00
Alexander Udalov
28c77bfb01 Fix kotlin.annotation.Target's kdoc
The original sentence was incorrect because it did not exclude type
aliases
2018-02-01 19:27:43 +01:00
Alexander Udalov
616ba1fbe4 Minor, remove obsolete JDK 9 EA version guard 2018-02-01 19:27:43 +01:00
Alexander Udalov
efd92547ef Remove unused description file 2018-02-01 19:26:39 +01:00
Vyacheslav Gerasimov
dd9ea0bc87 Remove unnecessary dependencies on :prepare:idea-plugin:idea-plugin 2018-02-01 18:11:25 +03:00
Vyacheslav Gerasimov
ec511f7a78 Use dependsOn for dependencies on dist & ideaPlugin tasks
instead `shouldRunAfter`
2018-02-01 18:11:25 +03:00
Vyacheslav Gerasimov
a595fdd312 Make root dist & ideaPlugin depend on all corresponding tasks in child projects 2018-02-01 18:11:25 +03:00
Alexey Tsvetkov
74e47e024f Replace testCompile with testRuntime dependencies
Compile dependencies broke incremental compilation
because packed compiler was present in idea
test compile classpath (we do not track changes in
fat jars)
2018-02-01 17:39:55 +03:00
Alexey Tsvetkov
4ee34fc355 Avoid building kotlin-compiler-embeddable before running idea tests
kotlin-compiler-embeddable is a runtimeOnly dependency of
kotlin-compiler-runner, so embeddable jar was built
before idea tests execution.
Building the jar takes ~20s on my machine, which is a waste
of time since idea does not use embeddable compiler.
2018-02-01 17:39:55 +03:00
Alexey Tsvetkov
29d2679e8d Do not configure dist task for every published module
This change avoids compiling kotlin-compiler-embeddable,
kotlin-gradle-plugin, and other gradle plugins,
when running `./gradlew dist`
2018-02-01 17:39:55 +03:00
Alexey Tsvetkov
d5ee77eb07 Avoid exception when listing configuration contents 2018-02-01 17:39:54 +03:00
Alexey Sedunov
f35af11423 Rename: Make improvements for "by-convention" calls
- Convert between conventions call for 'get' and 'invoke'
- Drop 'operator' when converting 'get'/'invoke' to something other than
  'invoke'/'get' respectively

 #KT-12365 Fixed
2018-02-01 15:41:09 +03:00
Alexey Sedunov
caeb594e09 Rename: Replace name identifiers via AST to prevent unwanted reformatting
#KT-8563 Fixed
2018-02-01 15:41:06 +03:00
Alexey Sedunov
58bf42c1dd Rename: Support KtTypeAlias in RenameKotlinClassProcessor
#KT-21719 Fixed
2018-02-01 15:41:04 +03:00
Alexey Sedunov
90392a8d8a Loop to Call Chain: Do not generate lambda with double wrapping block
#KT-22476 Fixed
2018-02-01 15:41:03 +03:00
Alexey Sedunov
8c9c1609c0 Move Class to Top Leve: Suggest file name based on new class name
#KT-17977 Fixed
2018-02-01 15:41:01 +03:00
Alexey Sedunov
4d52bf04fe Kotlin Ultimate: Support NodeJS CLI run configuration
#KT-16710 Fixed
2018-02-01 15:35:35 +03:00
Alexey Sedunov
1f7fab837f Gradle: Import production output path for JavaScript modules 2018-02-01 15:35:34 +03:00
Alexey Sedunov
80887a84ca Kotlin Ultimate: Add "Build" action to JS run configurations
#KT-20522 Fixed
2018-02-01 15:35:34 +03:00
Ilmir Usmanov
8ffb205f1c Reformat coroutineContext related code 2018-02-01 13:18:43 +03:00
Ilmir Usmanov
18c03f94f8 Move coroutineContext to correct package
from kotlin.coroutines.experimental.instrinsics to kotlin.coroutines.experimental

 #KT-22400
2018-02-01 13:18:32 +03:00
Natalia Selezneva
efabf80d37 Scratch: do not store psiFile in ScratchFile 2018-02-01 11:07:54 +03:00
Natalia Selezneva
c32a7dd852 Scratch: add logging 2018-02-01 10:21:55 +03:00
Natalia Selezneva
2140b9457d Minor: fix formatting 2018-02-01 10:21:55 +03:00
Natalia Selezneva
ac7beb41f3 Rearrange checkboxes in scratch panel 2018-02-01 10:21:55 +03:00
Natalia Selezneva
d6d2d4271b Scratch: restore information about module in scratch panel after ide restart 2018-02-01 10:21:55 +03:00
Natalia Selezneva
0a274a7e61 Align output in scratch file 2018-02-01 10:21:55 +03:00
Natalia Selezneva
8e98f703ac Change colors for scratch output 2018-02-01 10:21:55 +03:00
Natalia Selezneva
dc71ac09b2 Scratch: do not report errors from generated file to editor 2018-02-01 10:21:55 +03:00
Natalia Selezneva
ad90095dc7 Show multple errors in scratch toolwindow 2018-02-01 10:21:55 +03:00
Natalia Selezneva
d7c6dacc86 Temporary workaround: rename scratch files with kt extension to kts before additional api will be added in IDEA 2018-02-01 10:21:55 +03:00
Natalia Selezneva
c4971de7c1 Scratch: add Make before Run checkbox 2018-02-01 10:21:55 +03:00
Natalia Selezneva
a96cf147fc Scratch: add multifile tests 2018-02-01 10:21:55 +03:00
Natalia Selezneva
23ef50203e Use correct check for isRepl checkbox in scratch panel 2018-02-01 10:21:55 +03:00
Natalia Selezneva
654890fac3 Scratch: implement compiling executor 2018-02-01 10:21:55 +03:00
Natalia Selezneva
dda0b38fb9 Scratch: tests for repl execution 2018-02-01 10:21:55 +03:00
Natalia Selezneva
1a84c05db2 Scratch: implement output handlers for displaying execution results 2018-02-01 10:21:55 +03:00
Natalia Selezneva
01e62c9bdb Scratch: implement run action with repl 2018-02-01 10:21:55 +03:00
Natalia Selezneva
2ccf4b7d7f Initial support for scratch files 2018-02-01 10:21:55 +03:00
Alexey Sedunov
82a997e0a2 Kotlin Ultimate: Support Jest run configurations for Kotlin sources
#KT-21531 Fixed
2018-02-01 04:40:31 +03:00
Alexey Sedunov
2c0af794ea JS: Drop obsolete "Kotlin (JavaScript)" run configuration
#KT-21312 Fixed
2018-02-01 04:40:30 +03:00
Vyacheslav Gerasimov
bb6ab6309a Fix runIdeTask dependencies for communiti and ultimate 2018-01-31 21:36:03 +03:00
Vyacheslav Gerasimov
3e67bfd9b3 Exclude Kotlin plugin when unzipping intellij sdk 2018-01-31 20:10:25 +03:00
Vyacheslav Gerasimov
e20b6738f6 Extract removing bundled Kotlin plugin to separate task 2018-01-31 18:53:59 +03:00
Vyacheslav Gerasimov
59effef423 Delete bundled Kotlin plugin
Idea fails to start with two Kotlin plugins
2018-01-31 17:49:52 +03:00
Vyacheslav Gerasimov
527bdef447 Fix runIdeTask plugin path 2018-01-31 17:49:52 +03:00
Mikhail Glukhikh
babcea9edc Fix completion test (companion object is allowed in annotation scope) 2018-01-31 14:44:33 +03:00
Nicolay Mitropolsky
cf6e21daad Light annotations made strictly non-physical (KT-22565) 2018-01-31 14:31:35 +03:00
Mikhail Glukhikh
00ceac54fc Fix "create enum constant" test (create type alias is no longer here) 2018-01-31 13:56:07 +03:00
Nikolay Krasko
209c66ca1b Set better defaults on Imports tab in Code Style -> Kotlin (KT-22575)
"Top level symbols" and "Java Statics and Enum Members" are always
returned to 2 after saving to not-number option

 #KT-22575 Fixed
2018-01-31 13:27:30 +03:00
Nikolay Krasko
607fa30c5a Can't add import for using with '*' in settings (KT-22570)
#KT-22570 Fixed
2018-01-31 13:27:29 +03:00
Nikolay Krasko
894db730b2 Fix modification check for Kotlin import settings (KT-22557)
#KT-22557 Fixed
2018-01-31 13:27:29 +03:00
Nikolay Krasko
c0aa2c5469 Lost IF_RPAREN_ON_NEW_LINE settings from Kotlin code style 2018-01-31 13:27:29 +03:00
Nikolay Krasko
17da150bc2 Add ability to customize and save IF_RPAREN_ON_NEW_LINE setting 2018-01-31 13:27:29 +03:00
Ilya Chernikov
d70b9c1d76 Detect new activity after delayed shutdown correctly
fixes #KT-22549, test

(cherry picked from commit 50f34db)
2018-01-31 10:25:29 +01:00
Mikhail Glukhikh
98b0f91d84 Fix parcelize delete creator field test (companion is retained now) 2018-01-31 11:48:03 +03:00
Mikhail Glukhikh
294dcf36e8 Fix J2K 'testAnnotationInterface3' (annotation diagnostic changed) 2018-01-31 11:24:40 +03:00
Toshiaki Kameyama
677b05cc8c KT-22167 "Add annotation target" quick fix does nothing and disappears from menu 2018-01-30 20:25:08 +03:00
Mikhail Glukhikh
6fbf5a8904 Reverts commit 2472966
(Remove unused function parameter: minor improvement)
Transformation was not equivalent due to change signature in between
This revert fixes broken quick-fix tests (remove parameter based)
2018-01-30 18:43:25 +03:00
Vyacheslav Gerasimov
d0b232c172 Update readme part about dependencies 2018-01-30 17:06:18 +03:00
Vyacheslav Gerasimov
68b5dc756c Remove intellij-core from testRuntime if full idea is already there
Looks like it makes tests flacky
2018-01-30 17:06:18 +03:00
Vyacheslav Gerasimov
29caa00f23 Add asm-all to jps-plugin dependencies 2018-01-30 17:06:18 +03:00
Vyacheslav Gerasimov
bc86f40fd8 Update kotlinx-coroutines version to 0.20 2018-01-30 17:06:18 +03:00
Vyacheslav Gerasimov
89a07ded1c Extract versions and remove unnecessary '.jar' extensions 2018-01-30 17:06:18 +03:00
Vyacheslav Gerasimov
3e34b95610 Use KotlinTestUtils.findAndroidSdk() in BuildCacheRelocationIT 2018-01-30 17:06:18 +03:00
Vyacheslav Gerasimov
052be93c97 Add some logging to intellij-sdk build script 2018-01-30 17:06:17 +03:00
Vyacheslav Gerasimov
558a2cb8a8 Explicit intellijUltimateEnabled should override teamcity build 2018-01-30 17:06:17 +03:00
Vyacheslav Gerasimov
3d1e0c3b39 Add dependency versions for 171, 181, AS 2018-01-30 17:06:17 +03:00
Vyacheslav Gerasimov
ca6889b4c6 Fix build script for kotlin-gradle-subplugin-example 2018-01-30 17:06:17 +03:00
Vyacheslav Gerasimov
07b191f460 Update dependency versions after migration to 173 2018-01-30 17:06:17 +03:00
Ilya Chernikov
8ab121b373 Exclude new dependencies locations from CodeConformanceTest 2018-01-30 17:06:17 +03:00
Ilya Chernikov
555e9674b2 Fix dependencies to the cross-project tasks 2018-01-30 17:06:17 +03:00
Ilya Chernikov
434bbafe58 Implement runners without intellij plugin, share common part 2018-01-30 17:06:16 +03:00
Ilya Chernikov
0a95e7b20f Fix dependencies and artifacts contents after review 2018-01-30 17:06:16 +03:00
Ilya Chernikov
058ef31d7a Fixes after review 2018-01-30 17:06:16 +03:00
Ilya Chernikov
14e586d5a5 Refactor android sdk preparation project after review 2018-01-30 17:06:16 +03:00
Dmitry Jemerov
e83845ea72 Build changes to support Android Studio 2018-01-30 17:06:16 +03:00
Dmitry Jemerov
b2ca302bf7 Support downloading Android Studio 2018-01-30 17:06:16 +03:00
Dmitry Jemerov
f4feb71ad2 Extract repeated versions to a single location 2018-01-30 17:06:16 +03:00
Dmitry Jemerov
df17f20ec7 Fix project sync when intelliUltimateEnabled is not set 2018-01-30 17:06:16 +03:00
Dmitry Jemerov
a58a6290cc Fix typo 2018-01-30 17:06:15 +03:00
Ilya Chernikov
5dc094d290 Implement correct and fast ultimate/community sdks handling 2018-01-30 17:06:15 +03:00
Ilya Chernikov
6f1e6f1f1b Fix tests after rebasing and messing with the dependencies 2018-01-30 17:06:15 +03:00
Ilya Chernikov
246f73c879 Cleanup unused ant-related bits and script constants 2018-01-30 17:06:15 +03:00
Ilya Chernikov
0c35e79283 Fix idea home path usages 2018-01-30 17:06:15 +03:00
Ilya Chernikov
2dc4769c0a Fixes after rebase 2018-01-30 17:06:15 +03:00
Ilya Chernikov
172a29ba04 Implement NodeJS plugin downloading 2018-01-30 17:06:15 +03:00
Ilya Chernikov
48cbcbc496 Switch jsr305 usages to the maven version
since it is not available in the intellij ultimate SDK
2018-01-30 17:06:14 +03:00
Ilya Chernikov
acc84d2524 Rollback incorrect tests fix 2018-01-30 17:06:14 +03:00
Ilya Chernikov
7218bd536c Implement single idea sdk scheme, some refactoring 2018-01-30 17:06:14 +03:00
Ilya Chernikov
5f7c783bb2 Stop using com.intellij.openapi.components.service functions:
they are getting obfuscated in the ultimate SDK, which prevents us
from using ultimate sdk for all modules.
Could probably be rolled back after fixing KT-18563
2018-01-30 17:06:14 +03:00
Ilya Chernikov
d38b1c361a Add ultimate sdk 2018-01-30 17:06:14 +03:00
Ilya Chernikov
1219572aa0 Extract intellij params to buildSrc's build script 2018-01-30 17:06:14 +03:00
Ilya Chernikov
05f0978865 Fix after review 2018-01-30 17:06:14 +03:00
Ilya Chernikov
fbbece3c86 Fix publishing problem 2018-01-30 17:06:13 +03:00
Ilya Chernikov
7e21573cf4 Convert the rest of the project to intellij repo prepared in buildSrc 2018-01-30 17:06:13 +03:00
Ilya Chernikov
e23b1529b3 Convert intellij usages in the groovy build scripts 2018-01-30 17:06:13 +03:00
Ilya Chernikov
4eb557724c Convert compiler projects to the new intellij deps 2018-01-30 17:06:13 +03:00
Ilya Chernikov
a418a3ac49 Renaming for easier conversion, some more manual conversion 2018-01-30 17:06:13 +03:00
Ilya Chernikov
6f21c36d68 Switch first project to the new custom dependencies schema 2018-01-30 17:06:13 +03:00
Ilya Chernikov
47507ad694 Switch all usages of dx.jar to the new mechanism, cleanup and refactoring 2018-01-30 17:06:13 +03:00
Ilya Chernikov
eabbebd458 Prepare intellij sdk deps in buildSrc 2018-01-30 17:06:13 +03:00
Yan Zhulanow
59c8f33450 Fix jps android test 2018-01-30 17:06:12 +03:00
Ilya Chernikov
46be5e25be Rewrite android sdk dependencies to avoid config-time tasks execution 2018-01-30 17:06:12 +03:00
Ilya Chernikov
febab82c7e Switch jps android test to platform 26 2018-01-30 17:06:12 +03:00
Ilya Chernikov
7120fe190a Fix overrides of the findViewById in android tests for platform 26 2018-01-30 17:06:12 +03:00
Ilya Chernikov
587f76251e Fix os-specific downloads in android sdk 2018-01-30 17:06:12 +03:00
Ilya Chernikov
e8494a5371 Fix uast-kotlin dependencies and tests 2018-01-30 17:06:12 +03:00
Ilya Chernikov
a6f8db5d02 Fix script-util tests 2018-01-30 17:06:12 +03:00
Ilya Gorbunov
7710cc455c Refactor helper tasks for TeamCity builds
Invoke them properly from TeamCityBuild.xml acting as a temporary adapter.
Remove obsolete tasks from TeamCityBuild.xml.

Patch plugin version with regex replacement in plugin.xml.
2018-01-30 17:06:12 +03:00
Ilya Chernikov
b5db681e06 Switch tests to android sdk 26 2018-01-30 17:06:11 +03:00
Ilya Chernikov
c153a386ab Fix tests 2018-01-30 17:06:11 +03:00
Ilya Chernikov
a4f28cd94f Make all dependencies to idea sdk intransitive 2018-01-30 17:06:11 +03:00
Ilya Chernikov
e76cd802d8 Fix jps tests 2018-01-30 17:06:11 +03:00
Ilya Chernikov
b2926a9322 Add classpath printing tasks to all relevant projects 2018-01-30 17:06:11 +03:00
Ilya Chernikov
0b63e11ea8 Replace android sdk dependencies with custom project build, cleanup update_dependencies.xml 2018-01-30 17:06:11 +03:00
Ilya Chernikov
98204aa2d3 Move jflex download out from update_dependencies, add lexer (ant) tasks to frontend project 2018-01-30 17:06:11 +03:00
Ilya Chernikov
90e5558704 Re-add node.js tests, switch to direct usage of node_utils.xml, remove node parts from update_dependencies.xml 2018-01-30 17:06:10 +03:00
Ilya Chernikov
7f86fb9343 Switch to idea NodeJS plugin usage via intellij gradle plugin 2018-01-30 17:06:10 +03:00
Ilya Chernikov
69787bd0d1 Switch spring usages to regular dependency 2018-01-30 17:06:10 +03:00
Ilya Chernikov
d301938d23 Rewrite TeamCityBuild.xml tasks in gradle, finally drop build.xml files
also:
  proxying previous tasks from TeamCityBuild.xml to gradle,
  cleaning update_dependencies.xml from ant dependencies
2018-01-30 17:06:10 +03:00
Ilya Chernikov
12f0f019da Switch robolectric usages to regular dependency 2018-01-30 17:06:10 +03:00
Ilya Chernikov
361d8536ac Switch ant usages to regular dependency 2018-01-30 17:06:10 +03:00
Ilya Chernikov
486c3a2aff Do not depende on the ideaSdk location in integration tests
assume that tests are always run from the project's root
2018-01-30 17:06:10 +03:00
Ilya Chernikov
f96153693e Make tools.jar search non-throwing 2018-01-30 17:06:09 +03:00
Ilya Chernikov
80ad969f7b Switch markdown usages to regular (teamcity) dependency 2018-01-30 17:06:09 +03:00
Ilya Chernikov
78d2c655d5 Switch native-platform usages to regular dependency 2018-01-30 17:06:09 +03:00
Ilya Chernikov
4a47fb3ffb Switch protobuf usages to regular dependency 2018-01-30 17:06:09 +03:00
Ilya Chernikov
a952d797f1 Switch org.json:json usages to regular dependency 2018-01-30 17:06:09 +03:00
Ilya Chernikov
8f96157d7f Switch kotlinx-coroutines usages to regular dependency 2018-01-30 17:06:09 +03:00
Ilya Chernikov
8bc95295eb Drop other references to ideaSdk 2018-01-30 17:06:09 +03:00
Ilya Chernikov
9766508512 Drop drop lib folder and all (arguably obsolete) dependent usages 2018-01-30 17:06:09 +03:00
Ilya Chernikov
713fb9a0e7 Drop ideaSdk downloading in update_dependencies 2018-01-30 17:06:08 +03:00
Ilya Chernikov
b490a79d95 Replace direct usages of ideaSdk in tests with property passed from build scripts 2018-01-30 17:06:08 +03:00
Ilya Chernikov
eb8ef6e803 Drop unused sources 2018-01-30 17:06:08 +03:00
Ilya Chernikov
d39d2883e2 Ignore local data dir in idea and git 2018-01-30 17:06:08 +03:00
Ilya Chernikov
26369c3cca Cleanup obsolete ideaSdk helpers 2018-01-30 17:06:08 +03:00
Ilya Chernikov
28689f631c Convert instrumentation 2018-01-30 17:06:08 +03:00
Ilya Chernikov
10732a1bdd Convert ultimate runner to intellij plugin 2018-01-30 17:06:08 +03:00
Ilya Chernikov
5d3579c079 Convert idea ultimate module to intellij plugin 2018-01-30 17:06:08 +03:00
Ilya Chernikov
f0edb602da Convert ide-runner to intellij plugin 2018-01-30 17:06:07 +03:00
Ilya Chernikov
556287f9bb Move idea plugin artifacts one dir deeper to simplify runIde task
Running idea via specifying plugins dir (instead of plugin.path property
allow idea to select proper plugin version without a need to remove a bundled
plugin. But in order to make it work, the regular and ultimate plugins
should have separate parent dirs.
2018-01-30 17:06:07 +03:00
Ilya Chernikov
06c8cbf7d6 Convert all remaining plugin modules to intellij plugin 2018-01-30 17:06:07 +03:00
Ilya Chernikov
9b51a547d8 Convert generators to intellij plugin, clean up dependencies 2018-01-30 17:06:07 +03:00
Ilya Chernikov
0d264793ce Convert idea plugin modules to intellij plugin 2018-01-30 17:06:07 +03:00
Ilya Chernikov
3912025e14 Convert jps module to intellij plugin 2018-01-30 17:06:07 +03:00
Ilya Chernikov
8266777bd5 Convert js modules to intellij plugin 2018-01-30 17:06:07 +03:00
Ilya Chernikov
74411d9b9c Convert all compiler modules to intellij plugin 2018-01-30 17:06:06 +03:00
Ilya Chernikov
6614695616 Convert more projects 2018-01-30 17:06:06 +03:00
Ilya Chernikov
743f599262 Add infrastructure and helpers for using intellij plugin, convert first project 2018-01-30 17:06:06 +03:00
Mikhail Glukhikh
a0d0bc074b Cleanup: KotlinPullUpHelper 2018-01-30 16:32:20 +03:00
Mikhail Glukhikh
cefa17f877 Reformat: KotlinPullUpHelper 2018-01-30 16:30:08 +03:00
Mikhail Glukhikh
d88b5746c7 Delete companion manually during pull up 2018-01-30 16:29:22 +03:00
Mikhail Glukhikh
7c6a217579 Reformat: KotlinInlineCallableProcessor 2018-01-30 16:03:14 +03:00
Mikhail Glukhikh
6181ba47c8 Delete companion manually during callable inlining 2018-01-30 16:02:32 +03:00
Mikhail Glukhikh
9b1f323118 Retain empty companion in KtNamedDeclarationStub.remove 2018-01-30 15:41:38 +03:00
Mikhail Glukhikh
5abb9dd23e Create actual fix: handle companions correctly #KT-21114 Fixed 2018-01-30 15:41:37 +03:00
Mikhail Glukhikh
f46fa263ef Fix two psi checker tests (related to annotation diagnostic / parsing) 2018-01-30 15:41:06 +03:00
Mikhail Glukhikh
86f25bff63 KtVisitor: delegate constructors to KtNamedDeclaration
In particular, enables back "Unused symbol" on constructors
2018-01-30 15:24:39 +03:00
Mikhail Glukhikh
460688526d Fix testAnnotationInterface3 in J2K (error message) 2018-01-30 15:23:41 +03:00
Mikhail Glukhikh
899da99232 Fix testAnnotation in "member visibility can be private" 2018-01-30 14:59:47 +03:00
Dmitry Savvinov
404122654f Advance bootstrap version to 1.2.30-dev-672 2018-01-30 13:32:07 +03:00
Mikhail Zarechenskiy
c80beea6fd [NI] Refactoring: extract method to create resolution result out 2018-01-30 13:01:21 +03:00
Mikhail Zarechenskiy
0e31162df4 [NI] Fix substitution for receiver when resolving constructor super call 2018-01-30 13:00:44 +03:00
Mikhail Zarechenskiy
2a0bb68e1c [NI] Fix substitution of NotNullTypeParameter 2018-01-30 13:00:43 +03:00
Mikhail Zarechenskiy
4cd07f59a0 [NI] Don't fail on captured type that contains type variable 2018-01-30 13:00:42 +03:00
Mikhail Zarechenskiy
145c04e7e2 [NI] Fix substitution of incorporation constraint type 2018-01-30 13:00:40 +03:00
Mikhail Glukhikh
725704e70f ExclExclCallFixes: reformat 2018-01-30 11:23:18 +03:00
Mikhail Glukhikh
2472966749 Remove unused function parameter: minor improvement 2018-01-30 11:23:18 +03:00
Mikhail Glukhikh
1298ef7fed Redundant Unit expression: simplify code a bit 2018-01-30 11:18:01 +03:00
Mikhail Glukhikh
cd9e298e53 getParentOfTypesAndPredicate: Class<T> -> Class<out T> 2018-01-30 11:17:27 +03:00
Toshiaki Kameyama
18de0f75ab Redundant Unit inspection: fix false positive for single expression
So #KT-22097 Fixed
2018-01-30 10:03:36 +03:00
Mikhail Glukhikh
30acc224ec Reformat: redundant setter 2018-01-30 10:00:02 +03:00
Toshiaki Kameyama
69f3f04fe4 Correct report of "redundant setter" for override & empty block cases
So #KT-22364 Fixed
2018-01-30 09:59:55 +03:00
Alexander Udalov
0ad3872d1b Remove unneeded constructor parameters in CallCheckerContext 2018-01-29 19:38:03 +01:00
Dmitry Savvinov
1171fdb14d Add draft of changelog for 1.2.30 2018-01-29 19:50:04 +03:00
Dmitry Savvinov
a39aba4269 Revert "Add changelog for 1.2.30"
This reverts commit 4b70654c7e.
2018-01-29 19:45:08 +03:00
Dmitry Savvinov
4b70654c7e Add changelog for 1.2.30 2018-01-29 19:42:26 +03:00
Toshiaki Kameyama
28123eaf7b Add intention for changing setter accessibility #KT-22409 Fixed 2018-01-29 19:09:19 +03:00
Alexey Sedunov
7f97d58970 Type Hierarchy: Do not use JVM class mapping in non-JVM modules
#KT-21424 In Progress
2018-01-29 18:56:29 +03:00
Alexey Sedunov
089b34a8a9 Minor: Regenerate tests 2018-01-29 18:56:28 +03:00
Mikhail Glukhikh
1f8e2a1057 Reformat: unfold return to ... 2018-01-29 18:01:10 +03:00
Toshiaki Kameyama
3a81be6cfb Do not insert returns before Nothing in "Replace return with 'if'"
So #KT-22159 Fixed
2018-01-29 17:56:26 +03:00
Mikhail Glukhikh
f28bec0db1 Reformat: if-then utilities 2018-01-29 17:49:34 +03:00
Mikhail Glukhikh
3b8f5bce41 Reformat: "if then to safe access" inspection 2018-01-29 17:44:19 +03:00
Toshiaki Kameyama
fad7818bf0 Fix "if to safe access" false positive for check on incorrect type
So #KT-21881 Fixed
2018-01-29 17:43:01 +03:00
Mikhail Glukhikh
5798595206 Cleanup: IntentionDescriptionTest 2018-01-29 16:28:45 +03:00
kenji tomita
a28bc830f5 Add Intention for single character substring #KT-22171 Fixed 2018-01-29 16:23:01 +03:00
Mikhail Glukhikh
29eb594309 Inspection to replace Java Collections methods: simplify type check
Related to KT-22038
2018-01-29 15:52:45 +03:00
Mikhail Glukhikh
068f520c01 Inspection to replace Java Collections methods: fix formatting 2018-01-29 15:52:45 +03:00
Toshiaki Kameyama
be4739e65e Inspection to replace Java Collections methods: extend set of types
So #KT-22038 Fixed
2018-01-29 15:52:44 +03:00
Alexey Sedunov
bd8a4d78fa Line Markers: Don't show test run line markers for top-level functions
#KT-13509 Fixed
2018-01-29 14:48:41 +03:00
Mikhail Glukhikh
8cbf364457 Remove braces: add parentheses to if-else in more general case
Related to KT-18308
2018-01-29 14:32:36 +03:00
Toshiaki Kameyama
44c15d8311 Remove braces: add parentheses to if-else inside expression
So #KT-18308 Fixed
2018-01-29 14:32:36 +03:00
Alexander Udalov
19e38bbc72 Do not run annotation checkers for every non-annotated element 2018-01-29 12:22:41 +01:00
Alexander Udalov
46b8deedf7 Run classifier usage checkers on constructor calls
In some cases, REFERENCE_TARGET for annotation entries is the annotation
class descriptor, and in others -- the constructor of that class
2018-01-29 12:22:41 +01:00
Alexander Udalov
8cd7686535 Introduce DeclarationCheckerContext, remove SimpleDeclarationChecker 2018-01-29 12:22:40 +01:00
Alexander Udalov
4cb5483c13 Introduce CheckerContext and ClassifierUsageCheckerContext
To reduce the number of parameters in classifier usage checker
implementations, and to unify the API with call checkers
2018-01-29 12:20:36 +01:00
Alexander Udalov
e2def0c60e Do not report "invalid type of annotation member" on error types
In case the referred type is actually an enum that is not found in
dependencies due to a configuration problem, this usage could be valid.
So we can avoid reporting an error here, to reduce the number of
diagnostics.

Also do not report "default value of annotation parameter must be a
compile-time constant" in the same case for the same reason
2018-01-29 12:20:36 +01:00
Natalia Selezneva
c251386fc3 Rearrange script templates in GradleScriptTemplateProvider
#KT-22473 Fixed
2018-01-29 11:16:29 +03:00
Alexey Sedunov
b091500adc Rename: Wrap facade class when renaming file
This prevents assertion error (introduced in IDEA 181)
caused by facade light class invalidation
and fixes failing test
2018-01-29 01:34:48 +03:00
Alexey Sedunov
80643c5603 Rename: Fix processing of functions without light methods
#KT-22461 Fixed
2018-01-29 01:34:48 +03:00
Alexander Udalov
245d1de2a2 Remove runtime dependency on projectDist(":kotlin-compiler")
This dependency makes IDEA reindex kotlin-compiler.jar after every
Gradle build, which takes time and breaks some key IDE features
2018-01-28 10:14:24 +01:00
Dmitry Savvinov
4d951de616 Propagate nullability changes to enhancement for JSR-305 types
Fix TypeUtils.makeNullableAsSpecified for SimpleTypeWithEnhancement and
FlexibleTypeWithEnhancement: change nullability of enhancement too. This
fixes several false-positive warnings, like in KT-20855 and KT-20466.

Note that it removes warning in some cases (see testdata change for
uselessElvisRightIsNull.kt). However, this removes warning about
*unnecessary* elvis, i.e. this fixed introduces weak false-negatives, which
is acceptable for the moment.

#KT-20855 Fixed Target versions 1.2.30
#KT-20466 Fixed Target versions 1.2.30
#KT-21238 Fixed Target versions 1.2.30
2018-01-26 12:49:14 +03:00
Nikolay Krasko
4c76dc7287 Forbid modification for KtLambdaExpression in JavaCodeBlockModificationListener
See IDEA-185462 for details
2018-01-26 12:42:17 +03:00
Nikolay Krasko
4d2061d836 Minor: reformat coverage 2018-01-26 12:42:17 +03:00
Nikolay Krasko
6d7c779df2 Better diagnostic for file absence in updateJar (KT-22272)
#EA-96117 Fixed
 #KT-22272 Fixed
2018-01-26 12:42:16 +03:00
Toshiaki Kameyama
7e417272b2 "Join lines" works incorrectly in case of line containing more than one string literal (KT-22374)
#KT-22374 Fixed
2018-01-26 12:42:16 +03:00
Mikhael Bogdanov
cc346aef64 Support @JvmStatic for interface companion objects in backend 2018-01-26 10:09:21 +01:00
Mikhael Bogdanov
8bfd6d7404 Support JVM_TARGET in diagnostic tests 2018-01-26 10:09:20 +01:00
Mikhael Bogdanov
c4da370b0b Allow to use @JvmStatic in interface companion object 2018-01-26 10:09:20 +01:00
Mikhael Bogdanov
2340756b88 Minor. Reformat 2018-01-26 10:09:20 +01:00
Dmitry Savvinov
253cd3871b Support effect system-related args in platform 2018-01-26 11:30:44 +03:00
Dmitry Savvinov
b29a6e48fb Refactor language features, which control effect system
- Introduce new language feature 'ReadDeserializedContracts', which
allows to deserialize contracts from metadata.

- Introduce new language feature 'AllowContractsForCustomFunctions',
which allows reading contracts from sources.

- Use new features instead of combination 'CallsInPlaceEffect ||
ReturnsEffect'

- Rename 'CallsInPlaceEffect' -> 'UseCallsInPlaceEffect',
'ReturnsEffect' -> 'UseReturnsEffect'. As names suggest, they control
if it is allowed to use corresponding effect in analysis.

We have to introduce separate 'ReadDeserializedContracts' to enable
contracts only in some modules of the project, because libraries are
read with project-wide settings (see KT-20692).
2018-01-26 11:30:44 +03:00
Dmitry Savvinov
78850087be Revert reformatting for OperationsMapGenerated.kt 2018-01-26 11:00:28 +03:00
Dmitry Petrov
5e34f290ce Reified 'as?' produces nullable result
Previously, this was treated as a regular CHECKCAST, causing KT-22410.

 #Fixed KT-22410 Target versions 1.2.30
2018-01-26 10:22:59 +03:00
Dmitry Petrov
bd25bf14df Minor: reformat code in org.jetbrains.kotlin.codegen.optimization 2018-01-26 10:18:17 +03:00
Yan Zhulanow
e12deb54d6 Android Extensions: Fix "Inconsistent file tree" exception on Activity creation (KT-22349) 2018-01-25 22:03:30 +03:00
Yan Zhulanow
7b055c2172 Kapt: Prefer non-aliased imports over aliased. Make sure the imported short names are unique (KT-22083) 2018-01-25 22:03:29 +03:00
Ilya Gorbunov
233376eef0 Improve min/max specialization for longs and 3-arg overloads in JS 2018-01-25 21:41:18 +03:00
Ilya Gorbunov
2da9f12bc5 Inline findAnyOf(chars) into indexOfAny/lastIndexOfAny
This helps to reduce allocation count

#KT-22042
2018-01-25 21:37:22 +03:00
Cuihtlauac ALVARADO
923d9f03fc Update test results
Separated issue reported: KT-22522

#KT-22369 Fixed
2018-01-25 21:15:08 +03:00
Denis Zharkov
31e73e90d6 Explicitly state that PluginDeclarationProviderFactory is source-only
Before this change `filesScope` was effectively empty in cases when
module info is a library, thus looking
into PackageIndexUtil.packageExists(name, indexedFilesScope, project)
was kind of redundant since it always returns false for empty scopes

The initial motivation was run by 1716720604
that made PackageIndexUtil::packageExists calls much more frequent
2018-01-25 14:41:28 +03:00
Denis Zharkov
2224f95294 Minor. Avoid wrapping GlobalSearchScope.EMPTY_SCOPE 2018-01-25 14:41:28 +03:00
Denis Zharkov
4d378912bf Minor. Reformat JVM/JS analyzer facades 2018-01-25 14:41:28 +03:00
Toshiaki Kameyama
4232ad8dfe "Join lines" works incorrectly in case of line with more than one string literal (KT-22374)
#KT-22374 Fixed
2018-01-24 20:09:32 +03:00
Toshiaki Kameyama
c06aaf6128 Some Live Templates should probably be enabled also for "expressions" not only "statements" (KT-19194)
Consider if-then, if-else, do-while, while positions without block as
statement position.

 #KT-19194 Fixed
2018-01-24 20:09:32 +03:00
Alexander Udalov
543db380d2 Use isJvmInterface in JVM back-end instead of isInterface
To support const vals and proper initialization order for companions of
annotations (since 1.3+) as well as interfaces

 #KT-16962 Fixed
2018-01-24 15:54:35 +01:00
Alexander Udalov
a46a2b9b1c Support nested classes in annotation classes
#KT-16962 In Progress
2018-01-24 15:54:35 +01:00
Alexey Sedunov
5947b4eb8e Minor: Fix Maven server url 2018-01-24 17:52:41 +03:00
Alexey Sedunov
c96eb8df85 Minor: Fix test data for ConvertFunctionTypeParameterToReceiverIntention 2018-01-24 17:28:34 +03:00
Sergey Igushkin
a59fd3bc85 Remove the usage of repository.jetbrains.com 2018-01-24 17:12:45 +03:00
Ilya Gorbunov
32b68ae1d5 Rearrange platform specialized functions
Place them according to their operation to ArrayOps and Filtering.
2018-01-24 02:10:05 +03:00
Ilya Gorbunov
eda8bbacb3 Remove obsolete JvmVersion annotation from generated functions
These functions are already generated in jvm-only file
2018-01-24 02:10:01 +03:00
Sergey Igushkin
20c4775da0 Remove repository.jetbrains.com mirror of Maven Central in libraries. 2018-01-23 23:41:39 +03:00
Sergey Igushkin
0c78a2c026 Remove some of the remaining mentions of repository.jetbrains.com 2018-01-23 23:35:50 +03:00
Alexander Udalov
f516667640 Exclude META-INF/services from kotlin-reflect-sources.jar 2018-01-23 17:11:20 +01:00
Alexander Udalov
3bf5f44b9d Exclude .proto files from kotlin-reflect.jar
#KT-22459 Fixed
2018-01-23 17:11:09 +01:00
Vyacheslav Gerasimov
399282234e Add changelog for 1.2.21 2018-01-23 17:47:17 +03:00
Ilya Gorbunov
6b9520ec73 KT-16661 Simplify String.split a bit more
Check that limit is reached only once in a loop, move nextIndex check to the end of loop.
2018-01-23 13:29:35 +03:00
Vsevolod
510e17246f KT-16661 Simplify Strings#split
Do not search for next occurrence if limit is reached.
2018-01-23 13:29:29 +03:00
Vsevolod
2805371bdc KT-16661 Provide fast-path for Strings#split with single delimiter
Optimize single delimiter split when no matches is found:
Return listOf() of single element instead of adding 'this' to result
because underlying array in ArrayList is created lazily and
by default its size is 16.

Pre-size resulting list in split when limit is known.
2018-01-23 13:29:05 +03:00
Dmitry Petrov
72ffbb9825 Add test for array modification within for-in-array-withIndex loop body 2018-01-23 10:55:24 +03:00
Dmitry Petrov
40d1925e19 Provide optimized code generation for for-in-withIndex for sequences
#KT-5177 In Progress
2018-01-23 10:55:24 +03:00
Dmitry Petrov
2399a39414 Provide optimized code generation for for-in-withIndex for CharSequences
#KT-5177 In Progress
2018-01-23 10:55:24 +03:00
Dmitry Petrov
9c9e507172 Provide optimized code generation for for-in-withIndex for iterables
#KT-5177 In Progress
2018-01-23 10:55:24 +03:00
Dmitry Petrov
08622b0953 Provide optimized code generation for for-in-withIndex for arrays
#KT-5177 In Progress
2018-01-23 10:55:24 +03:00
Dmitry Petrov
e07e9c0ea5 Refactor RangeCodegenUtil: introduce isTopLevelExtensionOnType 2018-01-23 10:55:24 +03:00
Dmitry Petrov
fb487b31ba Minor: format code in RangeCodegenUtil 2018-01-23 10:55:24 +03:00
Dmitry Petrov
5c1321a29f Minor: format code in org.jetbrains.kotlin.codegen.range 2018-01-23 10:55:24 +03:00
Alexey Tsvetkov
f77586574f Always sort files in K2JSCompiler
Previously files were sorted only when IncrementalDataProvider
was not null to normalize js output in case of incremental compilation.
Because of that an output js file could be different after rebuild
in IC tests.
The issue could be reproduced anywhere, but the tests failed only on
Windows, and it seems tests were not run on Windows for some time.
2018-01-22 18:34:17 +03:00
Alexey Tsvetkov
21f2b68357 Fix BuildLogParserParametrizedTest on Windows: normalize line separators 2018-01-22 18:34:17 +03:00
Alexey Tsvetkov
6fc5c3325c Minor: rename file to match class name 2018-01-22 18:34:17 +03:00
Alexey Sedunov
737d7dcc2f Kotlin Facet: Use Kotlin SDK for non-JVM imported modules 2018-01-22 12:21:13 +03:00
Alexey Sedunov
70cb08bfdb Misc: Update test data (new 'allopen' Spring annotations added) 2018-01-22 12:21:12 +03:00
Denis Zharkov
2e933a165a Avoid retaining all protobuf objects in DeserializedMemberScope
Object model for deserialized protobuf isn't very cheap, so
loading just our stdlib's packages several times (as we do in the IDE)
might lead to ~ 96 MB of retained memory just by these objects.

While in fact many of them remain unused

 #KT-21517 Fixed
2018-01-22 10:48:25 +03:00
Nikolay Krasko
b701117ffb Minor: reformat, and warning fixes in outdated notification subsystem 2018-01-19 22:41:52 +03:00
Nikolay Krasko
2386cfbd07 Do not spell check overridden declaration names (KT-15000)
#KT-15000 Fixed
2018-01-19 22:41:51 +03:00
Anton Bannykh
ff00831109 JS: minor fixes in kotlin-test-js-it
Jasmine version 2.6.0 doesn't support Promise-based
asynchronous tests.
Also the error message for an unexpected test result was incorrect.
2018-01-19 20:16:31 +03:00
Ilmir Usmanov
f4ad5182b8 Fix OOM error in ReturnUnitMethodTransformer
#KT-22345: Fixed
2018-01-19 20:13:23 +03:00
Ilya Gorbunov
40aa2280a5 Replace .. with until or indices where appropriate
Replace indices.reversed() with lastIndex..0 as it is not optimized in JS yet
2018-01-19 19:53:09 +03:00
Alexander Udalov
513f50785e Use processResources task to copy compiler.xml to IDEA plugin
This fixes tests broken in 4b2d281bba and 95f9884799
2018-01-19 17:26:33 +01:00
Alexander Udalov
4b2d281bba Include META-INF/extensions/compiler.xml into IDEA plugin
This fixes tests and IDEA run configurations broken in 95f9884799
2018-01-19 15:13:40 +01:00
Mikhail Glukhikh
577c6cde82 KtInvokeFunctionReference: protect from KNPE in getLambdaExpression
So EA-114887 Fixed
2018-01-19 16:16:33 +03:00
Mikhail Glukhikh
26c1673da0 J2K: KtInvokeFunctionReference 2018-01-19 16:16:31 +03:00
Mikhail Glukhikh
117c5a29fb KtInvokeFunctionReference.java -> kt 2018-01-19 16:16:22 +03:00
Mikhail Glukhikh
b1bff24cde Move lambda inside: protect from KNPE in getLambdaExpression
So EA-114888 Fixed
2018-01-19 16:16:21 +03:00
Mikhail Glukhikh
f675d9fd81 Convert reference to lambda: protect from root fq name EA-114907 Fixed 2018-01-19 16:16:19 +03:00
Mikhail Glukhikh
3c19af3645 Convert reference to lambda: reformat 2018-01-19 16:16:18 +03:00
Mikhail Glukhikh
9d9b2b2a58 Fix stub inconsistency in "inline type parameter fix"
Fixes one quick-fix test
2018-01-19 16:16:17 +03:00
Mikhail Glukhikh
1924172189 Inline type parameter fix: reformat 2018-01-19 16:16:16 +03:00
Mikhail Glukhikh
ee3f89df87 Remove unused function parameter: delete empty constructor accurately
So #KT-22221 Fixed
Fixes also some quick-fix tests
2018-01-19 16:16:15 +03:00
Mikhail Glukhikh
c4ef95dbf7 Remove empty primary constructor: reformat 2018-01-19 16:16:13 +03:00
Mikhail Glukhikh
ac1c40c0e6 Add function to supertype fix: get rid of incorrect type comparator
So EA-100297 Fixed
2018-01-19 16:16:12 +03:00
Mikhail Glukhikh
7f947bed1e Add function to supertype fix: reformat 2018-01-19 16:16:11 +03:00
Mikhail Glukhikh
925e4e0a67 KotlinUnusedImportInspection: use LocalQuickFixOnPsiElement 2018-01-19 16:16:10 +03:00
Mikhail Glukhikh
a3dda258c8 KotlinUnusedImportInspection (minor): specify platform type 2018-01-19 16:16:09 +03:00
Mikhail Glukhikh
dade8deea6 KotlinUnusedImportInspection: reformat 2018-01-19 16:16:07 +03:00
Mikhail Glukhikh
c54dd6385c KotlinUnusedImportInspection: check for disposal of progress indicator
So #KT-22335 Fixed
2018-01-19 16:16:06 +03:00
Mikhail Glukhikh
c52fcdde70 Remove explicit type: reformat 2018-01-19 16:16:05 +03:00
Mikhail Glukhikh
512e287f3a Remove setter parameter type: do not suggest if type is empty
So #KT-22339 Fixed
2018-01-19 16:16:04 +03:00
Mikhail Glukhikh
f0b172ca35 Remove setter parameter type: reformat 2018-01-19 16:16:02 +03:00
Sergey Igushkin
c8900d672f Update Gradle plugins build instructions 2018-01-19 12:58:39 +03:00
Mikhael Bogdanov
4c1eb21805 Minor. Add assertion message 2018-01-19 10:42:02 +01:00
Nicolay Mitropolsky
2623ae714c Uast: consistency updates for ULambdaExpression 2018-01-19 10:45:58 +03:00
Nicolay Mitropolsky
25cd54713b Uast: consistency for imports-expressions 2018-01-19 10:45:58 +03:00
Nicolay Mitropolsky
d5d49c65b4 Uast: tests for UClass.uastSuperTypes 2018-01-19 10:45:58 +03:00
Mikhael Bogdanov
7b212c5650 Add support for android MPP
#KT-18462 Fixed
2018-01-18 15:21:19 +01:00
Toshiaki Kameyama
2a10d8e837 KT-15176 Remove "Create type alias" intention when called on java class 2018-01-18 16:23:40 +03:00
Dmitry Savvinov
44920f42d8 [NI] Fix unit coercion
Consider following case:

fun foo(): Unit = run { "hello" }

Previously, NI would analyze lambda body without expected type, because
it is a type variable 'R' from 'run', which hasn't been fixed yet. This
leads to treating "hello" as lambda-return argument and adding bogus
'String' constraint on 'R', and, consequently, type mismatch.

Now, we peek into current constraint system and check if return-type of
lambda is type variable with upper-Unit constraint (which is exactly
condition for its body to be Unit-coerced). If so, then we provide
expected Unit-type for body explicitly, and the rest will be done
automatically (in particular, in aforementioned example "hello" wouldn't
be treated as lambda return argument).
2018-01-18 15:13:45 +03:00
Alexander Udalov
b3eeb2f735 Remove unneeded members of ConstantValueFactory 2018-01-18 12:49:38 +01:00
Alexander Udalov
82574cb570 Do not store ClassDescriptor in EnumValue
Only store the ClassId of the enum class and the Name of the entry, and
resolve the needed descriptor in getType() instead, which now takes the
module instance where that descriptor should be resolved
2018-01-18 12:49:38 +01:00
Alexander Udalov
9290d58ed0 Improve "firstArgumentValue" and "argumentValue" extension functions
Using the argument value, which is of type "Any?", is more implicit and
thus difficult to read than using the ConstantValue instance and casting
it to the needed constant value implementation before taking the value
2018-01-18 12:49:38 +01:00
Alexander Udalov
899002b681 Refactor JavaEnumValueAnnotationArgument and implementations
Only require implementations to be able to compute the enum class name
and the corresponding entry name. Only this should be necessary to
correctly resolve the argument; the resolvers will find the
corresponding class descriptor if necessary
2018-01-18 12:49:38 +01:00
Alexander Udalov
907f53e539 Refactor ConstantValue implementations
Remove KotlinBuiltIns and take a ModuleDescriptor instance in getType
instead. This will allow to create constant values in contexts where
there's no module or built-ins accessible (such as, deserialization of
module annotations during indexing of .kotlin_module files in IDE).

Note that some values (KClassValue, EnumValue, AnnotationValue) still
take module-dependent objects (KotlinType, ClassDescriptor and
AnnotationDescriptor respectively). This is to be refactored later
2018-01-18 12:49:38 +01:00
Alexander Udalov
5e97517c8b Fix bug in StringValue.equals
Also simplify equals() implementations of other constant values
2018-01-18 12:49:38 +01:00
Alexander Udalov
95f9884799 Move META-INF/extensions/compiler.xml to module 'cli' 2018-01-18 12:48:04 +01:00
Alexander Udalov
02857dbfdb JS: support "LANGUAGE" directives in box tests 2018-01-18 12:46:27 +01:00
Alexander Udalov
8b3d439d5b JS: minor, simplify code locating default argument values
At the only call site of getDefaultArgument it is checked that the
parameter actually _declares_ default value, so it's not necessary to
try to load that value from supertypes
2018-01-18 12:46:27 +01:00
Nikolay Krasko
ae2d67a5b1 Update "Kotlin configured but no stdlib" status on file update (KT-22356)
Provide feedback before project re-import is finished.

 #KT-22356 Fixed
2018-01-18 12:13:54 +03:00
Nikolay Krasko
2637a36e22 Inspection doesn't suggest Maven Plugin for kotlin-stdlib-jre8 (KT-18007)
#KT-18007 Fixed
2018-01-18 12:13:53 +03:00
Nikolay Krasko
4a2440ea0f Reformat and cleanup idea-maven_main module 2018-01-18 12:13:53 +03:00
Mikhael Bogdanov
7f1cc81d39 Support test directives in android tests 2018-01-18 10:08:58 +01:00
Mikhael Bogdanov
ef1a3ec32d Convert CodegenTestsOnAndroidGenerator to Kotlin 2018-01-18 10:08:58 +01:00
Mikhael Bogdanov
7e6542b8c8 Renema CodegenTestsOnAndroidGenerator.java to CodegenTestsOnAndroidGenerator.kt 2018-01-18 10:08:57 +01:00
Denis Zharkov
1716720604 Optimize declaration providers for case of non-existing packages
Avoid creating memoized function nodes when the value is obviously null
Otherwise, it may lead to about 25M retained by empty concurrent hashmap
nodes
2018-01-18 11:40:26 +03:00
Denis Zharkov
0f74bb4a7a Get rid of compile dependency to 'compiler-embeddable' from :idea
Previously, it's been added transitively from :kotlin-compiler-runner
as a compile dependency instead of runtime as it's declared in compiler-runner
2018-01-18 11:39:34 +03:00
Alexey Tsvetkov
72f2406083 Turn IC on by default for MPP projects 2018-01-17 21:23:43 +03:00
Sergey Igushkin
5deb20543f Get rid of gradle-api artifacts uploaded to and used from JB repo
Remove redundant Maven dependency to `gradle-api` scoped as provided
2018-01-17 18:45:26 +03:00
Vyacheslav Gerasimov
d16883deaa Build: Clean previous output before instrumentation
Otherwise it may lead to unnecessary classes (left from previous plugin build) being packed to plugin
2018-01-17 16:57:56 +03:00
Dmitry Savvinov
c704f2de9a Reformat 'resolution' module according to new codestyle 2018-01-17 16:47:45 +03:00
Vyacheslav Gerasimov
e2b83aecd7 Fix publishing to Gradle plugin portal 2018-01-17 15:33:15 +03:00
Anton Bannykh
7b0070ea62 Promise-based async integration test for kotlin-test-js 2018-01-17 14:46:13 +03:00
Dmitry Jemerov
ca57309374 Temp revert fix for KT-10591 as it causes non-obvious test breakage 2018-01-17 11:39:35 +01:00
Alexey Sedunov
a752f3f38e Misc: Rename class 2018-01-17 12:54:39 +03:00
Alexey Sedunov
62580a47dc Misc: Add test for KT-7316
#KT-7316 Fixed
2018-01-17 12:53:57 +03:00
Alexey Sedunov
54f4f5ff24 Configuration: Add Kotlin SDK for non-JVM projects
#KT-16976 Fixed
2018-01-17 12:52:51 +03:00
Alexey Sedunov
af1d6124ce JS: Do not specify NodeJS path in Gradle projects
We rely on node_modules directory content which must be populated
by the build script itself
2018-01-17 12:45:45 +03:00
Alexey Sedunov
c6a9c36275 Analyze Data Flow: Support cross-language analysis
#KT-16833 Fixed
2018-01-17 12:40:34 +03:00
Dmitry Petrov
6cb68531ae Minor: add missing "'" 2018-01-17 12:31:07 +03:00
Dmitry Petrov
bba8168150 Add test for extension properties declaration in IR 2018-01-17 12:31:07 +03:00
Dmitry Petrov
1f841e35bc Formatting: psi2ir 2018-01-17 12:31:07 +03:00
Dmitry Petrov
432c743771 Formatting: ir.tree and some common code 2018-01-17 12:31:07 +03:00
Dmitry Petrov
fdd000c94f Update testData to new format 2018-01-17 12:31:07 +03:00
Dmitry Petrov
4d54036d21 Use declaration properties in RenderIrElementVisitor 2018-01-17 12:31:07 +03:00
Dmitry Petrov
7dc15b15bb Add basic properties to IR declarations 2018-01-17 12:31:07 +03:00
Dmitry Petrov
2f09c51dca Formatting: IR test classes 2018-01-17 12:31:07 +03:00
Nikolay Krasko
704ce121bc Use other property name in Java with Kotlin static import tests 2018-01-17 12:05:06 +03:00
Nikolay Krasko
1c7e42f1d4 Collapsed comments containing * get removed in the summary line (KT-21994)
#KT-21994 Fixed
2018-01-17 12:05:05 +03:00
Nikolay Krasko
a1b20535b2 Search same place for it usages in rainbow highlighter (KT-22242)
Reuse KotlinTargetElementEvaluator for getting same declaration
context for implicit 'it' parameter.

 #KT-22242 Fixed
2018-01-17 12:05:04 +03:00
Vyacheslav Gerasimov
f86b77083f Add sources and javadoc to kotlin-annotations-android 2018-01-16 21:19:46 +03:00
Alexey Tsvetkov
d1d786dffa Fix lookup tracking in JPS with enabled daemon
#KT-21962 fixed
2018-01-16 21:09:57 +03:00
Alexey Tsvetkov
220fab0d3f Test JPS with Daemon and IC 2018-01-16 21:09:57 +03:00
Alexey Tsvetkov
ca09be1411 Minor: move 'KotlinJpsBuildTestIncremental' to separate file 2018-01-16 21:09:57 +03:00
Nicolay Mitropolsky
b4db744a9b Uast: KotlinStringULiteralExpression.getExpressionType() made always return String 2018-01-16 20:38:00 +03:00
Dmitry Jemerov
e46f69bb36 Disable "Decompile" button if bytecode generation threw exception
#KT-13791 Fixed
2018-01-16 17:54:49 +01:00
Dmitry Jemerov
404f9cc7d8 KotlinBytecodeToolWindow: convert to .kt 2018-01-16 17:54:48 +01:00
Dmitry Jemerov
bad76eb5c2 KotlinBytecodeToolWindow: rename to .kt 2018-01-16 17:54:47 +01:00
Dmitry Jemerov
5b3ab97b4e Highlight 'var' primary constructor parameters as mutable
#KT-11467 Fixed
2018-01-16 17:54:45 +01:00
Dmitry Jemerov
571b424b33 Use DescriptorToSourceUtilsIde.getAnyDeclaration in super navigation
#KT-16333 Fixed
2018-01-16 17:54:44 +01:00
Dmitry Jemerov
cc90dfa65b GotoSuperActionHandler: convert to .kt 2018-01-16 17:54:43 +01:00
Dmitry Jemerov
690c3433d6 GotoSuperActionHandler: rename to .kt 2018-01-16 17:54:42 +01:00
Dmitry Jemerov
106e1b8661 Don't include unindented comments preceding a function into its text range
#KT-10591 Fixed
2018-01-16 17:54:29 +01:00
Dmitry Jemerov
075541da21 Show location info for members defined in object literals
#KT-22179 Fixed
2018-01-16 17:54:27 +01:00
Dmitry Jemerov
564490c9d4 Don't require presence of PropertiesComponent
#KT-22214 Fixed
2018-01-16 17:54:19 +01:00
Dmitry Jemerov
1b6f6e8bf7 Don't indent block comments of typealiases
#KT-22230 Fixed
2018-01-16 17:54:16 +01:00
Dmitry Savvinov
c2b532b167 Reformat the rest of 'frontend'-module according to new codestyle 2018-01-16 18:26:21 +03:00
Dmitry Savvinov
e5f0ffb0c2 Reformat 'frontend' module according to new codestyle 2018-01-16 17:51:51 +03:00
Kirill Rakhman
b567817d1f Make completion for overriding functions respect suspend modifier
Fixes #KT-22200
2018-01-16 15:42:03 +01:00
Kirill Rakhman
8bc020f31b Fix modifier order in generated overriden functions
Fixes #KT-21600
2018-01-16 15:42:02 +01:00
Alexey Sedunov
99be75cbfc Refactoring: Use modifier list in CallableInfo where possible 2018-01-16 17:06:53 +03:00
Alexey Sedunov
ba0a91d74c Quick Fixes: Drop deprecated KotlinCommonIntentionActionsFactory
Also update relevant test to use new action factory API
2018-01-16 17:06:53 +03:00
Alexey Sedunov
908bf71ae6 Quick Fixes: Support cross-language "Create from Usage" with Kotlin target 2018-01-16 17:06:53 +03:00
Alexey Sedunov
d44313876c Create from Usage: Support primary constructor insertion 2018-01-16 17:06:52 +03:00
Alexey Sedunov
877874978f Misc: Add action text assertions to CommonIntentionActionsTest 2018-01-16 17:06:52 +03:00
Toshiaki Kameyama
113e9f496e Add quickfix for UnsafeCastFromDynamicInspection #KT-20915 Fixed 2018-01-16 17:06:51 +03:00
Vyacheslav Gerasimov
f709a382ae Update changelog for 1.2.20 2018-01-16 16:13:54 +03:00
Alexey Sedunov
05b618eec8 Gradle: Use copyable user data for compiler plugin options
#KT-22227 Fixed
2018-01-16 16:09:18 +03:00
Alexey Sedunov
5892944bfc Convert Enum to Sealed Class: Support expect/actual classes 2018-01-16 16:09:17 +03:00
Alexey Sedunov
9d5d85a1c5 Convert Sealed Class to Enum: Support expect/actual classes
#KT-18912 Fixed
2018-01-16 16:09:17 +03:00
Natalia Selezneva
dbd7ceb5fd Fix Evaluate Expression for inline functions from multifile package class.
Find main class generated for debugger by its name instead of relativePath length.
 #KT-22311 Fixed
2018-01-16 16:00:32 +03:00
Cuihtlauac Alvarado
c5982e7ff5 Avoid pick environement variables test failures (#1467)
Remove all lines containing a "Picked up <ENVIRONMENT_VARIALBE>: ..."

Remove empty ERR: section

FIX: KT-22241
2018-01-16 12:33:19 +01:00
Mikhael Bogdanov
b539adf105 Support simple capturing in IR inliner 2018-01-16 11:53:25 +01:00
Mikhael Bogdanov
ca22bc57fd Don't capture primary constructor variables 2018-01-16 11:53:25 +01:00
Mikhael Bogdanov
28f4cc5b18 Generate parameter name in assertion for lateinit properties 2018-01-16 11:53:24 +01:00
Mikhael Bogdanov
e58558dffd Support mapped companions 2018-01-16 11:53:24 +01:00
Mikhael Bogdanov
e57efc7233 Support external functions 2018-01-16 11:53:23 +01:00
Mikhael Bogdanov
c1a1a7f9fb Code clean 2018-01-16 11:53:22 +01:00
Mikhael Bogdanov
9d7eca1376 Support throwNpe intrinsic 2018-01-16 11:53:22 +01:00
Mikhael Bogdanov
d62a7cc9d1 Unwrap fake override on field access 2018-01-16 11:53:21 +01:00
Mikhael Bogdanov
dfbe92344f Skip setter accessors for val 2018-01-16 11:53:21 +01:00
Mikhael Bogdanov
2b95e6bc0d Generate proper vararg array 2018-01-16 11:53:20 +01:00
Mikhael Bogdanov
724f3bf714 Return proper type after coercion 2018-01-16 11:53:20 +01:00
Mikhael Bogdanov
77b93ab7ad Add classType property in IrClassReference, support class references in codegen 2018-01-16 11:53:19 +01:00
Mikhael Bogdanov
b2970ef771 Skip noinline lambdas during inline 2018-01-16 11:53:19 +01:00
Mikhael Bogdanov
ab96e0102a Support IrGetClass 2018-01-16 11:53:18 +01:00
Mikhael Bogdanov
9a1f484771 Fix equals 2018-01-16 11:53:18 +01:00
Nicolay Mitropolsky
d7f0695a51 Uast: KotlinNullabilityUAnnotation.javaPsi type set to PsiAnnotation? 2018-01-16 13:26:22 +03:00
Ilya Chernikov
c7f8312e1b Shade kotlinx.coroutines in embeddable artefacts
fixes #KT-22196
2018-01-16 09:03:53 +01:00
Sergey Igushkin
3ed7df506b Bump bootstrap to 1.2.30-dev-441 2018-01-15 22:38:28 +03:00
Nicolay Mitropolsky
9ce9b434fe Uast: testdata fix for KotlinUastTypesTest.testEa101715 2018-01-15 20:58:18 +03:00
Denis Zharkov
886d3ef3a6 Optimize KotlinScriptDefinitionFromAnnotatedTemplate::isScript
Avoid multiple pattern compilation for script file regex
2018-01-15 18:20:27 +03:00
Denis Zharkov
b4e5f8cf1c Optimize collecting module info in IDE
The problem was that there is no special entity for libraries
in the IntelliJ model, and when we have an element for a library
we have to search through all of its dependencies
(see getOrderEntriesForFile call in collectInfosByVirtualFile)

But for popular library there could be quite a lot of dependencies,
while in most cases we need only the first one to obtain module
info for library itself (see changed usage in resolverForElement).

So it's worth replacing List with Sequence here
2018-01-15 18:20:27 +03:00
Denis Zharkov
d848238a46 Add cache for Module::languageVersionSettings
It might be useful because getExtraLanguageFeatures might be
rather expensive to compute

 #KT-21450 Fixed
2018-01-15 18:20:27 +03:00
Dmitry Jemerov
60874f29fe Inspection for scope functions conversion
#KT-17047 Fixed
2018-01-15 15:37:36 +01:00
Dmitry Jemerov
0b24be9460 Don't enclose 'this' in braces inside string templates 2018-01-15 15:03:39 +01:00
Dmitry Jemerov
560dc920e4 Don't increase nesting level if we aren't processing current expression 2018-01-15 15:03:39 +01:00
Dmitry Jemerov
3a7e4acf22 Reformat and cleanup 2018-01-15 15:03:39 +01:00
Dmitry Jemerov
d15fa83749 API for building visitors from lambdas 2018-01-15 15:03:39 +01:00
Nikolay Krasko
46ac14198c Don't try to cast light element to KtElement (EA-114820) 2018-01-15 14:05:51 +03:00
Nikolay Krasko
adf6ad6283 Check file before cast in KotlinCompletionContributor (EA-101984) 2018-01-15 14:05:50 +03:00
Nikolay Krasko
eae79e96ee Fix NPE in PlainTextPasteImportResolver.tryResolveReferences (EA-10589) 2018-01-15 14:05:50 +03:00
Nikolay Krasko
93d40b0492 Fix NPE in SourceNavigationHelper.findFirstMatchingInIndex (EA-91517) 2018-01-15 14:05:50 +03:00
Nikolay Krasko
2ca7045228 Rewrite KotlinNameSuggesterTest test with KotlinLightCodeInsightFixtureTestCase
Use proper project descriptors and avoid reconfigure for test project.
2018-01-15 14:05:50 +03:00
Ilmir Usmanov
ed11528664 Ignore unreachable code on tail call optimization
#KT-21759: Fixed
2018-01-15 12:57:10 +03:00
Ilmir Usmanov
25998c1f9b Reformat tail call optimization related code 2018-01-15 12:56:54 +03:00
Yan Zhulanow
2ee23ddd02 EA-101715: Handle also case with IntegerValueTypeConstructor 2018-01-15 12:39:35 +09:00
Yan Zhulanow
108e91f2a2 Kapt: Be less strict when it's impossible to add a generated Kotlin source directory for Android project (KT-22056, EA-114271) 2018-01-15 12:39:34 +09:00
Yan Zhulanow
283c762b8b Kapt: Remove laziness from diagnosticFactory and javacMessages, use factory from supertype (KT-22189)
writeDiagnostic() may be invoked after the 'context' is cleared, and lazy implementations will fail.
2018-01-15 12:39:34 +09:00
Yan Zhulanow
192489ae66 Minor: Remove bulk class added by mistake 2018-01-15 12:39:33 +09:00
Yan Zhulanow
1c5cd1b3a0 Minor: Fix problem in IDE with @TestOnly annotation resolution 2018-01-15 12:39:32 +09:00
Yan Zhulanow
81aae03b57 Use Gradle API to import annotations from compiler plugins instead of nasty data storage tasks
Tasks itself will be left for some time until all users migrate to the newer IDE plugin versions.
2018-01-15 12:39:31 +09:00
Yan Zhulanow
e7c1d94c0f Minor: Fix red code in IDE 2018-01-15 12:39:30 +09:00
Yan Zhulanow
e978c42e52 SamWithReceiver: Add Maven/Gradle importers for SamWithReceiver 2018-01-15 12:39:30 +09:00
Yan Zhulanow
0a3a493f25 AllOpen: Fix incorrect 'accessing non-final property in constructor' warning (KT-16619) 2018-01-15 12:39:29 +09:00
Yan Zhulanow
df19162c8c Kapt: Store line information in a file doc comment, instead of annotations (KT-21936) 2018-01-15 12:39:28 +09:00
Yan Zhulanow
c66947ba40 NoArg: Parse 'invokeInitializers' option in Maven importer (KT-19900) 2018-01-15 12:39:27 +09:00
Yan Zhulanow
3512675d96 Compiler plugins: Refactor Maven import handlers in order to support other plugin options 2018-01-15 12:39:26 +09:00
Yan Zhulanow
a85b4ddb0f Kapt: Clear stubs directory on non-incremental stub generation (KT-21735) 2018-01-15 12:39:25 +09:00
Nicolay Mitropolsky
f4a7ecc1bb Uast: Fix for missing local variables in ctor-s bodies
similar to how it is done in `KotlinUBlockExpression`
2018-01-12 22:32:52 +03:00
Dmitry Jemerov
322ac6340a Fix GradleConfigureProjectByChangingFileTestGenerated 2018-01-12 18:58:04 +01:00
Anton Bannykh
c6d7ffb3eb JS DCE: drop unknown file report severity to WARNING
*.kjsm and other files might be received when FileCollection is
used in Gradle as a dependency.

Example: `testCompile project(":$coroutines_core").sourceSets.test.output`
(a popular-ish solution to introduce dependencies between tests)
2018-01-12 20:00:34 +03:00
Anton Bannykh
5d6d321fb2 Reformat K2JSDce.kt 2018-01-12 20:00:34 +03:00
Dmitry Jemerov
ce5b1acfa7 Regenerate tests 2018-01-12 16:59:31 +01:00
Alexander Podkhalyuzin
b8dded2685 Simple implementation for kt paste into project view #KT-8352 Fixed 2018-01-12 15:57:34 +03:00
Alexander Udalov
b925b6ef9f Add test for obsolete issue
#KT-10494
2018-01-12 12:50:38 +01:00
Nikolay Krasko
aee7329b89 Modify incremental test in 173 branch - files are not created anymore 2018-01-12 13:54:45 +03:00
Nikolay Krasko
5a6d58a799 Update to 2017.3.2 (173.4127.27) 2018-01-12 13:54:43 +03:00
Nikolay Krasko
4c09a6cf06 Allow different diagnostics in Javac tests - workaround for IDEA-184289 2018-01-12 13:54:42 +03:00
Nicolay Mitropolsky
27b3cdf1fa Uast: KotlinAccessorCallExpression made implement JvmDeclarationUElement 2018-01-12 13:54:41 +03:00
Nicolay Mitropolsky
254caef0e6 Idea version set to 173.3942.27 2018-01-12 13:54:39 +03:00
Nicolay Mitropolsky
f8601479de Uast: handling @receiver annotations 2018-01-12 13:54:38 +03:00
Nicolay Mitropolsky
f91f42c253 Uast: Constructors.kt testdata fixes 2018-01-12 13:54:36 +03:00
Nicolay Mitropolsky
2c81362ce1 Uast: uastParent made final in KotlinAbstractUElement 2018-01-12 13:54:35 +03:00
Nicolay Mitropolsky
e7200d16c3 Uast: no more need to exclude UIdentifier from JvmDeclarationUElement check 2018-01-12 13:54:33 +03:00
Nicolay Mitropolsky
e22e466485 Uast: making AbstractKotlinUClass not inherit from AbstractJavaUClass 2018-01-12 13:54:32 +03:00
Nicolay Mitropolsky
084da3665a Uast: removing java-uast usage from KotlinUastLanguagePlugin and KotlinEnumConstantClassReference 2018-01-12 13:54:31 +03:00
Nicolay Mitropolsky
260c549cd7 Uast: AbstractKotlinUVariable annotations now are retrieved from Kotlin Psi, not from compiled (KT-21025)
and `KotlinNullabilityUAnnotation` now is created for every `AbstractKotlinUVariable`
2018-01-12 13:54:29 +03:00
Nicolay Mitropolsky
f0723a5c07 Uast: WrappedUAnnotation as replacement for usage of JavaUAnnotation (KT-21025) 2018-01-12 13:54:28 +03:00
Vyacheslav Gerasimov
53d6c17417 Set correct until-build for Idea 173 plugin 2018-01-12 13:54:26 +03:00
Nicolay Mitropolsky
a278e4ccef Fixing non-running tests, that used MockApplication environment 2018-01-12 13:54:25 +03:00
Alexey Sedunov
c1cf03d89c Data Inflow: Support grouping by expression nullability 2018-01-12 13:54:23 +03:00
Nicolay Mitropolsky
0a1580159f Uast: Constructors.kt testData fixes 2018-01-12 13:54:22 +03:00
Alexey Sedunov
683bbe396d Data Inflow: Support grouping by leaf expressions 2018-01-12 13:54:20 +03:00
Alexey Sedunov
b46784ab86 Safe Delete: Suppress walking through light field initializer
This fixes some tests failing in 173 branch

 #KT-21508 Fixed
2018-01-12 13:54:19 +03:00
Nikolay Krasko
cbfd7088bf Fix inAnnotation test in 173 branch 2018-01-12 13:54:17 +03:00
Nikolay Krasko
c0582ed732 Update file name replace in QuickFix tests 2018-01-12 13:54:16 +03:00
Nicolay Mitropolsky
502a6fa9f1 Uast: SuperCalls.render.txt testdata fix 2018-01-12 13:54:14 +03:00
Nicolay Mitropolsky
5f6e5c5779 Uast: AbstractKotlinUClass compilation fix 2018-01-12 13:54:13 +03:00
Nicolay Mitropolsky
b51a7c6957 Spring: fix for package-completion tests
because otherwise `java` package name interfere with `java` directory name completion from somewhere
2018-01-12 13:54:12 +03:00
Nicolay Mitropolsky
1fd8abb0bb Spring: removing needless EP-s because they ported to UAST in platform 2018-01-12 13:54:10 +03:00
Nicolay Mitropolsky
79abc8743e KotlinSpringComponentScanInspection made to support platform JamReferenceContributor 2018-01-12 13:54:09 +03:00
Vyacheslav Gerasimov
0cad41bb0c Drop missing gradle extensions from gradle.xml 2018-01-12 13:54:07 +03:00
Nikolay Krasko
23bd0b3db5 Update test data because of changed action name in 173 2018-01-12 13:54:06 +03:00
Nicolay Mitropolsky
29fd34d1de Idea version set to 173.3727.22(RC1) 2018-01-12 13:54:05 +03:00
Nicolay Mitropolsky
8c27bf98f4 UAST: StringTemplateComplex testdata fix 2018-01-12 13:54:03 +03:00
Alexey Sedunov
f3dad53ad4 Line Markers: Respect subclass module when filtering out duplicates
#KT-21010 Fixed
2018-01-12 13:54:02 +03:00
Alexey Sedunov
d37c8397f5 Move: Fix applicability check in IDEA 173 2018-01-12 13:54:00 +03:00
Vyacheslav Gerasimov
ab50ccf995 Fix formatting for new kotlin dsl gradle project build script 2018-01-12 13:53:59 +03:00
Vyacheslav Gerasimov
560e2d1ced Drop new Kotlin Dsl gradle project wizard which has been merged to idea 2018-01-12 13:53:58 +03:00
Nicolay Mitropolsky
aa43bebbf1 SpringTestFixtureExtension: option to forbid facet autoconfigure added 2018-01-12 13:53:56 +03:00
Nicolay Mitropolsky
3a06b8fe3b SpringKotlinAutowiringInspection: getting rid of SpringJavaInjectionPointsAutowiringInspection 2018-01-12 13:53:55 +03:00
Nicolay Mitropolsky
bef100b46e AbstractIntentionTest: isApplicableOnPooled made run under ProgressIndicator 2018-01-12 13:53:53 +03:00
Vyacheslav Gerasimov
09f31076e6 Update ideaVersion to 173.3415.22 2018-01-12 13:53:52 +03:00
Nicolay Mitropolsky
2f30ca3fac Ultimate-plugin: UAST added as dependency 2018-01-12 13:53:51 +03:00
Nicolay Mitropolsky
f4a8a98157 Ultimate-plugin: multiplePropertiesAnnotationConfig.kt test data fixes
`@Qualifier` should not be there. It was a bug in platform
2018-01-12 13:53:49 +03:00
Nicolay Mitropolsky
6cb556dd6b AbstractQuickFixTest: FORCE_PACKAGE_FOLDER directive added
It was added as workaround for IDEA-176033 (IDEA-176032 in particular)
2018-01-12 13:53:48 +03:00
Nicolay Mitropolsky
ab0c081897 AbstractExtractionTest: fix for invalid files
`configureByFile` should be run after other configurations (like `configureKotlinRuntimeAndSdk`) because they could make configured file invalid
2018-01-12 13:53:46 +03:00
Nicolay Mitropolsky
dd45780de9 RecursiveMethodCallMarkerInfo and SuspendCallMarkerInfo forced to target Leaf-elements
because of restriction added in IDEA 173
2018-01-12 13:53:45 +03:00
Nicolay Mitropolsky
34bdc04fbe AbstractNavigateToLibraryTest: fix for invalid files
otherwise current file is invalidated by `configureAs` and `additionalConfig`
2018-01-12 13:53:44 +03:00
Nicolay Mitropolsky
7758875955 EdtTestUtil.runInEdtAndWait fix for proper user action emulation
changed because `com.intellij.ide.IdeEventQueue` doesn't consider events from `SwingUtilities.invokeAndWait` as user interaction
2018-01-12 13:53:42 +03:00
Nicolay Mitropolsky
0acfce55a8 KotlinCoreEnvironment: set ideaCompatibleBuildNumber = "173.1" 2018-01-12 13:53:41 +03:00
Nicolay Mitropolsky
6bfe168dd7 UAST: SimpleKotlinRenderLogTest.testWhenAndDestructing testdata fix 2018-01-12 13:53:39 +03:00
Nicolay Mitropolsky
8a23a62c90 AbstractJavaToKotlinConverterForWebDemoTest: setup fix: JvmElementProvider and JavaModuleSystem added 2018-01-12 13:53:38 +03:00
Mikhail Glukhikh
8810e15f08 ExpressionOfTypeProcessor: get member name in read action 2018-01-12 13:53:36 +03:00
Mikhail Glukhikh
3f9054b28b Fix find usages tests in 173 (run via ProgressIndicator) 2018-01-12 13:53:35 +03:00
Nicolay Mitropolsky
cfcee0a1fe Workaround for CoreEnvironment initialization: explicitly setting versions for extensions 2018-01-12 13:53:34 +03:00
Nicolay Mitropolsky
6b656d4da5 Spring gutter icons SpringApiIcons -> SpringApiIcons.Gutter fix.
Following the patch in idea https://upsource.jetbrains.com/IDEA/revision/ultimate-527b9189219f191b62eed59d699f57acccda05c3
2018-01-12 13:53:32 +03:00
Nicolay Mitropolsky
099c1a84ec Idea version set to 173.3302.8 2018-01-12 13:53:31 +03:00
Nikolay Krasko
60149e3021 Update file structure tests as FileStructurePopup api was changed in 173 2018-01-12 13:53:29 +03:00
Nicolay Mitropolsky
f5e3a5faa4 Spring-Kotlin: Gutter repaired (KT-20550, KT-20566)
Platform now allows Gutter to be placed only on leafs elements, this patch fixes it for `KotlinSpringClassAnnotator`.
2018-01-12 13:53:28 +03:00
Ilya Gorbunov
9e21744bf5 streamex version was changed in 173-snapshot to 0.6.5 2018-01-12 13:53:27 +03:00
Nicolay Mitropolsky
208a986eab UAST: support for JvmDeclarationUElement 2018-01-12 13:53:25 +03:00
Nicolay Mitropolsky
f1579d01af UAST test data fixes: LocalVariableWithAnnotationKt fix for variable type
it is not clear for me why it was not `String`
2018-01-12 13:53:24 +03:00
Nicolay Mitropolsky
7c3c59de00 UAST test data fixes: @null in render
as a "nullability" annotation for primitive types
2018-01-12 13:53:22 +03:00
Nicolay Mitropolsky
9fed8f1d24 idea-version set to since-build="173.1" until-build="181.*" 2018-01-12 13:53:21 +03:00
Vyacheslav Gerasimov
ceaa34201e Fix GradleNoduleBuilder use qualified names check 2018-01-12 13:53:19 +03:00
Nicolay Mitropolsky
4c775a9516 JvmFacade-related tests repair 2018-01-12 13:53:18 +03:00
Simon Ogorodnik
7da9268e10 Fix proguard settings for 173 (ignore com.intellij.util.io.TarUtil) 2018-01-12 13:53:16 +03:00
Simon Ogorodnik
f940c0b86f Fix compilation in 173 (GradleModuleBuilder.java) 2018-01-12 13:53:15 +03:00
Anton Bannykh
4f97040ce5 Fix compilation (MockParameterInfoUIContext.java)
(cherry picked from commit 21b0956)
2018-01-12 13:53:14 +03:00
Nicolay Mitropolsky
7eb2d0d185 KotlinLanguageInjector using Registry to enable annotation injections
(cherry picked from commit 8bdfeb7)
2018-01-12 13:53:12 +03:00
Simon Ogorodnik
12daf4389e Fix compilation in 173 (MockParameterInfoUIContext.java) 2018-01-12 13:53:11 +03:00
Dmitry Jemerov
53a3d08a0e Fix compatibility with BuildScriptDataBuilder API changes 2018-01-12 13:53:09 +03:00
Nicolay Mitropolsky
d7fcc69315 KotlinLanguageInjector#injectInAnnotationCall optimization: using PsiClassNamePatternCondition to avoid calling getResolvedCall 2018-01-12 13:53:08 +03:00
Nicolay Mitropolsky
81b6a61edf KotlinLanguageInjector can inject into files modified for autocompletion 2018-01-12 13:53:07 +03:00
Nicolay Mitropolsky
1435911437 KotlinLanguageInjector understands patterns-injections into Java annotations 2018-01-12 13:53:05 +03:00
xiexed
743dc80b4d KtLightAbstractAnnotation build fix for 173 (#1283) 2018-01-12 13:53:04 +03:00
Dmitry Jemerov
70caae4c6f Register new service and EPs added in 173 2018-01-12 13:53:02 +03:00
xiexed
defb5a9d10 Fixes for 173 after 28.08.17 changes in IDEA (#1271)
* `JarFileSystem.getJarRootForLocalFile` now is nullable in IDEA

* Spring-related renamings following ones in IDEA
2018-01-12 13:53:01 +03:00
Nicolay Mitropolsky
6690f9f1da Build fix for KotlinSpringClassAnnotator after collectNavigationMarkers nullability changes in IDEA 173 2018-01-12 13:52:59 +03:00
Vyacheslav Gerasimov
3f15f7a394 UAST: Fix testPropertyWithAnnotation 2018-01-12 13:52:58 +03:00
Vyacheslav Gerasimov
e6efaaf752 UAST: Add testConvertTypeInAnnotation 2018-01-12 13:52:56 +03:00
Vyacheslav Gerasimov
92c23aa0ed UAST: override getFunctionalInterfaceType + test 2018-01-12 13:52:55 +03:00
Vyacheslav Gerasimov
8eddb10870 UAST: Properly handle annotations on local variables 2018-01-12 13:52:54 +03:00
Vyacheslav Gerasimov
35fa8efbf3 Fix compilation after moving to idea 173 2018-01-12 13:52:52 +03:00
Vyacheslav Gerasimov
8f7a354592 Download IDEA 173.3188.16 2018-01-12 13:52:51 +03:00
Nikolay Krasko
2a0b7e293f Minor: KotlinCodeFragmentFactory.kt cleanup 2018-01-11 22:08:18 +03:00
Natalia Selezneva
4d6c83b5b9 Debugger: do not fail if j2k couldn't convert expression creating codeFragment from text 2018-01-11 22:08:17 +03:00
Ilmir Usmanov
c023831a00 Ignore open modifier on top-level suspend function when generating light classes
#KT-21642: Fixed
2018-01-11 19:33:47 +03:00
Nikolay Krasko
5da156e93c Setup modules before test configuration in NavigateToStdlibSourceTest.kt 2018-01-11 15:03:03 +03:00
Nikolay Krasko
91a9d3cf80 Search class after full test configuration in AbstractHierarchyWithLibTest 2018-01-11 15:02:14 +03:00
Nikolay Krasko
2f817662d5 Process only project scope in AbstractHierarchyWithLibTest 2018-01-11 15:01:47 +03:00
Nikolay Krasko
8ade03ac0b Avoid using mock JDK because of bad cast in ProjectJdkTableImpl.getState
com.intellij.openapi.projectRoots.impl.MockSdk cannot be cast to com.intellij.openapi.projectRoots.impl.ProjectJdkImpl
2018-01-11 15:00:57 +03:00
Nikolay Krasko
e710cbb0bb Don't fail during error reporting on invalid elements 2018-01-11 14:56:32 +03:00
Alexander Udalov
2593ce73f1 Update copyright in generated sources
To fix tests that are checking that the generated data is up to date
2018-01-11 12:45:36 +01:00
Nicolay Mitropolsky
9cb62d66cb KtLightAnnotation: handling vararg with single arg (EA-114679)
It is deprecated but yet possible form of usage
2018-01-11 14:05:15 +03:00
Ilya Gorbunov
6197c5bf7f Add sample for coerceIn with floating point range
#KT-20357
2018-01-11 09:05:28 +03:00
Ilya Gorbunov
8fc83e3ff5 Add samples for coerceIn, coerceAtLeast, coerceAtMost for comparable types
#KT-20357
2018-01-11 09:05:28 +03:00
shiraji
17573a3c21 Add samples for coerceIn
#KT-20357
2018-01-11 09:05:28 +03:00
shiraji
4559da9848 Add samples for coerceAtMost
#KT-20357
2018-01-11 09:05:28 +03:00
shiraji
db607e231c Add samples for coerceAtLeast
#KT-20357
2018-01-11 09:05:27 +03:00
kenji tomita
1db0e5c23e Add samples for reversed list views
#KT-20357
2018-01-11 09:05:27 +03:00
AdamMc331
2fc26ba08f Added samples for property delegates as part of KT-20357. 2018-01-11 09:05:27 +03:00
Vyacheslav Gerasimov
892e901f35 Update changelog for 1.2.20 2018-01-10 20:32:05 +03:00
Ilmir Usmanov
32a94c70e9 Use tail call optimization if ARETURN has multiple sources
#KT-21977: Fixed
2018-01-10 20:14:32 +03:00
Ilmir Usmanov
5dbab2f907 Disable tail call optimization, if the call is inside try block
#KT-21165: Fixed
2018-01-10 20:13:55 +03:00
Denis Zharkov
3cfe43f83a Add -Xsupport-compatqual-checker-framework-annotations flag
It's implemented through Jsr305State while it's not related
to jsr-305 becasue currently it's the most convenient way
to introduce the flag.

Probably, it's worth renaming Jsr305State to something more abstract
like NullabilityAnnotationsConfiguration

 #KT-21982 Fixed
2018-01-10 17:02:46 +03:00
Simon Ogorodnik
40706de3db Add ability to resolve kdoc links from package view 2018-01-10 16:37:07 +03:00
Alexey Sedunov
75ce68197f Configuration: Fix API version UI update on language version change
#KT-21979 Fixed
 #KT-21980 Fixed
2018-01-10 16:24:30 +03:00
Alexey Sedunov
9d1fbbd1c6 Move: Correctly determine target module for deferred files 2018-01-10 16:24:28 +03:00
Alexey Sedunov
253c5f2d9b Gradle: Compile Gradle models/model builders for plugins under JVM 1.6
This prevents imports failure in projects using older versions of Gradle
2018-01-10 16:24:27 +03:00
Alexey Sedunov
258bd1e8c0 Maven: Fix <args> parsing on import to the Kotlin facet
#KT-22153 Fixed
2018-01-10 16:24:25 +03:00
Ilya Chernikov
6f135e89d7 Make daemon starting more tolerant to the failures - retry
(cherry picked from commit 386cfec)
2018-01-10 13:38:20 +01:00
Ilya Gorbunov
c8bd623d69 Samples: add some operations to do with the constructed ranges 2018-01-10 15:32:51 +03:00
kenji tomita
4cb2b12f01 Add samples for range construction operators 2018-01-10 15:32:50 +03:00
Andre Perkins
31d650a041 Add sample for emptySet 2018-01-10 15:32:50 +03:00
Jake Wharton
11696ac4c0 Implement String.toBoolean() for JS.
#KT-16348
2018-01-10 15:32:49 +03:00
Dmitry Jemerov
86c10b635a Initial implementation of method separators
#KT-13029 Fixed
2018-01-10 13:17:33 +01:00
Dmitry Jemerov
fd01351740 Implement display of code construct start for Kotlin
#KT-20470 Fixed
2018-01-10 13:17:33 +01:00
Dmitry Jemerov
968e6ecde4 KotlinPairMatcher: convert to .kt
(cherry picked from commit 0bc4f26)
2018-01-10 13:17:33 +01:00
Dmitry Jemerov
0c429857de KotlinPairMatcher: rename to .kt
(cherry picked from commit e386c35)
2018-01-10 13:17:33 +01:00
Nicolay Mitropolsky
4a4bf5635d Uast: KtLightAnnotation converting support (KT-21702) 2018-01-10 15:12:12 +03:00
Dmitry Jemerov
99a9634609 Don't generate references to eap-1.1 and eap-1.2 repositories
Now all Kotlin EAP releases are published only to kotlin-eap on Bintray
2018-01-10 12:13:02 +01:00
Dmitry Petrov
5ffd6a737e Closures in scripts have outer expression
#KT-22029 Fixed Target versions 1.2.30
2018-01-10 14:08:56 +03:00
Dmitry Petrov
d25ebadf53 Minor: formatting 2018-01-10 14:08:56 +03:00
Dmitry Jemerov
e80dae1802 Update copyright in generated tests 2018-01-10 11:55:28 +01:00
Dmitry Jemerov
5ec5807399 TestGenerator: J2K 2018-01-10 11:20:57 +01:00
Dmitry Jemerov
993db696ec TestGenerator: rename to .kt 2018-01-10 11:19:25 +01:00
Dmitry Jemerov
da678a4be2 Use new JRE chooser in Kotlin script run configuration 2018-01-09 18:43:21 +01:00
Dmitry Jemerov
ebc9c217c1 Get rid of PluginJetFilesProvider, use a more sane impl instead 2018-01-09 18:43:20 +01:00
Dmitry Jemerov
685d38218d Extension point for detecting build system type used in project
Now we use a non-deprecated way to detect Maven modules
2018-01-09 18:43:19 +01:00
Dmitry Jemerov
0ca2117ac7 Remove the usages of some of the deprecated APIs 2018-01-09 18:43:11 +01:00
Dmitry Jemerov
361824e170 Fix HighlightingTestGenerated and LambdaImplicitHintsTest 2018-01-09 18:04:39 +01:00
Dmitry Jemerov
8c7f57ca83 Honor "Use continuation indent in argument lists" for indent by Enter
#KT-22121 Fixed
2018-01-09 15:41:21 +01:00
Dmitry Jemerov
d79ac58340 Refactoring: replace WrappingStrategy interface with lambda 2018-01-09 15:41:20 +01:00
Dmitry Jemerov
67897d9b3d Don't wrap argument list containing anonymous functions
Just like for objects and lambdas, don't consider line breaks inside
anonymous functions as line breaks inside argument list
2018-01-09 15:41:18 +01:00
Dmitry Jemerov
a5cc9809ac Improved logic for chained lambda indentation
#KT-22071 Fixed
2018-01-09 15:41:17 +01:00
Dmitry Jemerov
54c262c505 Use receiver type of extension members as qualifier in Goto Symbol
#KT-17217 Fixed
2018-01-09 15:41:15 +01:00
Dmitry Jemerov
0104ed7d44 Show line marker navigation actions in Alt-Enter menu
#KT-14951 Fixed
2018-01-09 15:41:09 +01:00
Dmitry Jemerov
63af3c8e03 Delegate Ctrl-Shift-Enter to plain handler if needed
#KT-11503 Fixed
2018-01-09 15:32:22 +01:00
Dmitry Jemerov
f36f85f55c Don't require documentation in test sources
#KT-21837 Fixed
2018-01-09 13:54:56 +01:00
Dmitry Jemerov
165ac97c4b SortModifiersInspection detects modifiers before annotations
#KT-22013 Fixed
2018-01-09 13:54:56 +01:00
Dmitry Jemerov
408c753837 Check that a file with .kt extension is actually a KtFile
#KT-22111 Fixed
2018-01-09 13:54:56 +01:00
Dmitry Jemerov
69c8da7403 Cleanup: apply all inspection quickfixes 2018-01-09 13:54:56 +01:00
Dmitry Jemerov
6f722d647f Reformat 2018-01-09 13:54:56 +01:00
Dmitry Jemerov
6299e0e941 Check correct element to determine if 'if' rbrace needs wrapping
#KT-22093 Fixed
2018-01-09 13:54:56 +01:00
Dmitry Jemerov
e9ca6a6038 Call arguments should not affect parameter names returned in MethodInfo
The parameter names are only used for blacklist filtering, and should
correspond only to the function being called; the order and number of
actually provided arguments does not matter.
2018-01-09 13:49:03 +01:00
Dmitry Jemerov
599bb878f1 Rename test to correspond to the name of code under test 2018-01-09 13:49:02 +01:00
Dmitry Jemerov
78682ac493 Respect imports when rendering class names in type hints
#KT-19524 Fixed
2018-01-09 13:49:01 +01:00
Dmitry Jemerov
45282af38b Prototype of inlay hints for suspending calls (KT-20187) 2018-01-09 13:48:31 +01:00
Dmitry Jemerov
d060203896 Don't show type hints for SAM constructors
#KT-22050 Fixed
2018-01-09 13:34:11 +01:00
Dmitry Jemerov
0991dba626 Better position of argument name hint for multiline varargs
#KT-20614 Fixed
2018-01-09 13:34:10 +01:00
Dmitry Jemerov
6c23d3a220 Show inlay hints for implicit parameters and receivers of lambdas
#KT-20533 Fixed
2018-01-09 13:34:09 +01:00
Dmitry Jemerov
da157fafdc Add inlay hints for values returned from lambdas
#KT-20067 Fixed
2018-01-09 13:34:01 +01:00
Dmitry Jemerov
e558837214 Cleanup: better function name 2018-01-08 14:41:49 +01:00
Toshiaki Kameyama
3b212558e2 KT-21949 Please add a separate Color Scheme settings for properties synthesized from Java accessors (#1458) 2018-01-08 13:04:43 +01:00
Toshiaki Kameyama
19c35ef48c KT-21213 multiline kdoc - intellij joins lines together without space (#1459)
* KT-21213 multiline kdoc - intellij joins lines together without space

* Use \n directly as a line separator #KT-21213

* Remove unused import #KT-21213
2018-01-05 15:29:11 +01:00
Dmitry Jemerov
d51dd97156 Avoid exception from DocumentImpl.setInBulkUpdate in reformat inspection
#KT-21036 Fixed
2018-01-04 19:03:55 +01:00
Toshiaki Kameyama
266b40b654 KT-21974 Editor color scheme option for Kotlin typealias names (#1457) 2018-01-04 17:39:39 +01:00
Sergey Igushkin
06903f803b (minor) Separate the Gradle annotations from CompilerArgumentAware 2018-01-03 22:14:23 +03:00
Sergey Igushkin
d881efdeb1 Improve disambiguation of subplugin option inputs
The original approach required evaluating the existing input properties
of the task. This led to evaluation of the property values, and could
execute incorrectly if the task was not properly initialized at that
moment.
The new approach fixes that by first grouping options from each
subplugin by key and then adding disambiguating index suffixes.
2018-01-03 22:14:23 +03:00
Sergey Igushkin
1be9e04797 Move conditional task caching setup into the task constructors;
Add 'kotlin.caching.enabled' flag to switch the caching for all tasks;
Rename and change semantics of cache support checks: make two instead
    of one, `isBuildCacheSupported` and `isBuildCacheEnabledForKotlin`;
Remove FileOptionKind entries that are redundant at the moment;
Improvements in BuildCacheIT.kt and other refactoring  suggestions from
    the review
    https://upsource.jetbrains.com/kotlin/review/KOTLIN-CR-1647
2018-01-03 22:14:22 +03:00
Sergey Igushkin
fd066ea4d5 Fix top-level property of an API-level-dependent class: move to the body 2018-01-03 22:14:22 +03:00
Sergey Igushkin
c5a88c5fb7 Add BuildCacheRelocationIT, remove same files testing as redundant. 2018-01-03 22:14:22 +03:00
Sergey Igushkin
6bea643176 Fix JS DCE classpath duplicated in two input properties
* Do not add the classpath elements to source to avoid them being
  treated as task inputs without proper classpath normalization
* Move resolution of the classpath configuration to execution time
2018-01-03 22:14:22 +03:00
Sergey Igushkin
67b5527c68 Fix Kotlin destination dir added to Java task without normalization.
Issue #KT-20604 Fixed
2018-01-03 22:14:22 +03:00
Sergey Igushkin
97edda44c8 Turn on relocatable build cache -- change PathSensitivity to RELATIVE 2018-01-03 22:14:22 +03:00
Sergey Igushkin
c852d0b6cb Subplugin options refactoring & Gradle input improvements
Introduce FilesSubpluginOption Special kind of SubpluginOption that
holds a list of files together with the kind of these files with respect
to the task.

Add a logic for handling such options and converting them into
task inputs.

Refactor CompilerPluginOptions: make it store subplugin options to be
able to add options from KotlinCompile to the kapt tasks.

Introduce WrapperSubpluginOption for encoded and complex options.

Remove pluginOptions from the Gradle inputs built from the
compiler args.

Do not cache Kotlin compilation with kapt1 enabled: since we are going
to drop kapt1 it anyway, there's no point in implementing
proper cache for it, so just disable the caching of the task in case
kapt1 is used.
2018-01-03 22:14:22 +03:00
Sergey Igushkin
93097014a0 Add integration tests for Gralde build cache support.
Add an up-to-date'ness test for subplugin options.
2018-01-03 22:14:21 +03:00
Sergey Igushkin
57f710c931 Explicit opt-in switch for Kapt caching. 2018-01-03 22:14:21 +03:00
Sergey Igushkin
7ee3b81939 Add Kotlin sources output as a separate output directory for kapt. 2018-01-03 22:14:21 +03:00
Sergey Igushkin
4a69d1545b Disable IC when IC cache is missing
Check task build directory for any files
2018-01-03 22:14:21 +03:00
Sergey Igushkin
14c80baec8 Make the tasks cacheable, add logic that decides whether to cache them 2018-01-03 22:14:21 +03:00
Sergey Igushkin
26c158cbae Annotate the properties with @PathSensitive (+ override source) 2018-01-03 22:14:21 +03:00
Sergey Igushkin
e46b56acbc Add @LocalState of buildServicesWorkingDir to KotlinCompile 2018-01-03 22:14:21 +03:00
Sergey Igushkin
627fe52858 Map compiler arguments to Gradle inputs. 2018-01-03 22:14:20 +03:00
Sergey Igushkin
a8ba8fbf77 Make pluginOptions.classpath a separate input in the Gradle tasks
(cherry picked from commit b03e758)
2018-01-03 22:14:20 +03:00
Sergey Igushkin
a752d30f12 Move CompilerArgumentAware to the <...>.internal package. 2018-01-03 22:14:20 +03:00
Sergey Igushkin
62f2876230 Refactor compiler arguments in Gradle tasks:
Pull create/setup args functions up to CompilerArgumentsAware interface
Remove diamond-shaped CompilerArgumentsAware inheritance
Provide the default implementation for serialization in the interface
Make KotlinJsDce implement CompilerArgumentsAware
Implement the compiler args logic for Kapt & GenerateStubs tasks
2018-01-03 22:14:20 +03:00
Toshiaki Kameyama
6b2c22aff1 Add intention to specify all types explicitly in destructuring assignment
#KT-16260 Fixed
2018-01-03 17:23:31 +01:00
Dmitry Jemerov
3529d61a7d Exclude generated test classes from language statistics 2018-01-03 14:57:01 +01:00
Toshiaki Kameyama
eb12cfd444 KT-18674 Join Lines should join strings (#1305)
* Join Lines should join strings #KT-18674 Fixed

* #KT-18674 Fixed
2018-01-03 11:27:16 +01:00
Toshiaki Kameyama
16695c1af5 KT-21929 Inappropriate quick fix for a sealed class instantiation (#1444) 2018-01-03 11:20:58 +01:00
Toshiaki Kameyama
de185b79d0 KT-21780 Wrong redundant setter inspection (#1453) 2018-01-03 11:14:23 +01:00
Toshiaki Kameyama
640c28ceaf KT-14670 Support kotlinPackageName() macro in live templates (#1455)
* KT-14670 Support kotlinPackageName() macro in live templates

* Use context.psiElementAtStartOffset.containingFile #KT-14670
2018-01-03 10:41:28 +01:00
Dmitry Jemerov
84d63051f9 Add a rule for invalid characters in names 2018-01-02 13:17:31 +01:00
Dmitry Jemerov
f83c5344d7 Apply same style for top-level and object properties
#KT-20437 Fixed
2018-01-02 12:46:03 +01:00
Dmitry Jemerov
1c7d97289b Naming convention inspection for test functions
#KT-21547 Fixed
2018-01-02 12:46:02 +01:00
Dmitry Jemerov
37d2ff2d4d Report more friendly messages from naming conventions inspection
#KT-19736 Fixed
2018-01-02 12:46:01 +01:00
Dmitry Jemerov
429bf5bb98 Reformat 2018-01-02 12:46:00 +01:00
Toshiaki Kameyama
79ff36592d KT-15320 Live templates: please add function which returns the "outer" class name 2018-01-02 12:35:20 +01:00
Ilya Gorbunov
e2306ecf94 Keep exception primary constructors for binary compatibility in JS
Resort to a workaround for KT-22053 in direct Throwable inheritors.
2017-12-29 21:21:20 +03:00
Ilya Gorbunov
3825187e93 Update expected reachable node count 2017-12-29 21:20:59 +03:00
Ilya Gorbunov
a1f67e347f Relax nullability of UninitializedPropertyAccessException constructor parameters
To make it consistent with other exception types
2017-12-29 21:16:17 +03:00
Ilya Gorbunov
4e26ca5659 Add missing exception constructors to common and JS declarations
Add test to validate exception properties after calling various constructors.

Make NumberFormatException a descendant of IllegalArgumentException in all platforms.

#KT-21861 Fixed
#KT-21191 Fixed
2017-12-29 21:16:17 +03:00
Ilya Gorbunov
496df371f4 Provide the guide for sample authoring 2017-12-29 20:42:46 +03:00
Pavel V. Talanov
03a8ce63b2 Scripts: fix any file deletion potentially leading to reindex 2017-12-29 20:14:59 +03:00
Dmitry Jemerov
25ea53457e Send source code in exceptions as attachments, not text (common cases)
#KT-17678 In Progress
2017-12-29 15:35:53 +01:00
Toshiaki Kameyama
817dadc120 Specify type: do not suggest nullable type if not null is overridden
So #KT-12814 Fixed
2017-12-29 17:28:44 +03:00
Mikhail Glukhikh
50eaca1ac4 Add modifier fix: improve style a bit 2017-12-29 17:17:38 +03:00
Toshiaki Kameyama
184651d366 Do not suggest "add inner" quick fix for interfaces etc. #KT-18396 Fixed 2017-12-29 16:43:47 +03:00
Toshiaki Kameyama
84a6ef6ac4 Add inspection to detect is checks for object types #KT-21741 Fixed 2017-12-29 16:24:18 +03:00
Dmitry Jemerov
247881baf9 Apply style guide and enable reformat inspection 2017-12-29 13:51:53 +01:00
Mikhail Glukhikh
0df3ffbe36 Build fix: convert reference to lambda
Related to KT-19283 (fixes mistake in 3f005924)
2017-12-29 14:36:10 +03:00
Dmitry Jemerov
896246a7f5 More cleanup after J2K 2017-12-29 10:19:50 +01:00
Dmitry Jemerov
d0e8e176c4 Catch exceptions from decompiler service
EA-108937 - RE: InvocationExprent.toJava
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
9a61abfb9f Don't add null module info to list
EA-113650 - TCE: LazyModuleDependencies.getModulesWhoseInternalsAreVisible
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
2c4180222a Check if containing file is KtFile
EA-109460 - CCE: KtElementImplStub.getContainingKtFile
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
4b6efe3eb0 Take read action in KtLightParameter.isEquivalentTo()
EA-109775 - (OperatorReferencesSearcher) assert: PsiFileImpl.getStubTree
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
7f1dd88600 KtLightParameter: convert to .kt and cleanup 2017-12-29 10:19:50 +01:00
Dmitry Jemerov
98d26ae59f KtLightElementParameter: rename to .kt 2017-12-29 10:19:50 +01:00
Dmitry Jemerov
cde84a7923 Handle I/O exceptions when updating library jars
EA-101940 - FNFE: FileUtil.openOutputStream
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
254f766aaf Take longer read action in forEachKotlinOverride()
EA-114124 - assert: CompositeElement.getChildrenAsPsiElements
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
768fce4722 Check for project disposed when reporting outdated libraries
EA-106858 - assert: ComponentManagerImpl.getPicoContainer
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
cc2faa67f9 Don't pass null element to RefactoringFactory.createRename()
EA-114286 - IAE: RenameProcessor.$$$reportNull$$$
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
9a156541c1 Don't try to read attribute for files with no ID
(EA-114351 - CCE: PersistentFSImpl.getFileId)
2017-12-29 10:19:50 +01:00
Toshiaki Kameyama
5e765c525e Do not suggest quickfix 'Specify type explicitly' with existing type
So #KT-15180 Fixed
2017-12-28 21:06:48 +03:00
Mikhail Glukhikh
5475f99cec Elvis -> if-then: handle case with safe cast separately #KT-17816 Fixed 2017-12-28 20:31:55 +03:00
Mikhail Glukhikh
ec60c92fe9 Lambda -> reference: build bound reference for complex qualified
So #KT-19073 Fixed
2017-12-28 20:31:53 +03:00
Mikhail Glukhikh
73bca21f94 Allow using add modifier quick-fixes in batch mode #KT-21950 Fixed 2017-12-28 20:31:47 +03:00
Mikhail Glukhikh
2e71691ab2 Fix potential leak in "unused lambda expression body" fix 2017-12-28 20:31:45 +03:00
Mikhail Glukhikh
8e23ca597d Add extra tests for KT-20429, simplify code a bit 2017-12-28 20:31:44 +03:00
Toshiaki Kameyama
a65304556c CFG: provide "used as expression" in enum constant constructor
This allows to avoid
"unused return value of a function with lambda expression body"
for such a situation
So #KT-20429 Fixed
2017-12-28 20:31:42 +03:00
Mikhail Glukhikh
e10fa218f5 Extend range of "use expression body" to left brace..end of return
Range is extended iff we are in DO_NOT_SHOW case,
otherwise just return is highlighted to avoid ugly highlighting
So #KT-19771 Fixed
2017-12-28 20:31:41 +03:00
Mikhail Glukhikh
95e7d29743 Minor: improve style in "operator to function" 2017-12-28 20:31:40 +03:00
Toshiaki Kameyama
52df70a576 Do not suggest replacing comparison to null with function call
So #KT-20620 Fixed
2017-12-28 20:31:38 +03:00
Mikhail Glukhikh
d7807b5ae3 Do not report "redundant Unit return type" on expression bodies
So #KT-21983 Fixed
2017-12-28 20:31:37 +03:00
Mikhail Glukhikh
232ec63121 Inline dialog: handle case with unknown occurrence number correctly
So #KT-21963 Fixed
2017-12-28 20:31:36 +03:00
Mikhail Glukhikh
947e853d9e Inline dialog: show "inline all and keep" for occurred once declarations
So #KT-21964 Fixed
2017-12-28 20:31:35 +03:00
Mikhail Glukhikh
d5bb7e457e Inline dialog: unify messages with each other #KT-21965 Fixed 2017-12-28 20:31:33 +03:00
Mikhail Glukhikh
3f00592443 Do not suggest "convert ref to lambda" for reflect types #KT-19283 Fixed 2017-12-28 20:31:27 +03:00
Mikhail Glukhikh
fc93e7a727 Do not report "redundant suspend" on override / open #KT-21938 Fixed 2017-12-28 20:31:24 +03:00
Sergey Igushkin
276a6acc3e Use .withDependencies { ... } to set up default versions with Gradle 4.4
+ Improve the test for omitted Kotlin module versions.

Issues: #KT-21806 Fixed, #KT-21203 Fixed
2017-12-28 19:47:02 +03:00
Vyacheslav Gerasimov
8b7a8f7bef Update changelog for 1.2.20 2017-12-28 16:15:54 +03:00
Dmitry Jemerov
fc51673c83 Update copyright profile 2017-12-28 10:47:43 +01:00
Ilya Chernikov
efc470df2b Reading KOTLIN_HOME only once
may fix #KT-21145, or at least make it less flaky
2017-12-28 09:43:44 +01:00
Ilya Chernikov
945da50b61 Add kotlin-compiler-client-embeddable to the plugin's lib since...
it's used in the `KotlinJsr223JvmScriptEngine4Idea`
Fixes #KT-18613
2017-12-28 09:43:43 +01:00
Vyacheslav Gerasimov
6116b5c497 Update coroutines version to 0.20 2017-12-28 00:35:15 +03:00
Ilya Gorbunov
042f81f23b Fix Volatile usages in common and JS code 2017-12-27 21:55:24 +03:00
Ilya Gorbunov
a33a3867b8 JS: Move declaration to match their packages in JVM and Common stdlib
Mostly internal, but also two public annotations
2017-12-27 21:55:24 +03:00
Ilya Gorbunov
d2eb8b4a3f Do not compile SynchronizedLazyImpl for platforms other than JVM 2017-12-27 21:55:24 +03:00
Ilya Gorbunov
b6595d661d Improve expect declarations in kotlin.text
- Replace overloads with default parameters in expect declarations by suppressing errors
- Remove meaningless inline modifier
2017-12-27 21:55:24 +03:00
Ilya Gorbunov
824b506abe Remove inheritance between LinkedHashSet/Map and HashSet/Map 2017-12-27 21:55:24 +03:00
Ilya Gorbunov
c5c6eed170 Make common ArrayList declaration not open and implementing RandomAccess 2017-12-27 21:55:24 +03:00
Ilya Gorbunov
fb13347864 Extract kotlin.collections expect classes into separate files
Add missing expect declarations for AbstractMutableMap/Set.
2017-12-27 21:55:24 +03:00
Ilya Gorbunov
93ef16deaf Move expect declarations to the appropriate packages
So that they match actual declarations in Kotlin/JVM stdlib.
2017-12-27 21:55:24 +03:00
Pavel V. Talanov
dd32c4e66a Revert minor semantic differences introduced in c030a047aa
Fix 'pull members up' and 'kotlin injected into kotlin' tests
2017-12-27 20:24:26 +03:00
Anton Bannykh
2df85ae4a9 kotlin-test-js: pass test function result to test framework (e.g. Promise) 2017-12-27 19:57:49 +03:00
Anton Bannykh
3e0d83b7d1 Make :js:npm a separate project to avoid calling update_dependencies 2017-12-27 17:35:34 +03:00
Alexander Udalov
129fad6ade Minor, merge two KotlinCoreEnvironment-creating functions 2017-12-27 14:50:04 +01:00
Alexander Udalov
613297ad60 Rename ModuleScriptData -> ModuleChunk and refactor related code
Use the term "build file" instead of the old "module"/"module script"
2017-12-27 14:50:03 +01:00
Alexander Udalov
f3f8db989a Fix test data for annotations on DefaultImpls members
After ea5505f80c, the annotations are now generated correctly
2017-12-27 14:12:14 +01:00
Chris Povirk
ac87ad422d Recognize Checker Framework declaration annotations.
We are migrating Guava to use these annotations rather than jsr305's
@Nullable. We can't use the Checker Framework's _@Nullable_ yet because
we promise compatibility with Java 7, which doesn't support type
annotations. This is related to but distinct from
https://youtrack.jetbrains.com/issue/KT-21408, which is about a
different jsr305 annotation we use, @ParametersAreNonnullByDefault.

I've also updated some docs to mention Kotlin's existing support for the
Checker Framework _@NonNull_.
2017-12-27 13:23:06 +01:00
Anton Bannykh
79359b7bc2 JS: test kotlin-test as box tests, support nested, fix mpp
Support tests inside nested classes and companion objects (KT-21850
fixed).
Don't launch multiplatform tests twice (KT-21567 fixed).
2017-12-27 15:22:26 +03:00
Nikolay Krasko
3bf8436895 Fix licence check after "jetbrains/kotlin/idea/copyright" package move 2017-12-27 13:44:55 +03:00
Nikolay Krasko
b7ff00ec34 Remove author tag from JavaSdkUtil to fix CodeConformanceTest 2017-12-27 13:27:59 +03:00
Nikolay Krasko
419abadcda Search for Kotlin sources in project too in fallback scope
When debugging in Gradle or Maven we may miss debug scope completely,
but still want to be responsible for building source positions for all
Kotlin source files (other PositionManagers may produce unexpected
results).
2017-12-27 01:09:53 +03:00
Ilya Gorbunov
f468990f97 Add racing version of each Lazy test
Run several concurrent accesses to a lazy value
many times and validate invariants.
2017-12-26 23:14:11 +03:00
Ilya Gorbunov
4827aadcfd Improve stability of lazy test, make some tests take less time 2017-12-26 23:14:09 +03:00
Ilya Gorbunov
934b3cc54e Do not read volatile _value field second time it is already initialized 2017-12-26 23:14:07 +03:00
Ilya Gorbunov
5d62277fa5 Make SafePublicationLazyImpl.initializer volatile
This establishes happens-before relation between nulling out the initializer and
checking whether it is null. This will prevent the subsequent _value reads
being reordered before the initializer reads.

#KT-21868 Fixed
2017-12-26 23:13:14 +03:00
Sergey Igushkin
685b138f79 (minor) Fix testAndroidExtensionsIncremental() ambiguous file operation 2017-12-26 21:38:15 +03:00
Sergey Igushkin
01931c2ae6 Fix Kotlin internal files created in 'build/' ignoring custom buildDir
Issue #KT-10537 Fixed
2017-12-26 21:38:15 +03:00
Ilya Chernikov
953a485fe7 Increment repl line generation on compilation error
fixes #KT-17921 and #KT-21141
Tests added to the JSR223 local eval example
2017-12-26 19:27:32 +01:00
Ilya Chernikov
2d8e73f3f6 Make JSR 223 examples compatible with embeddable compiler, strip ...
some dependencies.
Fixes #KT-17561 and related issues
Warning: API changed slightly
2017-12-26 19:27:31 +01:00
Sergey Igushkin
d51b17c1b2 Fix @OutputFile annotation on a String property outputFile. 2017-12-26 20:29:45 +03:00
Sergey Igushkin
9d1091cdaa Add java-gradle-plugin for kotlin-gradle-plugin tasks validation;
Make task properties validation fail on warnings; run it during IT
2017-12-26 20:29:45 +03:00
Sergey Igushkin
7031087a93 Mark Gradle task properties with input/output annotations. 2017-12-26 20:29:45 +03:00
Sergey Igushkin
d62ced3a82 Compile against gradleApi() 2017-12-26 20:29:45 +03:00
Mikhail Glukhikh
72ec55769b Improve wording for "change package" fix for source root case 2017-12-26 18:39:51 +03:00
Mikhail Glukhikh
429c31c010 Improve wording in some inspections 2017-12-26 18:39:51 +03:00
Mikhail Glukhikh
1534488dd1 Test minor: output all available fixes in local inspection tests 2017-12-26 18:39:51 +03:00
Mikhail Glukhikh
2f987f08fa Forbid word 'can' in local inspections with level > INFORMATION
Inspection texts were changed accordingly
2017-12-26 18:39:51 +03:00
Mikhail Glukhikh
56230420f8 AbstractApplicabilityBasedInspection: move visitor inside base class 2017-12-26 18:39:51 +03:00
Mikhail Glukhikh
3268189215 Cache intention inside IntentionBasedInspection
So intention is created only once.
Case with multiple intentions is no more allowed.
So #KT-21137 Fixed
2017-12-26 18:39:50 +03:00
Mikhail Glukhikh
5affb9a25c Refactoring: "package matching directory" is now an inspection 2017-12-26 18:39:50 +03:00
Mikhail Glukhikh
3f1a3dfeb2 Refactoring: make "loop to call chain" AbstractKotlinInspection 2017-12-26 18:39:50 +03:00
Mikhail Glukhikh
f44fba746e Refactoring: make "unnecessary variable" inspection applicability-based 2017-12-26 18:39:50 +03:00
Mikhail Glukhikh
221aac9820 J2K registerInspectionBasedProcessing: use correct target for applyTo 2017-12-26 18:39:50 +03:00
Mikhail Glukhikh
5a1a35bb35 Refactoring: "replace put with assignment" is now applicability-based 2017-12-26 18:39:49 +03:00
Mikhail Glukhikh
9e919829c8 Refactoring: "simplify assert not null" is now an inspection 2017-12-26 18:39:49 +03:00
Mikhail Glukhikh
8ebe16c9b2 Minor: reformat XML 2017-12-26 18:39:49 +03:00
Mikhail Glukhikh
bc361363d5 Refactoring: "simplify negated binary expression" is now an inspection 2017-12-26 18:39:49 +03:00
Mikhail Glukhikh
35d85ddd1f Refactoring: "replace with operator assignment" is now an inspection 2017-12-26 18:39:49 +03:00
Mikhail Glukhikh
c995f70631 J2K processing: simplify (minor) 2017-12-26 18:39:48 +03:00
Mikhail Glukhikh
6b5aeaa9a6 J2K inspection-based processing: use more accurate isApplicable
Information level is taken into account in both base and pre-fix
isApplicable calls
2017-12-26 18:39:48 +03:00
Mikhail Glukhikh
ada7287c66 Refactoring: make "replace call with binary operator" an inspection 2017-12-26 18:39:48 +03:00
Mikhail Glukhikh
6d4b5bc48f Refactoring: "introduce when subject" is now an inspection 2017-12-26 18:39:48 +03:00
Mikhail Glukhikh
a8b01a6b00 Refactoring: make "if-then to safe access" an inspection 2017-12-26 18:39:47 +03:00
Mikhail Glukhikh
91bcfb97c6 Refactoring: make "replace get or set" an inspection 2017-12-26 18:39:47 +03:00
Mikhail Glukhikh
756cb32eaf Refactoring: make "replace array equality ..." an inspection 2017-12-26 18:39:47 +03:00
Mikhail Glukhikh
33d94cd5e1 J2kPostProcessing: add inspection-based processing #KT-21635 Fixed 2017-12-26 18:39:46 +03:00
Mikhail Glukhikh
67b78bce39 Introduce AbstractApplicabilityBasedInspection
Related to KT-21635, KT-21137
2017-12-26 18:39:46 +03:00
Nikolay Krasko
bf393505a9 More nullability update in selectors for compatibility in 181 2017-12-26 17:37:38 +03:00
Nikolay Krasko
e66e8bcd07 Use platform types to prepare for nullability check in 181 2017-12-26 17:08:11 +03:00
Joscha Alisch
809cc220ed Select lambda after other args when it's outside argument list (KT-21214)
#KT-21214 Fixed
2017-12-26 13:09:17 +03:00
Nikolay Krasko
976a158ce1 Support alternative source popup for Kotlin files (KT-21958)
#KT-21958 Fixed
2017-12-26 12:49:27 +03:00
Nikolay Krasko
449fee74e8 Skip all same line locations when stepping over inline call (KT-20351)
#KT-20351
2017-12-26 12:46:45 +03:00
Nikolay Krasko
f39250c9a2 Fix irrelevant additional stops on breakpoint on line with inlines (KT-21945)
#KT-21945 Fixed
2017-12-26 12:46:45 +03:00
Nikolay Krasko
f38a4f509d Minor: code rearrange 2017-12-26 12:46:45 +03:00
Nikolay Krasko
c5886bc7a2 Remove sleep() from soSuspendableCallInEndOfFun and guarantee suspending 2017-12-26 12:46:45 +03:00
Ilya Gorbunov
10639eaf6a Add pattern and options properties to common Regex
And add a test that accesses them and checks they work as expected.
2017-12-26 05:40:37 +03:00
Ilya Gorbunov
d9edc5f221 Replace Regex constructor-like functions with secondary constructors
Historically secondary constructors were not supported in Kotlin/JS, so they had to
be emulated with constructor-like top level functions, now they can be rewritten
as true secondary constructors.

#KT-22003 Fixed
2017-12-26 05:40:35 +03:00
Ilya Gorbunov
053f3b6ac0 Tests: use helper function to assert compile-time and run-time type check
To cleanup warnings about useless cast or type check that is always true.
2017-12-26 04:55:44 +03:00
Ilya Gorbunov
ecd42f14b3 Compile common stdlib tests against common stdlib
Declare platform-specific test utilities as expect.
2017-12-26 04:55:40 +03:00
Pavel V. Talanov
c030a047aa Fix getting ModuleResolver by element for script files
Fixes EA-105435 (some isntances)
JavaResolveExtension: refactor API
2017-12-25 20:12:51 +03:00
Pavel V. Talanov
2af0bf4c71 Drop JsProjectDetector
It leads to undesired behaviour
    such as returning library source when only binaries are queried
It is redundant since js libraries do not include kotlin source files
    (real binary format is used for this purpose for along time now)
2017-12-25 20:12:48 +03:00
Pavel V. Talanov
6551ee5403 Test completion in script files
Test for 'JavaResolutionUtils.getJavaDescriptorResolver' failing with AE
Tests ebd3ac6dc8
See EA-105435
2017-12-25 20:12:46 +03:00
Sergey Igushkin
149b197b24 Fix unconditional warning in JS compilation with sourceMap disabled. 2017-12-25 15:30:01 +03:00
Sergey Igushkin
66d3c94193 Fix both moduleFile and destination passed to the compiler
when it is run not in daemon from Gradle; don't pass the destination in
such case.

Issue #KT-21637 Fixed
2017-12-25 15:29:34 +03:00
Sergey Igushkin
00d7150944 Fix warning check in tests:
* Fix the regex that could not actually find warnings
* Suppress an unused parameter warning in the test project
* Add allWarningsAsErrors to ExecutionStrategyIT
2017-12-25 15:28:33 +03:00
Sergey Igushkin
41086f26ae Fix duplicate classpath entry in JS Gradle compilation causing warnings
Issue #KT-21943 Fixed
2017-12-25 15:15:54 +03:00
Nikolay Krasko
93e7e9b28c Minor: regenerate tests 2017-12-22 17:06:12 +03:00
Alexey Tsvetkov
d7edbb8dfc Track changes in inline function when friend paths are disabled in JS 2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
a4d122478b Replace testCancelLongKotlinCompilation with less flaky test 2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
ee94a64718 Explicitly request rebuild when untracked java file is removed
Previously a rebuild was happenning because FileNotFoundException
was thrown when getting psiFile of removed file.
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
61cb39a600 Include tests from incremental-compilation-impl in compiler tests 2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
50bf74b909 Turn off class redeclaration test for JS IC temporarily
So the tests could be run on TC.
Turn on after KT-19846 is fixed.
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
5b646ba4fa Generate source maps in JS IC tests
#KT-21700 fixed
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
0fee7883ed Recompile only files from last iteration after compile error 2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
3914c1b0e9 Allow to edit non-JPS build logs in "Show difference" window for non-JPS IC tests 2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
ff2e3ecfc4 Add JS specific IC build log in test
JS IC compares proto using a source file path as a key,
so moving file causes recompilation of its usages
unlike JVM IC that uses a class file path as a key.
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
7712044146 Fix IC test build log diverged from JPS
JPS marks dirty direct usages of removed classes since 172.* before a build.
Generic IC also marks dirty all subclasses and their usages.
That is necessary because a method from a removed class could be used
through a subclass.
JPS and generic IC logs diverged in 172 branch, but non-JPS tests
were not run on CI.
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
ad1978940b Recompile inline function usages in JS when offset is changed
Otherwise source maps would differ after rebuild
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
a31f503fa5 Recompile all subclasses of removed classes 2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
e8162cd99d Unify processing of removed files for JS and JVM IC 2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
d0ca0dca2b Avoid processing incremental changes after first build for JVM 2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
91bb57c5a3 Make general IC logs similar to JPS IC logs 2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
fec2d08d22 Compile actual and expected declarations together
#KT-20840 fixed
2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
123fd64a34 Fix stdlib usages in IC tests
* Use stdlib from dist
* Check that stdlib exists
* Don't add stdlib for JS, because compiler adds one by default
(stdlib would be read twice which is slow)
2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
e3a9ad5a74 Minor: remove unused variable 2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
dfe176efca Avoid computing source files changes in IC for Gradle 2017-12-22 16:12:19 +03:00
Nikolay Krasko
5a8c0f8f42 Minor: fix compile error in test data 2017-12-22 15:27:11 +03:00
Toshiaki Kameyama
9fad40b586 KT-21928 Structure view doesn't show default constructor 2017-12-22 15:27:10 +03:00
Dmitry Jemerov
3178dee759 Insert line break before elvis when converting if to elvis
This ensures correct indentation
2017-12-22 10:35:23 +01:00
Dmitry Jemerov
6208c69c72 Add option for wrapping closing paren in multiline if conditions 2017-12-22 10:35:23 +01:00
Dmitry Jemerov
7711f8e3a7 Add predefined code style for Kotlin style guide 2017-12-22 10:35:23 +01:00
Dmitry Jemerov
d69382f129 Don't apply indent on Enter after modifier list
#KT-9562 Fixed
2017-12-22 10:35:23 +01:00
Dmitry Jemerov
43ef113b7a Correctly apply annotation wrap before modifier keyword
#KT-20314 Fixed
2017-12-22 10:35:22 +01:00
Dmitry Jemerov
fa19bd6d9b Apply indent of continuation call start to its children
#KT-15099 Fixed
2017-12-22 10:35:22 +01:00
Dmitry Jemerov
5652fa762f Force no line break after dot in chained calls
#KT-20362 Fixed
2017-12-22 10:35:22 +01:00
Dmitry Jemerov
06fa61bb6f Line breaks in objects and lambdas don't trigger call paren wrapping
#KT-19727 Fixed
2017-12-22 10:35:22 +01:00
Dmitry Jemerov
79a509df7b Option to apply normal indent to children of 'if' expressions 2017-12-22 10:35:21 +01:00
Dmitry Jemerov
640bf22e4f Refactoring: extract 'continuationIf' method 2017-12-22 10:35:21 +01:00
Dmitry Jemerov
44ee228ac9 Don't wrap parentheses in long argument list containing only object 2017-12-22 10:35:21 +01:00
Dmitry Jemerov
a2175c2ef5 KotlinFormattingModelBuilder: J2K 2017-12-22 10:35:21 +01:00
Dmitry Jemerov
57844968b0 KotlinFormattingModelBuilder: rename to .kt 2017-12-22 10:35:20 +01:00
Mikhael Bogdanov
ea5505f80c Generate annotations in proper order in DefaultImpls 2017-12-22 10:02:04 +01:00
Mikhael Bogdanov
c9d0ab38cf Generate proper java parameter names for DefaultImpls
#KT-21919 Fixed
2017-12-22 10:02:04 +01:00
Alexander Podkhalyuzin
12a8048bf7 Fixed exception reporting in Kotlin plugin and IDEA releases 2017-12-22 11:33:36 +03:00
Sergey Igushkin
a88206c5ea (minor) Fix platform-dependent line separators in source maps test 2017-12-21 20:49:58 +03:00
Ilya Gorbunov
94a0e508d9 Use empty array instead of presized for Collection.toArray
#KT-21918
2017-12-21 20:10:28 +03:00
Alexander Podkhalyuzin
8203d1c3fe Extracted Kotlin.JVM IDE into separate module
This change is required to have possibility to build plugin against
minor IDEs, which don't have Java. So we want to extract idea-jvm
2017-12-21 18:34:02 +03:00
Alexander Podkhalyuzin
2bb02beb84 Do not report exceptions/errors in very specific case
In IDEA special property can be used for that, Kotlin plugin should honor that
2017-12-21 18:34:00 +03:00
Alexander Podkhalyuzin
5e21dc5560 Removed non ASCII char to reduce pain in compilation. 2017-12-21 18:34:00 +03:00
Ilmir Usmanov
c8904b1c7c Replace POP with ARETURN if it pops Unit and ARETURN shall return Unit
#KT-16880: Fixed
2017-12-21 18:08:39 +03:00
Toshiaki Kameyama
2cdc246a27 Inspection to highlight usages of Collections.sort() and replace them with .sort() method from Kotlin stdlib
#KT-11023 Fixed
2017-12-21 15:05:48 +01:00
Alexey Sedunov
4ac870500f Minor: Fix test data 2017-12-21 16:01:29 +03:00
Emmanuel Duchastenier
a8ddf03b53 README: IntelliJ IDEA 2017.3 is not early access anymore
update README.md with direct download link to IntelliJ IDEA latest version
2017-12-21 13:51:24 +01:00
Nikolay Krasko
e6aeb66875 Sort files according to given scope in debugger (KT-21931)
#KT-21931 Fixed
2017-12-21 15:46:28 +03:00
Nikolay Krasko
7c73356893 Early exit from getSourcePosition() for non-kotlin source files 2017-12-21 15:46:28 +03:00
Mikhael Bogdanov
50608d0844 Don't delete nested default lambda classes during inline transformation 2017-12-21 12:52:29 +01:00
Mikhael Bogdanov
b65dcf27ee Provide test source mapping data for separate and non-separate compilation
Compilation in same module or in separate ones
2017-12-21 12:52:28 +01:00
Mikhael Bogdanov
f4f7c83eeb Copy nested objects of default lambda during inline 2017-12-21 12:52:28 +01:00
Mikhael Bogdanov
3513f1a86a Properly process default lambda source mapping
#KT-21827 Fixed
2017-12-21 12:52:27 +01:00
Nicolay Mitropolsky
657123f2c0 LightClassUtil.extractPropertyAccessors refactoring to fix KotlinShortNamesCacheTest.testGetMethodsByNameWithCustomPropertyAccessors test
After light classes caching the test started to fail.
 Also refer Simon Ogorodnik.
2017-12-21 12:25:51 +03:00
Sergey Igushkin
710c726c9a Improve kapt arguments & javac options usability with Kotlin DSL
Issue #KT-21596 Fixed
2017-12-20 20:49:30 +03:00
Toshiaki Kameyama
411feab9ae KT-21698 Create interface shouldn't suggest to declare it inside a class which implements it 2017-12-20 18:14:55 +01:00
Vyacheslav Gerasimov
1deed28464 Add missing changelog for [1.2.20 - 1.1.60] versions 2017-12-20 19:10:26 +03:00
Pavel V. Talanov
aec893180e Minor, JvmAnalyzerFacade: drop logging
Prevent log spam
2017-12-20 17:19:09 +03:00
Dmitry Jemerov
78a87ac0cf Regenerate test 2017-12-20 15:03:25 +01:00
Mikhail Glukhikh
484bf0115f Fix "fake JVM field" inspection test XML 2017-12-20 16:31:10 +03:00
Kirill
7842fa4796 Support callable references in "implicit this" inspection
Second part of #KT-21510
2017-12-20 14:16:39 +03:00
Kirill
74e5a9425a Support callable references in "explicit this" inspection
So #KT-21510 Fixed
2017-12-20 14:16:33 +03:00
Dmitry Jemerov
d3adf57145 Don't apply highlighting to zero-length elements
#KT-19820 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
52ccfcecfc Fix highlighting of TODO calls in lambdas
#KT-19915 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
0159d19539 Apply rainbow highlighting in anonymous initializers
#KT-18839 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
94a7673c2d Don't show type hints for destructuring declarations with explicit type
#KT-21833 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
b0b69b2ad0 Put argument name hint before spread element
#KT-21645 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
c336159b2b Don't show argument name hints for dynamic calls.
Mark function descriptors created for dynamic calls as having
synthesized parameter names.

 #KT-21275 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
3e7e01dc4d Add mapOf() to default parameter name hints blacklist
#KT-18829 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
fd7aaa1579 Add single-arg 'assert' method to parameter name hints blacklist
#KT-17965 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
cf6b71aa05 Don't show type hint for local variable initialized with object
#KT-17964 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
77c186442a Don't show parameter name hints when calling Java methods with unknown
parameter names

 #KT-17843 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
6d63dd9d83 Enable "Configure Kotlin plugin updates" with no open project
#KT-20380 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
1a9d2ab4ee Fix name of inspection description file 2017-12-20 11:56:04 +01:00
kenji tomita
3cd4d90bf8 Use BodyResolveMode.PARTIAL and ProblemHighlightType.GENERIC_ERROR_OR_WARNING 2017-12-20 11:56:04 +01:00
kenji tomita
37351c344f code style inspection: to -> Pair function used not in infix form 2017-12-20 11:56:04 +01:00
Mikhail Glukhikh
41739602bc Inline handler: fix reference detection for properties 2017-12-20 13:54:36 +03:00
Mikhail Glukhikh
ce441e2163 Extract common class from two KotlinInline<...>Dialogs #KT-17212 Fixed 2017-12-20 13:54:30 +03:00
Mikhael Bogdanov
3e1f471121 Rollback change in 'usesDefaultArguments' 2017-12-20 10:58:35 +01:00
Mikhael Bogdanov
32b90a1cae Generate type checker barriers in bridges 2017-12-20 10:48:52 +01:00
Mikhael Bogdanov
be18cb9b16 Fix default methods visibility 2017-12-20 10:48:51 +01:00
Mikhael Bogdanov
9365d1d859 Remove redundant extra default mask for function with N*32 parameters 2017-12-20 10:48:51 +01:00
Mikhael Bogdanov
ef5c3512cd Skip FAKE_OVERRIDE fields 2017-12-20 10:48:50 +01:00
Mikhael Bogdanov
aeb74f7e70 Skip bridge generation for non real declaration on first step they would be processed later
~

~
2017-12-20 10:48:50 +01:00
Mikhael Bogdanov
4657ae06f4 Don't cast receiver to super type on super calls 2017-12-20 10:48:49 +01:00
Mikhael Bogdanov
a936f75423 Fix empty vararg processing in intrinsics 2017-12-20 10:48:49 +01:00
Mikhael Bogdanov
420b9fdaa9 Support interface companion object lowering 2017-12-20 10:48:48 +01:00
Mikhael Bogdanov
24336113a2 Support class companion object lowering 2017-12-20 10:48:48 +01:00
Mikhael Bogdanov
224adfabc5 Support synthetic accessors for constructors 2017-12-20 10:48:47 +01:00
Mikhael Bogdanov
5cbfdf6024 SyntheticAccessorLowering refactoring 2017-12-20 10:48:47 +01:00
Mikhael Bogdanov
7da847e943 Fix coercion after call 2017-12-20 10:48:46 +01:00
Mikhael Bogdanov
4df0a1bb1f Fix parameter indices on lowering 2017-12-20 10:48:46 +01:00
Mikhael Bogdanov
0729566458 Support javaClass for Void type 2017-12-20 10:48:45 +01:00
Mikhael Bogdanov
f7968e1b61 Fix inner class lowering: don't try to process nested classes on processing outer 2017-12-20 10:48:45 +01:00
Mikhael Bogdanov
dde0535c5a Fix cast for IMPLICIT_NOTNULL 2017-12-20 10:48:44 +01:00
Mikhael Bogdanov
05b56b0c4a Update ArrayConstructor to support inline 2017-12-20 10:48:44 +01:00
Mikhael Bogdanov
665a697093 Support simple function inlining in ir 2017-12-20 10:48:43 +01:00
Mikhael Bogdanov
54dc828c8e Rename ExpressionLambda to PsiExpressionLambda 2017-12-20 10:48:43 +01:00
Mikhael Bogdanov
0e2bd46124 Remove cycle check and resolvedCall from 'preformInline' method 2017-12-20 10:48:42 +01:00
Mikhael Bogdanov
4711e2f9da Don't use kind for static check
Lowers should perform proper transformations
2017-12-20 10:48:42 +01:00
Mikhael Bogdanov
3432014971 Add 'generateModule' method to CodegenFactory 2017-12-20 10:48:41 +01:00
Mikhael Bogdanov
06fd996266 Switch LocalFunctionLowering to LocalDeclarationLowering 2017-12-20 10:48:41 +01:00
Mikhael Bogdanov
1f053be289 Support default function lowering 2017-12-20 10:48:40 +01:00
Mikhael Bogdanov
83710a8ed6 HACK: process unbound symbols 2017-12-20 10:48:40 +01:00
Mikhael Bogdanov
5032064bf0 Enable tailrec lower 2017-12-20 10:48:39 +01:00
Mikhael Bogdanov
84e960b3a4 Enable lateinit lowering 2017-12-20 10:48:39 +01:00
Mikhael Bogdanov
039e036e22 Support IrExpressionBody in codegen 2017-12-20 10:48:38 +01:00
Mikhael Bogdanov
4017195ff1 Always include stdlib in IrTests 2017-12-20 10:48:38 +01:00
Mikhael Bogdanov
e16bdd4287 Switch JvmBackendContext to CommonBackendContext
(cherry picked from commit 5d4736c)
2017-12-20 10:48:37 +01:00
Nikolay Krasko
f963b8bd42 Fix QuickFixTestGenerated$DeprecatedSymbolUsage$TypeAliases
Revert asking super isAvailable in DeprecatedSymbolUsageInWholeProjectFix
2017-12-20 12:27:36 +03:00
Nikolay Krasko
b80403cf13 Consistency for replace string quick fix message
https://youtrack.jetbrains.com/issue/KT-21746#comment=27-2634335
2017-12-20 12:27:36 +03:00
Vyacheslav Gerasimov
95cc3fe1b7 Fix availability of AddFunctionParametersFix
fixes RenameTestGenerated.testAutomaticVariableRenamerWithQuotation_AutomaticVariableRenamerWithQuotation
2017-12-19 21:23:38 +03:00
Nicolay Mitropolsky
bb4d6d1059 LightClassEqualsTest fix by creating lightclasses with createNoCache 2017-12-19 20:03:59 +03:00
Nicolay Mitropolsky
4c5cf0f7e7 *kapt3-idea* added to test-dependencies in *uast-kotlin* 2017-12-19 18:22:14 +03:00
Mikhael Bogdanov
ef433d163e Apply common header directives to second file in AbstractCompileKotlinAgainstKotlinTest 2017-12-19 16:11:39 +01:00
Mikhael Bogdanov
819a3a95b3 Add support for contract feature in inliner 2017-12-19 16:11:39 +01:00
Pavel V. Talanov
4890979476 ScriptDefinitionsManager: ignore reloadDefinitionsBy calls
If definitions are not loaded yet
2017-12-19 17:15:39 +03:00
Pavel V. Talanov
106f571814 scriptTemplatesFromCompilerSettings: fix ScriptDefinitionsManager access
#KT-21545 Fixed
2017-12-19 17:15:36 +03:00
Mikhail Glukhikh
4bff0fb338 Unused symbol: revert entry point check optimization to fix regression
E.g. JUnit 3 tests was highlighted as unused after it
2017-12-19 15:59:30 +03:00
Mikhail Zarechenskiy
9eca8cd451 [NI] Fix hierarchy of resolution atoms for lambda with non-local return 2017-12-19 15:11:04 +03:00
Mikhail Zarechenskiy
c6d8b39b4f [NI] Prioritize type variables related to output type for fixation 2017-12-19 15:11:04 +03:00
Mikhail Zarechenskiy
d818af5287 [NI] Don't forget to analyze whole block for last postponed expression 2017-12-19 15:11:03 +03:00
Anton Bannykh
8ed8e05a68 JS: honor ignoreTestFailures flag and report failures to TC (KT-20735
fixed)
2017-12-19 14:38:15 +03:00
Alexey Sedunov
0ab924a298 Change Signature: Fix overrider search for suspend functions
#KT-21288 Fixed
2017-12-19 13:47:02 +03:00
Alexey Sedunov
b5bd5942e7 Kotlin Facet: Do not auto-advance version in imported projects
#KT-21879 Fixed
2017-12-19 13:47:02 +03:00
Alexey Sedunov
88540360b4 Misc: Fix NPE on external project import 2017-12-19 13:47:02 +03:00
Nicolay Mitropolsky
4a6cc3913d Fix for "safe delete" after caching added to light elements 2017-12-19 13:32:23 +03:00
Alexey Tsvetkov
18fae9e16d Allow override removing temporary module files after build
For debug purposes
2017-12-18 21:19:15 +03:00
Alexey Tsvetkov
5bffef6de7 Allow customizing directory for temporary module files 2017-12-18 21:19:15 +03:00
Alexey Tsvetkov
37b00b91fc Avoid generating too long path for temp module file
#KT-21841 fixed
2017-12-18 21:19:15 +03:00
Toshiaki Kameyama
a4fbe95112 KT-21770 Pasting into an interpolated string shouldn't escape $ 2017-12-18 18:25:43 +01:00
Toshiaki Kameyama
eb25ac44e6 KT-17928 Support code folding for primary constructors 2017-12-18 18:14:27 +01:00
Dmitry Jemerov
18cb9593c8 Add 'reformat' flag to DeprecatedSymbolUsageFixBase 2017-12-18 18:10:36 +01:00
Dmitry Jemerov
48021ce5a1 Disallow formatting in KotlinQuickFix.isAvailable() 2017-12-18 18:10:34 +01:00
Dmitry Jemerov
64f01e53af Check that add() method is in fact MutableCollection.add()
#KT-18881 Fixed
2017-12-18 18:10:33 +01:00
Dmitry Jemerov
94b8614fb8 Don't suggest mapTo() transformation over range literals
#KT-18816 Fixed
2017-12-18 18:10:32 +01:00
Dmitry Jemerov
09d27ca61c Don't generate .forEach { return } when converting loop to call chain
#KT-17161 Fixed
2017-12-18 18:10:31 +01:00
Dmitry Jemerov
b775b901cc Fix incorrect replacement with 'any' instead of 'all'
#KT-17730 Fixed
2017-12-18 18:10:24 +01:00
Dmitry Jemerov
ba4cf4dcc6 Delete unused class 2017-12-18 18:10:21 +01:00
Dmitry Jemerov
d0a8dd7dc8 Update EAP channel names in plugin update check dialog 2017-12-18 18:10:14 +01:00
Ilya Chernikov
3e2003e60d Do not log daemon connection errors as exceptions - may reduce number of ...
redundant report if the problem is corrected on retry

(cherry picked from commit 260fe36)
2017-12-18 17:08:15 +01:00
Ilya Chernikov
f83dc0a067 Make daemon session retrieval more robust to the daemon failures 2017-12-18 16:49:53 +01:00
Ilya Chernikov
1101bb7fb4 Treat "daemon is dying" state as a case for fallback compilation strategy in jps 2017-12-18 16:49:52 +01:00
Ilya Chernikov
6e34f57acf Retry socket connection on connection errors, number of retries and...
retry interval are configurable via the system props
2017-12-18 16:49:51 +01:00
Ilya Chernikov
1cd14f00eb Ignore connection error on the (optional) daemon.clearJarCache call
May fix issues with NoSuchObjectException and UnmarshalException - the
stacktraces often point to this place
2017-12-18 16:49:50 +01:00
Mikhail Glukhikh
0d64ab4846 Fix corner cases (override/script/null/etc.) in "might be const"
Related to KT-20644
2017-12-18 17:23:41 +03:00
Alexey Tsvetkov
3f082346ae Do not set api version to language version when language version is null
#KT-21852 fixed
    #KT-21574 fixed
2017-12-18 16:22:07 +03:00
Dmitry Petrov
17b4d4a973 Differentiate accessors by FieldAccessorKind
Otherwise accessors for backing fields (as in '{ field }') clash with
accessors for properties (as in '{ prop }').

 #KT-21258 Fixed Target versions 1.2.30
2017-12-18 16:15:52 +03:00
Ilya Gorbunov
d8cd926a8c Do not leak primitiveness of an array wrapped with asList
A primitive array wrapped in a List with asList had incorrect implementation of toArray method:
while it declares that an object array is returned, it returned a primitive array.
Therefore the methods such as `Collection.toTypedArray()` and its dependents
`ArrayList(collection)`, `Collection + Iterable` might behave incorrectly
having relied on `toTypedArray` returned an object array.

#KT-21828 Fixed
2017-12-18 15:50:15 +03:00
Sergey Igushkin
c55f08a166 Optimize embeddable JARs
Exclude the compiler dummy JAR from the resulting shadow JAR
2017-12-18 15:46:23 +03:00
Alexander Udalov
3a807cb39b Support Void.TYPE as underlying Class object for KClass
#KT-20875 Fixed
2017-12-18 11:57:05 +01:00
Anton Bannykh
46a631a654 Ignore license in the downloaded node_modules and nodejs 2017-12-18 13:46:25 +03:00
Yan Zhulanow
1692d1a087 Kapt: Add missing 'flush()', otherwise the serialized data can be empty 2017-12-18 18:57:38 +09:00
Nikolay Krasko
f67eb90dfb Don't show file root if it's same as the only declaration (KT-21200)
#KT-21200 Fixed
2017-12-18 11:50:50 +03:00
Nikolay Krasko
a3028beca9 Fix smart step into to Kotlin SAM adapter (KT-21538)
#KT-21538 Fixed
2017-12-18 11:50:49 +03:00
Denis Zharkov
adfee2086a Update bootstrap to 1.2.20-dev-814 2017-12-16 18:56:26 +03:00
Yan Zhulanow
d4be55df0e Kapt, Minor: Fix empty option parsing 2017-12-16 02:17:24 +09:00
Simon Ogorodnik
7c5897c1ab Skip deprecated for org.junit package in kotlin.test 2017-12-15 20:09:51 +03:00
Simon Ogorodnik
c2e706db6c Enable generation of docs for deprecated declarations 2017-12-15 20:09:49 +03:00
Simon Ogorodnik
c5c52dbda5 Fix annotations docs for kotlin.test 2017-12-15 20:09:48 +03:00
Simon Ogorodnik
430aad3651 Set LV = 1.2 in Dokka for generating stdlib docs 2017-12-15 20:09:47 +03:00
Simon Ogorodnik
3c78156f0f Suppress kotlin.reflect.jvm.internal 2017-12-15 20:09:46 +03:00
Simon Ogorodnik
fb3cf212ce Suppress docs for org.junit.Test header in kotlin.test 2017-12-15 20:09:45 +03:00
Simon Ogorodnik
99951db7e3 Add module docs for kotlin.test 2017-12-15 20:09:44 +03:00
Simon Ogorodnik
978a7fdfaa Add stdlib to kotlin.test docs classpath 2017-12-15 20:09:43 +03:00
Simon Ogorodnik
773fca5245 Use correct task to build builtins.jar 2017-12-15 20:09:42 +03:00
Simon Ogorodnik
640ce213cf Compile stdlib builtins ant pass it to Dokka
We need builtins to allow linking to type-aliased classes
such as Exception
2017-12-15 20:09:41 +03:00
Simon Ogorodnik
697b358293 Make local dokka run easier 2017-12-15 20:09:40 +03:00
Simon Ogorodnik
9ab48d8374 Suppress whole org.w3c 2017-12-15 20:09:38 +03:00
Simon Ogorodnik
99af2372c3 Suppress undocumented warnings for third-party js packages 2017-12-15 20:09:37 +03:00
Simon Ogorodnik
17106d6546 Use makeurl to create package-list URL in ant 2017-12-15 20:09:36 +03:00
Ilya Gorbunov
cc139856c8 List all source folders instead of project folder 2017-12-15 20:09:34 +03:00
Ilya Gorbunov
9b1867ce64 Docs: run gradle project and wrapper from the root dir
Build docs for kotlin-stdlib-jdk7/8 instead of jre7/8.
2017-12-15 20:09:33 +03:00
Simon Ogorodnik
a19e229a72 Minor: prepare for documentation generation 2017-12-15 20:09:32 +03:00
Ilya Chernikov
775eeb75c9 Treat daemon startup timeout/error exceptions the same way as RMI errors
will result on regular retry cycle on them, hopefully eliminating or
reducing appropriate exception reports
2017-12-15 15:24:38 +01:00
Mikhail Glukhikh
ea5a52f918 Restrict search scope in some inspections to avoid testData search
Affected inspections: can be private, can be parameter, unused symbol.
Related to KT-21756. May fix EA-113712.
2017-12-15 17:07:37 +03:00
Mikhail Glukhikh
2b5bbf0fdd Fix tests for "may be constant" inspection 2017-12-15 17:07:35 +03:00
Sergey Igushkin
3b4f82c9b9 Advance Gradle version -> 4.4
(cherry picked from commit 2fc7628)
2017-12-15 16:59:37 +03:00
Nikolay Krasko
6456f4ed98 Test step into for Java constructor with SAM conversion
Additional test for KT-21538

 #KT-21538 Fixed
2017-12-15 16:14:50 +03:00
Nikolay Krasko
d6cface66f Make isFromJava check work for SAM adapter extension descriptors (KT-21538)
Consider all callable descriptor in JavaClassDescriptor to be from Java.

This is used to check if smart step into should be intercepted by Kotlin
handler or delegated to Java.

 #KT-21538 Fixed
2017-12-15 16:14:50 +03:00
Nikolay Krasko
26413acf33 Refactoring: introduce method for reuse file for single class logic 2017-12-15 16:14:50 +03:00
Nikolay Krasko
5c33e4a32d Minor: remove warnings in KotlinStructureViewFactory 2017-12-15 16:14:49 +03:00
Nikolay Krasko
c79386594d Don't show useless fold icon in structure view (KT-17254, KT-21200)
#KT-21200 In Progress
 #KT-17254 Fixed
2017-12-15 16:14:49 +03:00
Nikolay Krasko
1688f6fdbd Minor: inline method in KotlinStructureViewElement and rewrite with when 2017-12-15 16:14:49 +03:00
Nikolay Krasko
7bf071b69f Precount 'isPublic' property if descriptor available 2017-12-15 16:14:49 +03:00
Nikolay Krasko
c28a7d8f6d Fix structure view auto-update (KT-21733, KT-19519)
- Fixed by subclassing PsiTreeElementBase instead of StructureViewTreeElement
- Warnings cleanup

 #KT-19519 Fixed
 #KT-21733 Fixed
2017-12-15 16:14:48 +03:00
Nikolay Krasko
b133189309 Rename: MyFunctionDescriptor -> SamAdapterExtensionFunctionDescriptorImpl 2017-12-15 16:14:48 +03:00
Toshiaki Kameyama
d719d06020 Don't suggest "convert to array literal" for *arrayOf #KT-21726 Fixed 2017-12-15 15:01:22 +03:00
Anton Bannykh
f68d639c63 Add @Target's to kotlin.test annotations 2017-12-15 14:14:00 +03:00
Toshiaki Kameyama
5680405531 "Redundant spread operator" inspection: support array literal
So #KT-21727 Fixed
2017-12-15 13:50:53 +03:00
Mikhail Glukhikh
df4bf73033 Convert lambda to reference: minor cleanup 2017-12-15 13:37:00 +03:00
Toshiaki Kameyama
0071ca64c7 Convert lambda to reference produces: fix case with qualified this
So #KT-19977 Fixed
2017-12-15 13:36:32 +03:00
Mikhail Glukhikh
50dc9a14a6 May be constant: fix corner case with getter & initializer 2017-12-15 13:31:49 +03:00
Mikhail Glukhikh
7358980cbc Add inspection to detect non-const vals used as Java annotation args
So #KT-20615 Fixed
2017-12-15 13:31:41 +03:00
Mikhail Glukhikh
70b7e5eb68 Introduce inspection to detect vals might be marked as const
So #KT-20644 Fixed
2017-12-15 13:05:50 +03:00
Yan Zhulanow
4ec20ad595 Minor: Fix build, remove inline function usage 2017-12-15 17:39:17 +09:00
Nicolay Mitropolsky
da98b7e07b Uast: type-mapper checks deeper for local classes (KT-21546, EA-100195) 2017-12-15 09:16:46 +03:00
Yan Zhulanow
f9813e3276 Kapt, Minor: Add kapt-runtime to sources for kotlin-annotation-processing-maven 2017-12-15 02:35:17 +09:00
Yan Zhulanow
187182e46f Noarg, Minor: Include IDEA 'testRuntime' dependency as in other compiler plugins 2017-12-15 02:35:16 +09:00
Yan Zhulanow
db4c441573 Kapt, Maven: Fix path for kapt3 compiler plugin sources 2017-12-15 02:35:16 +09:00
Yan Zhulanow
4d067ab9ce Kapt, Maven: Support passing javac/annotation processor options (KT-21565, KT-21566) 2017-12-15 02:35:15 +09:00
Yan Zhulanow
1af93b8342 Kapt: Consider all 'kapt' configuration dependencies as KaptTask dependencies. 2017-12-15 02:35:14 +09:00
Yan Zhulanow
6941065e2c Fix EA-1005833: Try to find a field using also the receiver type (KT-21820) 2017-12-15 02:35:13 +09:00
Yan Zhulanow
d58665b5a8 Kapt: Remove duplicating check, this also removes the senseless warning (KT-21425) 2017-12-15 02:35:12 +09:00
Yan Zhulanow
4c96453a4b Kapt: Annotations on enum constants are not kept on the generated stub (KT-21433) 2017-12-15 02:35:12 +09:00
Yan Zhulanow
c6f922fb64 EA-110813: Resolve the parent directory safely 2017-12-15 02:08:03 +09:00
Yan Zhulanow
e5a2be4f3c EA-96041: Make error message more user-friendly 2017-12-15 02:08:00 +09:00
Denis Zharkov
fa6285d32a Fix NPE in JavaNullabilityChecker when checking equals-calls
This NPE was introduced in ce41b5745a
Prior to the latter change there was a synthetic PSI element for each
equals-related call, thus callOperationNode was not null here.

== are intentionally treated as safe calls, but for nullability checker
it's not relevant, it only should report warnings on real safe-calls
2017-12-14 19:15:41 +03:00
Denis Zharkov
d64e8e3b33 Revert "Update bootstrap to 1.2.20-dev-732"
This reverts commit f7ccc4144c.
2017-12-14 19:15:41 +03:00
Nicolay Mitropolsky
6ac345df51 Caching KtLightClassForSourceDeclaration (KT-21701)
to make their UserData survive for longer, because otherwise a new LightClass with empty UserData comes to Spring every time, but Spring stores a lot of important things in UserData
2017-12-14 18:05:47 +03:00
Anton Bannykh
6bee5699a0 Migrate node_utils.xml to Gradle 2017-12-14 17:41:20 +03:00
Dmitry Jemerov
40184f053e Don't invoke formatter while checking availability of intentions
#KT-21632 Fixed
2017-12-14 12:02:39 +01:00
Dmitry Jemerov
54d626fe7d Change vendor to JetBrains to always enable exception reporting
#KT-17838 Fixed
2017-12-14 12:02:39 +01:00
Dmitry Jemerov
ba21bae653 Get rid of forced index rebuild on version change
#KT-17367 Fixed
2017-12-14 12:02:39 +01:00
Denis Vnukov
52ccd67ec1 Remove duplicate parameter null checks in JvmStatic delegate methods.
Remove unnecessary non-null parameter checks inside static delegate methods
created for @JvmStatic companion object methods. Allows function generation
strategy decide if such checks need to be injected.

 #KT-7188 Fixed
2017-12-14 13:48:50 +03:00
Alexander Udalov
9e82ab38f0 Fix lookup tracker tests after 2be7116b0b
Standard library is no longer automatically added to the classpath when
-Xbuild-file is used. Before 2be7116b0b, these tests worked because no
matter whether -Xbuild-file was used or not, the automatically computed
classpath (which erroneously was used to populate content roots in the
compiler) contained the standard library (see
K2JVMCompiler.configureContentRoots)
2017-12-14 11:37:56 +01:00
Alexander Udalov
46fa5cfae0 Add dependency on compiler dist from jps-tests
Otherwise, because there's no explicit dependency and the JPS plugin
loads the compiler from dist, the compiler jar is not rebuilt between
changes in compiler code and running jps-tests
2017-12-14 11:37:56 +01:00
Yan Zhulanow
5116f598df Kapt: Fix error message when no annotation processors were found (KT-21729)
Error message says "androidProcessor", it should be "annotationProcessor"
2017-12-14 19:28:51 +09:00
Denis Zharkov
f7ccc4144c Update bootstrap to 1.2.20-dev-732 2017-12-14 11:11:23 +03:00
Dmitry Petrov
1aab4e643c Add overflow-related tests for 'reversed' 2017-12-14 10:41:51 +03:00
Dmitry Petrov
65b5cdbb8d Maintain bounds evaluation order in intrinsics for 'reversed'
Makes sense for 'rangeTo', 'downTo', and 'until' with non-const bounds.
2017-12-14 10:41:51 +03:00
Dmitry Petrov
9fa9a8748b Check that qualified const expressions are recognized properly in 'for' 2017-12-14 10:41:51 +03:00
Dmitry Petrov
bf97b332cf Support const-bounded for loop generation for reversed 'until' 2017-12-14 10:41:51 +03:00
Dmitry Petrov
54cceac99b Intrinsics for 'reversed': until 2017-12-14 10:41:51 +03:00
Dmitry Petrov
5f7460a8c7 Support const-bound counter loop generation for 'downTo' 2017-12-14 10:41:51 +03:00
Dmitry Petrov
2f0df832c0 Minor: pull up helper methods for const-bounded for-in-range generation 2017-12-14 10:41:51 +03:00
Dmitry Petrov
a4c29b3587 Support Long and Char in const-bounded counter loop generation
If the loop end value is a compile-time constant (best we can do now),
and it is safe to iterate over a given range using "naive" for loop
(using '<=' or '>=' in loop condition),
generate such loops for Longs and Chars as well Ints (Bytes, Shorts).
2017-12-14 10:41:51 +03:00
Dmitry Petrov
df2b8d01d8 Extract common code in PrimitiveNumberRangeLiteralRangeValue 2017-12-14 10:41:51 +03:00
Dmitry Petrov
455a1c0f53 Intrinsics for 'reversed': downTo
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
64ba811b7f Intrinsics for 'reversed': CharSequence.indices
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
7ba73c1635 Intrinsics for 'reversed': collection.indices
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
5bcbe25469 Intrinsics for 'reversed': array.indices
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
beff4a1b92 Intrinsics for 'reversed': support non-literal range expressions
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
1493805f8e Take into account step sign in pre-condition for simple progression
So far, all non-end-inclusive progressions had step > 0.
With intrinsics for 'reversed' this will change.
2017-12-14 10:41:51 +03:00
Dmitry Petrov
821843e13f Intrinsics for 'reversed': generate in-const-bound ranges as countable
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
1775f294f4 Intrinsics for 'reversed': infrastructure & primitive range support
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Mikhail Glukhikh
83ae34bb29 Fix leak in matchAndConvert (loopToCallChain) 2017-12-14 10:38:28 +03:00
Ilya Gorbunov
479f293edc Expose internal getProgressionLastElement to public api
To be used in compiler loop optimizations.
#KT-18869 Fixed
2017-12-14 07:22:08 +03:00
Ilya Chernikov
c453ff01cd Increase daemon socket queue size, make it controllable via system prop
Hopefully fixes #KT-15562
Also some minor refactoring
2017-12-13 17:34:13 +01:00
Ilya Chernikov
8f42aa1eda Improve parallel daemon start test:
- move asserts to the end to collect all diagnostics before it
  - disable compilation by default for better testing the startup logic
  - minor refactorings
2017-12-13 17:34:12 +01:00
Alexander Udalov
c5c4c9cfcc Support "-module-name" argument for common code compiler
#KT-20892 Fixed
2017-12-13 11:49:58 +01:00
Alexander Udalov
3ede503042 Minor, remove empty K2JSCompilerArguments.java 2017-12-13 11:49:58 +01:00
Alexander Udalov
cc9ebb26de Minor, improve "-module-name" argument description 2017-12-13 11:49:58 +01:00
Alexander Udalov
dc23a53116 Enumerate module roots directly in ModuleHighlightUtil2.getModuleDescriptor
This is faster than going through FilenameIndex which would call
GlobalSearchScope.accept for all "module-info.java" files in the
project, and there can be many of those.

Also see https://github.com/JetBrains/intellij-community/pull/670
2017-12-13 11:49:51 +01:00
Alexey Sedunov
38d3362bcb Configuration: Support selection of "Latest stable" version vs specific one
#KT-21229 Fixed
2017-12-12 20:48:26 +03:00
Mikhail Glukhikh
5252cd4da4 Lift return or assignment: use register...WithoutOfflineInformation 2017-12-12 19:47:52 +03:00
Mikhail Glukhikh
a375500a33 Spelling: MemberVisibilityCanPrivate > MemberVisibilityCanBePrivate 2017-12-12 19:47:46 +03:00
Dmitry Jemerov
db8147bd79 Regenerate test 2017-12-12 17:13:35 +01:00
Denis Zharkov
e24e711208 Avoid rebuilds after changes of layouts xml-files
This commit makes IC react more granularly on these changes
Precisely, it marks dirty only kt-files that having lookups into
synthetic package built upon a changed layout-file

 #KT-21622 Fixed
2017-12-12 16:17:58 +03:00
Denis Zharkov
58123f2103 Enable kotlin.incremental.usePreciseJavaTracking in gradle.properties 2017-12-12 16:17:58 +03:00
Denis Zharkov
a079b92ea0 Add property for precise version of Java tracking in Gradle IC
The flag name is kotlin.incremental.usePreciseJavaTracking
By default precise version is disabled

 #KT-17621 Fixed
2017-12-12 16:17:58 +03:00
Denis Zharkov
a978c6be35 Fix precise Java IC for multi-module projects
The problem may happen in case of multi-module projects:
If a Java class was effectively unused in one module (A),
but it's used in kt-files from the dependent module (B) then
we wouldn't track the changes of the class while compiling A
and don't recompile its usages in B.

It happens because now we track only Java classes that were
resolved by out frontend instead of all classes in the module
that would be more correct but it might be rather slow.

The idea is that whenever we see change in an untracked Java file
we start tracking the classes in it and for the first time we mark
all its content as changed.
2017-12-12 16:17:58 +03:00
Denis Zharkov
d9cfdf2f63 Add assertion to JavaClassesTrackerImpl::onCompletedAnalysis 2017-12-12 16:17:58 +03:00
Denis Zharkov
8dd5c2f895 Avoid serlialization for unrelated Java source-based classes
There is no need to track unknown (not being tracked before)
classes content of which we didn't request

 #KT-17621 Fixed
2017-12-12 16:17:58 +03:00
Denis Zharkov
f33255c990 Add jetbrains annotations to javac classpath in IncrementalJvmCompilerRunnerTest
Before this change some of these tests were failing
2017-12-12 16:17:58 +03:00
Denis Zharkov
df533053f9 Record special name lookup when trying use interface as a SAM
It was already working in JPS, because it see our synthetic classes
as subclasses for SAM's, but with non-JPS build we have to manually
tracking places that should be recompiled after SAM members are changed
2017-12-12 16:17:58 +03:00
Denis Zharkov
ae6421476d Refine dirty files computation in case of Java source changes
#KT-17621 In Progress
2017-12-12 16:17:58 +03:00
Denis Zharkov
26393d738f Drop IncrementalCompilerRunner::markDirty and its override 2017-12-12 16:17:58 +03:00
Denis Zharkov
1702775738 Introduce JavaClassesSerializerExtension
It will be used to track java classes changes for incremental compilation

 #KT-17621 In Progress
2017-12-12 16:17:58 +03:00
Denis Zharkov
c86dc0d7af Add protobuf extensions to serialized Java descriptors
#KT-17621 In Progress
2017-12-12 16:17:58 +03:00
Denis Zharkov
34452f4f4a Introduce JavaClassesTracker interface into java resolution components
It's purpose is passing java classes being used during analysis
to incremental compilation to let it track diffs

Potentially it might be done the other way:
incremental compilation could build a separate container to analyze
necessary classes, but it's rather hard to implement now

 #KT-17621 In Progress
2017-12-12 16:17:58 +03:00
Alexey Sedunov
9ed0b49746 Gradle: Compile Gradle models/model builders under JVM 1.6
This prevents imports failure in projects using older versions of Gradle

 #KT-21610 Fixed
2017-12-12 15:38:40 +03:00
Dmitry Petrov
a1a1972a04 Provide DescriptorUtils.isAnonymousFunction (for IR-based BE) 2017-12-12 15:29:45 +03:00
Anton Bannykh
0566366895 Make project wizards produce kotlin-test-js testDependency in all Kotlin/JS projects 2017-12-12 14:25:24 +03:00
Alexander Udalov
3c98274006 Move -Xjsr-305 argument parsing out of K2JVMCompilerArguments
To simplify K2JVMCompilerArguments, which is mostly a data holder
2017-12-11 18:02:37 +01:00
Alexander Udalov
5092758acb Improve help message on -Xjsr305 CLI argument 2017-12-11 18:02:04 +01:00
Dmitry Jemerov
900ec82614 Fix indent of expressions following elvis operator 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
87d2d16cda "Use continuation indent for expression body" for prop initializers 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
eacd010e7e Option to wrap elvis expressions
#KT-21720 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
d1daca2560 No line break before = in property initializer and function expr body 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
ab99bf843a Implement option for wrapping assignment statements
#KT-21718 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
947833cad6 Add wrap option for expression body functions
#KT-21470 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
3394d675e5 Option to use continuation indent in argument lists 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
3038f87105 Move two continuation indent wrapping options to wrapping page 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
dc4e673fb1 Initial support for chained call wrapping options
#KT-21529 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
1a93d10697 Refactoring: use more specific block type in signatures 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
3233d650c1 Refactoring: cleanup access to code style settings 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
ff99b921b7 Refactoring: work with ASTNodes in functional style 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
389729cc50 Option for normal indent in supertype lists
#KT-21527 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
67cd4ed17a Don't indent closing parenthesis in conditions
#KT-21485 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
26d47a034e Don't indent closing parenthesis of a destructuring declaration
#KT-20758 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
4068b3d9b9 Add continuation indent for wrapped type aliases
#KT-21078 Fixed

fixup type alias
2017-12-11 17:58:02 +01:00
Nikolay Krasko
1ada284a03 Better folding for mulitline strings (KT-21441)
#KT-21441 Fixed
2017-12-11 18:28:01 +03:00
Nikolay Krasko
ab7ba3ae46 Add exit point highlighting for accessors (KT-21318)
#KT-21318 Fixed
2017-12-11 18:28:00 +03:00
Alexey Andreev
93f8542fc4 JS: serialize location of JsCase/JsDefault
See KT-21699
2017-12-11 17:20:15 +03:00
Alexey Andreev
25e56874c1 JS: readable error when source maps change in IC tests 2017-12-11 17:20:15 +03:00
Alexey Tsvetkov
c13b2a6bbc Test incremental recompilation of enum usage in JS 2017-12-11 17:20:14 +03:00
Andrey Mischenko
e1dbb90fdd KT-21729 Error message says "androidProcessor" should be "annotationProcessor" 2017-12-11 09:29:06 +08:00
Toshiaki Kameyama
4563cf250d "Add type" quick fix incorrectly processes vararg modifier with primitive type array initializer #KT-21544 Fixed 2017-12-08 15:46:45 +01:00
Dmitry Jemerov
846e50dcaa Wording fix 2017-12-08 15:44:18 +01:00
Toshiaki Kameyama
270b41dc66 KT-13378 Provide ability to configure highlighting for !! in expressions and ? in types 2017-12-08 15:44:18 +01:00
Dmitry Jemerov
ab619c5655 Improve wording; mark inspection as cleanup tool 2017-12-08 15:41:22 +01:00
Toshiaki Kameyama
0e2bdf8995 Add inspection to sort modifiers #KT-21560 Fixed 2017-12-08 15:41:22 +01:00
Alexander Udalov
2be7116b0b Deduplicate classpath roots in compiler when -Xbuild-file is used
In kotlin-gradle-plugin, the compiler is invoked with a
K2JVMCompilerArguments instance where both the classpath is set, and the
buildFile is used (containing the same classpath entries in XML).
Previously, the compiler concatenated those two classpaths, which
resulted in duplicated entries, which could slow down compilation. Now,
if buildFile is used, the classpath passed explicitly is ignored
(exactly as, for example, destination ("-d"), which is also stored in
the XML build file).

No test added because there doesn't seem to be any change in
user-visible behavior
2017-12-08 12:07:22 +01:00
Alexander Udalov
d65b999c2c Minor, rename variable for clarity 2017-12-08 12:07:22 +01:00
Ilya Gorbunov
0b9830248d Restore original accessor signature as deprecated
The deprecated function is not operator because it covers cases where it was used in explicit form.

#KT-18789
2017-12-07 20:26:53 +03:00
Ilya Gorbunov
7efaa7cabc Allow delegating val properties to out-projected MutableMap
Change generic signature of MutableMap.getValue, use 'out @Exact V' and `V1: V` types instead of single `in V`.
Fix affected IR generation tests.

#KT-18789 Fixed
2017-12-07 20:26:53 +03:00
Mikhail Glukhikh
e503c1d411 Suspend call detector: fix delegated properties checking 2017-12-07 15:54:47 +03:00
Mikhail Glukhikh
24bd31457c Has suspend calls: fix suspend iterator case 2017-12-07 15:54:47 +03:00
Mikhail Glukhikh
4404439521 Introduce "redundant suspend" inspection #KT-19103 Fixed 2017-12-07 15:54:47 +03:00
Mikhael Bogdanov
edefb45585 Copy sam wrappers during inline
#KT-21671 Fixed
2017-12-07 12:57:43 +01:00
Mikhael Bogdanov
4eb30b6626 Code clean 2017-12-07 12:57:42 +01:00
Mikhail Zarechenskiy
d47130eff8 [NI] Don't check type for constants too early to avoid mismatch 2017-12-07 14:18:20 +03:00
Mikhail Zarechenskiy
6c27a49114 [NI] Use effective variance for equal approximated type
It's totally safe from the point of type system and reduces extra `out` projections that can add problems with subtyping
2017-12-07 14:18:17 +03:00
Dmitry Savvinov
874267b79d Report cyclic scopes properly
This commit introduces proper handling of recursion in scopes, which
could occur when some of companion object supertypes are members of
that companion owner:

```
class Container {
  open class Base
  companion object : Base()
}
```

To resolve `Base`, we have to build member scope for `Container`.
In the member scope of `Container`, we see all classifiers from
companion and his supertypes
So, we have to resolve companion objects supertype, which happens to be
`Base` again - therefore, we encounter recursion here.

Previously, we created `ThrowingLexicalScope` for such recursive calls,
but didn't checked for loop explicitly, which lead to a wide variety of
bugs (see https://jetbrains.quip.com/dc5aABhZoaQY and KT-10532).

To report such cyclic declarations properly, we first change
`ThrowingLexicalScope` to `ErrorLexicalScope` -- the main difference is
that latter doesn't throws ISE when someone tries to resolve type in it,
allowing us to report error instead of crashing with exception.

Then, we add additional fake edge in supertypes graph (from
host-class to companion object) which allows us to piggyback on existing
supertypes loops detection mechanism, and report such cycles for user.
2017-12-07 14:14:08 +03:00
Dmitry Savvinov
33f9576dd1 [NI] Turn off KnownTypeParameterSubstitutor for NI
The main consequence of it is that TYPE_MISMATCH range for control
structures became wider.

Also, for extra safety, don't change behaviour of OI.
2017-12-07 14:05:42 +03:00
Denis Zharkov
4ed6928e6b Avoid building stubs in KtFile::getClasses for compiled files
In Gradle, JavaPsiFacade finds Kotlin compiled files as KtFile instances
and tries to obtain classes from them.

And while it returns an empty array anyway, it starts building
unnecessary stub when calling `isScript`
2017-12-07 12:53:33 +03:00
Denis Zharkov
6007d244f3 Optimize LazyJavaAnnotations::isEmpty 2017-12-07 12:53:33 +03:00
Denis Zharkov
07df29dfbf Optimize LazyJavaScope::getPropertyType
Avoid running hasConstantNotNullInitializer for non-primitive fields
2017-12-07 12:53:33 +03:00
Denis Zharkov
5e334550eb Optimize entry point check in UnusedSymbolInspection
It helps to avoid return types calculation for light-class element
2017-12-07 12:53:33 +03:00
Denis Zharkov
dd3dbda719 Optimize computation of default excluded import in IDE
Prior to this change, it was rather slow since it would lead
to a ModuleDescriptor::packageFragmentProviderForWholeModuleWithDependencies
computation, that would force the computation of libraries'
dependencies, that actually was the major bottleneck here.

The idea is that we do not need to search through dependencies
of dependencies, but only need contents of one of the modules
direct content.

This commit is made under the assumption that if a module has may see
some runtime parts, than runtime jar should be among its direct
depenencies.
2017-12-07 12:53:33 +03:00
Denis Zharkov
4b96311600 Add faster get*Names overrides in LazyClassMemberScope 2017-12-07 12:53:33 +03:00
Denis Zharkov
ac56965a99 Do not force loading all kt-files inside LazyPackageDescriptor constructor
Effectively it leads to all stubs being built for any once used package

The idea is that they only were used for FILE_TO_PACKAGE_FRAGMENT
that is mostly read in backend and rarely in the IDE, so we can replace
its usages with searching through related package-fragments
2017-12-07 12:53:33 +03:00
Denis Zharkov
d655c4075c Introduce index for the set of top-level names by package
It should help with actual loading of all the stubs for all declarations
in the package on every access when it's implemented through
`getDeclarations()`
2017-12-07 12:53:33 +03:00
Denis Zharkov
ce41b5745a Avoid creating synthetic safe-call nodes when resolving == calls
Each of them leads to a separate synthetic file retained in the memory
2017-12-07 12:53:33 +03:00
Denis Zharkov
cc312bcaa2 Avoid creating a separate synthetic file for each default import 2017-12-07 12:53:33 +03:00
Denis Zharkov
2d82cb936e Fix potential memory leak in light-classes
The problem is that they might indirectly retain a reference to an
obsolete ResolverForProject (it becomes outdated after out of block
modification).

The best solution would be to avoid preserving jvm-related diagnostics
(that are only used once to report them when highlighting, and exactly
they retains an obsolete resolve session)

But it seems that this may lead to a deep light-classes refactoring and
the temporary fix is storing diagnostics themselves in a CachedValue
bound to out of block modification tracker. There're no guarantees that
this would help, since CachedValue anyway is based on soft-reference
that is not the first thing GC collects
2017-12-07 12:53:33 +03:00
Denis Zharkov
a67598e0c1 Minor. Apply intention for "?: false" -> "== true" in light classes 2017-12-07 12:53:33 +03:00
Denis Zharkov
f1cbf21f96 Simplify LazyLightClassDataHolder
- Use only stubs instead of full results in LazyLightClassData
- Store only stubs for inexactStub
2017-12-07 12:53:33 +03:00
Dmitry Savvinov
aaee401240 [NI] Minor renaming
Use words 'returnArgument' instead of 'resultArgument' when talking
about values, which can be possibly returned from lambda.

Correct 'addSubsystemForArgument' -> 'addSubsystemFromArgument'
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
30a51af931 [NI] Minor: rename typo KotlinCallDiagnistics.kt -> KotlinCallDiagnostics.kt 2017-12-07 12:49:56 +03:00
Dmitry Savvinov
1ada52968b [NI] Fix KnownTypeParameterSubstitutor for !! 2017-12-07 12:49:56 +03:00
Dmitry Savvinov
15a595749b [NI] Weird testdata change after fixes in ErrorTypes
The issue here is that OI infers correct types for (k, v) destructing
declaration, while NI infers errors for them. That happens because NI
resolves iterator() on nullable 'm', but rightfully reports it as
unsuccessful, while OI somehow manages to resolve it to success (and
thus getting nice expected type, allowing destructing declaration to be
resolved in a proper types).
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
ea72c76a37 [NI] Testdata changes after fixes in error types 2017-12-07 12:49:56 +03:00
Dmitry Savvinov
957bbe291d [NI] Don't approximate error types
Previously, we did approximation of error types to Any?/Nothing in some
contexts (e.g. non-local declarations).

There are several reasons why it is not desired:
- OI doesn't approximate ErrorType
- This behaviour is inconsistent with ourselves (i.e. sometimes we *do*
  infer errortype for top-level declaration)
- It causes different digressions from OI in reported diagnostics

This commit turns off error type approximation. It causes large testdata
shift, which is deliberately split into several parts and commited in a
separate commits.
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
70a1beeff6 [NI] Use ErrorType in ParseErrorKotlinCallArgument
Previously, there was receiver of type Nothing, which could case result
of the call to be inferred to Nothing too. This could case bogus
UNREACHABLE_CODE diagnostics in cases like this:

```
fun <T> id(x: T) = x
fun test() {
    id(unresolvedReference) // type of statement is 'Nothing'
    // ... everything here is marked as unreachable ...
}
```

This commit changes type of receiver for such calls form Nothing to
ErrorType.
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
eadd1355c2 [NI] Add ErrorType constraint
Previously, constraint wasn't added if bound was ErrorType. That could
cause TypeVariable to be inferred to Any?/Nothing instead of ErrorType,
which could influence other parts of analysis (in particular, inferring
Nothing instead of ErrorType can cause bogus UNREACHABLE_CODE diagnostics)

Because of that fix, intersection type can be added to CS as supertype,
which provokes AssertionError. This commit also relaxes this assertion,
as it seems that it's valid that supertype is an intersection type.
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
8e50a58408 [NI] New failing test after changes in applicabilities 2017-12-07 12:49:56 +03:00
Dmitry Savvinov
816d89e393 [NI] Improved testdata after changes in applicabilities
This commits introduces testdata changes, where NI behaviour strictly
improved, after several previous fixes.

For some tests, just WITH_NEW_INFERENCE directive was added. It
indicates, that some of previous commits first introduced error in that
test, and then some other commit fixed it (netting no overall testdata
change). It is preferrably to keep those annotations until we will
migrate to NI completely, to prevent unexpected regressions.
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
9f63818bd3 [NI] Introduce INAPPLICABLE_ARGUMENTS_MAPPING_ERROR for some NI diagnostics 2017-12-07 12:49:56 +03:00
Dmitry Savvinov
e2d65adc7e [NI] Fix KotlinResolutionCandidate.isSuccessfull
Check if ConstrainSystem has any contradiction in 'isSuccessful'.
Otherwise we may erroneously think that there are some successful
candidates in 'TowerResolver.SuccessfullResultCollector.pushCandidates()'
and clear other unsuccessful ones (while they actually may have higher
applicability).
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
78a526c937 [NI] Support EffectSystem
- During final phase of resolution (i.e. converting NI-results to
OI-results), make call into EffectSystem to record all necessary
effects-related information.

- To be able to enhance resulting dataFlowInfo for call at that stage,
introduce internal method 'updateResultingDataFlowInfo' in
NewResolvedCallImpl.
2017-12-07 12:49:56 +03:00
Toshiaki Kameyama
b23d62c760 Transfer type to parent property in "Remove redundant getter" inspection
So #KT-21612 Fixed
2017-12-07 12:19:35 +03:00
Mikhail Glukhikh
834c3fe62b Do not inline property setter if it's not required (e.g. ReplaceWith)
So #KT-21237 Fixed
2017-12-07 12:14:29 +03:00
Mikhail Glukhikh
bddaab9d48 Inline properties without setter / with default setter correctly
Related to KT-21237
2017-12-07 12:14:29 +03:00
Nikolay Krasko
fba50a8d15 Disable language injection for SpEL language as it cause to many troubles
It's known that there're several inspections that report warnings when
SpEL language is injected not to Java files if IDEA is before 173.
2017-12-07 12:02:39 +03:00
Michal Bendowski
6f350c032d Recognize injections in annotations (KT-13636)
Recognize patterns from both Java (psiMethod) and Kotlin
(kotlinParameter) that match the annotation argument.
2017-12-07 12:02:37 +03:00
Nikolay Krasko
b7ba45c001 Reparse lambda expression after removing parameter comma (KT-21497)
Without the parameter it can become block.

 #KT-21497 Fixed
2017-12-07 12:02:07 +03:00
Nikolay Krasko
273bd55f01 Refactoring: extract methods 2017-12-07 11:49:19 +03:00
Dmitry Petrov
04ab3e1519 Use ForInSimpleProgressionLoopGenerator for most of the loop intrinsics 2017-12-07 11:36:20 +03:00
Dmitry Petrov
6b6ae2f7d7 Minor: formatting 2017-12-07 11:36:20 +03:00
Dmitry Petrov
75315a4edb Replace BoundedValue objects in 'indices' with SimpleBoundedValue 2017-12-07 11:36:20 +03:00
Nicolay Mitropolsky
209ba89a49 Uast: KotlinSecondaryConstructorWithInitializersUMethod introduced as workaround for KT-21617
to be the only constructor which includes `init` block when there is no primary constructors in the class
2017-12-06 22:19:57 +03:00
Nicolay Mitropolsky
b8069b48c5 Uast: returning back secondary constructors bodies (KT-21575)
but secondary constructors without primary constructor will not contain initializers, it is still an issue
2017-12-06 22:19:57 +03:00
Nikita Skvortsov
962c512882 optimize search for modules nodes 2017-12-06 18:55:09 +01:00
Nikita Skvortsov
cc580ca1dc optimize check of module-per-source-set 2017-12-06 18:55:09 +01:00
AJ Alt
8297fee615 Fix typo in File.copyTo KDoc 2017-12-06 18:11:11 +01:00
Yusuke Hosonuma
949f9b9342 gitignore: remove duplicates 2017-12-06 18:09:43 +01:00
Nikolay Krasko
110a9ff600 Fix project configuration: avoid adding test jar as library dependency
For some reason gradle processes "testJar" task differently and collects
artifacts for it during configuration phase. This helps Idea project
configurator understand that there's no need to attach test jar as separate
binary library dependency.

Having compiled module in dependencies results IDEA finds both compiled and
source version of classes. This may cause bad navigation and reindexing.
2017-12-06 19:14:28 +03:00
Mikhail Zarechenskiy
1d736f59b6 [NI] Refine nullability for CST of types with undefined nullability 2017-12-06 18:36:20 +03:00
Mikhail Zarechenskiy
b9d390449c [NI] Refactor constraints transformations, update comments 2017-12-06 18:36:19 +03:00
Mikhail Zarechenskiy
351c592c83 [NI] Drop hack that was used before DefinitelyNotNull types 2017-12-06 18:36:17 +03:00
Mikhail Zarechenskiy
b2299ed19f [NI] Fix testdata after introducing DefinitelyNotNull types 2017-12-06 18:36:16 +03:00
Mikhail Zarechenskiy
9565b56b2a [NI] Render DefinitelyNotNull types with !! postfix 2017-12-06 18:36:14 +03:00
Mikhail Zarechenskiy
7f0cca52ca [NI] Use definitely not-null types for smartcasts 2017-12-06 18:36:13 +03:00
Mikhail Zarechenskiy
64f0688b71 [NI] Introduce DefinitelyNotNullType as type for T!! or {T & Any} 2017-12-06 18:36:11 +03:00
Mikhail Zarechenskiy
8e0171d475 [NI] Don't loose platform types on simplifying lower constraints 2017-12-06 18:08:52 +03:00
Alexey Sedunov
e2743c8f34 Rename: Do not use KotlinDirectoryAsPackageRenameHandler via dispatch handler
#KT-21604 Fixed
2017-12-06 14:17:56 +03:00
Alexey Sedunov
e1ed74008f Rename: Fix exception on attempt to rename KtConstructorDelegationReference
#KT-21536 Fixed
2017-12-06 14:17:56 +03:00
Alexey Sedunov
ec85b708c9 Misc: Use delegate with predefined name for fake light methods
#KT-21414 Fixed
2017-12-06 14:17:56 +03:00
Alexey Sedunov
89352a295d Maven Import: Support compiler arguments specified directly in <args>
#KT-21592 Fixed
2017-12-06 14:17:56 +03:00
Alexey Sedunov
288560eb37 Misc: Fix project configuration test 2017-12-06 14:17:55 +03:00
Alexey Sedunov
4369c6d26c Minor: Update Maven import test data 2017-12-06 14:17:55 +03:00
Mikhael Bogdanov
5c2f5fee39 Make 'addCommonSourceSetToPlatformSourceSet' open to support native specifics 2017-12-06 10:57:08 +01:00
Mikhael Bogdanov
60b812e3dd Increase android emulator startup await 2017-12-06 10:57:08 +01:00
shiraji
5d44037a2b Support 'it op something' case in "redundant let" #KT-21373 Fixed 2017-12-05 19:23:44 +03:00
Ramon Wirsch
f961f33f9d Fix for KT-19188
Fixes nondeterministic Default Method Order under existance of generic
type parameters.
SubstitutingScope did not respect source code method order by not using
a LinkedHashSet
2017-12-05 18:33:22 +03:00
Mikhail Glukhikh
8257e14055 J2K: perform additional isActiveFor check before applying inspections 2017-12-05 18:21:22 +03:00
Mikhail Glukhikh
7eb62b9ca4 Add kapt as test runtime dependency to J2K 2017-12-05 18:18:48 +03:00
Mikhail Glukhikh
a90e3c2e45 Add "replace map.put with assignment" to J2K
Related to KT-21502
2017-12-05 18:18:25 +03:00
Dereck Bridie
8c305a137f Introduce inspection "replace map.put with assignment" #KT-21502 Fixed 2017-12-05 16:57:36 +03:00
Nikolay Krasko
ab28bdf32f Store in test data failure for quotedName name 2017-12-05 16:07:55 +03:00
Nikolay Krasko
57d62eb74a Document error behaviour of evaluate expression lost sometime 2017-12-05 16:07:54 +03:00
Nikolay Krasko
b21fb1a375 Replace assertTrue with assertEquals in AbstractKotlinEvaluateExpressionTest 2017-12-05 16:07:53 +03:00
Nikolay Krasko
04e6aa76cf Fix lint apiCheck lint 2017-12-05 16:07:53 +03:00
Dmitry Petrov
3d473f608e Add more tests for for-in-array
#KT-21354 Fixed Target versions 1.2.20
 #KT-21321 Fixed Target versions 1.2.20
2017-12-05 15:45:20 +03:00
Dmitry Petrov
e4ecc13e13 Generate for-in-array loops with proper semantics in 1.3+
In Kotlin 1.3+, assignment to the for-in-array loop range variable in
the loop body doesn't affect loop execution (as if it was a loop on an
array iterator, or some other container).

 #KT-21354 In Progress
 #KT-21321 In Progress
2017-12-05 15:45:20 +03:00
Dmitry Petrov
7a6f80606b Warn on for-in-array range variable assignment in loop body
According to KT-21354, this should be a warning in 1.2 and before, and
no warning (with changed semantics) in 1.3 and later.
NB there are some false positives in this check.

 #KT-21354 In Progress
 #KT-21321 In Progress
2017-12-05 15:45:20 +03:00
Mikhail Glukhikh
7118a4bf80 Fix KNPE in "introduce variable", add some name conflict introduce tests
So #KT-21530 Fixed
2017-12-05 15:29:45 +03:00
Mikhail Glukhikh
20b48ab90c Fix suggested names in Spring (do not take same parameter into account) 2017-12-05 15:29:45 +03:00
Mikhail Glukhikh
b09465ca0b Unnecessary variable: do not suggest in case of name duplication
So #KT-20300 Fixed
2017-12-05 15:29:45 +03:00
Mikhail Glukhikh
844dd1c43c Refactoring: Unnecessary variable inspection 2017-12-05 15:29:45 +03:00
Mikhail Glukhikh
52053695fe Fix variable name validator (take parameters into account) 2017-12-05 15:29:44 +03:00
Toshiaki Kameyama
e341ec969f "Join declaration and assignment" should remove 'lateinit' for 'var' #KT-21603 Fixed 2017-12-05 11:19:58 +09:00
Ilya Chernikov
075203ad33 Make embedding javaslang into compiler intransitive, as it was before gradle
fixes KT-21537

(cherry picked from commit cc5c1d5)
2017-12-04 14:47:53 +01:00
Mikhail Glukhikh
ac3542c041 Minor cleanup 2017-12-04 15:58:13 +03:00
Toshiaki Kameyama
74d83997c7 Fix false "function is never used" for functions with '@JvmName'
So #KT-20435 Fixed
2017-12-04 15:58:13 +03:00
Denis Zharkov
84282035b0 Set up projectTest.workingDir for incremental-compilation-impl 2017-12-04 15:21:03 +03:00
Mikhail Glukhikh
fb8dc7b590 Minor cleanup 2017-12-04 15:16:04 +03:00
Toshiaki Kameyama
0eec3ef1f8 Add / preserve semicolon after empty companion object #KT-21179 Fixed 2017-12-04 15:15:49 +03:00
Alexey Andreev
45e5cc190f Update DCE limits in JS tests 2017-12-04 11:25:39 +03:00
Dmitry Petrov
0db6e5c3f3 Fix SAM wrapper generation in secondary constructor calls
Should simply invoke 'checkSamCall' in corresponding visitor method to
check if call arguments should be wrapped.
2017-12-04 10:29:33 +03:00
Dmitry Petrov
3431a1445c Fix enum entry class delegating constructor call generation
When the enum entry requires a specific class, its constructor should
invoke proper supertype constructor (from the corresponding enum class).
Corresponding resolved call should be passed from the front-end in
CONSTRUCTOR_RESOLVED_DELEGATION_CALL slice.
In case of enum entries without explicit supertype initializer, this
information was missing.
2017-12-04 10:29:33 +03:00
Ilmir Usmanov
d8c4d19152 Make suspendCoroutineOrReturn ordinary function 2017-12-01 20:18:04 +03:00
Yan Zhulanow
0b37c9e83c Kapt: Report about of time spent in each annotation processor in verbose mode (KT-21542) 2017-12-01 22:53:22 +09:00
Yan Zhulanow
ef6be206d0 Kapt: Clear URL cache after changing annotation processor JAR 2017-12-01 22:53:22 +09:00
Yan Zhulanow
84a766de24 Kapt: Register AP classpath as an input for "generate stubs" and "kapt" tasks
...so if the annotation processor artifact is changed, annotation processing will be relaunched.
2017-12-01 22:53:22 +09:00
Yan Zhulanow
9e43992094 Minor: Update kapt converter test for imports 2017-12-01 22:53:21 +09:00
Yan Zhulanow
3dc7502b0b Kapt, minor: Remove kaptError with location, it doesn't do anything reasonable now anyway 2017-12-01 22:53:21 +09:00
Yan Zhulanow
a4a7db06d2 Kapt: force resolve import references in partial analysis mode (required for import conversion in correctErrorTypes) 2017-12-01 22:53:21 +09:00
Yan Zhulanow
1a3317ae2b Kapt: Attach generated classes directory as library source (KT-19823)
This may seem like a magic, but actually it's deadly simple.

GradleProjectResolver.mergeLibraryAndModuleDependencyData() tries to find a better substitution for the absolute BINARY paths, but actually makes things worse in our case.
GradleProjectResolver checks if the provided path is in the Gradle project output path list, and if the answer is yes, then it replaces our path to a Gradle Project (or a module in JPS terminology) dependency.
2017-12-01 22:53:21 +09:00
Yan Zhulanow
2e17c0b7f1 Kapt: Filter out non-package all-under imports whenever possible in "correctErrorTypes" (KT-21359) 2017-12-01 22:53:21 +09:00
Yan Zhulanow
00bb38fbb1 Kapt: Support import directive with aliases in "correctErrorTypes" mode (KT-21358) 2017-12-01 22:53:21 +09:00
Yan Zhulanow
c7645bcf03 Kapt: Replace error.NonExistentClass usages to Object (as it does not break class hierarchies) 2017-12-01 22:53:21 +09:00
Yan Zhulanow
e46fe9b255 Kapt: Do not add duplicating library entries in project importing 2017-12-01 22:53:20 +09:00
Yan Zhulanow
3d1ca61f9f Kapt: Remove artificial KaptError exception on errors from annotation processor (KT-21262) 2017-12-01 22:53:20 +09:00
Yan Zhulanow
0a0de8da29 Kapt: Fix correctErrorTypes for getters of properties defined in the primary constructor 2017-12-01 22:53:20 +09:00
Yan Zhulanow
182c2e2eeb Kapt: Launch integration tests also under Java 9 2017-12-01 22:53:20 +09:00
Yan Zhulanow
6ccf361942 Kapt: -Xmaxerrs javac option is not propagated properly (KT-21264) 2017-12-01 22:53:20 +09:00
Yan Zhulanow
2819fc718a Parcelable: Migrate to canonical NEW-DUP-INVOKESPECIAL form (KT-20545) 2017-12-01 22:53:20 +09:00
Yan Zhulanow
37543deefa Kapt: Keep KDoc comments in Java stubs (KT-21205) 2017-12-01 22:53:19 +09:00
Yan Zhulanow
af57ab8119 Kapt: Fix remaining issues with Java 9 compatibility in converter, add Java 9 tests 2017-12-01 22:53:19 +09:00
Yan Zhulanow
dde87ae1f9 Attempt to fix Gradle project importing error on older Gradle versions (KT-20967) 2017-12-01 22:53:19 +09:00
Yan Zhulanow
49db1bfe5d Introduce preliminary check for special annotations (allopen/noarg/samWithReceiver) (KT-21194) 2017-12-01 22:53:19 +09:00
Yan Zhulanow
ecfb045790 Android Extensions: Do not generate synthetic components in Kotlin Bytecode tool window when the Gradle plugin is disabled 2017-12-01 22:53:19 +09:00
Yan Zhulanow
8496ff8611 Minor: Add kotlin-android-extensions-runtime dependency to get rid of error messages in IDE 2017-12-01 22:53:19 +09:00
Yan Zhulanow
037caf3a17 Kapt: Prefer Kotlin diagnostic locations over ones from stubs 2017-12-01 22:53:19 +09:00
Yan Zhulanow
861d778530 Kapt: Fix 'correctErrorTypes' for primary constructor properties 2017-12-01 22:53:18 +09:00
Yan Zhulanow
7136bf7e0a Kapt: Add Kotlin location to diagnostics reported in Kapt stubs 2017-12-01 22:53:18 +09:00
Yan Zhulanow
8fba19f269 Kapt: Do not print empty diagnostic messages 2017-12-01 22:53:18 +09:00
Yan Zhulanow
5efdf111f5 Kapt: Support type aliases in correctErrorTypes mode (KT-19402) 2017-12-01 22:53:18 +09:00
Yan Zhulanow
84e5fa38bb Kapt: Exclude all primitive Java constants from inlining (String is still inlined) (KT-20878) 2017-12-01 22:53:18 +09:00
Yan Zhulanow
6ca5787799 Kapt: Allow to ignore specific methods/fields from being put into kapt stubs
Classes can't be ignored yet as it requires to ignore also all type usages which is a non-trivial operation.
2017-12-01 22:53:18 +09:00
Yan Zhulanow
fd84ecda54 Kapt: Add runtime library, move all modules inside the 'kapt3' directory 2017-12-01 22:53:17 +09:00
Yan Zhulanow
b74ef72af7 Kapt: Forbid illegal Java identifiers in Enum value literals 2017-12-01 22:53:17 +09:00
Yan Zhulanow
f52749741b Minor: Remove unused fileManager property 2017-12-01 22:53:17 +09:00
Yan Zhulanow
bdf77ccb65 Kapt: Refactoring, replace getValidIdentifierName() with more appropriate isValidIdentifier() 2017-12-01 22:53:17 +09:00
Yan Zhulanow
f368414328 SamWithReceiver: Pick the right compiler plugin (KT-20813) 2017-12-01 22:53:17 +09:00
Yan Zhulanow
3d7222485d Android Extensions: Add missing documentation, move the hasCache property to the compiler module 2017-12-01 22:53:16 +09:00
Yan Zhulanow
e4f476c09f Kapt, Maven: Fix running with the non-clean build (KT-20816)
Clean target directories for kapt stubs and generated source files.
Filter out the compile destination directory from the classpath.
2017-12-01 22:53:16 +09:00
Yan Zhulanow
381379fb62 Kapt, Maven: Clean directories for generated sources and stubs before AP 2017-12-01 22:53:16 +09:00
Yan Zhulanow
b074c7e22f Minor: Return back the whole test contents 2017-12-01 22:53:16 +09:00
Yan Zhulanow
1f65f8bc97 Encode all compiler plugin arguments for Android Extensions in kapt
Commas in option values breaks the option parsing in daemon (KT-20235).
2017-12-01 22:53:16 +09:00
Yan Zhulanow
425d104255 Parcelable: Convert I to Z explicitly, older Android Dex has strict checks for it (KT-20928) 2017-12-01 22:53:16 +09:00
Yan Zhulanow
e28cffd0ad Parcelable: newArray() result type should be Object[] (KT-20717) 2017-12-01 22:53:15 +09:00
Yan Zhulanow
26005751d8 Parcelable: Fix compatibility with serialization plugin (KT-20742) 2017-12-01 22:53:15 +09:00
Yan Zhulanow
3d155dd757 Kapt: Support Java 9 in Gradle plugin infrastructure 2017-12-01 22:53:15 +09:00
Yan Zhulanow
c6eab6f72e Kapt: Support Java 9 in compiler plugin 2017-12-01 22:53:15 +09:00
Yan Zhulanow
e97b3ed324 Kapt: Get rid of DatatypeConverter in order to support JDK9 (KT-20749) 2017-12-01 22:53:15 +09:00
Yan Zhulanow
fa54a0c642 AllOpen: Add Validated to the list of annotations supported by kotlin-spring plugin (KT-20751) 2017-12-01 22:53:15 +09:00
Yan Zhulanow
eccc3447f6 Infrastructure: move compiler plugin tests back to their modules 2017-12-01 22:53:14 +09:00
Alexander Udalov
7248f2568a Drop USE_NEW_INFERENCE, configure language version settings in KotlinTestUtils
This will only have effect for tests which do not use their own instance
of LanguageVersionSettings though
2017-12-01 13:35:25 +01:00
Alexey Andreev
9c0e049bbe JS: fix boxed char with latest changes in compiler 2017-12-01 15:20:34 +03:00
Nikolay Krasko
2c79481f37 Add IdeaOpenApiClassFinder and BundledGroovyClassFinder to known finder
Fix testKnownNonClasspathFinder for 173 branch
2017-12-01 00:44:05 +03:00
Nikolay Krasko
e2418ec892 Remove custom runtime configure from AbstractParameterInfoTest 2017-12-01 00:44:05 +03:00
Nikolay Krasko
f460104ace Unconfigure library in AbstractLineMarkersTest 2017-12-01 00:44:04 +03:00
Nikolay Krasko
22b0dd91e4 Fix GradleConfiguratorTest: jre8 is expected for 1.1.2 version 2017-12-01 00:44:04 +03:00
Nikolay Krasko
3dc494ed00 Some qualified names might be null for classes 2017-12-01 00:44:04 +03:00
Nikolay Krasko
32da2ccb81 Don't intercept unexpected exceptions in AbstractQuickFixTest.kt 2017-12-01 00:44:04 +03:00
Nicolay Mitropolsky
f67db64dba *kapt3-idea* added to *ultimate* as testRuntime dependency
because of falling tests. It seems that there is not such issue in 1.2.0 branch
2017-11-30 21:27:56 +03:00
Nicolay Mitropolsky
4db5ca66e3 Uast: constructors calls consistency for KtObjectLiteralExpression (KT-21409) 2017-11-30 20:08:16 +03:00
Nicolay Mitropolsky
1dbce18afc Uast: constructors calls consistency except anonymous object literals (KT-21409) 2017-11-30 20:08:16 +03:00
Nicolay Mitropolsky
77be33d433 Uast: KotlinPrimaryConstructorUMethod renamed to KotlinConstructorUMethod (KT-21409) 2017-11-30 20:08:16 +03:00
Nicolay Mitropolsky
1ce21583ad Uast: secondary constructors delegation support (KT-21409) 2017-11-30 20:08:16 +03:00
Nicolay Mitropolsky
3bfa5c4706 Uast: parsing primary constructors superCalls (KT-21409) 2017-11-30 20:08:16 +03:00
Mikhail Glukhikh
a39f2f8271 Downgrade "use expression body" inspection to INFORMATION default level
(cherry picked from commit b6bc8eb)
2017-11-30 17:19:19 +03:00
Mikhail Glukhikh
0d65df4d3e Recursive equals: case with recursive not equals + extra tests 2017-11-30 16:47:27 +03:00
Mikhail Glukhikh
13e0ba0836 Recursive equals: fix false positive with different argument
Related to KT-13702
2017-11-30 16:44:51 +03:00
Mikhail Glukhikh
917be5d271 Support "recursive equals" for direct equals call (related to KT-13702) 2017-11-30 16:44:50 +03:00
Mikhail Glukhikh
e301506460 Simplify and fix "recursive equals" inspection (related to KT-13702) 2017-11-30 16:44:45 +03:00
Toshiaki Kameyama
b8fcdea673 Add inspection for equals which is called recursively within itself
So #KT-13702 Fixed
2017-11-30 16:44:20 +03:00
Mikhail Glukhikh
bd348911af Add "unused equals" for direct calls without receiver
Related to KT-21192
2017-11-30 16:44:16 +03:00
Mikhail Glukhikh
64159a900a Add "unused equals" warning on direct equals call #KT-21192 Fixed 2017-11-30 16:43:54 +03:00
Mikhail Glukhikh
07ec4ecd7f Add tests for KT-19511 and KT-21192 (with void -> boolean) 2017-11-30 16:43:53 +03:00
Sergey Igushkin
bf2e3decaa Add :kotlin-annotation-processing-gradle:install dependency to Gradle IT 2017-11-30 15:42:42 +03:00
Sergey Igushkin
98e8e73810 Fix kotlin-reflect dependency IDE import after API separation.
(cherry picked from commit 19967a2)
2017-11-30 15:42:42 +03:00
Alexey Andreev
af6adc61ae Update bootstrap to 1.2.20-dev-524 2017-11-30 15:27:41 +03:00
Alexey Andreev
acb058f328 JS: fix bootstrap build error related to updates in source maps 2017-11-30 14:26:05 +03:00
Nikolay Krasko
f46a8e0b16 Restore iml files for jps tests 2017-11-30 13:24:08 +03:00
Nikolay Krasko
cfa70dbe26 Don't ignore iml files in testData 2017-11-30 13:24:07 +03:00
Nikolay Krasko
170b352185 Deprecate 'configureAs' method and stop using it in js decompiled tests
This commit fixes tests in 173 branch, avoid exception:

com.intellij.openapi.util.TraceableDisposable$DisposalException:
Virtual pointer 'jar:///mnt/agent/work/bd0f559856a14a82/dist/kotlinc/lib/kotlin-stdlib-js.jar!/'
hasn't been disposed: --------------Creation trace:
java.lang.Throwable
    at com.intellij.openapi.util.TraceableDisposable.<init>(TraceableDisposable.java:45)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerImpl.<init>(VirtualFilePointerImpl.java:41)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.getOrCreate(VirtualFilePointerManagerImpl.java:266)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.create(VirtualFilePointerManagerImpl.java:205)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.create(VirtualFilePointerManagerImpl.java:136)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerContainerImpl.create(VirtualFilePointerContainerImpl.java:359)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerContainerImpl.add(VirtualFilePointerContainerImpl.java:169)
    at com.intellij.openapi.roots.impl.libraries.LibraryImpl.addRoot(LibraryImpl.java:505)
    at com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor.exportRoots(NewLibraryEditor.java:247)
    at com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor.applyTo(NewLibraryEditor.java:218)
    at org.jetbrains.kotlin.idea.test.ConfigLibraryUtil.addLibrary(ConfigLibraryUtil.kt:113)
    at org.jetbrains.kotlin.idea.test.KotlinStdJSProjectDescriptor.configureModule(KotlinStdJSProjectDescriptor.kt:38)
    at org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor.configureModule(KotlinLightProjectDescriptor.java:46)
    at org.jetbrains.kotlin.idea.test.TestUtilsKt$configureAs$1.consume(testUtils.kt:59)
    at org.jetbrains.kotlin.idea.test.TestUtilsKt$configureAs$1.consume(testUtils.kt)
    at com.intellij.openapi.roots.ModuleRootModificationUtil.updateModel(ModuleRootModificationUtil.java:143)
    at org.jetbrains.kotlin.idea.test.TestUtilsKt.configureAs(testUtils.kt:50)
    at org.jetbrains.kotlin.idea.test.TestUtilsKt.configureAs(testUtils.kt:69)
    at org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractDecompiledTextFromJsMetadataTest.setUp(AbstractDecompiledTextFromJsMetadataTest.kt:38)
    ...
2017-11-30 13:24:07 +03:00
Nikolay Krasko
a45fa9a33f Configure JdkAndMockLibrary with JS stdlib if jsLib flag is set 2017-11-30 13:24:06 +03:00
Nikolay Krasko
1bc8ad7852 Don't mess up with configuring project descriptors in PullPush tests
This commit fixes tests in 173 branch.
2017-11-30 13:24:05 +03:00
Alexey Sedunov
6a9317fc57 Misc: Drop utilities for checking nullability/mutability annotations
Types annotated by them are already loaded as inflexible
2017-11-30 12:49:25 +03:00
Alexey Sedunov
84c6f9bf45 Create from Usage: Fix choosing superclass for abstract member
This applies to cases when non-existing member is called without
explicit receiver

 #KT-21332 Fixed
2017-11-30 12:49:25 +03:00
Alexey Sedunov
7e3ca4734d Create from Usage: Add val to data class parameter
Also place new parameters on the new line if previous ones have line breaks

 #KT-21162 Fixed
2017-11-30 12:49:25 +03:00
Alexey Sedunov
c54b934383 Configuration: Fix deserialization of immutable freeArgs collection
#KT-21363 Fixed
2017-11-30 12:49:24 +03:00
Alexey Sedunov
998c312ad2 Unifier: Fix matching of callable references with expression receivers
#KT-21334 Fixed
2017-11-30 12:49:24 +03:00
Alexey Sedunov
354a6cbfd9 Change Signature: Keep parameter 'val'/'var' when invoked from Java
#KT-20901 Fixed
 #KT-21159 Fixed
2017-11-30 12:49:24 +03:00
Alexey Sedunov
820ade41ed Create from Usage: Do not add bodies to expect class members
#KT-21122 Fixed
2017-11-30 12:49:24 +03:00
Alexey Andreev
063b4b6c18 Remove unused 'json-org' dependency (fix build) 2017-11-30 11:43:44 +03:00
Alexey Andreev
1d48442a5d Change default output dir in JS DCE Gradle plugin
See KT-21328

Compiler removes all files from its output directory.
Due to this reason (and some other reasons) it't not a good idea
to put DCE output to `classes` dir.
Therefore we changed output dir to `$buildDir/kotlin-js-min`.
Additionally, we now allow to customize output dir.
In particular, this fixes issues with webpack in multi-project build +
continuous Gradle build.
2017-11-29 20:08:30 +03:00
Alexey Andreev
5672e1f56e JS: add DCE devmode. Fix mapping paths in source maps
See KT-20210, KT-21307
2017-11-29 20:08:30 +03:00
Alexey Andreev
ffdebfab45 JS: change the way how DCE resolves input paths 2017-11-29 20:08:29 +03:00
Alexey Andreev
8514a7706f Remove json.org library, use own JSON parser to parse source maps 2017-11-29 20:08:29 +03:00
Alexey Andreev
729715ec62 Add simple JSON parser 2017-11-29 19:43:28 +03:00
Ilya Gorbunov
c6b957f457 Force LF line delimiters for bash scripts and CRLF for .bat scripts in compiler/cli 2017-11-29 19:03:28 +03:00
Alexander Udalov
4f70983735 Update Proguard to 5.3.3 2017-11-29 11:58:38 +01:00
Alexander Udalov
d4b5032810 Add JDK roots to the beginning of the roots list
This behavior was used until 6a1b6d10d8, where the JDK has
unintentionally started to be added to the end of the list, breaking
code which depended on libraries which bundle something from the JDK

 #KT-21299 Fixed
2017-11-29 11:49:48 +01:00
Dmitry Petrov
d976eeabf7 Refactor GenerationState creation 2017-11-29 12:17:06 +03:00
Alexey Sedunov
d6d6cef10d Gradle: Use copyable user data to retain intermediate model
#KT-21418 Fixed
2017-11-29 12:00:25 +03:00
Alexey Sedunov
c8d9f9ac50 Refactoring: Rename copyable property delegates for PsiElement 2017-11-29 12:00:25 +03:00
Alexey Sedunov
b956363d6f Minor: Drop unused class 2017-11-29 12:00:25 +03:00
Alexey Andreev
19438a3a07 JS: fix losing lambda in inline function after incremental compilation
See KT-21493

It's hard to maintain staticRef in cached AST. In fact, we don't need
it in this optimization. We'll get excessive names in used set,
which is ok: non-function names don't matter, they'll be simply ignored.
One possible concern: there's more chance to get name same to
some function's name and it won't be removed. First, it's not fatal,
it won't break the code (but put some excessive code that will likely
be removed by DCE). Second, there's same chance of two functions
having same names, and we manage to avoid this (otherwise we'll get
many problems).
2017-11-29 11:53:35 +03:00
Alexey Andreev
29b494cdac JS: don't optimize when over external enum
See KT-21468
2017-11-29 11:52:36 +03:00
Dmitry Petrov
5b8c0d4c3e Optimize for-in-string loops
For-in-string loop can be generated using specialized 'length' and
'charAt' method calls, and with cached string length.
Note that update of the string variable in loop body doesn't affect
loop execution semantics.

 #KT-21322 Fixed Target versions 1.2.20
2017-11-29 10:15:38 +03:00
Dmitry Petrov
e2fa613b70 Cache array length in for-in-array loop if possible
If the range expression is not a local variable (which can be updated in
the loop body affecting loop behavior, see KT-21354), we can cache the
array length, thus turning a for-in-array loop into a simple optimizable
counter loop.

 #KT-21321 In Progress
2017-11-29 10:15:32 +03:00
Mikhail Zarechenskiy
328c67b9e8 Add separate diagnostic renderer results for tests with NI 2017-11-29 02:54:30 +03:00
Mikhail Zarechenskiy
8757298994 Add diagnostics to test data from NI 2017-11-29 02:54:26 +03:00
Mikhail Zarechenskiy
a71238bf94 Place !WITH_NEW_INFERENCE directive to diagnostics test data 2017-11-29 02:53:49 +03:00
Mikhail Zarechenskiy
81b3fefa58 Improve test framework for diagnostic tests with NI
Mark with `NI;` or `OI;` only diagnostics that are specific for concrete inference
2017-11-29 02:49:31 +03:00
Ilya Gorbunov
bd4d847943 Fix unresolved references in the api docs
These were mostly incorrect parameter names and external api links.
2017-11-28 18:41:17 +03:00
Ilya Gorbunov
3f26fd3f7f Provide summary for kotlin.math package 2017-11-28 18:41:15 +03:00
Ilya Gorbunov
5e85f71e48 Improve cover documentation page of kotlin.test library 2017-11-28 18:41:12 +03:00
Ilya Gorbunov
cf076f3d25 Unify docs wording of 'trim*' functions 2017-11-28 17:59:05 +03:00
Ilya Gorbunov
4f76cdfc34 Use new annotations in mutability tests instead of old ones 2017-11-28 17:45:10 +03:00
Ilya Gorbunov
9995a31c46 Add ReadOnly and Mutable into kotlin.annotations.jvm
Originally provided in org.jetbrains.annotations package as a part of stdlib.
2017-11-28 17:45:10 +03:00
Alexander Udalov
f80c9a4692 Drop TypeMappingConfiguration.innerClassNameFactory, use default implementation
After 57d209f599, non-default behavior is no longer used.

 #KT-21453 Fixed
2017-11-28 14:15:03 +01:00
Alexander Udalov
79e399942d Use "sourcesJar" task builder for kotlin-reflect sources 2017-11-28 12:46:10 +01:00
Alexander Udalov
9f3577dc70 Minor, use firstFromJavaHomeThatExists for JDK for Proguard
Similarly to "proguard" task in prepare/compiler/build.gradle.kts
2017-11-28 12:45:57 +01:00
Alexander Udalov
3d3ece72d2 Do not add task dependency from "sourcesJar" on "classes"
There doesn't seem to be any problem with collecting sources of the
project separately from compiling the project
2017-11-28 12:45:56 +01:00
Alexander Udalov
200c62b574 Use JvmPackageTable from bootstrap compiler in KotlinModuleShadowTransformer
Instead of generating another copy of it into buildSrc. Also move
KotlinModuleShadowTransformer to kotlin-reflect's build script, to its
only usage
2017-11-28 12:45:56 +01:00
Alexander Udalov
a1f895bb1f Rewrite kotlin-reflect build script from Groovy to Kotlin 2017-11-28 12:45:53 +01:00
Alexander Udalov
885ddc49a2 Move libraries/reflect/{build.gradle -> build.gradle.kts}
To preserve Git history after conversion to Kotlin in the next commit
2017-11-28 12:35:50 +01:00
Alexander Udalov
aca74cef0e Replace dependencies on kotlin-reflect with kotlin-reflect-api
See the previous commit for information on the kotlin-reflect vs
kotlin-reflect-api distinction.

Add kotlin-reflect as an explicit runtime dependency of most of the test
configurations because even though they all depend on tests-common, the
runtime dependency on kotlin-reflect is not exported from tests-common
to other modules because the projectTests dependency is not transitive.
2017-11-28 12:35:49 +01:00
Alexander Udalov
329fbd8fa8 Extract kotlin-reflect-api module out of kotlin-reflect
This is needed only for faster compilation of the Kotlin project itself
and has no effect on the public artifact
org.jetbrains.kotlin:kotlin-reflect.

The problem this is solving is the rebuild of the project once anything
has been changed in modules in 'core' (even inside function bodies, i.e.
a non-API change). Previously, changes in 'core' led to the compilation
of kotlin-reflect, which led to the rebuild of all modules depending on
kotlin-reflect directly or indirectly (which is almost all modules in
the project) because kotlin-reflect's artifacts are custom-built and the
changes can not be picked up incrementally. But 99.9% of the time the
initial changes in 'core' could not have any effect on the usages of
kotlin-reflect, because classes from those modules are moved to an
internal package in kotlin-reflect and thus are an internal
implementation detail.

Now, changes in 'core' still lead to the compilation of kotlin-reflect
and to the process of building the custom jar. But if a module depends
on kotlin-reflect-api, not kotlin-reflect, then the incremental
difference checker will detect that the module does not have to be
recompiled if there hasn't been any changes to the API of
kotlin-reflect-api. Which means that the module will not be rebuilt on
every change in 'core'.

This commit only introduces the new module. The dependencies
(kotlin-reflect -> kotlin-reflect-api) are replaced in the next commit.
2017-11-28 12:35:48 +01:00
Alexander Udalov
3e8b39af90 Move kotlin-reflect Gradle project to libraries/reflect/ 2017-11-28 12:33:21 +01:00
Toshiaki Kameyama
7448042b68 Fix callable code factory (parameter with default value case)
Before we can have end of '<Type>' and '=' joined as '>=' breaking PSI
So #KT-15941 Fixed
2017-11-28 14:11:04 +03:00
Mikhael Bogdanov
21bd10da2e Move generator utils 2017-11-28 11:04:40 +01:00
Mikhael Bogdanov
f529069077 Move common test parts to tests-common. Minify test jar dependencies 2017-11-28 11:04:39 +01:00
Alexey Sedunov
acbf53c42e Move: Make applicable to type aliases
#KT-21071 Fixed
2017-11-27 21:19:23 +03:00
Alexey Sedunov
bcdb46653c Line Markers: Detect recursive calls of companion invoke() member
#KT-21076 Fixed
2017-11-27 21:19:23 +03:00
Alexey Sedunov
169a22226f Rename: Support inplace rename of class via primary constructor
#KT-20146 Fixed
 #KT-21371 Fixed
2017-11-27 21:19:22 +03:00
Alexey Sedunov
2792e0c412 Rename: Introduce dispatching handler
The goal is to filter out KotlinMemberInplaceHandler similar to how
RenameHandlerRegistry does with MemberInplaceHandler
2017-11-27 21:19:22 +03:00
Alexey Sedunov
56746380f7 Data Inflow: Support delegated assignments
#KT-19089 Fixed
2017-11-27 21:19:22 +03:00
Alexey Sedunov
9d482bbbb1 Data Inflow: Show composite assignments
#KT-19112 Fixed
2017-11-27 21:19:22 +03:00
Alexey Sedunov
a333eb917b Data Inflow: Show qualified assignments
#KT-19087 Fixed
2017-11-27 21:19:21 +03:00
Vyacheslav Gerasimov
c06f72b73f Remove invalid toast test case, worked previously due to uast bug 2017-11-27 20:20:40 +03:00
Vyacheslav Gerasimov
26dcd1c706 Add kapt3-idea to test runtime of idea-android 2017-11-27 20:20:40 +03:00
Alexander Udalov
386a3fb5ce Fix tests after f4f5359725 2017-11-27 16:03:38 +01:00
Dmitry Petrov
f586bd4a34 Generate proper visibility for companion object instance field in LV1.3+ 2017-11-27 17:15:16 +03:00
Dmitry Petrov
70d3e6592d Unwrap object member imported by name before determining receivers
Existing code for receiver generation accidentally worked in most cases
for object members imported by name. However, it generated strange
bytecode (such as
    GETFIELD AnObject.INSTANCE
    GETFIELD AnObject.INSTANCE
    POP
), and worked incorrectly for augmented assignments.

 #KT-21343 Fixed Target versions 1.2.20
2017-11-27 17:15:16 +03:00
Alexey Andreev
7bee2ceac7 JS: add boxing/unboxing to default accessors of non-simple properties
See KT-21421
2017-11-27 17:01:19 +03:00
Alexey Andreev
be4e2f96c2 JS: throw error from coroutine marker functions 2017-11-27 17:01:18 +03:00
Alexey Andreev
71b1591044 JS: replace suspend inline metadata after inlining
This fixes some issues on coroutine inlining, see tests
2017-11-27 17:01:18 +03:00
Alexey Andreev
f8e7861ce6 JS: add partial tail-call optimization for suspend functions 2017-11-27 17:01:17 +03:00
Alexey Andreev
7c621488ad Remove unnecessary CONTAINS_NON_TAIL_SUSPEND_CALLS slice 2017-11-27 17:01:17 +03:00
Alexey Andreev
26843509c7 JS: disable suspend function tail-call optimization based on FE data
Partially fixes KT-21026
2017-11-27 17:01:16 +03:00
Alexey Andreev
6ab87ad66a Fix failing JS tests 2017-11-27 17:01:15 +03:00
Toshiaki Kameyama
2dd66225f3 Take into account vararg modifier in "Add type" quick fix
So #KT-20894 Fixed
2017-11-27 16:44:42 +03:00
Toshiaki Kameyama
4d93c08bd0 Do not propose to make local lateinit var immutable #KT-21104 Fixed 2017-11-27 16:44:04 +03:00
Alexander Udalov
938fd1a57e Use ResolvedCall for callable reference in KCallableNameProperty intrinsic
Instead of manually inspecting the DOUBLE_COLON_LHS slice, which is a
bit more error-prone. Note that new tests were passing before this
change
2017-11-27 12:46:56 +01:00
Alexander Udalov
f4f5359725 Fix exception on inlining callable reference with implicit this in LHS
Use ResolvedCall to determine the receiver type in the JVM codegen,
instead of manually inspecting the PSI

 #KT-20821 Fixed
2017-11-27 12:46:55 +01:00
Alexey Sedunov
1ceb751061 Data Outflow: Allow for-loop variables
#KT-19018 Fixed
2017-11-27 14:36:09 +03:00
Alexey Sedunov
fc307da383 Data Outflow: Show all reference expressions as separate steps
#KT-19012 Fixed
 #KT-19017 Fixed
 #KT-19036 Fixed
 #KT-19039 Fixed
 #KT-19104 Fixed
 #KT-19106 Fixed
2017-11-27 14:36:09 +03:00
Alexey Sedunov
0fc1c793fe Kotlin Facet: Support compileKotlinCommon tasks in Gradle importer
#KT-21187 Fixed
2017-11-27 14:36:09 +03:00
Alexey Sedunov
3f66d11624 Kotlin Facet: Fix language/API version initialization
#KT-21180 Fixed
2017-11-27 14:36:09 +03:00
Dmitry Jemerov
200d7f0718 Send API version instead of build number for plugin update checks
#KT-21263 Fixed
2017-11-24 19:39:22 +01:00
Alexey Tsvetkov
a1939c093c Use isolated classloader for in-process compilation
#KT-20233 fixed
2017-11-24 16:17:13 +03:00
Alexey Tsvetkov
0077ab59d6 Remove custom cache version checks from Gradle
#KT-21009 fixed

Cache version could be changed only when compiler is changed.

@InputFiles on `AbstractKotlinCompileTool#computedCompilerClasspath`
ensures that non incremental build is performed when compiler is changed.
2017-11-24 16:17:13 +03:00
Nikolay Krasko
602ac3e816 Refactoring: GradleDependencyInspection -> DeprecatedGradleDependencyInspection 2017-11-24 14:29:03 +03:00
Nikolay Krasko
bfb069b0c5 Warning and quick fix for using jre-artifacts in Maven (KT-20947)
#KT-20947 In Progress
2017-11-24 14:29:03 +03:00
Nikolay Krasko
99f7d605a7 Refactoring: move deprecation information to common place 2017-11-24 14:29:02 +03:00
Nikolay Krasko
0f1e169bd7 Introduce a quick fix for deprecated jre artifact in gradle (KT-20947)
#KT-20947 In Progress
2017-11-24 14:29:02 +03:00
Nikolay Krasko
23afa07e55 Inspection for using deprecated jre artifacts in Gradle (KT-20947)
#KT-20947 In Progress
2017-11-24 14:29:02 +03:00
Nikolay Krasko
4281b5e1b0 Refactoring: extract utility methods to separate class 2017-11-24 14:29:02 +03:00
Nikolay Krasko
64bb40869e Compare testData files with KotlinTestUtils.assertEqualsToFile 2017-11-24 14:29:02 +03:00
Nikolay Krasko
30d8875bdf Check file is valid before search in ScriptDependenciesCache
Otherwise search will fail.
2017-11-24 14:29:02 +03:00
Dmitry Jemerov
7625130b49 SOE protection when enumerating dependencies of common modules
#KT-20937 Fixed
2017-11-23 18:04:28 +01:00
Alexey Tsvetkov
2b708f67ee Add tests for explicit language/api version change in Gradle
Modifying language/api version should cause non-incremental build.
Implicit change (e.g. when versions are not specified, but the compiler
is updated 1.1->1.2) is handled by `AbstractKotlinCompileTool#computedCompilerClasspath`.
Explicit change is handled by `AbstractKotlinCompile#serializedCompilerArguments`.
2017-11-23 14:46:23 +03:00
Alexey Tsvetkov
913a997f24 Rebuild when language/api version is changed (JPS)
#KT-20757 fixed
2017-11-23 14:46:23 +03:00
Alexey Tsvetkov
b1f0f87829 Fix default value for api version string in IC meta info file 2017-11-23 14:46:22 +03:00
Dmitry Savvinov
b8447d6d97 Add test on smartcasts with reified types
This test introduces very special (for current implementation) case,
when we have smartcast indirectly, via some reified type parameter.

It covers recursive call inSmartCastManager.checkAndRecordPossibleCast(),
which wasn't previously covered by any test in testbase.
2017-11-23 12:45:10 +03:00
Dmitry Savvinov
440b6d9934 Add -Xeffect-system CLI argument which enables Effect System 2017-11-23 12:35:51 +03:00
Leonid Startsev
44d232a83c Extension point for synthetic function names contributions 2017-11-23 12:21:47 +03:00
Leonid Startsev
d6e5551237 More entry points for compiler plugins
* In Kotlin/JS JPS compilation
* In kotlin-common CLI compiler
* In kotlin-common gradle build
2017-11-23 12:12:01 +03:00
Nicolay Mitropolsky
07601b2ec4 KtLightAnnotationForSourceEntry: varargs handling improved (KT-21335, EA-107118) 2017-11-23 10:37:24 +03:00
Nicolay Mitropolsky
23344783a5 KtLightAnnotationForSourceEntry: made more verbose with errors in arrays in params (KT-21335, EA-107118) 2017-11-23 10:37:24 +03:00
Alexander Udalov
e43bf90b9c Use CompilerDeserializationConfiguration in JS IC package fragment
This is more correct because it'll allow the incremental package
fragment to be deserialized with the same analysis flags as the changed
sources. Currently it doesn't seem possible to add a reasonable test for
this fix because there are no flags relevant for JS except for
skipMetadataVersionCheck, which is experimental and thus doesn't require
a test
2017-11-22 18:33:04 +01:00
Dmitry Jemerov
fd763bde17 Reorder imports to avoid merge conflict
(cherry picked from commit 4286cce)
2017-11-22 18:30:34 +01:00
Dmitry Jemerov
6586228c15 Logging to catch KT-20937 2017-11-22 16:42:01 +01:00
Mikhail Glukhikh
078c27efa3 Add fallback flag for legacy var smart casts after try #KT-21377 Fixed 2017-11-22 18:31:04 +03:00
Mikhail Glukhikh
8b6e63dc18 Add forgotten new inference to JS 2017-11-22 18:31:03 +03:00
Dmitry Jemerov
dfe5eb65f9 Don't pack any kotlin stdlib classes into kotlin-plugin.jar
#KT-21395 Fixed

(cherry picked from commit 3fbc5ab)
2017-11-22 14:44:01 +01:00
Dmitry Jemerov
e00cc5ab3d Don't crash with old versions of Android Gradle plugin
#KT-21383 Fixed
2017-11-22 14:14:26 +01:00
Simon Ogorodnik
236ba1d2f2 Refactor PerModulePackageCacheService to fix various problems
Original issue here - structure of VfsEvents,
when directory gets deleted, we receive only VFileDeleteEvent
for directory, but not it's content, so we should invalidate
all modules in which sources this directory located, and all
modules that located in such directory

Second problem - When VirtualFile was deleted it is impossible to
get ModuleInfo for it using getModuleInfoByVirtualFile

Third problem - stale references in cache, due cycle dependency

 #KT-20987 Fixed
2017-11-22 16:07:34 +03:00
Mikhail Zarechenskiy
bee7ed1431 [NI] Fix mapping of type arguments to parameters for inner classes 2017-11-22 10:22:41 +03:00
Mikhail Zarechenskiy
e526a87d54 [NI] Make model more robust: remove diagnostics from resolution atoms
Currently there are two major phases in NI that report diagnostics: resolution parts and completion. They connected in method `KotlinCallCompleter.runCompletion` and previously diagnostics were collected in several places, from resolution atoms, partly from constraint system and partly from `CallResolutionResult`, some of them were lost.

 To mitigate this problem, now diagnostics are not bind to the intermediate candidate, only to the result resolution candidate (overloaded or usual one). And all diagnostics are now collected in method `runCompletion`
2017-11-22 10:22:39 +03:00
Nikolay Krasko
6e51c4d5db Disable script dependency updater in AddRequireModuleTest 2017-11-21 18:55:42 +03:00
Nikolay Krasko
a530163074 Add sources for 'reflect' and 'test' libs during JPS config (KT-20956)
#KT-20956 Fixed
2017-11-21 18:55:42 +03:00
Alexey Andreev
ec8adfe7c4 JS: fix referencing outer class from secondary constructor
See KT-21041
2017-11-21 12:22:10 +03:00
Alexey Andreev
88441da131 JS: cache PropertyMetadata objects in property delegates
Also, remove unused PropertyMetadata instances

See KT-20737, KT-20738
2017-11-21 12:21:22 +03:00
Alexey Andreev
7ebfba3722 JS: apply boxing when initializing val parameter of type Char
See KT-20854
2017-11-21 12:20:01 +03:00
Alexey Andreev
32a0221474 JS: refactor code that copies default methods in interfaces to classes
Als fixes KT-21245
2017-11-21 12:18:16 +03:00
Alexey Andreev
38e50e964a JS: fix generation of source map for inline lambda with ignored result
See KT-21309
2017-11-21 12:15:25 +03:00
Nikolay Krasko
d2aabe076d Refactoring: extract jar names in PathUtil and use them in artifacts 2017-11-21 01:11:01 +03:00
Nikolay Krasko
3a90f3618a Don't force configure with kotlin-jdk artifacts for early versions (KT-21028)
#KT-21028 Fixed
2017-11-21 01:11:00 +03:00
Nikolay Krasko
679a460c44 Minor: make sdk version comparison compatible with JDK > 9 2017-11-21 01:10:59 +03:00
Ilya Chernikov
0e5c443894 Move kapt3 embeddable to prepare folder 2017-11-20 22:59:40 +01:00
Ilya Chernikov
6f73e9994b Add kotlin-annotation-processing-embeddable, publish base kapt3 as kotlion-annotation-processing
(cherry picked from commit 148d4e4)
2017-11-20 20:06:43 +01:00
Ilya Chernikov
56542286eb Bring back filtering of jna and shading of jline in embeddable compiler
they were lost during the migration to gradle

(cherry picked from commit 126a6a8)
2017-11-20 19:59:40 +01:00
Alexey Andreev
a9548b1224 JS: fix translation of safe calls to suspend unit functions
See KT-21317
2017-11-20 19:19:24 +03:00
Denis Zharkov
91730e1a9e Do not run search for operator-like names in inspections
It might be rather expensive to search componentN's usages in the whole project
2017-11-20 18:33:46 +03:00
Ilmir Usmanov
0fbbe10143 Support suspendCoroutineUninterceptedOrReturn intrinsic
KT-17336: Fixed
2017-11-20 18:12:41 +03:00
Mikhail Glukhikh
4c583c5a61 Catch InvalidModuleException from getModality() in icon provider
Related to KT-20986
2017-11-18 12:38:25 +03:00
Mikhail Glukhikh
dce7377099 Revert check on module descriptor validness in lookup
Related to KT-20986
2017-11-18 12:35:01 +03:00
Mikhail Glukhikh
e53cedbd6b Throw InvalidModuleException in assertValid() instead of standard ISE 2017-11-18 12:34:59 +03:00
Mikhail Glukhikh
539f8afef3 Style: do not highlight single return when as "Use expresison body" 2017-11-18 12:34:58 +03:00
Nikolay Krasko
c0a3344803 Download jflex from bintray 2017-11-17 17:21:59 +03:00
Mikhael Bogdanov
a547019ed0 Switch DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET according to LL 2017-11-17 13:48:44 +01:00
Alexander Udalov
d386712903 Report pre-release errors if release LV is used
#KT-21267 Fixed
2017-11-17 13:42:36 +01:00
Dmitry Jemerov
64a8008a8a Add icon for multiplatform projects, update JS icon
#KT-19824 Fixed
2017-11-17 13:13:04 +01:00
Mikhail Zarechenskiy
20e1caaab1 [NI] Use refined expected type by smartcasts in CS 2017-11-17 15:04:20 +03:00
Mikhail Zarechenskiy
ca035bc8b8 [NI] Report error from expected type constraint position 2017-11-17 15:04:18 +03:00
Igor Chevdar
d4d3f237ee Fix for package level lateinit properties 2017-11-17 13:48:17 +03:00
Alexey Andreev
89db4dfe79 JS: translate when against enum to JsSwitch when possible 2017-11-17 11:07:41 +03:00
Alexey Andreev
c54c4a6ce8 JS: fix support of JsSwitch in coroutines 2017-11-17 11:07:39 +03:00
Alexey Andreev
678b4c67c1 JS: translate when to JsSwitch when possible
See KT-21160
2017-11-17 11:07:38 +03:00
Alexey Andreev
7b403211dd JS: kotlinize WhenTranslator 2017-11-17 11:07:37 +03:00
Alexey Andreev
b93acb07d2 JS: don't remove debugger statement from coroutine
See KT-19826
2017-11-17 11:07:36 +03:00
Alexey Andreev
21de76f88d JS: fix identifier generation in delegate constructor calls
See KT-21093
2017-11-17 11:07:34 +03:00
Ilya Gorbunov
fdeb916111 Correct exclusions of kotlin-stdlib-js 2017-11-16 20:30:51 +03:00
Ilya Gorbunov
c10771092a Add maven subprojects to the project 2017-11-16 20:30:51 +03:00
Nikolay Krasko
17f0d3b9b3 Revert JetRunConfiguration for compatibility (KT-21296)
#KT-21296 Fixed
2017-11-16 20:14:38 +03:00
Mikhail Zarechenskiy
66064345e9 [NI] Support fallback resolution for refined sams priority feature 2017-11-16 18:07:54 +03:00
Mikhail Zarechenskiy
e42f07b031 [NI] Wait for proper constraints to fix type for callable reference
If expected type is a type variable, then we'll wait for proper constraints, but previously we resolved callable reference as it didn't have expected type at all, because type variable isn't a functional type

 Consider the following example:

 fun foo(i: Int) {}
 fun foo(s: String) {}
 fun <T> id(x: T): T = x

 fun test() {
     val x1: (Int) -> Unit = id(id(::foo))
 }

 Here we shouldn't resolve callable reference until we get constraint from expected type of `x1`
2017-11-16 18:07:51 +03:00
Mikhael Bogdanov
cbfcb74b58 Get rid of cli dependencies from ir 2017-11-16 14:46:53 +01:00
Zalim Bashorov
28e34ac39b Minor: fix IDEA warnings in BasicBoxTest.kt 2017-11-16 15:42:08 +03:00
Zalim Bashorov
291e903ae6 Mark js/js/translator/testData/out-min/ as excluded directory in IDEA
It's required to avoid indexing a lot of js files (> 200MB)
after each run of js tests.
2017-11-16 15:41:45 +03:00
Zalim Bashorov
4849bddde1 KJS: write minification's test results to separate directory
It allows excluding this directory from indexing inside IDEA
and probably simplifies the main workflow.
2017-11-16 15:36:20 +03:00
Alexey Tsvetkov
18261838b6 Avoid deserializing .kotlin_module as class proto
#KT-20184 fixed
2017-11-16 14:47:59 +03:00
Alexander Udalov
c55ac55526 Restore and deprecate JvmFileClassesProvider.getFileClassInternalName
#KT-21270 Fixed
2017-11-16 11:24:11 +01:00
Dmitry Petrov
4193fae9fa Fix floating point comparison generation for range literals 2017-11-16 10:54:25 +03:00
Dmitry Petrov
354d54aef6 Don't generate DUPX instructions for in-range-literal expressions
Store argument into a local variable instead.
2017-11-16 10:54:25 +03:00
Vladimir Kasatkin
9b49e9139c Added samples for map filtering operators (KT-20357)
Fix map transformations sample names.
2017-11-15 23:58:51 +03:00
Ilya Gorbunov
dca23e339a Improve iterator samples, add explanatory comments (KT-20357) 2017-11-15 23:58:49 +03:00
kenji tomita
4d13ea89b2 Add samples for iterator-related extensions (KT-20357) 2017-11-15 23:39:07 +03:00
Ilya Gorbunov
94f77c773c Remove unused function, simplify outdated runtime version tests 2017-11-15 17:53:18 +03:00
Ilya Gorbunov
18611343f2 Do not infer artifact version from build.txt #KT-21150 2017-11-15 17:53:18 +03:00
Ilya Gorbunov
9de6dd814b Docs: clarifications on LazyThreadSafetyMode 2017-11-15 17:41:43 +03:00
Nikolay Krasko
0768e7404b Stop overwriting values with defaults in compiler arguments
'verbose' option was always lost.
2017-11-15 16:12:41 +03:00
Nikolay Krasko
0480042ffd Log incremental options before passing them to kotlin daemon 2017-11-15 16:12:40 +03:00
Nikolay Krasko
643f771c24 Report rebuild reason in rebuild function 2017-11-15 16:12:38 +03:00
Nikolay Krasko
97c1e58149 Minor: reformat too long lines 2017-11-15 16:12:37 +03:00
9506 changed files with 279935 additions and 164239 deletions

3
.gitattributes vendored
View File

@@ -1 +1,4 @@
**/testData/** linguist-vendored
*Generated.java linguist-generated=true
compiler/cli/bin/* eol=lf
compiler/cli/bin/*.bat eol=crlf

12
.gitignore vendored
View File

@@ -4,6 +4,7 @@
/confluence/target
/dependencies
/dist
/local
/gh-pages
/ideaSDK
/clionSDK
@@ -18,15 +19,20 @@ workspace.xml
/ultimate/ideaSDK
/ultimate/out
/ultimate/tmp
/js/js.translator/testData/**/out/
/js/js.translator/testData/out/
/js/js.translator/testData/out-min/
.gradle/
build/
!**/src/**/build
*.iml
!**/test/**/build
.idea/modules.xml
*.iml
!**/testData/**/*.iml
.idea/libraries/Gradle*.xml
.idea/libraries/Maven*.xml
.idea/artifacts
.idea/modules
.idea/runConfigurations/JPS_*.xml
.idea/libraries
.idea/modules.xml
.idea/gradle.xml
.idea/compiler.xml

5
.idea/ant.xml generated
View File

@@ -2,10 +2,6 @@
<project version="4">
<component name="AntConfiguration">
<buildFile url="file://$PROJECT_DIR$/compiler/frontend/buildLexer.xml" />
<buildFile url="file://$PROJECT_DIR$/build.xml">
<antCommandLine value="-J-ea" />
<maximumHeapSize value="1024" />
</buildFile>
<buildFile url="file://$PROJECT_DIR$/update_dependencies.xml" />
<buildFile url="file://$PROJECT_DIR$/TeamCityBuild.xml">
<maximumHeapSize value="512" />
@@ -18,6 +14,5 @@
</properties>
</buildFile>
<buildFile url="file://$PROJECT_DIR$/TeamCityRelay.xml" />
<buildFile url="file://$PROJECT_DIR$/node_utils.xml" />
</component>
</project>

View File

@@ -55,6 +55,16 @@
</value>
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="CONTINUATION_INDENT_IN_PARAMETER_LISTS" value="false" />
<option name="CONTINUATION_INDENT_IN_ARGUMENT_LISTS" value="false" />
<option name="CONTINUATION_INDENT_FOR_EXPRESSION_BODIES" value="false" />
<option name="CONTINUATION_INDENT_FOR_CHAINED_CALLS" value="false" />
<option name="CONTINUATION_INDENT_IN_SUPERTYPE_LISTS" value="false" />
<option name="CONTINUATION_INDENT_IN_IF_CONDITIONS" value="false" />
<option name="WRAP_EXPRESSION_BODY_FUNCTIONS" value="1" />
<option name="IF_RPAREN_ON_NEW_LINE" value="true" />
</JetCodeStyleSettings>
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
@@ -207,6 +217,13 @@
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
</codeStyleSettings>
<codeStyleSettings language="PROTO">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Scala">
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<option name="ELSE_ON_NEW_LINE" value="true" />
@@ -228,7 +245,6 @@
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="ELSE_ON_NEW_LINE" value="true" />
@@ -261,12 +277,16 @@
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="5" />
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@@ -1,9 +1,7 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="Copyright 2010-&amp;#36;today.year JetBrains s.r.o.&#10;&#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10;http://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License." />
<option name="keyword" value="Copyright" />
<option name="allowReplaceKeyword" value="JetBrains" />
<option name="allowReplaceRegexp" value="JetBrains" />
<option name="notice" value="Copyright 2010-&amp;#36;today.year JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license &#10;that can be found in the license/LICENSE.txt file." />
<option name="myName" value="apache" />
<option name="myLocal" value="true" />
</copyright>
</component>

View File

@@ -1,7 +1,7 @@
<component name="CopyrightManager">
<settings default="">
<settings>
<module2copyright>
<element module="all except testData" copyright="apache" />
<element module="Apply copyright" copyright="apache" />
</module2copyright>
<LanguageOptions name="Groovy">
<option name="fileTypeOverride" value="1" />

View File

@@ -2,6 +2,7 @@
<dictionary name="Nikolay.Krasko">
<words>
<w>accessors</w>
<w>coroutines</w>
<w>crossinline</w>
<w>fqname</w>
<w>goto</w>
@@ -12,6 +13,7 @@
<w>memoize</w>
<w>memoized</w>
<w>multiline</w>
<w>navigatable</w>
<w>preload</w>
<w>preloader</w>
<w>preloading</w>

View File

@@ -2,9 +2,13 @@
<dictionary name="bashor">
<words>
<w>ctor</w>
<w>inlining</w>
<w>interner</w>
<w>kclass</w>
<w>lookups</w>
<w>minification</w>
<w>minifier</w>
<w>minify</w>
<w>unescape</w>
</words>
</dictionary>

View File

@@ -3,6 +3,8 @@
<words>
<w>checkcast</w>
<w>coroutine</w>
<w>experimentalities</w>
<w>experimentality</w>
<w>insn</w>
<w>liveness</w>
</words>

View File

@@ -5,6 +5,7 @@
<w>impls</w>
<w>kapt</w>
<w>parceler</w>
<w>repl</w>
<w>uast</w>
</words>
</dictionary>

17
.idea/encodings.xml generated
View File

@@ -1,6 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
<file url="file://$PROJECT_DIR$/libraries" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/examples/browser-example" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/examples/browser-example-with-library" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/examples/js-example" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/examples/kotlin-java-example" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/examples/kotlin-js-library-example" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/idl2k" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-annotation-processing-maven" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-allopen" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-noarg" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-plugin" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-plugin-test" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-sam-with-receiver" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-osgi-bundle" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/maven-archetypes" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/maven-archetypes/kotlin-archetype-js" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/maven-archetypes/kotlin-archetype-jvm" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@@ -56,7 +56,7 @@
<option name="ignoreOnVolatileVariables" value="true" />
</inspection_tool>
<inspection_tool class="DuplicateCondition" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreMethodCalls" value="false" />
<option name="ignoreSideEffectConditions" value="true" />
</inspection_tool>
<inspection_tool class="EmptyStatementBody" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_reportEmptyBlocks" value="false" />
@@ -281,6 +281,7 @@
<option name="fromVersion" value="2.4" />
<option name="toVersion" value="3.1" />
</inspection_tool>
<inspection_tool class="Reformat" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="ReplaceAssignmentWithOperatorAssignment" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreLazyOperators" value="true" />
<option name="ignoreObscureOperators" value="true" />
@@ -402,8 +403,10 @@
<inspection_tool class="UnnecessaryFullyQualifiedName" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="IDEA Test Sources" level="WARNING" enabled="false">
<option name="m_ignoreJavadoc" value="true" />
<option name="ignoreInModuleStatements" value="true" />
</scope>
<option name="m_ignoreJavadoc" value="true" />
<option name="ignoreInModuleStatements" value="true" />
</inspection_tool>
<inspection_tool class="UnnecessaryLabelOnBreakStatement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryLabelOnContinueStatement" enabled="false" level="WARNING" enabled_by_default="false" />

2
.idea/kotlinc.xml generated
View File

@@ -13,6 +13,6 @@
</option>
</component>
<component name="KotlinCompilerSettings">
<option name="additionalArguments" value="-version -Xallow-kotlin-package -Xskip-metadata-version-check" />
<option name="additionalArguments" value="-version -Xallow-kotlin-package -Xskip-metadata-version-check -Xread-deserialized-contracts" />
</component>
</project>

4
.idea/misc.xml generated
View File

@@ -40,8 +40,7 @@
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/confluence-highlighting/pom.xml" />
<option value="$PROJECT_DIR$/confluence/pom.xml" />
<option value="$PROJECT_DIR$/libraries/pom.xml" />
</list>
</option>
</component>
@@ -54,6 +53,7 @@
<component name="SuppressABINotification">
<option name="modulesWithSuppressedNotConfigured">
<set>
<option value="backend.src" />
<option value="kotlin-stdlib-common" />
<option value="kotlin-stdlib-js" />
<option value="kotlin-test-common" />

View File

@@ -4,7 +4,7 @@
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-x :ultimate:generateTests" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>

View File

@@ -4,7 +4,7 @@
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="scriptParameters" value="-P intellijUltimateEnabled" />
<option name="taskDescriptions">
<list />
</option>

3
.idea/scopes/Apply_copyright.xml generated Normal file
View File

@@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*&amp;&amp;!file[*]:*.gradle.kts&amp;&amp;!file[*]:*.gradle" />
</component>

4
.idea/vcs.xml generated
View File

@@ -15,6 +15,10 @@
<option name="issueRegexp" value="KEEP\-(\d+)" />
<option name="linkRegexp" value="https://github.com/Kotlin/KEEP/issues/$1" />
</IssueNavigationLink>
<IssueNavigationLink>
<option name="issueRegexp" value="KOTLIN-CR\-\d+" />
<option name="linkRegexp" value="https://upsource.jetbrains.com/kotlin/review/$0" />
</IssueNavigationLink>
</list>
</option>
</component>

File diff suppressed because it is too large Load Diff

View File

@@ -29,16 +29,16 @@ Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links:
In order to build Kotlin distribution you need to have:
- Apache Ant 1.9.4 and higher
- JDK 1.6, 1.7 and 1.8
- JDK 1.6, 1.7, 1.8 and 9
- Setup environment variables as following:
JAVA_HOME="path to JDK 1.8"
JDK_16="path to JDK 1.6"
JDK_17="path to JDK 1.7"
JDK_18="path to JDK 1.8"
JDK_9="path to JDK 9"
For local development, if you're not working on bytecode generation or the standard library, it's OK to have only JDK 8 installed, and to point all of the environment variables mentioned above to your JDK 8 installation.
For local development, if you're not working on bytecode generation or the standard library, it's OK to have only JDK 1.8 and JDK 9 installed, and to point JDK_16 and JDK_17 environment variables to your JDK 1.8 installation.
You also can use [Gradle properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_properties_and_system_properties) to setup JDK_* variables.
@@ -46,24 +46,25 @@ You also can use [Gradle properties](https://docs.gradle.org/current/userguide/b
## Building
To build this project, first time you try to build you need to run this:
The project is built with Gradle. Run Gradle to build the project and to run the tests
using the following command on Unix/macOS:
ant -f update_dependencies.xml
./gradlew <tasks-and-options>
or the following command on Windows:
which will setup the dependencies on
gradlew <tasks-and-options>
On the first project configuration gradle will download and setup the dependencies on
* `intellij-core` is a part of command line compiler and contains only necessary APIs.
* `idea-full` is a full blown IntelliJ IDEA Community Edition to be used in the plugin module.
Then, you may run Gradle to build the project and run tests, using:
./gradlew <tasks-and-options>
These dependencies are quite large, so depending on the quality of your internet connection
you might face timeouts getting them. In this case you can increase timeout by specifying the following
command line parameters on the first run:
command on Unix/macOS, or
gradlew <tasks-and-options>
on Windows.
./gradlew -Dhttp.socketTimeout=60000 -Dhttp.connectionTimeout=60000
## Important gradle tasks
@@ -77,15 +78,12 @@ on Windows.
- `compilerTest` - build and run all compiler tests
- `ideaPluginTest` - build and run all IDEA plugin tests
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately by Maven: go into `libraries` directory after building the compiler and run:
mvn install
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately with Maven.
Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.
## Working with the project in IntelliJ IDEA
## <a name="working-in-idea"></a> Working with the project in IntelliJ IDEA
Working with the Kotlin project requires IntelliJ IDEA 2017.3. You can download an Early Access Preview version of IntelliJ IDEA 2017.3 [here](https://www.jetbrains.com/idea/nextversion/).
Working with the Kotlin project requires IntelliJ IDEA 2017.3. You can download IntelliJ IDEA 2017.3 [here](https://www.jetbrains.com/idea/download).
To import the project in Intellij choose project directory in Open project dialog. Then, after project opened, Select
`File` -> `New...` -> `Module from Existing Sources` in the menu, and select `build.gradle.kts` file in the project's root folder.
@@ -94,7 +92,7 @@ In the import dialog, select `use default gradle wrapper`.
To be able to run tests from IntelliJ easily, check `Delegate IDE build/run actions to Gradle` in the Gradle runner settings.
At this time, you can use the latest released 1.1.x version of the Kotlin plugin for working with the code. To make sure you have the latest version installed, use Tools | Kotlin | Configure Kotlin Plugin Updates and press "Check for updates now".
At this time, you can use the latest released 1.2.x version of the Kotlin plugin for working with the code. To make sure you have the latest version installed, use Tools | Kotlin | Configure Kotlin Plugin Updates and press "Check for updates now".
### Compiling and running
@@ -104,6 +102,18 @@ From this root project there are Run/Debug Configurations for running IDEA or th
* Run the "IDEA" run configuration in the project
* a child IntelliJ IDEA with the Kotlin plugin will then startup
### Including into composite build
To include kotlin compiler into [composite build](https://docs.gradle.org/current/userguide/composite_builds.html) you need to define `dependencySubstitution` for `kotlin-compiler` module in `settings.gradle`
```
includeBuild('/path/to/kotlin') {
dependencySubstitution {
substitute module('org.jetbrains.kotlin:kotlin-compiler') with project(':include:kotlin-compiler')
}
}
```
# Contributing
We love contributions! There's [lots to do on Kotlin](https://youtrack.jetbrains.com/issues/KT) and on the
@@ -125,7 +135,7 @@ macro to include code from a test function. The benefits of this approach are tw
Also the [JavaScript translation](https://github.com/JetBrains/kotlin/blob/master/js/ReadMe.md) could really use your help. See the [JavaScript contribution section](https://github.com/JetBrains/kotlin/blob/master/js/ReadMe.md) for more details.
Some of the code in the standard library is created by generating code from templates. See the [README](libraries/stdlib/ReadMe.md) in the stdlib section for how run the code generator. The existing templates can be used as examples for creating new ones.
Some of the code in the standard library is created by generating code from templates. See the [README](libraries/stdlib/ReadMe.md) in the stdlib section for how to run the code generator. The existing templates can be used as examples for creating new ones.
## Submitting patches

View File

@@ -1,12 +1,13 @@
<project name="Kotlin CI Steps" default="none">
<import file="build.xml" optional="false"/>
<import file="common.xml" optional="false"/>
<property name="kotlin-home" value="${output}/kotlinc"/>
<property name="build.number" value="snapshot"/>
<property name="fail.on.plugin.verifier.error" value="true"/>
<property name="version_substitute_dir" value="${basedir}/versions_temp/"/>
<property name="artifact.output.path" value="${basedir}/dist/artifacts"/>
<property name="artifact.output.path" value="${basedir}/dist/artifacts/ideaPlugin"/>
<property name="plugin.xml" value="idea/src/META-INF/plugin.xml"/>
<property name="plugin.xml.bk" value="${version_substitute_dir}/plugin.xml.bk"/>
<property name="plugin.xml.versioned" value="${plugin.xml}.versioned"/>
@@ -38,84 +39,49 @@
<echoprop prop="user.home"/>
<echoprop prop="user.dir"/>
<target name="cleanupArtifacts">
<delete dir="${artifact.output.path}" includes="*"/>
</target>
<macrodef name="substituteVersionInFile">
<attribute name="target.file"/>
<attribute name="test.string"/>
<attribute name="target.file.bk" default="@{target.file}.bk"/>
<attribute name="target.file.versioned" default="@{target.file}.versioned"/>
<attribute name="token.key" default="snapshot"/>
<attribute name="version" default="${build.number}"/>
<macrodef name="run-gradle">
<attribute name="tasks" />
<attribute name="args" default="" />
<sequential>
<!-- Create backup. Backup will be restored after build end. This will allow to rebuild project without renew
plugin.xml from repository. -->
<copy file="@{target.file}" tofile="@{target.file.bk}"/>
<!-- Check that version has correct pattern for substitution -->
<copy todir="">
<fileset file="@{target.file.bk}">
<contains text="@{test.string}"/>
</fileset>
<filterchain>
<replacetokens>
<token key="@{token.key}" value="@{version}"/>
</replacetokens>
</filterchain>
<mergemapper to="@{target.file.versioned}"/>
</copy>
<!-- If file doesn't exist - there's a problem with original plugin.xml. Probably there's a bad pattern used for version -->
<copy file="@{target.file.versioned}" tofile="@{target.file}" overwrite="true"/>
<delete file="@{target.file.versioned}" quiet="true"/>
<java classname="org.gradle.wrapper.GradleWrapperMain"
fork="true"
dir="${basedir}"
failonerror="true"
timeout="4000000"
maxmemory="400m"
taskname="gradle">
<classpath>
<pathelement location="${basedir}/gradle/wrapper/gradle-wrapper.jar"/>
</classpath>
<arg line="--no-daemon" />
<arg line="@{tasks}" />
<arg line="@{args}" />
</java>
</sequential>
</macrodef>
<target name="cleanupArtifacts">
<run-gradle tasks="cleanupArtifacts" />
</target>
<target name="zip-compiler">
<run-gradle tasks="zipCompiler" args="-PdeployVersion=${build.number}" />
</target>
<target name="zip-test-data">
<run-gradle tasks="zipTestData" />
</target>
<target name="writeCompilerVersionToTemplateFile">
<!-- empty, version is written in gradle build -->
</target>
<target name="writePluginVersionToTemplateFile">
<mkdir dir="${version_substitute_dir}"/>
<substituteVersionInFile
target.file="${plugin.xml}"
target.file.bk="${plugin.xml.bk}"
target.file.versioned="${plugin.xml.versioned}"
test.string="&lt;version&gt;@snapshot@&lt;/version&gt;"
version="${plugin.xml.version.number}"/>
<run-gradle tasks="writePluginVersion" args="-PpluginVersion=${plugin.xml.version.number}" />
</target>
<target name="revertTemplateFiles">
<copy file="${plugin.xml.bk}" tofile="${plugin.xml}" overwrite="true"/>
<copy file="${compiler.version.java.bk}" tofile="${compiler.version.java}" overwrite="true"/>
<delete dir="${version_substitute_dir}" quiet="true"/>
</target>
<target name="pre_build" depends="writeCompilerVersionToTemplateFile, writePluginVersionToTemplateFile, cleanupArtifacts"/>
<target name="zipArtifacts">
<macrodef name="zipPlugin">
<attribute name="filename"/>
<attribute name="prefix" />
<attribute name="dir"/>
<sequential>
<zip destfile="@{filename}">
<zipfileset prefix="@{prefix}" dir="@{dir}" excludes="kotlinc/bin/*"/>
<zipfileset prefix="@{prefix}/kotlinc/bin" dir="@{dir}/kotlinc/bin" includes="*.bat"
filemode="644"/>
<zipfileset prefix="@{prefix}/kotlinc/bin" dir="@{dir}/kotlinc/bin" excludes="*.bat"
filemode="755"/>
</zip>
</sequential>
</macrodef>
<zipPlugin filename="${plugin.zip}" prefix="Kotlin" dir="${artifact.output.path}/${pluginArtifactDir}"/>
<run-gradle tasks="zipPlugin" args="-PpluginArtifactDir=${pluginArtifactDir} -PpluginZipPath=${plugin.zip}"/>
</target>
<macrodef name="print-statistic">
@@ -148,42 +114,8 @@
<print-file-size-statistic path="${basedir}/libraries/stdlib/js/build/classes/main" file-name="kotlin.meta.js"/>
</target>
<target name="post_build" depends="zipArtifacts, revertTemplateFiles, printStatistics, remove_internal_artifacts, dont_remove_internal_artifacts"/>
<target name="none">
<fail message="Either specify pre_build or post_build"/>
</target>
<property name="teamcity.build.branch" value=""/>
<condition property="need.remove.artifacts" value="true">
<and>
<matches pattern="rri?/.*" string="${teamcity.build.branch}"/>
<not>
<matches pattern="rri?/internal/.*" string="${teamcity.build.branch}"/>
</not>
</and>
</condition>
<target name="remove_internal_artifacts"
description="Remove internal artifacts for rri?/* branches, but store them for rri?/internal/*"
if="need.remove.artifacts">
<echo message="Remove internal artifacts" />
<delete failonerror="false" verbose="true">
<fileset dir="dist">
<include name="kotlin-compiler-before-shrink.jar"/>
<include name="kotlin-for-upsource.jar"/>
<include name="kotlin-for-upsource-sources.jar"/>
<include name="kotlin-test-data.zip"/>
</fileset>
<fileset dir="out/artifacts/internal">
<include name="kotlin-ide-common.jar"/>
</fileset>
</delete>
</target>
<target name="dont_remove_internal_artifacts" unless="need.remove.artifacts">
<echo message="Internal artifacts left untouched"/>
</target>
</project>

View File

@@ -2,6 +2,7 @@
description = "Kotlin Build Common"
apply { plugin("kotlin") }
apply { plugin("jps-compatible") }
dependencies {
compileOnly(project(":core:util.runtime"))
@@ -10,15 +11,18 @@ dependencies {
compileOnly(project(":compiler:frontend.java"))
compileOnly(project(":js:js.serializer"))
compileOnly(project(":js:js.frontend"))
compileOnly(ideaSdkDeps("util"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
compileOnly(intellijDep()) { includeJars("annotations", "asm-all", "trove4j", "util") }
compileOnly(project(":kotlin-reflect-api"))
testCompileOnly(project(":compiler:cli-common"))
testCompile(projectTests(":compiler:tests-common"))
testCompile(commonDep("junit:junit"))
testCompile(protobufFull())
testCompile(projectDist(":kotlin-stdlib"))
testCompile(projectDist(":kotlin-reflect"))
testCompileOnly(ideaSdkDeps("openapi"))
testRuntime(projectDist(":kotlin-compiler"))
testCompileOnly(intellijDep()) { includeJars("openapi") }
testRuntime(projectDist(":kotlin-reflect"))
}
sourceSets {

View File

@@ -0,0 +1,40 @@
/*
* 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.metadata.java;
import "core/metadata/src/metadata.proto";
option java_outer_classname = "JavaClassProtoBuf";
option optimize_for = LITE_RUNTIME;
extend Function {
optional bool is_static_method = 1000;
optional bool is_package_private_method = 1001;
}
extend Property {
optional bool is_static_field = 1000;
optional bool is_package_private_field = 1001;
}
extend Class {
optional bool is_package_private_class = 1000;
}
extend Constructor {
optional bool is_package_private_constructor = 1000;
}

View File

@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.config.shouldWritePreReleaseFlag
import org.jetbrains.kotlin.config.isPreRelease
import org.jetbrains.kotlin.load.java.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion
@@ -63,10 +63,10 @@ fun JvmBuildMetaInfo(args: CommonCompilerArguments): JvmBuildMetaInfo {
val languageVersion = args.languageVersion?.let((LanguageVersion)::fromVersionString) ?: LanguageVersion.LATEST_STABLE
return JvmBuildMetaInfo(
isEAP = languageVersion.shouldWritePreReleaseFlag(),
isEAP = languageVersion.isPreRelease(),
compilerBuildVersion = KotlinCompilerVersion.VERSION,
languageVersionString = languageVersion.versionString,
apiVersionString = args.apiVersion ?: ApiVersion.LATEST_STABLE.versionString,
apiVersionString = args.apiVersion ?: languageVersion.versionString,
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,

View File

@@ -16,11 +16,12 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.deserialization.getClassId
class ChangesCollector {
private val removedMembers = hashMapOf<FqName, MutableSet<String>>()
@@ -72,13 +73,13 @@ class ChangesCollector {
}
}
fun collectProtoChanges(oldData: ProtoData?, newData: ProtoData?) {
fun collectProtoChanges(oldData: ProtoData?, newData: ProtoData?, collectAllMembersForNewClass: Boolean = false) {
if (oldData == null && newData == null) {
throw IllegalStateException("Old and new value are null")
}
if (oldData == null) {
newData!!.collectAll(isRemoved = false)
newData!!.collectAll(isRemoved = false, collectAllMembersForNewClass = collectAllMembersForNewClass)
return
}
@@ -120,10 +121,10 @@ class ChangesCollector {
private fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>): Set<String> =
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
private fun ProtoData.collectAll(isRemoved: Boolean) =
private fun ProtoData.collectAll(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) =
when (this) {
is PackagePartProtoData -> collectAllFromPackage(isRemoved)
is ClassProtoData -> collectAllFromClass(isRemoved)
is ClassProtoData -> collectAllFromClass(isRemoved, collectAllMembersForNewClass)
}
private fun PackagePartProtoData.collectAllFromPackage(isRemoved: Boolean) {
@@ -142,28 +143,36 @@ class ChangesCollector {
}
}
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean) {
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) {
val classFqName = nameResolver.getClassId(proto.fqName).asSingleFqName()
val kind = Flags.CLASS_KIND.get(proto.flags)
if (kind == ProtoBuf.Class.Kind.COMPANION_OBJECT) {
val memberNames =
proto.getNonPrivateNames(
nameResolver,
ProtoBuf.Class::getConstructorList,
ProtoBuf.Class::getFunctionList,
ProtoBuf.Class::getPropertyList
) + proto.enumEntryList.map { nameResolver.getString(it.name) }
val memberNames = getNonPrivateMemberNames()
val collectMember = if (isRemoved) this@ChangesCollector::collectRemovedMember else this@ChangesCollector::collectChangedMember
collectMember(classFqName.parent(), classFqName.shortName().asString())
memberNames.forEach { collectMember(classFqName, it) }
}
else {
if (!isRemoved && collectAllMembersForNewClass) {
val memberNames = getNonPrivateMemberNames()
memberNames.forEach { this@ChangesCollector.collectChangedMember(classFqName, it) }
}
collectSignature(classFqName, areSubclassesAffected = true)
}
}
private fun ClassProtoData.getNonPrivateMemberNames(): Set<String> {
return proto.getNonPrivateNames(
nameResolver,
ProtoBuf.Class::getConstructorList,
ProtoBuf.Class::getFunctionList,
ProtoBuf.Class::getPropertyList
) + proto.enumEntryList.map { nameResolver.getString(it.name) }
}
fun collectMemberIfValueWasChanged(scope: FqName, name: String, oldValue: Any?, newValue: Any?) {
if (oldValue == null && newValue == null) {
throw IllegalStateException("Old and new value are null for $scope#$name")
@@ -186,4 +195,4 @@ class ChangesCollector {
val prevValue = this.areSubclassesAffected[fqName] ?: false
this.areSubclassesAffected[fqName] = prevValue || areSubclassesAffected
}
}
}

View File

@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.cli.common.ExitCode
import java.io.File
interface ICReporter {
fun report(message: ()->String)
fun report(message: () -> String)
// used in Gradle plugin
@Suppress("unused")

View File

@@ -18,28 +18,31 @@ package org.jetbrains.kotlin.incremental
import com.intellij.util.io.EnumeratorStringDescriptor
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.deserialization.TypeTable
import org.jetbrains.kotlin.metadata.deserialization.supertypes
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.deserialization.TypeTable
import org.jetbrains.kotlin.serialization.deserialization.supertypes
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import java.io.File
/**
* Incremental cache common for JVM and JS
*/
abstract class IncrementalCacheCommon(workingDir: File) : BasicMapsOwner(workingDir) {
abstract class IncrementalCacheCommon<ClassName>(workingDir: File) : BasicMapsOwner(workingDir) {
companion object {
private val SUBTYPES = "subtypes"
private val SUPERTYPES = "supertypes"
private val CLASS_FQ_NAME_TO_SOURCE = "class-fq-name-to-source"
@JvmStatic protected val SOURCE_TO_CLASSES = "source-to-classes"
@JvmStatic protected val DIRTY_OUTPUT_CLASSES = "dirty-output-classes"
}
private val dependents = arrayListOf<IncrementalCacheCommon>()
fun addDependentCache(cache: IncrementalCacheCommon) {
private val dependents = arrayListOf<IncrementalCacheCommon<ClassName>>()
fun addDependentCache(cache: IncrementalCacheCommon<ClassName>) {
dependents.add(cache)
}
val thisWithDependentCaches: Iterable<IncrementalCacheCommon> by lazy {
val thisWithDependentCaches: Iterable<IncrementalCacheCommon<ClassName>> by lazy {
val result = arrayListOf(this)
result.addAll(dependents)
result
@@ -48,6 +51,11 @@ abstract class IncrementalCacheCommon(workingDir: File) : BasicMapsOwner(working
private val subtypesMap = registerMap(SubtypesMap(SUBTYPES.storageFile))
private val supertypesMap = registerMap(SupertypesMap(SUPERTYPES.storageFile))
protected val classFqNameToSourceMap = registerMap(ClassFqNameToSourceMap(CLASS_FQ_NAME_TO_SOURCE.storageFile))
internal abstract val sourceToClassesMap: AbstractSourceToOutputMap<ClassName>
internal abstract val dirtyOutputClassesMap: AbstractDirtyClassesMap<ClassName>
fun classesFqNamesBySources(files: Iterable<File>): Collection<FqName> =
files.flatMapTo(HashSet()) { sourceToClassesMap.getFqNames(it) }
fun getSubtypesOf(className: FqName): Sequence<FqName> =
subtypesMap[className].asSequence()
@@ -55,7 +63,16 @@ abstract class IncrementalCacheCommon(workingDir: File) : BasicMapsOwner(working
fun getSourceFileIfClass(fqName: FqName): File? =
classFqNameToSourceMap[fqName]
abstract fun markDirty(removedAndCompiledSources: List<File>)
open fun markDirty(removedAndCompiledSources: Collection<File>) {
for (sourceFile in removedAndCompiledSources) {
val classes = sourceToClassesMap[sourceFile]
classes.forEach {
dirtyOutputClassesMap.markDirty(it)
}
sourceToClassesMap.clearOutputsForSource(sourceFile)
}
}
protected fun addToClassStorage(proto: ProtoBuf.Class, nameResolver: NameResolver, srcFile: File) {
val supertypes = proto.supertypes(TypeTable(proto.typeTable))
@@ -73,11 +90,19 @@ abstract class IncrementalCacheCommon(workingDir: File) : BasicMapsOwner(working
classFqNameToSourceMap[child] = srcFile
}
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>) {
abstract fun clearCacheForRemovedClasses(changesCollector: ChangesCollector)
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>, changesCollector: ChangesCollector) {
if (removedClasses.isEmpty()) return
val removedFqNames = removedClasses.toSet()
for (removedClass in removedFqNames) {
for (affectedClass in withSubtypes(removedClass, thisWithDependentCaches)) {
changesCollector.collectSignature(affectedClass, areSubclassesAffected = false)
}
}
for (cache in thisWithDependentCaches) {
val parentsFqNames = hashSetOf<FqName>()
val childrenFqNames = hashSetOf<FqName>()

View File

@@ -19,31 +19,37 @@ package org.jetbrains.kotlin.incremental
import com.intellij.util.io.DataExternalizer
import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumerImpl
import org.jetbrains.kotlin.incremental.js.TranslationResultValue
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.incremental.storage.BasicStringMap
import org.jetbrains.kotlin.incremental.storage.DirtyClassesFqNameMap
import org.jetbrains.kotlin.incremental.storage.SourceToFqNameMap
import org.jetbrains.kotlin.incremental.storage.StringToLongMapExternalizer
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolverImpl
import org.jetbrains.kotlin.metadata.deserialization.getExtensionOrNull
import org.jetbrains.kotlin.metadata.js.JsProtoBuf
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolverImpl
import org.jetbrains.kotlin.serialization.js.JsProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import java.io.DataInput
import java.io.DataOutput
import java.io.File
open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon(cachesDir) {
open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon<FqName>(cachesDir) {
companion object {
private val TRANSLATION_RESULT_MAP = "translation-result"
private val SOURCES_TO_CLASSES_FQNS = "sources-to-classes"
private val INLINE_FUNCTIONS = "inline-functions"
private val HEADER_FILE_NAME = "header.meta"
}
private val dirtySources = arrayListOf<File>()
override val sourceToClassesMap = registerMap(SourceToFqNameMap(SOURCE_TO_CLASSES.storageFile))
override val dirtyOutputClassesMap = registerMap(DirtyClassesFqNameMap(DIRTY_OUTPUT_CLASSES.storageFile))
private val translationResults = registerMap(TranslationResultMap(TRANSLATION_RESULT_MAP.storageFile))
private val sourcesToClasses = registerMap(SourceToClassesMap(SOURCES_TO_CLASSES_FQNS.storageFile))
private val inlineFunctions = registerMap(InlineFunctionsMap(INLINE_FUNCTIONS.storageFile))
private val dirtySources = hashSetOf<File>()
private val headerFile: File
get() = File(cachesDir, HEADER_FILE_NAME)
@@ -54,31 +60,24 @@ open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon(cachesDi
headerFile.writeBytes(value)
}
override fun markDirty(removedAndCompiledSources: List<File>) {
override fun markDirty(removedAndCompiledSources: Collection<File>) {
super.markDirty(removedAndCompiledSources)
dirtySources.addAll(removedAndCompiledSources)
}
fun compareAndUpdate(incrementalResults: IncrementalResultsConsumerImpl, changesCollector: ChangesCollector) {
val translatedFiles = incrementalResults.packageParts
dirtySources.forEach {
if (it !in translatedFiles) {
translationResults.remove(it, changesCollector)
inlineFunctions.remove(it)
}
removeAllFromClassStorage(sourcesToClasses[it])
sourcesToClasses.clearOutputsForSource(it)
}
dirtySources.clear()
for ((srcFile, data) in translatedFiles) {
dirtySources.remove(srcFile)
val (binaryMetadata, binaryAst) = data
val oldProtoMap = translationResults[srcFile]?.metadata?.let { getProtoData(srcFile, it) } ?: emptyMap()
val newProtoMap = getProtoData(srcFile, binaryMetadata)
for (protoData in newProtoMap.values) {
for ((classId, protoData) in newProtoMap) {
registerOutputForFile(srcFile, classId.asSingleFqName())
if (protoData is ClassProtoData) {
addToClassStorage(protoData.proto, protoData.nameResolver, srcFile)
}
@@ -96,6 +95,21 @@ open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon(cachesDi
}
}
private fun registerOutputForFile(srcFile: File, name: FqName) {
sourceToClassesMap.add(srcFile, name)
dirtyOutputClassesMap.notDirty(name)
}
override fun clearCacheForRemovedClasses(changesCollector: ChangesCollector) {
dirtySources.forEach {
translationResults.remove(it, changesCollector)
inlineFunctions.remove(it)
}
removeAllFromClassStorage(dirtyOutputClassesMap.getDirtyOutputClasses(), changesCollector)
dirtySources.clear()
dirtyOutputClassesMap.clean()
}
fun nonDirtyPackageParts(): Map<File, TranslationResultValue> =
hashMapOf<File, TranslationResultValue>().apply {
for (path in translationResults.keys()) {
@@ -107,25 +121,6 @@ open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon(cachesDi
}
}
private class SourceToClassesMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, PathStringDescriptor, StringCollectionExternalizer) {
fun clearOutputsForSource(sourceFile: File) {
remove(sourceFile.canonicalPath)
}
fun add(sourceFile: File, className: FqName) {
storage.append(sourceFile.canonicalPath, className.asString())
}
operator fun get(sourceFile: File): Collection<FqName> =
storage[sourceFile.canonicalPath].orEmpty().map { FqName(it) }
override fun dumpValue(value: Collection<String>) = value.dumpCollection()
private fun remove(path: String) {
storage.remove(path)
}
}
private object TranslationResultValueExternalizer : DataExternalizer<TranslationResultValue> {
override fun save(output: DataOutput, value: TranslationResultValue) {
output.writeInt(value.metadata.size)
@@ -187,14 +182,11 @@ fun getProtoData(sourceFile: File, metadata: ByteArray): Map<ClassId, ProtoData>
}
proto.`package`.apply {
val packageFqName = if (hasExtension(JsProtoBuf.packageFqName)) {
nameResolver.getPackageFqName(getExtension(JsProtoBuf.packageFqName))
}
else FqName.ROOT
val packageFqName = getExtensionOrNull(JsProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName)?.let(::FqName) ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
return classes
}

View File

@@ -29,10 +29,11 @@ import org.jetbrains.kotlin.load.kotlin.ModuleMapping
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
import org.jetbrains.kotlin.load.kotlin.incremental.components.JvmPackagePartProto
import org.jetbrains.kotlin.metadata.jvm.deserialization.BitEncoding
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
import org.jetbrains.org.objectweb.asm.*
import java.io.File
import java.security.MessageDigest
@@ -43,57 +44,52 @@ val KOTLIN_CACHE_DIRECTORY_NAME = "kotlin"
open class IncrementalJvmCache(
private val targetDataRoot: File,
targetOutputDir: File?
) : IncrementalCacheCommon(File(targetDataRoot, KOTLIN_CACHE_DIRECTORY_NAME)), IncrementalCache {
) : IncrementalCacheCommon<JvmClassName>(File(targetDataRoot, KOTLIN_CACHE_DIRECTORY_NAME)), IncrementalCache {
companion object {
private val PROTO_MAP = "proto"
private val CONSTANTS_MAP = "constants"
private val PACKAGE_PARTS = "package-parts"
private val MULTIFILE_CLASS_FACADES = "multifile-class-facades"
private val MULTIFILE_CLASS_PARTS = "multifile-class-parts"
private val SOURCE_TO_CLASSES = "source-to-classes"
private val DIRTY_OUTPUT_CLASSES = "dirty-output-classes"
private val INLINE_FUNCTIONS = "inline-functions"
private val INTERNAL_NAME_TO_SOURCE = "internal-name-to-source"
private val JAVA_SOURCES_PROTO_MAP = "java-sources-proto-map"
private val MODULE_MAPPING_FILE_NAME = "." + ModuleMapping.MAPPING_FILE_EXT
}
override val sourceToClassesMap = registerMap(SourceToJvmNameMap(SOURCE_TO_CLASSES.storageFile))
override val dirtyOutputClassesMap = registerMap(DirtyClassesJvmNameMap(DIRTY_OUTPUT_CLASSES.storageFile))
private val protoMap = registerMap(ProtoMap(PROTO_MAP.storageFile))
private val constantsMap = registerMap(ConstantsMap(CONSTANTS_MAP.storageFile))
private val packagePartMap = registerMap(PackagePartMap(PACKAGE_PARTS.storageFile))
private val multifileFacadeToParts = registerMap(MultifileClassFacadeMap(MULTIFILE_CLASS_FACADES.storageFile))
private val partToMultifileFacade = registerMap(MultifileClassPartMap(MULTIFILE_CLASS_PARTS.storageFile))
private val sourceToClassesMap = registerMap(SourceToClassesMap(SOURCE_TO_CLASSES.storageFile))
private val dirtyOutputClassesMap = registerMap(DirtyOutputClassesMap(DIRTY_OUTPUT_CLASSES.storageFile))
private val inlineFunctionsMap = registerMap(InlineFunctionsMap(INLINE_FUNCTIONS.storageFile))
// todo: try to use internal names only?
private val internalNameToSource = registerMap(InternalNameToSourcesMap(INTERNAL_NAME_TO_SOURCE.storageFile))
private val javaSourcesProtoMap = registerMap(JavaSourcesProtoMap(JAVA_SOURCES_PROTO_MAP.storageFile))
private val outputDir by lazy(LazyThreadSafetyMode.NONE) { requireNotNull(targetOutputDir) { "Target is expected to have output directory" } }
protected open fun debugLog(message: String) {}
override fun markDirty(removedAndCompiledSources: List<File>) {
for (sourceFile in removedAndCompiledSources) {
val classes = sourceToClassesMap[sourceFile]
classes.forEach {
dirtyOutputClassesMap.markDirty(it.internalName)
}
sourceToClassesMap.clearOutputsForSource(sourceFile)
}
}
fun isTrackedFile(file: File) = sourceToClassesMap.contains(file)
// used in gradle
@Suppress("unused")
fun classesBySources(sources: Iterable<File>): Iterable<JvmClassName> =
sources.flatMap { sourceToClassesMap[it] }
fun sourceInCache(file: File): Boolean =
sourceToClassesMap.contains(file)
fun sourcesByInternalName(internalName: String): Collection<File> =
internalNameToSource[internalName]
fun isMultifileFacade(className: JvmClassName): Boolean =
className.internalName in multifileFacadeToParts
className in multifileFacadeToParts
override fun getClassFilePath(internalClassName: String): String {
return toSystemIndependentName(File(outputDir, "$internalClassName.class").canonicalPath)
@@ -102,7 +98,7 @@ open class IncrementalJvmCache(
fun saveModuleMappingToCache(sourceFiles: Collection<File>, file: File) {
val jvmClassName = JvmClassName.byInternalName(MODULE_MAPPING_FILE_NAME)
protoMap.storeModuleMapping(jvmClassName, file.readBytes())
dirtyOutputClassesMap.notDirty(MODULE_MAPPING_FILE_NAME)
dirtyOutputClassesMap.notDirty(jvmClassName)
sourceFiles.forEach { sourceToClassesMap.add(it, jvmClassName) }
}
@@ -111,7 +107,7 @@ open class IncrementalJvmCache(
val kotlinClass: LocalFileKotlinClass = generatedClass.outputClass
val className = kotlinClass.className
dirtyOutputClassesMap.notDirty(className.internalName)
dirtyOutputClassesMap.notDirty(className)
sourceFiles.forEach {
sourceToClassesMap.add(it, className)
}
@@ -169,22 +165,46 @@ open class IncrementalJvmCache(
}
}
fun clearCacheForRemovedClasses(changesCollector: ChangesCollector) {
val dirtyClasses = dirtyOutputClassesMap
.getDirtyOutputClasses()
.map(JvmClassName::byInternalName)
.toList()
fun saveJavaClassProto(source: File, serializedJavaClass: SerializedJavaClass, collector: ChangesCollector) {
val jvmClassName = JvmClassName.byClassId(serializedJavaClass.classId)
javaSourcesProtoMap.process(jvmClassName, serializedJavaClass, collector)
sourceToClassesMap.add(source, jvmClassName)
val (proto, nameResolver) = serializedJavaClass.toProtoData()
addToClassStorage(proto, nameResolver, source)
dirtyOutputClassesMap.notDirty(jvmClassName)
}
fun getObsoleteJavaClasses(): Collection<ClassId> =
dirtyOutputClassesMap.getDirtyOutputClasses()
.mapNotNull {
javaSourcesProtoMap[it]?.classId
}
fun isJavaClassToTrack(classId: ClassId): Boolean {
val jvmClassName = JvmClassName.byClassId(classId)
return dirtyOutputClassesMap.isDirty(jvmClassName) ||
jvmClassName !in javaSourcesProtoMap
}
fun isJavaClassAlreadyInCache(classId: ClassId): Boolean {
val jvmClassName = JvmClassName.byClassId(classId)
return jvmClassName in javaSourcesProtoMap
}
override fun clearCacheForRemovedClasses(changesCollector: ChangesCollector) {
val dirtyClasses = dirtyOutputClassesMap.getDirtyOutputClasses()
val facadesWithRemovedParts = hashMapOf<JvmClassName, MutableSet<String>>()
for (dirtyClass in dirtyClasses) {
val facade = partToMultifileFacade.get(dirtyClass.internalName) ?: continue
val facade = partToMultifileFacade.get(dirtyClass) ?: continue
val facadeClassName = JvmClassName.byInternalName(facade)
val removedParts = facadesWithRemovedParts.getOrPut(facadeClassName) { hashSetOf() }
removedParts.add(dirtyClass.internalName)
}
for ((facade, removedParts) in facadesWithRemovedParts.entries) {
val allParts = multifileFacadeToParts[facade.internalName] ?: continue
val allParts = multifileFacadeToParts[facade] ?: continue
val notRemovedParts = allParts.filter { it !in removedParts }
if (notRemovedParts.isEmpty()) {
@@ -203,18 +223,17 @@ open class IncrementalJvmCache(
constantsMap.remove(it)
inlineFunctionsMap.remove(it)
internalNameToSource.remove(it.internalName)
javaSourcesProtoMap.remove(it, changesCollector)
}
removeAllFromClassStorage(dirtyClasses.map { it.fqNameForClassNameWithoutDollars })
removeAllFromClassStorage(dirtyClasses.map { it.fqNameForClassNameWithoutDollars }, changesCollector)
dirtyOutputClassesMap.clean()
}
override fun getObsoletePackageParts(): Collection<String> {
val obsoletePackageParts =
dirtyOutputClassesMap.getDirtyOutputClasses().filter { packagePartMap.isPackagePart(JvmClassName.byInternalName(it)) }
val obsoletePackageParts = dirtyOutputClassesMap.getDirtyOutputClasses().filter(packagePartMap::isPackagePart)
debugLog("Obsolete package parts: $obsoletePackageParts")
return obsoletePackageParts
return obsoletePackageParts.map { it.internalName }
}
override fun getPackagePartData(partInternalName: String): JvmPackagePartProto? {
@@ -234,8 +253,9 @@ open class IncrementalJvmCache(
}
override fun getStableMultifileFacadeParts(facadeInternalName: String): Collection<String>? {
val partNames = multifileFacadeToParts.get(facadeInternalName) ?: return null
return partNames.filter { !dirtyOutputClassesMap.isDirty(it) }
val jvmClassName = JvmClassName.byInternalName(facadeInternalName)
val partNames = multifileFacadeToParts[jvmClassName] ?: return null
return partNames.filter { !dirtyOutputClassesMap.isDirty(JvmClassName.byInternalName(it)) }
}
override fun getModuleMappingData(): ByteArray? {
@@ -287,7 +307,9 @@ open class IncrementalJvmCache(
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
changesCollector.collectProtoChanges(oldData = oldValue.toProtoData(className.packageFqName), newData = null)
if (key != MODULE_MAPPING_FILE_NAME) {
changesCollector.collectProtoChanges(oldData = oldValue.toProtoData(className.packageFqName), newData = null)
}
storage.remove(key)
}
@@ -296,6 +318,36 @@ open class IncrementalJvmCache(
}
}
private inner class JavaSourcesProtoMap(storageFile: File) : BasicStringMap<SerializedJavaClass>(storageFile, JavaClassProtoMapValueExternalizer) {
fun process(jvmClassName: JvmClassName, newData: SerializedJavaClass, changesCollector: ChangesCollector) {
val key = jvmClassName.internalName
val oldData = storage[key]
storage[key] = newData
changesCollector.collectProtoChanges(
oldData?.toProtoData(), newData.toProtoData(),
collectAllMembersForNewClass = true
)
}
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
storage.remove(key)
changesCollector.collectProtoChanges(oldValue.toProtoData(), newData = null)
}
operator fun get(className: JvmClassName): SerializedJavaClass? =
storage[className.internalName]
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
override fun dumpValue(value: SerializedJavaClass): String =
java.lang.Long.toHexString(value.proto.toByteArray().md5())
}
// todo: reuse code with InlineFunctionsMap?
private inner class ConstantsMap(storageFile: File) : BasicStringMap<Map<String, Any>>(storageFile, ConstantsMapExternalizer) {
private fun getConstantsMap(bytes: ByteArray): Map<String, Any> {
@@ -358,13 +410,15 @@ open class IncrementalJvmCache(
}
private inner class MultifileClassFacadeMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
operator fun set(facadeName: JvmClassName, partNames: Collection<String>) {
storage[facadeName.internalName] = partNames
operator fun set(className: JvmClassName, partNames: Collection<String>) {
storage[className.internalName] = partNames
}
operator fun get(internalName: String): Collection<String>? = storage[internalName]
operator fun get(className: JvmClassName): Collection<String>? =
storage[className.internalName]
operator fun contains(internalName: String): Boolean = internalName in storage
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
@@ -378,9 +432,8 @@ open class IncrementalJvmCache(
storage[partName] = facadeName
}
fun get(partName: String): String? {
return storage.get(partName)
}
fun get(partName: JvmClassName): String? =
storage[partName.internalName]
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
@@ -389,25 +442,6 @@ open class IncrementalJvmCache(
override fun dumpValue(value: String): String = value
}
inner class SourceToClassesMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, PathStringDescriptor, StringCollectionExternalizer) {
fun clearOutputsForSource(sourceFile: File) {
remove(sourceFile.absolutePath)
}
fun add(sourceFile: File, className: JvmClassName) {
storage.append(sourceFile.absolutePath, className.internalName)
}
operator fun get(sourceFile: File): Collection<JvmClassName> =
storage[sourceFile.absolutePath].orEmpty().map { JvmClassName.byInternalName(it) }
override fun dumpValue(value: Collection<String>) = value.dumpCollection()
private fun remove(path: String) {
storage.remove(path)
}
}
inner class InternalNameToSourcesMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, EnumeratorStringDescriptor(), PathCollectionExternalizer) {
operator fun set(internalName: String, sourceFiles: Iterable<File>) {
storage[internalName] = sourceFiles.map { it.canonicalPath }
@@ -429,24 +463,6 @@ open class IncrementalJvmCache(
addToClassStorage(proto, nameResolver, srcFile)
}
private inner class DirtyOutputClassesMap(storageFile: File) : BasicStringMap<Boolean>(storageFile, BooleanDataDescriptor.INSTANCE) {
fun markDirty(className: String) {
storage[className] = true
}
fun notDirty(className: String) {
storage.remove(className)
}
fun getDirtyOutputClasses(): Collection<String> =
storage.keys
fun isDirty(className: String): Boolean =
storage.contains(className)
override fun dumpValue(value: Boolean) = ""
}
private inner class InlineFunctionsMap(storageFile: File) : BasicStringMap<Map<String, Long>>(storageFile, StringToLongMapExternalizer) {
private fun getInlineFunctionsMap(header: KotlinClassHeader, bytes: ByteArray): Map<String, Long> {
val inlineFunctions = inlineFunctionsJvmNames(header)

View File

@@ -0,0 +1,81 @@
/*
* Copyright 2010-2017 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
import org.jetbrains.kotlin.builtins.BuiltInSerializerProtocol
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.load.java.JavaVisibilities
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.serialization.DescriptorSerializer
import org.jetbrains.kotlin.serialization.KotlinSerializerExtensionBase
// It uses BuiltInSerializerProtocol for annotations serialization
class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSerializerProtocol) {
override fun serializeClass(descriptor: ClassDescriptor, proto: ProtoBuf.Class.Builder) {
super.serializeClass(descriptor, proto)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateClass, true)
}
}
override fun serializeConstructor(descriptor: ConstructorDescriptor, proto: ProtoBuf.Constructor.Builder) {
super.serializeConstructor(descriptor, proto)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateConstructor, true)
}
}
override fun serializeFunction(descriptor: FunctionDescriptor, proto: ProtoBuf.Function.Builder) {
super.serializeFunction(descriptor, proto)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateMethod, true)
}
if (descriptor.dispatchReceiverParameter == null) {
proto.setExtension(JavaClassProtoBuf.isStaticMethod, true)
}
}
override fun serializeProperty(descriptor: PropertyDescriptor, proto: ProtoBuf.Property.Builder) {
super.serializeProperty(descriptor, proto)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateField, true)
}
if (descriptor.dispatchReceiverParameter == null) {
proto.setExtension(JavaClassProtoBuf.isStaticField, true)
}
}
override fun shouldUseNormalizedVisibility() = true
override val customClassMembersProducer =
object : ClassMembersProducer {
override fun getCallableMembers(classDescriptor: ClassDescriptor) =
arrayListOf<CallableMemberDescriptor>().apply {
addAll(classDescriptor.unsubstitutedMemberScope.getSortedCallableDescriptors())
addAll(classDescriptor.staticScope.getSortedCallableDescriptors())
}
}
private fun MemberScope.getSortedCallableDescriptors(): Collection<CallableMemberDescriptor> =
DescriptorUtils.getAllDescriptors(this).filterIsInstance<CallableMemberDescriptor>()
.let { DescriptorSerializer.sort(it) }
}

View File

@@ -0,0 +1,153 @@
/*
* Copyright 2010-2017 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
import com.intellij.psi.PsiJavaFile
import com.intellij.util.io.DataExternalizer
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.findClassAcrossModuleDependencies
import org.jetbrains.kotlin.load.java.JavaClassesTracker
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaClassDescriptor
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolverImpl
import org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
import org.jetbrains.kotlin.resolve.source.PsiSourceElement
import org.jetbrains.kotlin.serialization.DescriptorSerializer
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.util.PerformanceCounter
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import org.jetbrains.kotlin.utils.sure
import java.io.DataInput
import java.io.DataOutput
import java.io.File
val CONVERTING_JAVA_CLASSES_TO_PROTO = PerformanceCounter.create("Converting Java sources to proto")
class JavaClassesTrackerImpl(
private val cache: IncrementalJvmCache,
private val untrackedJavaClasses: Set<ClassId>
) : JavaClassesTracker {
private val classToSourceSerialized: MutableMap<ClassId, SerializedJavaClassWithSource> = hashMapOf()
val javaClassesUpdates: Collection<SerializedJavaClassWithSource>
get() = classToSourceSerialized.values
private val classDescriptors: MutableList<JavaClassDescriptor> = mutableListOf()
override fun reportClass(classDescriptor: JavaClassDescriptor) {
val classId = classDescriptor.classId!!
if (!cache.isJavaClassToTrack(classId) || classDescriptor.javaSourceFile == null) return
classDescriptors.add(classDescriptor)
}
override fun onCompletedAnalysis(module: ModuleDescriptor) {
for (classId in cache.getObsoleteJavaClasses() + untrackedJavaClasses) {
// Just force the loading obsolete classes
// We assume here that whenever an LazyJavaClassDescriptor instances is created
// it's being passed to JavaClassesTracker::reportClass
module.findClassAcrossModuleDependencies(classId)
}
for (classDescriptor in classDescriptors.toList()) {
val classId = classDescriptor.classId!!
if (cache.isJavaClassAlreadyInCache(classId) || classId in untrackedJavaClasses || classDescriptor.wasContentRequested()) {
assert(classId !in classToSourceSerialized) {
"Duplicated JavaClassDescriptor $classId reported to IC"
}
classToSourceSerialized[classId] = CONVERTING_JAVA_CLASSES_TO_PROTO.time {
classDescriptor.convertToProto()
}
}
}
}
private fun JavaClassDescriptor.wasContentRequested() =
this.safeAs<LazyJavaClassDescriptor>()?.wasScopeContentRequested() != false
}
private val JavaClassDescriptor.javaSourceFile: File?
get() = source.safeAs<PsiSourceElement>()
?.psi?.containingFile?.takeIf { it is PsiJavaFile }
?.virtualFile?.path?.let(::File)
fun JavaClassDescriptor.convertToProto(): SerializedJavaClassWithSource {
val file = javaSourceFile.sure { "convertToProto should only be called for source based classes" }
val extension = JavaClassesSerializerExtension()
val serializer = DescriptorSerializer.createTopLevel(extension)
val classProto = serializer.classProto(this).build()
val (stringTable, qualifiedNameTable) = extension.stringTable.buildProto()
return SerializedJavaClassWithSource(file, SerializedJavaClass(classProto, stringTable, qualifiedNameTable))
}
class SerializedJavaClass(
val proto: ProtoBuf.Class,
val stringTable: ProtoBuf.StringTable,
val qualifiedNameTable: ProtoBuf.QualifiedNameTable
) {
val classId: ClassId
get() = NameResolverImpl(stringTable, qualifiedNameTable).getClassId(proto.fqName)
}
data class SerializedJavaClassWithSource(
val source: File,
val proto: SerializedJavaClass
)
fun SerializedJavaClass.toProtoData() = ClassProtoData(proto, NameResolverImpl(stringTable, qualifiedNameTable))
val JAVA_CLASS_PROTOBUF_REGISTRY =
ExtensionRegistryLite.newInstance()
.also(JavaClassProtoBuf::registerAllExtensions)
// Built-ins extensions are used for annotations' serialization
.also(BuiltInsProtoBuf::registerAllExtensions)
object JavaClassProtoMapValueExternalizer : DataExternalizer<SerializedJavaClass> {
override fun save(output: DataOutput, value: SerializedJavaClass) {
output.writeBytesWithSize(value.proto.toByteArray())
output.writeBytesWithSize(value.stringTable.toByteArray())
output.writeBytesWithSize(value.qualifiedNameTable.toByteArray())
}
private fun DataOutput.writeBytesWithSize(bytes: ByteArray) {
writeInt(bytes.size)
write(bytes)
}
private fun DataInput.readBytesWithSize(): ByteArray {
val bytesLength = readInt()
return ByteArray(bytesLength).also {
readFully(it, 0, bytesLength)
}
}
override fun read(input: DataInput): SerializedJavaClass {
val proto = ProtoBuf.Class.parseFrom(input.readBytesWithSize(), JAVA_CLASS_PROTOBUF_REGISTRY)
val stringTable = ProtoBuf.StringTable.parseFrom(input.readBytesWithSize(), JAVA_CLASS_PROTOBUF_REGISTRY)
val qualifiedNameTable = ProtoBuf.QualifiedNameTable.parseFrom(input.readBytesWithSize(), JAVA_CLASS_PROTOBUF_REGISTRY)
return SerializedJavaClass(proto, stringTable, qualifiedNameTable)
}
}

View File

@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.kotlin.utils.keysToMap
import java.io.File
import java.io.IOException
import java.util.*
@@ -47,11 +48,16 @@ open class LookupStorage(targetDataDir: File) : BasicMapsOwner(targetDataDir) {
private var deletedCount: Int = 0
init {
if (countersFile.exists()) {
val lines = countersFile.readLines()
size = lines[0].toInt()
deletedCount = lines[1].toInt()
try {
if (countersFile.exists()) {
val lines = countersFile.readLines()
size = lines[0].toInt()
deletedCount = lines[1].toInt()
}
} catch (e: Exception) {
throw IOException("Could not read $countersFile", e)
}
}
@Synchronized

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
* Copyright 2010-2018 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.
@@ -16,12 +16,15 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf
import org.jetbrains.kotlin.metadata.js.JsProtoBuf
import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf
import org.jetbrains.kotlin.metadata.serialization.Interner
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf
import org.jetbrains.kotlin.serialization.js.JsProtoBuf
import org.jetbrains.kotlin.utils.Interner
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import java.util.*
/** This file is generated by org.jetbrains.kotlin.generators.protobuf.GenerateProtoBufCompare. DO NOT MODIFY MANUALLY */
@@ -71,6 +74,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.getExtension(JsProtoBuf.packageFqName) != new.getExtension(JsProtoBuf.packageFqName)) return false
}
if (old.hasExtension(BuiltInsProtoBuf.packageFqName) != new.hasExtension(BuiltInsProtoBuf.packageFqName)) return false
if (old.hasExtension(BuiltInsProtoBuf.packageFqName)) {
if (old.getExtension(BuiltInsProtoBuf.packageFqName) != new.getExtension(BuiltInsProtoBuf.packageFqName)) return false
}
return true
}
enum class ProtoBufPackageKind {
@@ -81,7 +89,8 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
VERSION_REQUIREMENT_TABLE,
JVM_EXT_PACKAGE_MODULE_NAME,
JVM_EXT_PACKAGE_LOCAL_VARIABLE_LIST,
JS_EXT_PACKAGE_FQ_NAME
JS_EXT_PACKAGE_FQ_NAME,
BUILT_INS_EXT_PACKAGE_FQ_NAME
}
fun difference(old: ProtoBuf.Package, new: ProtoBuf.Package): EnumSet<ProtoBufPackageKind> {
@@ -122,6 +131,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.getExtension(JsProtoBuf.packageFqName) != new.getExtension(JsProtoBuf.packageFqName)) result.add(ProtoBufPackageKind.JS_EXT_PACKAGE_FQ_NAME)
}
if (old.hasExtension(BuiltInsProtoBuf.packageFqName) != new.hasExtension(BuiltInsProtoBuf.packageFqName)) result.add(ProtoBufPackageKind.BUILT_INS_EXT_PACKAGE_FQ_NAME)
if (old.hasExtension(BuiltInsProtoBuf.packageFqName)) {
if (old.getExtension(BuiltInsProtoBuf.packageFqName) != new.getExtension(BuiltInsProtoBuf.packageFqName)) result.add(ProtoBufPackageKind.BUILT_INS_EXT_PACKAGE_FQ_NAME)
}
return result
}
@@ -187,6 +201,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.hasExtension(JvmProtoBuf.anonymousObjectOriginName) != new.hasExtension(JvmProtoBuf.anonymousObjectOriginName)) return false
if (old.hasExtension(JvmProtoBuf.anonymousObjectOriginName)) {
if (!checkStringEquals(old.getExtension(JvmProtoBuf.anonymousObjectOriginName), new.getExtension(JvmProtoBuf.anonymousObjectOriginName))) return false
}
if (old.getExtensionCount(JsProtoBuf.classAnnotation) != new.getExtensionCount(JsProtoBuf.classAnnotation)) {
return false
}
@@ -201,6 +220,20 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.getExtension(JsProtoBuf.classContainingFileId) != new.getExtension(JsProtoBuf.classContainingFileId)) return false
}
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateClass) != new.hasExtension(JavaClassProtoBuf.isPackagePrivateClass)) return false
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateClass)) {
if (old.getExtension(JavaClassProtoBuf.isPackagePrivateClass) != new.getExtension(JavaClassProtoBuf.isPackagePrivateClass)) return false
}
if (old.getExtensionCount(BuiltInsProtoBuf.classAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.classAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.classAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.classAnnotation, i), new.getExtension(BuiltInsProtoBuf.classAnnotation, i))) return false
}
}
return true
}
enum class ProtoBufClassKind {
@@ -222,8 +255,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
VERSION_REQUIREMENT_TABLE,
JVM_EXT_CLASS_MODULE_NAME,
JVM_EXT_CLASS_LOCAL_VARIABLE_LIST,
JVM_EXT_ANONYMOUS_OBJECT_ORIGIN_NAME,
JS_EXT_CLASS_ANNOTATION_LIST,
JS_EXT_CLASS_CONTAINING_FILE_ID
JS_EXT_CLASS_CONTAINING_FILE_ID,
JAVA_EXT_IS_PACKAGE_PRIVATE_CLASS,
BUILT_INS_EXT_CLASS_ANNOTATION_LIST
}
fun difference(old: ProtoBuf.Class, new: ProtoBuf.Class): EnumSet<ProtoBufClassKind> {
@@ -290,6 +326,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.hasExtension(JvmProtoBuf.anonymousObjectOriginName) != new.hasExtension(JvmProtoBuf.anonymousObjectOriginName)) result.add(ProtoBufClassKind.JVM_EXT_ANONYMOUS_OBJECT_ORIGIN_NAME)
if (old.hasExtension(JvmProtoBuf.anonymousObjectOriginName)) {
if (!checkStringEquals(old.getExtension(JvmProtoBuf.anonymousObjectOriginName), new.getExtension(JvmProtoBuf.anonymousObjectOriginName))) result.add(ProtoBufClassKind.JVM_EXT_ANONYMOUS_OBJECT_ORIGIN_NAME)
}
if (old.getExtensionCount(JsProtoBuf.classAnnotation) != new.getExtensionCount(JsProtoBuf.classAnnotation)) {
result.add(ProtoBufClassKind.JS_EXT_CLASS_ANNOTATION_LIST)
}
@@ -304,6 +345,20 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.getExtension(JsProtoBuf.classContainingFileId) != new.getExtension(JsProtoBuf.classContainingFileId)) result.add(ProtoBufClassKind.JS_EXT_CLASS_CONTAINING_FILE_ID)
}
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateClass) != new.hasExtension(JavaClassProtoBuf.isPackagePrivateClass)) result.add(ProtoBufClassKind.JAVA_EXT_IS_PACKAGE_PRIVATE_CLASS)
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateClass)) {
if (old.getExtension(JavaClassProtoBuf.isPackagePrivateClass) != new.getExtension(JavaClassProtoBuf.isPackagePrivateClass)) result.add(ProtoBufClassKind.JAVA_EXT_IS_PACKAGE_PRIVATE_CLASS)
}
if (old.getExtensionCount(BuiltInsProtoBuf.classAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.classAnnotation)) {
result.add(ProtoBufClassKind.BUILT_INS_EXT_CLASS_ANNOTATION_LIST)
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.classAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.classAnnotation, i), new.getExtension(BuiltInsProtoBuf.classAnnotation, i))) result.add(ProtoBufClassKind.BUILT_INS_EXT_CLASS_ANNOTATION_LIST)
}
}
return result
}
@@ -364,6 +419,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (!checkEquals(old.getExtension(JvmProtoBuf.methodSignature), new.getExtension(JvmProtoBuf.methodSignature))) return false
}
if (old.hasExtension(JvmProtoBuf.lambdaClassOriginName) != new.hasExtension(JvmProtoBuf.lambdaClassOriginName)) return false
if (old.hasExtension(JvmProtoBuf.lambdaClassOriginName)) {
if (!checkStringEquals(old.getExtension(JvmProtoBuf.lambdaClassOriginName), new.getExtension(JvmProtoBuf.lambdaClassOriginName))) return false
}
if (old.getExtensionCount(JsProtoBuf.functionAnnotation) != new.getExtensionCount(JsProtoBuf.functionAnnotation)) {
return false
}
@@ -378,6 +438,25 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.getExtension(JsProtoBuf.functionContainingFileId) != new.getExtension(JsProtoBuf.functionContainingFileId)) return false
}
if (old.hasExtension(JavaClassProtoBuf.isStaticMethod) != new.hasExtension(JavaClassProtoBuf.isStaticMethod)) return false
if (old.hasExtension(JavaClassProtoBuf.isStaticMethod)) {
if (old.getExtension(JavaClassProtoBuf.isStaticMethod) != new.getExtension(JavaClassProtoBuf.isStaticMethod)) return false
}
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateMethod) != new.hasExtension(JavaClassProtoBuf.isPackagePrivateMethod)) return false
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateMethod)) {
if (old.getExtension(JavaClassProtoBuf.isPackagePrivateMethod) != new.getExtension(JavaClassProtoBuf.isPackagePrivateMethod)) return false
}
if (old.getExtensionCount(BuiltInsProtoBuf.functionAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.functionAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.functionAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.functionAnnotation, i), new.getExtension(BuiltInsProtoBuf.functionAnnotation, i))) return false
}
}
return true
}
@@ -460,6 +539,30 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.getExtension(JsProtoBuf.propertyContainingFileId) != new.getExtension(JsProtoBuf.propertyContainingFileId)) return false
}
if (old.hasExtension(JavaClassProtoBuf.isStaticField) != new.hasExtension(JavaClassProtoBuf.isStaticField)) return false
if (old.hasExtension(JavaClassProtoBuf.isStaticField)) {
if (old.getExtension(JavaClassProtoBuf.isStaticField) != new.getExtension(JavaClassProtoBuf.isStaticField)) return false
}
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateField) != new.hasExtension(JavaClassProtoBuf.isPackagePrivateField)) return false
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateField)) {
if (old.getExtension(JavaClassProtoBuf.isPackagePrivateField) != new.getExtension(JavaClassProtoBuf.isPackagePrivateField)) return false
}
if (old.getExtensionCount(BuiltInsProtoBuf.propertyAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.propertyAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.propertyAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.propertyAnnotation, i), new.getExtension(BuiltInsProtoBuf.propertyAnnotation, i))) return false
}
}
if (old.hasExtension(BuiltInsProtoBuf.compileTimeValue) != new.hasExtension(BuiltInsProtoBuf.compileTimeValue)) return false
if (old.hasExtension(BuiltInsProtoBuf.compileTimeValue)) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.compileTimeValue), new.getExtension(BuiltInsProtoBuf.compileTimeValue))) return false
}
return true
}
@@ -557,6 +660,15 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.getExtensionCount(BuiltInsProtoBuf.typeParameterAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.typeParameterAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.typeParameterAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.typeParameterAnnotation, i), new.getExtension(BuiltInsProtoBuf.typeParameterAnnotation, i))) return false
}
}
return true
}
@@ -651,6 +763,15 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.getExtensionCount(BuiltInsProtoBuf.typeAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.typeAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.typeAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.typeAnnotation, i), new.getExtension(BuiltInsProtoBuf.typeAnnotation, i))) return false
}
}
return true
}
@@ -681,6 +802,20 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateConstructor) != new.hasExtension(JavaClassProtoBuf.isPackagePrivateConstructor)) return false
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateConstructor)) {
if (old.getExtension(JavaClassProtoBuf.isPackagePrivateConstructor) != new.getExtension(JavaClassProtoBuf.isPackagePrivateConstructor)) return false
}
if (old.getExtensionCount(BuiltInsProtoBuf.constructorAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.constructorAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.constructorAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.constructorAnnotation, i), new.getExtension(BuiltInsProtoBuf.constructorAnnotation, i))) return false
}
}
return true
}
@@ -699,6 +834,15 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.getExtensionCount(BuiltInsProtoBuf.enumEntryAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.enumEntryAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.enumEntryAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.enumEntryAnnotation, i), new.getExtension(BuiltInsProtoBuf.enumEntryAnnotation, i))) return false
}
}
return true
}
@@ -747,6 +891,15 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.getExtensionCount(BuiltInsProtoBuf.parameterAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.parameterAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.parameterAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.parameterAnnotation, i), new.getExtension(BuiltInsProtoBuf.parameterAnnotation, i))) return false
}
}
return true
}
@@ -1335,6 +1488,10 @@ fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + getExtension(JsProtoBuf.packageFqName)
}
if (hasExtension(BuiltInsProtoBuf.packageFqName)) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.packageFqName)
}
return hashCode
}
@@ -1411,6 +1568,10 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.classLocalVariable, i).hashCode(stringIndexes, fqNameIndexes)
}
if (hasExtension(JvmProtoBuf.anonymousObjectOriginName)) {
hashCode = 31 * hashCode + stringIndexes(getExtension(JvmProtoBuf.anonymousObjectOriginName))
}
for(i in 0..getExtensionCount(JsProtoBuf.classAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(JsProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
@@ -1419,6 +1580,14 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
hashCode = 31 * hashCode + getExtension(JsProtoBuf.classContainingFileId)
}
if (hasExtension(JavaClassProtoBuf.isPackagePrivateClass)) {
hashCode = 31 * hashCode + getExtension(JavaClassProtoBuf.isPackagePrivateClass).hashCode()
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.classAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1475,6 +1644,10 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.methodSignature).hashCode(stringIndexes, fqNameIndexes)
}
if (hasExtension(JvmProtoBuf.lambdaClassOriginName)) {
hashCode = 31 * hashCode + stringIndexes(getExtension(JvmProtoBuf.lambdaClassOriginName))
}
for(i in 0..getExtensionCount(JsProtoBuf.functionAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(JsProtoBuf.functionAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
@@ -1483,6 +1656,18 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + getExtension(JsProtoBuf.functionContainingFileId)
}
if (hasExtension(JavaClassProtoBuf.isStaticMethod)) {
hashCode = 31 * hashCode + getExtension(JavaClassProtoBuf.isStaticMethod).hashCode()
}
if (hasExtension(JavaClassProtoBuf.isPackagePrivateMethod)) {
hashCode = 31 * hashCode + getExtension(JavaClassProtoBuf.isPackagePrivateMethod).hashCode()
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.functionAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.functionAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1551,6 +1736,22 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertyContainingFileId)
}
if (hasExtension(JavaClassProtoBuf.isStaticField)) {
hashCode = 31 * hashCode + getExtension(JavaClassProtoBuf.isStaticField).hashCode()
}
if (hasExtension(JavaClassProtoBuf.isPackagePrivateField)) {
hashCode = 31 * hashCode + getExtension(JavaClassProtoBuf.isPackagePrivateField).hashCode()
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.propertyAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
if (hasExtension(BuiltInsProtoBuf.compileTimeValue)) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.compileTimeValue).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1649,6 +1850,10 @@ fun ProtoBuf.TypeParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes:
hashCode = 31 * hashCode + getExtension(JsProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.typeParameterAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1723,6 +1928,10 @@ fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
hashCode = 31 * hashCode + getExtension(JsProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.typeAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1749,6 +1958,14 @@ fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I
hashCode = 31 * hashCode + getExtension(JsProtoBuf.constructorAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
if (hasExtension(JavaClassProtoBuf.isPackagePrivateConstructor)) {
hashCode = 31 * hashCode + getExtension(JavaClassProtoBuf.isPackagePrivateConstructor).hashCode()
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.constructorAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.constructorAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1763,6 +1980,10 @@ fun ProtoBuf.EnumEntry.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int
hashCode = 31 * hashCode + getExtension(JsProtoBuf.enumEntryAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.enumEntryAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.enumEntryAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1807,6 +2028,10 @@ fun ProtoBuf.ValueParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes:
hashCode = 31 * hashCode + getExtension(JsProtoBuf.parameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.parameterAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.parameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}

View File

@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.modules.KotlinModuleXmlBuilder
import org.jetbrains.kotlin.modules.TargetId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
import org.jetbrains.kotlin.synthetic.SAM_LOOKUP_NAME
import java.io.File
import java.util.*
@@ -46,7 +47,10 @@ fun makeModuleFile(
builder.addModule(
name,
outputDir.absolutePath,
sourcesToCompile,
// important to transform file to absolute paths,
// otherwise compiler will use module file's parent as base path (a temporary file; see below)
// (see org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.getAbsolutePaths)
sourcesToCompile.map { it.absoluteFile },
javaSourceRoots,
classpath,
null,
@@ -79,7 +83,8 @@ fun makeCompileServices(
fun updateIncrementalCache(
generatedFiles: Iterable<GeneratedFile>,
cache: IncrementalJvmCache,
changesCollector: ChangesCollector
changesCollector: ChangesCollector,
javaChangesTracker: JavaClassesTrackerImpl?
) {
for (generatedFile in generatedFiles) {
when {
@@ -88,6 +93,11 @@ fun updateIncrementalCache(
}
}
javaChangesTracker?.javaClassesUpdates?.forEach {
(source, serializedJavaClass) ->
cache.saveJavaClassProto(source, serializedJavaClass, changesCollector)
}
cache.clearCacheForRemovedClasses(changesCollector)
}
@@ -109,7 +119,7 @@ data class DirtyData(
)
fun ChangesCollector.getDirtyData(
caches: Iterable<IncrementalCacheCommon>,
caches: Iterable<IncrementalCacheCommon<*>>,
reporter: ICReporter
): DirtyData {
val dirtyLookupSymbols = HashSet<LookupSymbol>()
@@ -135,10 +145,10 @@ fun ChangesCollector.getDirtyData(
dirtyClassesFqNames.addAll(fqNames)
for (name in change.names) {
for (fqName in fqNames) {
dirtyLookupSymbols.add(LookupSymbol(name, fqName.asString()))
}
fqNames.mapTo(dirtyLookupSymbols) { LookupSymbol(name, it.asString()) }
}
fqNames.mapTo(dirtyLookupSymbols) { LookupSymbol(SAM_LOOKUP_NAME.asString(), it.asString()) }
}
}
@@ -163,7 +173,7 @@ fun mapLookupSymbolsToFiles(
}
fun mapClassesFqNamesToFiles(
caches: Iterable<IncrementalCacheCommon>,
caches: Iterable<IncrementalCacheCommon<*>>,
classesFqNames: Iterable<FqName>,
reporter: ICReporter,
excludes: Set<File> = emptySet()
@@ -173,7 +183,7 @@ fun mapClassesFqNamesToFiles(
for (cache in caches) {
for (dirtyClassFqName in classesFqNames) {
val srcFile = cache.getSourceFileIfClass(dirtyClassFqName)
if (srcFile == null || srcFile in excludes) continue
if (srcFile == null || srcFile in excludes || srcFile.isJavaFile()) continue
reporter.report { ("Class $dirtyClassFqName caused recompilation of: ${reporter.pathsAsString(srcFile)}") }
dirtyFiles.add(srcFile)
@@ -185,7 +195,7 @@ fun mapClassesFqNamesToFiles(
fun withSubtypes(
typeFqName: FqName,
caches: Iterable<IncrementalCacheCommon>
caches: Iterable<IncrementalCacheCommon<*>>
): Set<FqName> {
val types = LinkedList(listOf(typeFqName))
val subtypes = hashSetOf<FqName>()

View File

@@ -20,13 +20,13 @@ import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufClassKind
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufPackageKind
import org.jetbrains.kotlin.incremental.storage.ProtoMapValue
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.Deserialization
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
import java.util.*
data class Difference(
@@ -41,16 +41,15 @@ data class PackagePartProtoData(val proto: ProtoBuf.Package, val nameResolver: N
fun ProtoMapValue.toProtoData(packageFqName: FqName): ProtoData =
if (isPackageFacade) {
val packageData = JvmProtoBufUtil.readPackageDataFrom(bytes, strings)
PackagePartProtoData(packageData.packageProto, packageData.nameResolver, packageFqName)
}
else {
val classData = JvmProtoBufUtil.readClassDataFrom(bytes, strings)
ClassProtoData(classData.classProto, classData.nameResolver)
val (nameResolver, packageProto) = JvmProtoBufUtil.readPackageDataFrom(bytes, strings)
PackagePartProtoData(packageProto, nameResolver, packageFqName)
} else {
val (nameResolver, classProto) = JvmProtoBufUtil.readClassDataFrom(bytes, strings)
ClassProtoData(classProto, nameResolver)
}
internal val MessageLite.isPrivate: Boolean
get() = Visibilities.isPrivate(Deserialization.visibility(
get() = Visibilities.isPrivate(ProtoEnumFlags.visibility(
when (this) {
is ProtoBuf.Constructor -> Flags.VISIBILITY.get(flags)
is ProtoBuf.Function -> Flags.VISIBILITY.get(flags)
@@ -244,6 +243,16 @@ class DifferenceCalculatorForClass(
ProtoBufClassKind.JVM_EXT_CLASS_LOCAL_VARIABLE_LIST -> {
// Not affected, local variables are not accessible outside of a file
}
ProtoBufClassKind.JAVA_EXT_IS_PACKAGE_PRIVATE_CLASS -> {
isClassAffected = true
areSubclassesAffected = true
}
ProtoBufClassKind.BUILT_INS_EXT_CLASS_ANNOTATION_LIST -> {
isClassAffected = true
}
ProtoCompareGenerated.ProtoBufClassKind.JVM_EXT_ANONYMOUS_OBJECT_ORIGIN_NAME -> {
// Not affected, this extension is not used in the compiler
}
}
}
@@ -289,6 +298,9 @@ class DifferenceCalculatorForPackageFacade(
ProtoBufPackageKind.JVM_EXT_PACKAGE_LOCAL_VARIABLE_LIST -> {
// Not affected, local variables are not accessible outside of a file
}
ProtoBufPackageKind.BUILT_INS_EXT_PACKAGE_FQ_NAME -> {
// Not affected
}
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright 2010-2017 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.BooleanDataDescriptor
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import java.io.File
internal class DirtyClassesJvmNameMap(storageFile: File) : AbstractDirtyClassesMap<JvmClassName>(JvmClassNameTransformer, storageFile)
internal class DirtyClassesFqNameMap(storageFile: File) : AbstractDirtyClassesMap<FqName>(FqNameTransformer, storageFile)
internal abstract class AbstractDirtyClassesMap<Name>(
private val nameTransformer: NameTransformer<Name>,
storageFile: File
) : BasicStringMap<Boolean>(storageFile, BooleanDataDescriptor.INSTANCE) {
fun markDirty(className: Name) {
storage[nameTransformer.asString(className)] = true
}
fun notDirty(className: Name) {
storage.remove(nameTransformer.asString(className))
}
fun getDirtyOutputClasses(): Collection<Name> =
storage.keys.map { nameTransformer.asName(it) }
fun isDirty(className: Name): Boolean =
storage.contains(nameTransformer.asString(className))
override fun dumpValue(value: Boolean) = ""
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright 2010-2017 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 org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
internal interface NameTransformer<Name> {
fun asString(name: Name): String
fun asName(string: String): Name
fun asFqName(string: String): FqName
}
internal object FqNameTransformer : NameTransformer<FqName> {
override fun asString(name: FqName): String =
name.asString()
override fun asName(string: String): FqName =
FqName(string)
override fun asFqName(string: String): FqName =
asName(string)
}
internal object JvmClassNameTransformer : NameTransformer<JvmClassName> {
override fun asString(name: JvmClassName): String =
name.internalName
override fun asName(string: String): JvmClassName =
JvmClassName.byInternalName(string)
override fun asFqName(string: String): FqName =
asName(string).fqNameForClassNameWithoutDollars
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright 2010-2017 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 org.jetbrains.kotlin.incremental.dumpCollection
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import java.io.File
internal class SourceToJvmNameMap(storageFile: File) : AbstractSourceToOutputMap<JvmClassName>(JvmClassNameTransformer, storageFile)
internal class SourceToFqNameMap(storageFile: File) : AbstractSourceToOutputMap<FqName>(FqNameTransformer, storageFile)
internal abstract class AbstractSourceToOutputMap<Name>(
private val nameTransformer: NameTransformer<Name>,
storageFile: File
) : BasicStringMap<Collection<String>>(storageFile, PathStringDescriptor, StringCollectionExternalizer) {
fun clearOutputsForSource(sourceFile: File) {
remove(sourceFile.absolutePath)
}
fun add(sourceFile: File, className: Name) {
storage.append(sourceFile.absolutePath, nameTransformer.asString(className))
}
fun contains(sourceFile: File): Boolean =
sourceFile.absolutePath in storage
operator fun get(sourceFile: File): Collection<Name> =
storage[sourceFile.absolutePath].orEmpty().map(nameTransformer::asName)
fun getFqNames(sourceFile: File): Collection<FqName> =
storage[sourceFile.absolutePath].orEmpty().map(nameTransformer::asFqName)
override fun dumpValue(value: Collection<String>) =
value.dumpCollection()
private fun remove(path: String) {
storage.remove(path)
}
}

View File

@@ -0,0 +1,118 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: build-common/src/java_descriptors.proto
package org.jetbrains.kotlin.metadata.java;
public final class JavaClassProtoBuf {
private JavaClassProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite registry) {
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isStaticMethod);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isPackagePrivateMethod);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isStaticField);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isPackagePrivateField);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isPackagePrivateClass);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isPackagePrivateConstructor);
}
public static final int IS_STATIC_METHOD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Function,
java.lang.Boolean> isStaticMethod = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Function.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_METHOD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Function,
java.lang.Boolean> isPackagePrivateMethod = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Function.getDefaultInstance(),
false,
null,
null,
1001,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_STATIC_FIELD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
java.lang.Boolean> isStaticField = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_FIELD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
java.lang.Boolean> isPackagePrivateField = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
false,
null,
null,
1001,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_CLASS_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Class,
java.lang.Boolean> isPackagePrivateClass = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Class.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_CONSTRUCTOR_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Constructor,
java.lang.Boolean> isPackagePrivateConstructor = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Constructor.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
static {
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -28,6 +28,9 @@ data class BuildLogFinder(
private const val GRADLE_LOG = "gradle-build.log"
private const val DATA_CONTAINER_LOG = "data-container-version-build.log"
private const val SIMPLE_LOG = "build.log"
fun isJpsLogFile(file: File): Boolean =
file.name.let { it == SIMPLE_LOG || it == DATA_CONTAINER_LOG }
}
fun findBuildLog(dir: File): File? {

View File

@@ -19,10 +19,14 @@ package org.jetbrains.kotlin.incremental.testingUtils
import com.intellij.openapi.util.io.FileUtil
import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.metadata.DebugProtoBuf
import org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf
import org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf
import org.jetbrains.kotlin.metadata.jvm.deserialization.BitEncoding
import org.jetbrains.kotlin.protobuf.ExtensionRegistry
import org.jetbrains.kotlin.serialization.DebugProtoBuf
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
import org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import org.jetbrains.kotlin.utils.KotlinJavascriptMetadata
import org.jetbrains.kotlin.utils.KotlinJavascriptMetadataUtils
import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.org.objectweb.asm.ClassReader
import org.jetbrains.org.objectweb.asm.util.TraceClassVisitor
@@ -34,6 +38,7 @@ import java.io.PrintWriter
import java.io.StringWriter
import java.util.*
import java.util.zip.CRC32
import java.util.zip.GZIPInputStream
import kotlin.comparisons.compareBy
// Set this to true if you want to dump all bytecode (test will fail in this case)
@@ -163,6 +168,24 @@ private fun classFileToString(classFile: File): String {
return out.toString()
}
private fun metaJsToString(metaJsFile: File): String {
val out = StringWriter()
val metadataList = arrayListOf<KotlinJavascriptMetadata>()
KotlinJavascriptMetadataUtils.parseMetadata(metaJsFile.readText(), metadataList)
for (metadata in metadataList) {
val (header, content) = GZIPInputStream(ByteArrayInputStream(metadata.body)).use { stream ->
DebugJsProtoBuf.Header.parseDelimitedFrom(stream, JsSerializerProtocol.extensionRegistry) to
DebugJsProtoBuf.Library.parseFrom(stream, JsSerializerProtocol.extensionRegistry)
}
out.write("\n------ header -----\n$header")
out.write("\n------ library -----\n$content")
}
return out.toString()
}
private fun getExtensionRegistry(): ExtensionRegistry {
val registry = ExtensionRegistry.newInstance()!!
DebugJvmProtoBuf.registerAllExtensions(registry)
@@ -174,6 +197,9 @@ private fun fileToStringRepresentation(file: File): String {
file.name.endsWith(".class") -> {
classFileToString(file)
}
file.name.endsWith(KotlinJavascriptMetadataUtils.META_JS_SUFFIX) -> {
metaJsToString(file)
}
else -> {
file.readText()
}

View File

@@ -1,16 +1,16 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: core/deserialization/src/ext_options.debug.proto
// source: core/metadata/src/ext_options.debug.proto
package org.jetbrains.kotlin.serialization;
package org.jetbrains.kotlin.metadata;
public final class DebugExtOptionsProtoBuf {
private DebugExtOptionsProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.fqNameIdInTable);
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.stringIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.stringIdInTable);
}
public static final int SKIP_IN_COMPARISON_FIELD_NUMBER = 50000;
/**
@@ -65,16 +65,16 @@ public final class DebugExtOptionsProtoBuf {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n0core/deserialization/src/ext_options.d" +
"ebug.proto\022\"org.jetbrains.kotlin.seriali" +
"zation\032 google/protobuf/descriptor.proto" +
":;\n\022skip_in_comparison\022\035.google.protobuf" +
".FieldOptions\030\320\206\003 \001(\010:9\n\020name_id_in_tabl" +
"e\022\035.google.protobuf.FieldOptions\030\321\206\003 \001(\010" +
":<\n\023fq_name_id_in_table\022\035.google.protobu" +
"f.FieldOptions\030\322\206\003 \001(\010:;\n\022string_id_in_t" +
"able\022\035.google.protobuf.FieldOptions\030\323\206\003 " +
"\001(\010B\031B\027DebugExtOptionsProtoBuf"
"\n)core/metadata/src/ext_options.debug.pr" +
"oto\022\035org.jetbrains.kotlin.metadata\032 goog" +
"le/protobuf/descriptor.proto:;\n\022skip_in_" +
"comparison\022\035.google.protobuf.FieldOption" +
"s\030\320\206\003 \001(\010:9\n\020name_id_in_table\022\035.google.p" +
"rotobuf.FieldOptions\030\321\206\003 \001(\010:<\n\023fq_name_" +
"id_in_table\022\035.google.protobuf.FieldOptio" +
"ns\030\322\206\003 \001(\010:;\n\022string_id_in_table\022\035.googl" +
"e.protobuf.FieldOptions\030\323\206\003 \001(\010B\031B\027Debug" +
"ExtOptionsProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,200 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: core/metadata/src/builtins.debug.proto
package org.jetbrains.kotlin.metadata.builtins;
public final class DebugBuiltInsProtoBuf {
private DebugBuiltInsProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.packageFqName);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.classAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.constructorAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.compileTimeValue);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.enumEntryAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.parameterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.typeAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.typeParameterAnnotation);
}
public static final int PACKAGE_FQ_NAME_FIELD_NUMBER = 151;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Package { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Package,
java.lang.Integer> packageFqName = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Integer.class,
null);
public static final int CLASS_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> classAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Constructor,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> constructorAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int FUNCTION_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> functionAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PROPERTY_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> propertyAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 151;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.Argument.Value> compileTimeValue = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.Argument.Value.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.Argument.Value.getDefaultInstance());
public static final int ENUM_ENTRY_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.EnumEntry { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.EnumEntry,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> enumEntryAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.ValueParameter { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.ValueParameter,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> parameterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Type { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> typeAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int TYPE_PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.TypeParameter { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeParameter,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> typeParameterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n&core/metadata/src/builtins.debug.proto" +
"\022&org.jetbrains.kotlin.metadata.builtins" +
"\032&core/metadata/src/metadata.debug.proto" +
":@\n\017package_fq_name\022&.org.jetbrains.kotl" +
"in.metadata.Package\030\227\001 \001(\005:j\n\020class_anno" +
"tation\022$.org.jetbrains.kotlin.metadata.C" +
"lass\030\226\001 \003(\0132).org.jetbrains.kotlin.metad" +
"ata.Annotation:v\n\026constructor_annotation" +
"\022*.org.jetbrains.kotlin.metadata.Constru" +
"ctor\030\226\001 \003(\0132).org.jetbrains.kotlin.metad",
"ata.Annotation:p\n\023function_annotation\022\'." +
"org.jetbrains.kotlin.metadata.Function\030\226" +
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
"notation:p\n\023property_annotation\022\'.org.je" +
"tbrains.kotlin.metadata.Property\030\226\001 \003(\0132" +
").org.jetbrains.kotlin.metadata.Annotati" +
"on:~\n\022compile_time_value\022\'.org.jetbrains" +
".kotlin.metadata.Property\030\227\001 \001(\01328.org.j" +
"etbrains.kotlin.metadata.Annotation.Argu" +
"ment.Value:s\n\025enum_entry_annotation\022(.or",
"g.jetbrains.kotlin.metadata.EnumEntry\030\226\001" +
" \003(\0132).org.jetbrains.kotlin.metadata.Ann" +
"otation:w\n\024parameter_annotation\022-.org.je" +
"tbrains.kotlin.metadata.ValueParameter\030\226" +
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
"notation:h\n\017type_annotation\022#.org.jetbra" +
"ins.kotlin.metadata.Type\030\226\001 \003(\0132).org.je" +
"tbrains.kotlin.metadata.Annotation:{\n\031ty" +
"pe_parameter_annotation\022,.org.jetbrains." +
"kotlin.metadata.TypeParameter\030\226\001 \003(\0132).o",
"rg.jetbrains.kotlin.metadata.AnnotationB" +
"\027B\025DebugBuiltInsProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public org.jetbrains.kotlin.protobuf.ExtensionRegistry assignDescriptors(
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor[] {
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor(),
}, assigner);
packageFqName.internalInit(descriptor.getExtensions().get(0));
classAnnotation.internalInit(descriptor.getExtensions().get(1));
constructorAnnotation.internalInit(descriptor.getExtensions().get(2));
functionAnnotation.internalInit(descriptor.getExtensions().get(3));
propertyAnnotation.internalInit(descriptor.getExtensions().get(4));
compileTimeValue.internalInit(descriptor.getExtensions().get(5));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(6));
parameterAnnotation.internalInit(descriptor.getExtensions().get(7));
typeAnnotation.internalInit(descriptor.getExtensions().get(8));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(9));
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,131 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: build-common/src/java_descriptors.debug.proto
package org.jetbrains.kotlin.metadata.java;
public final class DebugJavaClassProtoBuf {
private DebugJavaClassProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isStaticMethod);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isPackagePrivateMethod);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isStaticField);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isPackagePrivateField);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isPackagePrivateClass);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isPackagePrivateConstructor);
}
public static final int IS_STATIC_METHOD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
java.lang.Boolean> isStaticMethod = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_METHOD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
java.lang.Boolean> isPackagePrivateMethod = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_STATIC_FIELD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.lang.Boolean> isStaticField = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_FIELD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.lang.Boolean> isPackagePrivateField = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_CLASS_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class,
java.lang.Boolean> isPackagePrivateClass = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_CONSTRUCTOR_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Constructor,
java.lang.Boolean> isPackagePrivateConstructor = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n-build-common/src/java_descriptors.debu" +
"g.proto\022\"org.jetbrains.kotlin.metadata.j" +
"ava\032&core/metadata/src/metadata.debug.pr" +
"oto:B\n\020is_static_method\022\'.org.jetbrains." +
"kotlin.metadata.Function\030\350\007 \001(\010:K\n\031is_pa" +
"ckage_private_method\022\'.org.jetbrains.kot" +
"lin.metadata.Function\030\351\007 \001(\010:A\n\017is_stati" +
"c_field\022\'.org.jetbrains.kotlin.metadata." +
"Property\030\350\007 \001(\010:J\n\030is_package_private_fi" +
"eld\022\'.org.jetbrains.kotlin.metadata.Prop",
"erty\030\351\007 \001(\010:G\n\030is_package_private_class\022" +
"$.org.jetbrains.kotlin.metadata.Class\030\350\007" +
" \001(\010:S\n\036is_package_private_constructor\022*" +
".org.jetbrains.kotlin.metadata.Construct" +
"or\030\350\007 \001(\010B\030B\026DebugJavaClassProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public org.jetbrains.kotlin.protobuf.ExtensionRegistry assignDescriptors(
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor[] {
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor(),
}, assigner);
isStaticMethod.internalInit(descriptor.getExtensions().get(0));
isPackagePrivateMethod.internalInit(descriptor.getExtensions().get(1));
isStaticField.internalInit(descriptor.getExtensions().get(2));
isPackagePrivateField.internalInit(descriptor.getExtensions().get(3));
isPackagePrivateClass.internalInit(descriptor.getExtensions().get(4));
isPackagePrivateConstructor.internalInit(descriptor.getExtensions().get(5));
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,203 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: core/deserialization/src/builtins.debug.proto
package org.jetbrains.kotlin.serialization.builtins;
public final class DebugBuiltInsProtoBuf {
private DebugBuiltInsProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.packageFqName);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.classAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.constructorAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.compileTimeValue);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.enumEntryAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.parameterAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.typeAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.typeParameterAnnotation);
}
public static final int PACKAGE_FQ_NAME_FIELD_NUMBER = 151;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Package { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Package,
java.lang.Integer> packageFqName = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Integer.class,
null);
public static final int CLASS_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Class,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> classAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Constructor,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> constructorAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int FUNCTION_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Function,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> functionAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PROPERTY_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> propertyAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 151;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Property,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value> compileTimeValue = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value.getDefaultInstance());
public static final int ENUM_ENTRY_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.EnumEntry { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.EnumEntry,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> enumEntryAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.ValueParameter { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.ValueParameter,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> parameterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Type { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> typeAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int TYPE_PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.TypeParameter { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeParameter,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> typeParameterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n-core/deserialization/src/builtins.debu" +
"g.proto\022+org.jetbrains.kotlin.serializat" +
"ion.builtins\0320core/deserialization/src/d" +
"escriptors.debug.proto:E\n\017package_fq_nam" +
"e\022+.org.jetbrains.kotlin.serialization.P" +
"ackage\030\227\001 \001(\005:t\n\020class_annotation\022).org." +
"jetbrains.kotlin.serialization.Class\030\226\001 " +
"\003(\0132..org.jetbrains.kotlin.serialization" +
".Annotation:\200\001\n\026constructor_annotation\022/" +
".org.jetbrains.kotlin.serialization.Cons",
"tructor\030\226\001 \003(\0132..org.jetbrains.kotlin.se" +
"rialization.Annotation:z\n\023function_annot" +
"ation\022,.org.jetbrains.kotlin.serializati" +
"on.Function\030\226\001 \003(\0132..org.jetbrains.kotli" +
"n.serialization.Annotation:z\n\023property_a" +
"nnotation\022,.org.jetbrains.kotlin.seriali" +
"zation.Property\030\226\001 \003(\0132..org.jetbrains.k" +
"otlin.serialization.Annotation:\210\001\n\022compi" +
"le_time_value\022,.org.jetbrains.kotlin.ser" +
"ialization.Property\030\227\001 \001(\0132=.org.jetbrai",
"ns.kotlin.serialization.Annotation.Argum" +
"ent.Value:}\n\025enum_entry_annotation\022-.org" +
".jetbrains.kotlin.serialization.EnumEntr" +
"y\030\226\001 \003(\0132..org.jetbrains.kotlin.serializ" +
"ation.Annotation:\201\001\n\024parameter_annotatio" +
"n\0222.org.jetbrains.kotlin.serialization.V" +
"alueParameter\030\226\001 \003(\0132..org.jetbrains.kot" +
"lin.serialization.Annotation:r\n\017type_ann" +
"otation\022(.org.jetbrains.kotlin.serializa" +
"tion.Type\030\226\001 \003(\0132..org.jetbrains.kotlin.",
"serialization.Annotation:\205\001\n\031type_parame" +
"ter_annotation\0221.org.jetbrains.kotlin.se" +
"rialization.TypeParameter\030\226\001 \003(\0132..org.j" +
"etbrains.kotlin.serialization.Annotation" +
"B\027B\025DebugBuiltInsProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public org.jetbrains.kotlin.protobuf.ExtensionRegistry assignDescriptors(
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor[] {
org.jetbrains.kotlin.serialization.DebugProtoBuf.getDescriptor(),
}, assigner);
packageFqName.internalInit(descriptor.getExtensions().get(0));
classAnnotation.internalInit(descriptor.getExtensions().get(1));
constructorAnnotation.internalInit(descriptor.getExtensions().get(2));
functionAnnotation.internalInit(descriptor.getExtensions().get(3));
propertyAnnotation.internalInit(descriptor.getExtensions().get(4));
compileTimeValue.internalInit(descriptor.getExtensions().get(5));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(6));
parameterAnnotation.internalInit(descriptor.getExtensions().get(7));
typeAnnotation.internalInit(descriptor.getExtensions().get(8));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(9));
org.jetbrains.kotlin.serialization.DebugProtoBuf.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -227,6 +227,10 @@ public final class DebugJsAstProtoBuf {
* <code>COROUTINE_RECEIVER = 8;</code>
*/
COROUTINE_RECEIVER(7, 8),
/**
* <code>SET_COROUTINE_RESULT = 9;</code>
*/
SET_COROUTINE_RESULT(8, 9),
;
/**
@@ -261,6 +265,10 @@ public final class DebugJsAstProtoBuf {
* <code>COROUTINE_RECEIVER = 8;</code>
*/
public static final int COROUTINE_RECEIVER_VALUE = 8;
/**
* <code>SET_COROUTINE_RESULT = 9;</code>
*/
public static final int SET_COROUTINE_RESULT_VALUE = 9;
public final int getNumber() { return value; }
@@ -275,6 +283,7 @@ public final class DebugJsAstProtoBuf {
case 6: return COROUTINE_RESULT;
case 7: return COROUTINE_CONTROLLER;
case 8: return COROUTINE_RECEIVER;
case 9: return SET_COROUTINE_RESULT;
default: return null;
}
}
@@ -32573,6 +32582,28 @@ public final class DebugJsAstProtoBuf {
*/
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder getStatementOrBuilder(
int index);
/**
* <code>optional int32 fileId = 3;</code>
*/
boolean hasFileId();
/**
* <code>optional int32 fileId = 3;</code>
*/
int getFileId();
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
boolean hasLocation();
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location getLocation();
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.LocationOrBuilder getLocationOrBuilder();
}
/**
* Protobuf type {@code org.jetbrains.kotlin.serialization.js.ast.SwitchEntry}
@@ -32647,6 +32678,24 @@ public final class DebugJsAstProtoBuf {
statement_.add(input.readMessage(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.PARSER, extensionRegistry));
break;
}
case 24: {
bitField0_ |= 0x00000002;
fileId_ = input.readInt32();
break;
}
case 34: {
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.Builder subBuilder = null;
if (((bitField0_ & 0x00000004) == 0x00000004)) {
subBuilder = location_.toBuilder();
}
location_ = input.readMessage(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(location_);
location_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000004;
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -32746,9 +32795,47 @@ public final class DebugJsAstProtoBuf {
return statement_.get(index);
}
public static final int FILEID_FIELD_NUMBER = 3;
private int fileId_;
/**
* <code>optional int32 fileId = 3;</code>
*/
public boolean hasFileId() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int32 fileId = 3;</code>
*/
public int getFileId() {
return fileId_;
}
public static final int LOCATION_FIELD_NUMBER = 4;
private org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location location_;
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public boolean hasLocation() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location getLocation() {
return location_;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.LocationOrBuilder getLocationOrBuilder() {
return location_;
}
private void initFields() {
label_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Expression.getDefaultInstance();
statement_ = java.util.Collections.emptyList();
fileId_ = 0;
location_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -32768,6 +32855,12 @@ public final class DebugJsAstProtoBuf {
return false;
}
}
if (hasLocation()) {
if (!getLocation().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
@@ -32781,6 +32874,12 @@ public final class DebugJsAstProtoBuf {
for (int i = 0; i < statement_.size(); i++) {
output.writeMessage(2, statement_.get(i));
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(3, fileId_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeMessage(4, location_);
}
getUnknownFields().writeTo(output);
}
@@ -32798,6 +32897,14 @@ public final class DebugJsAstProtoBuf {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(2, statement_.get(i));
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(3, fileId_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(4, location_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@@ -32909,6 +33016,7 @@ public final class DebugJsAstProtoBuf {
if (org.jetbrains.kotlin.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getLabelFieldBuilder();
getStatementFieldBuilder();
getLocationFieldBuilder();
}
}
private static Builder create() {
@@ -32929,6 +33037,14 @@ public final class DebugJsAstProtoBuf {
} else {
statementBuilder_.clear();
}
fileId_ = 0;
bitField0_ = (bitField0_ & ~0x00000004);
if (locationBuilder_ == null) {
location_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.getDefaultInstance();
} else {
locationBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
@@ -32974,6 +33090,18 @@ public final class DebugJsAstProtoBuf {
} else {
result.statement_ = statementBuilder_.build();
}
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000002;
}
result.fileId_ = fileId_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000004;
}
if (locationBuilder_ == null) {
result.location_ = location_;
} else {
result.location_ = locationBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@@ -33019,6 +33147,12 @@ public final class DebugJsAstProtoBuf {
}
}
}
if (other.hasFileId()) {
setFileId(other.getFileId());
}
if (other.hasLocation()) {
mergeLocation(other.getLocation());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@@ -33036,6 +33170,12 @@ public final class DebugJsAstProtoBuf {
return false;
}
}
if (hasLocation()) {
if (!getLocation().isInitialized()) {
return false;
}
}
return true;
}
@@ -33414,6 +33554,154 @@ public final class DebugJsAstProtoBuf {
return statementBuilder_;
}
private int fileId_ ;
/**
* <code>optional int32 fileId = 3;</code>
*/
public boolean hasFileId() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional int32 fileId = 3;</code>
*/
public int getFileId() {
return fileId_;
}
/**
* <code>optional int32 fileId = 3;</code>
*/
public Builder setFileId(int value) {
bitField0_ |= 0x00000004;
fileId_ = value;
onChanged();
return this;
}
/**
* <code>optional int32 fileId = 3;</code>
*/
public Builder clearFileId() {
bitField0_ = (bitField0_ & ~0x00000004);
fileId_ = 0;
onChanged();
return this;
}
private org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location location_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.getDefaultInstance();
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.LocationOrBuilder> locationBuilder_;
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public boolean hasLocation() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location getLocation() {
if (locationBuilder_ == null) {
return location_;
} else {
return locationBuilder_.getMessage();
}
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public Builder setLocation(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location value) {
if (locationBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
location_ = value;
onChanged();
} else {
locationBuilder_.setMessage(value);
}
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public Builder setLocation(
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.Builder builderForValue) {
if (locationBuilder_ == null) {
location_ = builderForValue.build();
onChanged();
} else {
locationBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public Builder mergeLocation(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location value) {
if (locationBuilder_ == null) {
if (((bitField0_ & 0x00000008) == 0x00000008) &&
location_ != org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.getDefaultInstance()) {
location_ =
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.newBuilder(location_).mergeFrom(value).buildPartial();
} else {
location_ = value;
}
onChanged();
} else {
locationBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public Builder clearLocation() {
if (locationBuilder_ == null) {
location_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.getDefaultInstance();
onChanged();
} else {
locationBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.Builder getLocationBuilder() {
bitField0_ |= 0x00000008;
onChanged();
return getLocationFieldBuilder().getBuilder();
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.LocationOrBuilder getLocationOrBuilder() {
if (locationBuilder_ != null) {
return locationBuilder_.getMessageOrBuilder();
} else {
return location_;
}
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.LocationOrBuilder>
getLocationFieldBuilder() {
if (locationBuilder_ == null) {
locationBuilder_ = new org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.LocationOrBuilder>(
getLocation(),
getParentForChildren(),
isClean());
location_ = null;
}
return locationBuilder_;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.js.ast.SwitchEntry)
}
@@ -49465,100 +49753,103 @@ public final class DebugJsAstProtoBuf {
"tch\022I\n\nexpression\030\001 \002(\01325.org.jetbrains." +
"kotlin.serialization.js.ast.Expression\022E" +
"\n\005entry\030\002 \003(\01326.org.jetbrains.kotlin.ser" +
"ialization.js.ast.SwitchEntry\"\234\001\n\013Switch" +
"ialization.js.ast.SwitchEntry\"\363\001\n\013Switch" +
"Entry\022D\n\005label\030\001 \001(\01325.org.jetbrains.kot" +
"lin.serialization.js.ast.Expression\022G\n\ts",
"tatement\030\002 \003(\01324.org.jetbrains.kotlin.se" +
"rialization.js.ast.Statement\"\225\001\n\005While\022H" +
"\n\tcondition\030\001 \002(\01325.org.jetbrains.kotlin" +
".serialization.js.ast.Expression\022B\n\004body" +
"\030\002 \002(\01324.org.jetbrains.kotlin.serializat" +
"ion.js.ast.Statement\"\227\001\n\007DoWhile\022H\n\tcond" +
"ition\030\001 \002(\01325.org.jetbrains.kotlin.seria" +
"lization.js.ast.Expression\022B\n\004body\030\002 \002(\013" +
"24.org.jetbrains.kotlin.serialization.js" +
".ast.Statement\"\304\003\n\003For\022I\n\tvariables\030\001 \001(",
"\01324.org.jetbrains.kotlin.serialization.j" +
"s.ast.StatementH\000\022K\n\nexpression\030\002 \001(\01325." +
"org.jetbrains.kotlin.serialization.js.as" +
"t.ExpressionH\000\022E\n\005empty\030\003 \001(\01324.org.jetb" +
"rains.kotlin.serialization.js.ast.EmptyI" +
"nitH\000\022H\n\tcondition\030\004 \001(\01325.org.jetbrains" +
"rialization.js.ast.Statement\022\016\n\006fileId\030\003" +
" \001(\005\022E\n\010location\030\004 \001(\01323.org.jetbrains.k" +
"otlin.serialization.js.ast.Location\"\225\001\n\005" +
"While\022H\n\tcondition\030\001 \002(\01325.org.jetbrains" +
".kotlin.serialization.js.ast.Expression\022" +
"H\n\tincrement\030\005 \001(\01325.org.jetbrains.kotli" +
"n.serialization.js.ast.Expression\022B\n\004bod" +
"y\030\006 \002(\01324.org.jetbrains.kotlin.serializa",
"tion.js.ast.StatementB\006\n\004init\"\013\n\tEmptyIn" +
"it\"\374\001\n\005ForIn\022\020\n\006nameId\030\001 \001(\005H\000\022K\n\nexpres" +
"sion\030\002 \001(\01325.org.jetbrains.kotlin.serial" +
"ization.js.ast.ExpressionH\000\022G\n\010iterable\030" +
"\003 \002(\01325.org.jetbrains.kotlin.serializati" +
"on.js.ast.Expression\022B\n\004body\030\004 \002(\01324.org" +
".jetbrains.kotlin.serialization.js.ast.S" +
"tatementB\007\n\005value\"\337\001\n\003Try\022F\n\010tryBlock\030\001 " +
"\002(\01324.org.jetbrains.kotlin.serialization" +
".js.ast.Statement\022D\n\ncatchBlock\030\002 \001(\01320.",
"org.jetbrains.kotlin.serialization.js.as" +
"t.Catch\022J\n\014finallyBlock\030\003 \001(\01324.org.jetb" +
"rains.kotlin.serialization.js.ast.Statem" +
"ent\"\224\001\n\005Catch\022G\n\tparameter\030\001 \002(\01324.org.j" +
"etbrains.kotlin.serialization.js.ast.Par" +
"ameter\022B\n\004body\030\002 \002(\01324.org.jetbrains.kot" +
"lin.serialization.js.ast.Statement\"\007\n\005Em" +
"pty\"\327\005\n\010Fragment\022R\n\017imported_module\030\001 \003(" +
"\01329.org.jetbrains.kotlin.serialization.j" +
"s.ast.ImportedModule\022G\n\014import_entry\030\002 \003",
"(\01321.org.jetbrains.kotlin.serialization." +
"js.ast.Import\022Q\n\021declaration_block\030\003 \001(\013" +
"26.org.jetbrains.kotlin.serialization.js" +
".ast.GlobalBlock\022L\n\014export_block\030\004 \001(\01326" +
".org.jetbrains.kotlin.serialization.js.a" +
"st.GlobalBlock\022Q\n\021initializer_block\030\005 \001(" +
"\01326.org.jetbrains.kotlin.serialization.j" +
"s.ast.GlobalBlock\022L\n\014name_binding\030\006 \003(\0132" +
"6.org.jetbrains.kotlin.serialization.js." +
"ast.NameBinding\022J\n\013class_model\030\007 \003(\01325.o",
"B\n\004body\030\002 \002(\01324.org.jetbrains.kotlin.ser" +
"ialization.js.ast.Statement\"\227\001\n\007DoWhile\022" +
"H\n\tcondition\030\001 \002(\01325.org.jetbrains.kotli" +
"n.serialization.js.ast.Expression\022B\n\004bod",
"y\030\002 \002(\01324.org.jetbrains.kotlin.serializa" +
"tion.js.ast.Statement\"\304\003\n\003For\022I\n\tvariabl" +
"es\030\001 \001(\01324.org.jetbrains.kotlin.serializ" +
"ation.js.ast.StatementH\000\022K\n\nexpression\030\002" +
" \001(\01325.org.jetbrains.kotlin.serializatio" +
"n.js.ast.ExpressionH\000\022E\n\005empty\030\003 \001(\01324.o" +
"rg.jetbrains.kotlin.serialization.js.ast" +
".ClassModel\022P\n\021module_expression\030\010 \003(\01325" +
".org.jetbrains.kotlin.serialization.js.a" +
"st.Expression\022N\n\rinline_module\030\t \003(\01327.o" +
".EmptyInitH\000\022H\n\tcondition\030\004 \001(\01325.org.je" +
"tbrains.kotlin.serialization.js.ast.Expr" +
"ession\022H\n\tincrement\030\005 \001(\01325.org.jetbrain",
"s.kotlin.serialization.js.ast.Expression" +
"\022B\n\004body\030\006 \002(\01324.org.jetbrains.kotlin.se" +
"rialization.js.ast.StatementB\006\n\004init\"\013\n\t" +
"EmptyInit\"\374\001\n\005ForIn\022\020\n\006nameId\030\001 \001(\005H\000\022K\n" +
"\nexpression\030\002 \001(\01325.org.jetbrains.kotlin" +
".serialization.js.ast.ExpressionH\000\022G\n\010it" +
"erable\030\003 \002(\01325.org.jetbrains.kotlin.seri" +
"alization.js.ast.Expression\022B\n\004body\030\004 \002(" +
"\01324.org.jetbrains.kotlin.serialization.j" +
"s.ast.StatementB\007\n\005value\"\337\001\n\003Try\022F\n\010tryB",
"lock\030\001 \002(\01324.org.jetbrains.kotlin.serial" +
"ization.js.ast.Statement\022D\n\ncatchBlock\030\002" +
" \001(\01320.org.jetbrains.kotlin.serializatio" +
"n.js.ast.Catch\022J\n\014finallyBlock\030\003 \001(\01324.o" +
"rg.jetbrains.kotlin.serialization.js.ast" +
".InlineModule\"\224\001\n\016ImportedModule\022\030\n\020exte" +
"rnal_name_id\030\001 \002(\005\022\030\n\020internal_name_id\030\002" +
" \002(\005\022N\n\017plain_reference\030\003 \001(\01325.org.jetb" +
"rains.kotlin.serialization.js.ast.Expres" +
"sion\"i\n\006Import\022\024\n\014signature_id\030\001 \002(\005\022I\n\n",
"expression\030\002 \002(\01325.org.jetbrains.kotlin." +
"serialization.js.ast.Expression\"3\n\013NameB" +
"inding\022\024\n\014signature_id\030\001 \002(\005\022\016\n\006nameId\030\002" +
" \002(\005\"\247\001\n\nClassModel\022\017\n\007name_id\030\001 \002(\005\022\025\n\r" +
"super_name_id\030\002 \001(\005\022\031\n\021interface_name_id" +
"\030\004 \003(\005\022V\n\026post_declaration_block\030\003 \001(\01326" +
".org.jetbrains.kotlin.serialization.js.a" +
"st.GlobalBlock\";\n\014InlineModule\022\024\n\014signat" +
"ure_id\030\001 \002(\005\022\025\n\rexpression_id\030\002 \002(\005\"\034\n\013S" +
"tringTable\022\r\n\005entry\030\001 \003(\t\"K\n\tNameTable\022>",
"\n\005entry\030\001 \003(\0132/.org.jetbrains.kotlin.ser" +
"ialization.js.ast.Name\"\263\001\n\004Name\022\021\n\ttempo" +
"rary\030\001 \002(\010\022\022\n\nidentifier\030\002 \001(\005\022\025\n\rlocal_" +
"name_id\030\003 \001(\005\022\027\n\010imported\030\004 \001(\010:\005false\022T" +
"\n\020special_function\030\005 \001(\0162:.org.jetbrains" +
".kotlin.serialization.js.ast.SpecialFunc" +
"tion\"\346\001\n\005Chunk\022L\n\014string_table\030\001 \002(\01326.o" +
".Statement\"\224\001\n\005Catch\022G\n\tparameter\030\001 \002(\0132" +
"4.org.jetbrains.kotlin.serialization.js." +
"ast.Parameter\022B\n\004body\030\002 \002(\01324.org.jetbra" +
"ins.kotlin.serialization.js.ast.Statemen" +
"t\"\007\n\005Empty\"\327\005\n\010Fragment\022R\n\017imported_modu",
"le\030\001 \003(\01329.org.jetbrains.kotlin.serializ" +
"ation.js.ast.ImportedModule\022G\n\014import_en" +
"try\030\002 \003(\01321.org.jetbrains.kotlin.seriali" +
"zation.js.ast.Import\022Q\n\021declaration_bloc" +
"k\030\003 \001(\01326.org.jetbrains.kotlin.serializa" +
"tion.js.ast.GlobalBlock\022L\n\014export_block\030" +
"\004 \001(\01326.org.jetbrains.kotlin.serializati" +
"on.js.ast.GlobalBlock\022Q\n\021initializer_blo" +
"ck\030\005 \001(\01326.org.jetbrains.kotlin.serializ" +
"ation.js.ast.GlobalBlock\022L\n\014name_binding",
"\030\006 \003(\01326.org.jetbrains.kotlin.serializat" +
"ion.js.ast.NameBinding\022J\n\013class_model\030\007 " +
"\003(\01325.org.jetbrains.kotlin.serialization" +
".js.ast.ClassModel\022P\n\021module_expression\030" +
"\010 \003(\01325.org.jetbrains.kotlin.serializati" +
"on.js.ast.Expression\022N\n\rinline_module\030\t " +
"\003(\01327.org.jetbrains.kotlin.serialization" +
".js.ast.InlineModule\"\224\001\n\016ImportedModule\022" +
"\030\n\020external_name_id\030\001 \002(\005\022\030\n\020internal_na" +
"me_id\030\002 \002(\005\022N\n\017plain_reference\030\003 \001(\01325.o",
"rg.jetbrains.kotlin.serialization.js.ast" +
".StringTable\022H\n\nname_table\030\002 \002(\01324.org.j" +
"etbrains.kotlin.serialization.js.ast.Nam",
"eTable\022E\n\010fragment\030\003 \002(\01323.org.jetbrains" +
".kotlin.serialization.js.ast.Fragment*@\n" +
"\013SideEffects\022\021\n\rAFFECTS_STATE\020\001\022\024\n\020DEPEN" +
"DS_ON_STATE\020\002\022\010\n\004PURE\020\003*?\n\016InlineStrateg" +
"y\022\017\n\013AS_FUNCTION\020\000\022\014\n\010IN_PLACE\020\001\022\016\n\nNOT_" +
"INLINE\020\002*\275\001\n\017SpecialFunction\022\032\n\026DEFINE_I" +
"NLINE_FUNCTION\020\001\022\021\n\rWRAP_FUNCTION\020\002\022\021\n\rT" +
"O_BOXED_CHAR\020\003\022\016\n\nUNBOX_CHAR\020\004\022\020\n\014SUSPEN" +
"D_CALL\020\005\022\024\n\020COROUTINE_RESULT\020\006\022\030\n\024COROUT" +
"INE_CONTROLLER\020\007\022\026\n\022COROUTINE_RECEIVER\020\010",
"B\024B\022DebugJsAstProtoBuf"
".Expression\"i\n\006Import\022\024\n\014signature_id\030\001 " +
"\002(\005\022I\n\nexpression\030\002 \002(\01325.org.jetbrains." +
"kotlin.serialization.js.ast.Expression\"3" +
"\n\013NameBinding\022\024\n\014signature_id\030\001 \002(\005\022\016\n\006n" +
"ameId\030\002 \002(\005\"\247\001\n\nClassModel\022\017\n\007name_id\030\001 " +
"\002(\005\022\025\n\rsuper_name_id\030\002 \001(\005\022\031\n\021interface_" +
"name_id\030\004 \003(\005\022V\n\026post_declaration_block\030" +
"\003 \001(\01326.org.jetbrains.kotlin.serializati" +
"on.js.ast.GlobalBlock\";\n\014InlineModule\022\024\n",
"\014signature_id\030\001 \002(\005\022\025\n\rexpression_id\030\002 \002" +
"(\005\"\034\n\013StringTable\022\r\n\005entry\030\001 \003(\t\"K\n\tName" +
"Table\022>\n\005entry\030\001 \003(\0132/.org.jetbrains.kot" +
"lin.serialization.js.ast.Name\"\263\001\n\004Name\022\021" +
"\n\ttemporary\030\001 \002(\010\022\022\n\nidentifier\030\002 \001(\005\022\025\n" +
"\rlocal_name_id\030\003 \001(\005\022\027\n\010imported\030\004 \001(\010:\005" +
"false\022T\n\020special_function\030\005 \001(\0162:.org.je" +
"tbrains.kotlin.serialization.js.ast.Spec" +
"ialFunction\"\346\001\n\005Chunk\022L\n\014string_table\030\001 " +
"\002(\01326.org.jetbrains.kotlin.serialization",
".js.ast.StringTable\022H\n\nname_table\030\002 \002(\0132" +
"4.org.jetbrains.kotlin.serialization.js." +
"ast.NameTable\022E\n\010fragment\030\003 \002(\01323.org.je" +
"tbrains.kotlin.serialization.js.ast.Frag" +
"ment*@\n\013SideEffects\022\021\n\rAFFECTS_STATE\020\001\022\024" +
"\n\020DEPENDS_ON_STATE\020\002\022\010\n\004PURE\020\003*?\n\016Inline" +
"Strategy\022\017\n\013AS_FUNCTION\020\000\022\014\n\010IN_PLACE\020\001\022" +
"\016\n\nNOT_INLINE\020\002*\327\001\n\017SpecialFunction\022\032\n\026D" +
"EFINE_INLINE_FUNCTION\020\001\022\021\n\rWRAP_FUNCTION" +
"\020\002\022\021\n\rTO_BOXED_CHAR\020\003\022\016\n\nUNBOX_CHAR\020\004\022\020\n",
"\014SUSPEND_CALL\020\005\022\024\n\020COROUTINE_RESULT\020\006\022\030\n" +
"\024COROUTINE_CONTROLLER\020\007\022\026\n\022COROUTINE_REC" +
"EIVER\020\010\022\030\n\024SET_COROUTINE_RESULT\020\tB\024B\022Deb" +
"ugJsAstProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -49793,7 +50084,7 @@ public final class DebugJsAstProtoBuf {
internal_static_org_jetbrains_kotlin_serialization_js_ast_SwitchEntry_fieldAccessorTable = new
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_serialization_js_ast_SwitchEntry_descriptor,
new java.lang.String[] { "Label", "Statement", });
new java.lang.String[] { "Label", "Statement", "FileId", "Location", });
internal_static_org_jetbrains_kotlin_serialization_js_ast_While_descriptor =
getDescriptor().getMessageTypes().get(37);
internal_static_org_jetbrains_kotlin_serialization_js_ast_While_fieldAccessorTable = new

View File

@@ -1,3 +1,5 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project
import java.util.*
import java.io.File
@@ -5,22 +7,28 @@ import org.gradle.api.tasks.bundling.Jar
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
import proguard.gradle.ProGuardTask
buildscript {
extra["defaultSnapshotVersion"] = "1.2-SNAPSHOT"
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.2.0-dev-439", onlySuccessBootstrap = false))
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.2.40-dev-967", onlySuccessBootstrap = false))
val mirrorRepo: String? = findProperty("maven.repository.mirror")?.toString()
val repos = listOfNotNull(
mirrorRepo,
bootstrapKotlinRepo,
"https://jcenter.bintray.com/",
"https://plugins.gradle.org/m2",
"http://repository.jetbrains.com/utils/")
"http://dl.bintray.com/kotlin/kotlinx",
"https://repo.gradle.org/gradle/libs-releases-local", // for native-platform
"https://jetbrains.bintray.com/intellij-third-party-dependencies", // for jflex
"https://dl.bintray.com/jetbrains/markdown" // for org.jetbrains:markdown
)
extra["repos"] = repos
extra["versions.shadow"] = "2.0.1"
repositories {
for (repo in repos) {
maven(url = repo)
@@ -30,6 +38,7 @@ buildscript {
dependencies {
classpath("com.gradle.publish:plugin-publish-plugin:0.9.7")
classpath(kotlinDep("gradle-plugin", bootstrapKotlinVersion))
classpath("net.sf.proguard:proguard-gradle:5.3.3")
}
}
@@ -76,16 +85,21 @@ dependencies {
}
val commonBuildDir = File(rootDir, "build")
val distDir = "$rootDir/dist"
val distKotlinHomeDir = "$distDir/kotlinc"
val distDir by extra("$rootDir/dist")
val distKotlinHomeDir by extra("$distDir/kotlinc")
val distLibDir = "$distKotlinHomeDir/lib"
val ideaPluginDir = "$distDir/artifacts/Kotlin"
val ideaUltimatePluginDir = "$distDir/artifacts/KotlinUltimate"
val commonLocalDataDir = "$rootDir/local"
val ideaSandboxDir = "$commonLocalDataDir/ideaSandbox"
val ideaUltimateSandboxDir = "$commonLocalDataDir/ideaUltimateSandbox"
val ideaPluginDir = "$distDir/artifacts/ideaPlugin/Kotlin"
val ideaUltimatePluginDir = "$distDir/artifacts/ideaUltimatePlugin/Kotlin"
extra["distDir"] = distDir
extra["distKotlinHomeDir"] = distKotlinHomeDir
// TODO: use "by extra()" syntax where possible
extra["distLibDir"] = project.file(distLibDir)
extra["libsDir"] = project.file(distLibDir)
extra["commonLocalDataDir"] = project.file(commonLocalDataDir)
extra["ideaSandboxDir"] = project.file(ideaSandboxDir)
extra["ideaUltimateSandboxDir"] = project.file(ideaUltimateSandboxDir)
extra["ideaPluginDir"] = project.file(ideaPluginDir)
extra["ideaUltimatePluginDir"] = project.file(ideaUltimatePluginDir)
extra["isSonatypeRelease"] = false
@@ -102,7 +116,12 @@ Properties().apply {
extra["JDK_16"] = jdkPath("1.6")
extra["JDK_17"] = jdkPath("1.7")
extra["JDK_18"] = jdkPath("1.8")
extra["JDK_9"] = jdkPathIfFound("9")
extra["JDK_9"] = jdkPath("9")
extra["JDK_10"] = jdkPathIfFound("10")
rootProject.apply {
from(rootProject.file("versions.gradle.kts"))
}
extra["versions.protobuf-java"] = "2.6.1"
extra["versions.javax.inject"] = "1"
@@ -113,9 +132,48 @@ extra["versions.junit"] = "4.12"
extra["versions.javaslang"] = "2.0.6"
extra["versions.ant"] = "1.8.2"
extra["versions.android"] = "2.3.1"
extra["versions.kotlinx-coroutines-core"] = "0.20"
extra["versions.kotlinx-coroutines-jdk8"] = "0.20"
extra["versions.json"] = "20160807"
extra["versions.native-platform"] = "0.14"
extra["versions.ant-launcher"] = "1.8.0"
extra["versions.robolectric"] = "3.1"
extra["versions.org.springframework"] = "4.2.0.RELEASE"
extra["versions.jflex"] = "1.7.0"
extra["versions.markdown"] = "0.1.25"
extra["ideaCoreSdkJars"] = arrayOf("annotations", "asm-all", "guava", "intellij-core", "jdom", "jna", "log4j", "picocontainer",
"snappy-in-java", "streamex", "trove4j", "xpp3-1.1.4-min", "xstream")
val isTeamcityBuild = project.hasProperty("teamcity") || System.getenv("TEAMCITY_VERSION") != null
val intellijUltimateEnabled = project.getBooleanProperty("intellijUltimateEnabled") ?: isTeamcityBuild
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
extra["intellijUltimateEnabled"] = intellijUltimateEnabled
extra["intellijSeparateSdks"] = intellijSeparateSdks
extra["IntellijCoreDependencies"] =
listOf("annotations",
"asm-all",
"guava-21.0",
"jdom",
"jna",
"log4j",
"picocontainer",
"snappy-in-java-0.5.1",
"streamex",
"trove4j")
extra["nativePlatformVariants"] =
listOf("windows-amd64",
"windows-i386",
"osx-amd64",
"osx-i386",
"linux-amd64",
"linux-i386",
"freebsd-amd64-libcpp",
"freebsd-amd64-libstdcpp",
"freebsd-i386-libcpp",
"freebsd-i386-libstdcpp")
extra["compilerModules"] = arrayOf(
":compiler:util",
@@ -123,6 +181,7 @@ extra["compilerModules"] = arrayOf(
":compiler:conditional-preprocessor",
":compiler:resolution",
":compiler:serialization",
":compiler:psi",
":compiler:frontend",
":compiler:frontend.java",
":compiler:frontend.script",
@@ -145,6 +204,8 @@ extra["compilerModules"] = arrayOf(
":js:js.dce",
":compiler",
":kotlin-build-common",
":core:metadata",
":core:metadata.jvm",
":core:descriptors",
":core:descriptors.jvm",
":core:deserialization",
@@ -162,6 +223,7 @@ val coreLibProjects = listOf(
":kotlin-test:kotlin-test-common",
":kotlin-test:kotlin-test-jvm",
":kotlin-test:kotlin-test-junit",
":kotlin-test:kotlin-test-testng",
":kotlin-test:kotlin-test-js",
":kotlin-reflect"
)
@@ -191,20 +253,7 @@ apply {
}
}
val importedAntTasksPrefix = "imported-ant-update-"
// TODO: check the reasons of import conflict with xerces
//ant.importBuild("$rootDir/update_dependencies.xml") { antTaskName -> importedAntTasksPrefix + antTaskName }
tasks.matching { task ->
task.name.startsWith(importedAntTasksPrefix)
}.forEach {
it.group = "Imported ant"
}
//task("update-dependencies") {
// dependsOn(tasks.getByName(importedAntTasksPrefix + "update"))
//}
apply { plugin("jps-compatible") }
fun Project.allprojectsRecursive(body: Project.() -> Unit) {
this.body()
@@ -213,7 +262,9 @@ fun Project.allprojectsRecursive(body: Project.() -> Unit) {
fun Task.listConfigurationContents(configName: String) {
doFirst {
println("$configName configuration files:\n${project.configurations[configName].allArtifacts.files.files.joinToString("\n ", " ")}")
project.configurations.findByName(configName)?.let {
println("$configName configuration files:\n${it.allArtifacts.files.files.joinToString("\n ", " ")}")
}
}
}
@@ -230,17 +281,22 @@ allprojects {
// - some tests (in particular js and binary-compatibility-validator depend on the fixed (default) location
// - idea seems unable to exclude common builddir from indexing
// therefore it is disabled by default
// buildDir = File(commonBuildDir, project.name)
// buildDir = File(commonBuildDir, project.name)
val repos: List<String> by rootProject.extra
repositories {
for (repo in (rootProject.extra["repos"] as List<String>)) {
maven { setUrl(repo) }
for (repo in repos) {
maven(repo)
}
intellijSdkRepo(project)
androidDxJarRepo(project)
}
configureJvmProject(javaHome!!, jvmTarget!!)
val commonCompilerArgs = listOf("-Xallow-kotlin-package")
val commonCompilerArgs = listOf("-Xallow-kotlin-package", "-Xread-deserialized-contracts")
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
kotlinOptions {
languageVersion = kotlinLanguageVersion
@@ -282,25 +338,40 @@ allprojects {
if (javaHome != defaultJavaHome || jvmTarget != defaultJvmTarget) {
configureJvmProject(javaHome!!, jvmTarget!!)
}
fun File.toProjectRootRelativePathOrSelf() = (relativeToOrNull(rootDir)?.takeUnless { it.startsWith("..") } ?: this).path
fun FileCollection.printClassPath(role: String) =
println("${project.path} $role classpath:\n ${joinToString("\n ") { it.toProjectRootRelativePathOrSelf() } }")
try { the<JavaPluginConvention>() } catch (_: UnknownDomainObjectException) { null }?.let { javaConvention ->
task("printCompileClasspath") { doFirst { javaConvention.sourceSets["main"].compileClasspath.printClassPath("compile") } }
task("printRuntimeClasspath") { doFirst { javaConvention.sourceSets["main"].runtimeClasspath.printClassPath("runtime") } }
task("printTestCompileClasspath") { doFirst { javaConvention.sourceSets["test"].compileClasspath.printClassPath("test compile") } }
task("printTestRuntimeClasspath") { doFirst { javaConvention.sourceSets["test"].runtimeClasspath.printClassPath("test runtime") } }
}
}
}
task<Copy>("dist") {
val distTask = task<Copy>("dist") {
val childDistTasks = getTasksByName("dist", true) - this@task
dependsOn(childDistTasks)
into(distDir)
from(files("compiler/cli/bin")) { into("kotlinc/bin") }
from(files("license")) { into("kotlinc/license") }
}
val compilerCopyTask = task<Copy>("idea-plugin-copy-compiler") {
dependsOnTaskIfExistsRec("dist")
dependsOn(distTask)
into(ideaPluginDir)
from(distDir) { include("kotlinc/**") }
}
task<Copy>("ideaPlugin") {
dependsOn(compilerCopyTask)
dependsOnTaskIfExistsRec("idea-plugin")
shouldRunAfter(":prepare:idea-plugin:idea-plugin")
val childIdeaPluginTasks = getTasksByName("ideaPlugin", true) - this@task
dependsOn(childIdeaPluginTasks)
into("$ideaPluginDir/lib")
}
@@ -312,6 +383,13 @@ tasks {
}
}
// TODO: copied from TeamCityBuild.xml (with ultimate-related modification), consider removing after migrating from it
"cleanupArtifacts" {
doLast {
delete(ideaPluginDir)
delete(ideaUltimatePluginDir)
}
}
"coreLibsTest" {
(coreLibProjects + listOf(
@@ -342,6 +420,7 @@ tasks {
"jsCompilerTest" {
dependsOn(":js:js.tests:test")
dependsOn(":js:js.tests:runMocha")
}
"scriptingTest" {
@@ -355,6 +434,7 @@ tasks {
dependsOn("scriptingTest")
dependsOn(":kotlin-build-common:test")
dependsOn(":compiler:incremental-compilation-impl:test")
}
"examplesTest" {
@@ -407,9 +487,11 @@ tasks {
"plugins-tests" {
dependsOn("dist")
dependsOn(":plugins:plugins-tests:test",
":kotlin-annotation-processing:test",
dependsOn(":kotlin-annotation-processing:test",
":kotlin-source-sections-compiler-plugin:test",
":kotlin-allopen-compiler-plugin:test",
":kotlin-noarg-compiler-plugin:test",
":kotlin-sam-with-receiver-compiler-plugin:test",
":plugins:uast-kotlin:test",
":kotlin-annotation-processing-gradle:test")
}
@@ -434,19 +516,70 @@ tasks {
"check" { dependsOn("test") }
}
fun CopySpec.compilerScriptPermissionsSpec() {
filesMatching("bin/*") { mode = 0b111101101 }
filesMatching("bin/*.bat") { mode = 0b110100100 }
}
val zipCompiler by task<Zip> {
destinationDir = file(distDir)
archiveName = "kotlin-compiler-$kotlinVersion.zip"
from(distKotlinHomeDir) {
into("kotlinc")
compilerScriptPermissionsSpec()
}
doLast {
logger.lifecycle("Compiler artifacts packed to $archivePath")
}
}
val zipTestData by task<Zip> {
destinationDir = file(distDir)
archiveName = "kotlin-test-data.zip"
from("compiler/testData") { into("compiler") }
from("idea/testData") { into("ide") }
from("idea/idea-completion/testData") { into("ide/completion") }
doLast {
logger.lifecycle("Test data packed to $archivePath")
}
}
val zipPlugin by task<Zip> {
val src = when (project.findProperty("pluginArtifactDir") as String?) {
"Kotlin" -> ideaPluginDir
"KotlinUltimate" -> ideaUltimatePluginDir
null -> if (project.hasProperty("ultimate")) ideaUltimatePluginDir else ideaPluginDir
else -> error("Unsupported plugin artifact dir")
}
val destPath = project.findProperty("pluginZipPath") as String?
val dest = File(destPath ?: "$buildDir/kotlin-plugin.zip")
destinationDir = dest.parentFile
archiveName = dest.name
doFirst {
if (destPath == null) throw GradleException("Specify target zip path with 'pluginZipPath' property")
}
into("Kotlin") {
from("$src/kotlinc") {
into("kotlinc")
compilerScriptPermissionsSpec()
}
from(src) {
exclude("kotlinc")
}
}
doLast {
logger.lifecycle("Plugin artifacts packed to $archivePath")
}
}
configure<IdeaModel> {
module {
excludeDirs = files(
project.buildDir,
commonLocalDataDir,
".gradle",
"dependencies",
"dist",
"ideaSDK/bin",
"ideaSDK/androidSDK",
"ideaSDK/config",
"ideaSDK/config-idea",
"ideaSDK/system",
"ideaSDK/system-idea"
"dist"
).toSet()
}
}
@@ -462,10 +595,12 @@ fun jdkPath(version: String): String = jdkPathIfFound(version)
fun Project.configureJvmProject(javaHome: String, javaVersion: String) {
tasks.withType<JavaCompile> {
options.isFork = true
options.forkOptions.javaHome = file(javaHome)
options.compilerArgs.add("-proc:none")
options.encoding = "UTF-8"
if (name != "compileJava9Java") {
options.isFork = true
options.forkOptions.javaHome = file(javaHome)
options.compilerArgs.add("-proc:none")
options.encoding = "UTF-8"
}
}
tasks.withType<KotlinCompile> {
@@ -477,3 +612,41 @@ fun Project.configureJvmProject(javaHome: String, javaVersion: String) {
executable = File(javaHome, "bin/java").canonicalPath
}
}
tasks.create("findShadowJarsInClasspath").doLast {
fun Collection<File>.printSorted(indent: String = " ") {
sortedBy { it.path }.forEach { println(indent + it.relativeTo(rootProject.projectDir)) }
}
val shadowJars = hashSetOf<File>()
for (project in rootProject.allprojects) {
for (task in project.tasks) {
when (task) {
is ShadowJar -> {
shadowJars.add(File(task.archivePath))
}
is ProGuardTask -> {
shadowJars.addAll(task.outputs.files.toList())
}
}
}
}
println("Shadow jars:")
shadowJars.printSorted()
fun Project.checkConfig(configName: String) {
val config = configurations.findByName(configName) ?: return
val shadowJarsInConfig = config.resolvedConfiguration.files.filter { it in shadowJars }
if (shadowJarsInConfig.isNotEmpty()) {
println()
println("Project $project contains shadow jars in configuration '$configName':")
shadowJarsInConfig.printSorted()
}
}
for (project in rootProject.allprojects) {
project.checkConfig("compileClasspath")
project.checkConfig("testCompileClasspath")
}
}

1050
build.xml

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,9 @@
buildscript {
val buildSrcKotlinVersion: String by extra(findProperty("buildSrc.kotlin.version")?.toString() ?: embeddedKotlinVersion)
val buildSrcKotlinRepo: String? by extra(findProperty("buildSrc.kotlin.repo") as String?)
extra["versions.shadow"] = "2.0.1"
extra["versions.shadow"] = "2.0.2"
extra["versions.intellij-plugin"] = "0.3.0-SNAPSHOT"
extra["versions.native-platform"] = "0.14"
repositories {
buildSrcKotlinRepo?.let {
@@ -29,21 +31,42 @@ plugins {
`kotlin-dsl`
}
fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty(name)?.let {
val v = it.toString()
if (v.isBlank()) true
else v.toBoolean()
}
rootProject.apply {
from(rootProject.file("../versions.gradle.kts"))
}
val isTeamcityBuild = project.hasProperty("teamcity") || System.getenv("TEAMCITY_VERSION") != null
val intellijUltimateEnabled by extra(project.getBooleanProperty("intellijUltimateEnabled") ?: isTeamcityBuild)
val intellijSeparateSdks by extra(project.getBooleanProperty("intellijSeparateSdks") ?: false)
extra["intellijRepo"] = "https://www.jetbrains.com/intellij-repository"
extra["intellijReleaseType"] = "releases" // or "snapshots"
extra["versions.androidDxSources"] = "5.0.0_r2"
extra["customDepsOrg"] = "kotlin.build.custom.deps"
repositories {
extra["buildSrcKotlinRepo"]?.let {
maven(url = it)
}
maven(url = "https://dl.bintray.com/kotlin/kotlin-dev") // for dex-method-list
// maven { setUrl("https://repo.gradle.org/gradle/libs-releases-local") }
maven(url = "https://repo.gradle.org/gradle/libs-releases-local") // for native-platform
jcenter()
}
dependencies {
compile(files("../dependencies/native-platform-uberjar.jar"))
compile("com.jakewharton.dex:dex-method-list:2.0.0-alpha")
// compile("net.rubygrapefruit:native-platform:0.14")
compile("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
compile("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
compile("net.rubygrapefruit:native-platform-windows-i386:${property("versions.native-platform")}")
compile("com.jakewharton.dex:dex-method-list:3.0.0")
// TODO: adding the dep to the plugin breaks the build unexpectedly, resolve and uncomment
// compile("org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.extra["bootstrap_kotlin_version"]}")
// Shadow plugin is used in many projects of the main build. Once it's no longer used in buildSrc, please move this dependency to the root project
compile("com.github.jengelman.gradle.plugins:shadow:${property("versions.shadow")}")
compile("org.ow2.asm:asm-all:6.0_BETA")
}
@@ -54,3 +77,5 @@ samWithReceiver {
fun Project.`samWithReceiver`(configure: org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverExtension.() -> Unit): Unit =
extensions.configure("samWithReceiver", configure)
tasks["build"].dependsOn(":prepare-deps:android-dx:build", ":prepare-deps:intellij-sdk:build")

View File

@@ -1,7 +1,7 @@
org.gradle.daemon=true
org.gradle.parallel=false
org.gradle.configureondemand=false
org.gradle.jvmargs=-Xmx1200m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m
#buildSrc.kotlin.repo=https://jcenter.bintray.com
#buildSrc.kotlin.version=1.1.50

View File

@@ -0,0 +1,106 @@
import org.gradle.api.publish.ivy.internal.artifact.DefaultIvyArtifact
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyConfiguration
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyPublicationIdentity
import org.gradle.api.publish.ivy.internal.publisher.IvyDescriptorFileGenerator
import java.io.File
import org.gradle.internal.os.OperatingSystem
import org.gradle.jvm.tasks.Jar
val toolsOs by lazy {
when {
OperatingSystem.current().isWindows -> "windows"
OperatingSystem.current().isMacOsX -> "macosx"
OperatingSystem.current().isLinux -> "linux"
else -> {
logger.error("Unknown operating system for android tools: ${OperatingSystem.current().name}")
""
}
}
}
val buildToolsVersion = rootProject.extra["versions.androidBuildTools"] as String
val dxSourcesVersion = rootProject.extra["versions.androidDxSources"] as String
repositories {
ivy {
artifactPattern("https://dl-ssl.google.com/android/repository/[artifact]_[revision](-[classifier]).[ext]")
artifactPattern("https://android.googlesource.com/platform/dalvik/+archive/android-$dxSourcesVersion/[artifact].[ext]")
}
}
val customDepsRepoDir = File(buildDir, "repo")
val customDepsOrg: String by rootProject.extra
val dxModuleName = "android-dx"
val dxRevision = buildToolsVersion
val dxRepoModuleDir = File(customDepsRepoDir, "$customDepsOrg/$dxModuleName/$dxRevision")
val buildToolsZip by configurations.creating
val dxSourcesTar by configurations.creating
dependencies {
buildToolsZip("google:build-tools:$buildToolsVersion:$toolsOs@zip")
dxSourcesTar("google:dx:0@tar.gz")
}
val unzipDxJar by tasks.creating {
dependsOn(buildToolsZip)
inputs.files(buildToolsZip)
outputs.files(File(dxRepoModuleDir, "dx.jar"))
doFirst {
project.copy {
from(zipTree(buildToolsZip.singleFile).files)
include("**/dx.jar")
into(dxRepoModuleDir)
}
}
}
val dxSourcesTargetDir = File(buildDir, "dx_src")
val untarDxSources by tasks.creating {
dependsOn(dxSourcesTar)
inputs.files(dxSourcesTar)
outputs.dir(dxSourcesTargetDir)
doFirst {
project.copy {
from(tarTree(dxSourcesTar.singleFile))
include("src/**")
includeEmptyDirs = false
into(dxSourcesTargetDir)
}
}
}
val prepareDxSourcesJar by tasks.creating(Jar::class) {
dependsOn(untarDxSources)
from("$dxSourcesTargetDir/src")
destinationDir = dxRepoModuleDir
baseName = "dx"
classifier = "sources"
}
val prepareIvyXml by tasks.creating {
dependsOn(unzipDxJar, prepareDxSourcesJar)
inputs.files(unzipDxJar, prepareDxSourcesJar)
val ivyFile = File(dxRepoModuleDir, "$dxModuleName.ivy.xml")
outputs.file(ivyFile)
doLast {
with(IvyDescriptorFileGenerator(DefaultIvyPublicationIdentity(customDepsOrg, dxModuleName, dxRevision))) {
addConfiguration(DefaultIvyConfiguration("default"))
addConfiguration(DefaultIvyConfiguration("sources"))
addArtifact(DefaultIvyArtifact(File(dxRepoModuleDir, "dx.jar"), "dx", "jar", "jar", null).also { it.conf = "default" })
addArtifact(DefaultIvyArtifact(File(dxRepoModuleDir, "dx-sources.jar"), "dx", "jar", "sources", "sources").also { it.conf = "sources" })
writeTo(ivyFile)
}
}
}
val build by tasks.creating {
dependsOn(unzipDxJar, prepareDxSourcesJar, prepareIvyXml)
}
val clean by tasks.creating(Delete::class) {
delete(dxRepoModuleDir)
delete(buildDir)
}

View File

@@ -0,0 +1,256 @@
@file:Suppress("PropertyName")
import org.gradle.api.publish.ivy.internal.artifact.DefaultIvyArtifact
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyConfiguration
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyPublicationIdentity
import org.gradle.api.publish.ivy.internal.publisher.IvyDescriptorFileGenerator
import java.io.File
import org.gradle.internal.os.OperatingSystem
val intellijUltimateEnabled: Boolean by rootProject.extra
val intellijRepo: String by rootProject.extra
val intellijReleaseType: String by rootProject.extra
val intellijVersion = rootProject.extra["versions.intellijSdk"] as String
val androidStudioRelease = rootProject.findProperty("versions.androidStudioRelease") as String?
val androidStudioBuild = rootProject.findProperty("versions.androidStudioBuild") as String?
val intellijSeparateSdks: Boolean by rootProject.extra
val installIntellijCommunity = !intellijUltimateEnabled || intellijSeparateSdks
val installIntellijUltimate = intellijUltimateEnabled
val platformBaseVersion = intellijVersion.substringBefore('.', "").takeIf { it.isNotEmpty() }
?: error("Invalid IDEA version $intellijVersion")
logger.info("intellijUltimateEnabled: $intellijUltimateEnabled")
logger.info("intellijVersion: $intellijVersion")
logger.info("androidStudioRelease: $androidStudioRelease")
logger.info("androidStudioBuild: $androidStudioBuild")
logger.info("intellijSeparateSdks: $intellijSeparateSdks")
logger.info("installIntellijCommunity: $installIntellijCommunity")
logger.info("installIntellijUltimate: $installIntellijUltimate")
val studioOs by lazy {
when {
OperatingSystem.current().isWindows -> "windows"
OperatingSystem.current().isMacOsX -> "mac"
OperatingSystem.current().isLinux -> "linux"
else -> {
logger.error("Unknown operating system for android tools: ${OperatingSystem.current().name}")
""
}
}
}
repositories {
if (androidStudioRelease != null) {
ivy {
artifactPattern("https://dl.google.com/dl/android/studio/ide-zips/$androidStudioRelease/[artifact]-[revision]-$studioOs.zip")
}
}
maven { setUrl("$intellijRepo/$intellijReleaseType") }
maven { setUrl("https://plugins.jetbrains.com/maven") }
ivy {
artifactPattern("https://raw.github.com/JetBrains/intellij-community/[revision]/lib/src/[artifact].zip")
}
}
val intellij by configurations.creating
val intellijUltimate by configurations.creating
val sources by configurations.creating
val `asm-shaded-sources` by configurations.creating
val `jps-standalone` by configurations.creating
val `jps-build-test` by configurations.creating
val `intellij-core` by configurations.creating
val `plugins-NodeJS` by configurations.creating
val customDepsRepoDir = File(buildDir, "repo")
val customDepsOrg: String by rootProject.extra
val customDepsRevision = intellijVersion
val customDepsRepoModulesDir = File(customDepsRepoDir, "$customDepsOrg/$customDepsRevision")
val repoDir = customDepsRepoModulesDir
dependencies {
if (androidStudioRelease != null) {
intellij("google:android-studio-ide:$androidStudioBuild")
} else {
if (installIntellijCommunity) {
intellij("com.jetbrains.intellij.idea:ideaIC:$intellijVersion")
}
if (installIntellijUltimate) {
intellijUltimate("com.jetbrains.intellij.idea:ideaIU:$intellijVersion")
}
}
sources("com.jetbrains.intellij.idea:ideaIC:$intellijVersion:sources@jar")
`asm-shaded-sources`("asmsources:asm-src:$platformBaseVersion@zip")
`jps-standalone`("com.jetbrains.intellij.idea:jps-standalone:$intellijVersion")
`jps-build-test`("com.jetbrains.intellij.idea:jps-build-test:$intellijVersion")
`intellij-core`("com.jetbrains.intellij.idea:intellij-core:$intellijVersion")
if (intellijUltimateEnabled) {
`plugins-NodeJS`("com.jetbrains.plugins:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}@zip")
}
}
fun Task.configureExtractFromConfigurationTask(sourceConfig: Configuration,
pathRemap: (String) -> String = { it },
extractor: (Configuration) -> Any) {
dependsOn(sourceConfig)
inputs.files(sourceConfig)
val targetDir = File(repoDir, sourceConfig.name)
outputs.dirs(targetDir)
doFirst {
project.copy {
from(extractor(sourceConfig))
into(targetDir)
eachFile {
path = pathRemap(path)
}
}
}
}
fun removePathPrefix(path: String): String {
if (androidStudioRelease == null) return path
val slashes = if (studioOs == "mac") 2 else 1
var result = path
repeat(slashes) {
result = result.substringAfter('/')
}
return result
}
val unzipIntellijSdk by tasks.creating {
configureExtractFromConfigurationTask(intellij, pathRemap = { removePathPrefix(it) }) {
zipTree(it.singleFile).matching {
if (OperatingSystem.current().isMacOsX && androidStudioRelease != null) {
exclude("Android Studio*.app/Contents/plugins/Kotlin/**")
}
exclude("plugins/Kotlin/**")
}
}
}
val unzipIntellijUltimateSdk by tasks.creating {
configureExtractFromConfigurationTask(intellijUltimate) {
zipTree(it.singleFile).matching {
exclude("plugins/Kotlin/**")
}
}
}
val unzipIntellijCore by tasks.creating { configureExtractFromConfigurationTask(`intellij-core`) { zipTree(it.singleFile) } }
val unzipJpsStandalone by tasks.creating { configureExtractFromConfigurationTask(`jps-standalone`) { zipTree(it.singleFile) } }
val copyIntellijSdkSources by tasks.creating {
configureExtractFromConfigurationTask(sources) { it.singleFile }
}
val copyJpsBuildTest by tasks.creating { configureExtractFromConfigurationTask(`jps-build-test`) { it.singleFile } }
val copyAsmShadedSources by tasks.creating { configureExtractFromConfigurationTask(`asm-shaded-sources`) { it.singleFile } }
val unzipNodeJSPlugin by tasks.creating { configureExtractFromConfigurationTask(`plugins-NodeJS`) { zipTree(it.singleFile) } }
fun writeIvyXml(moduleName: String, fileName: String, jarFiles: FileCollection, baseDir: File, sourcesJar: File?) {
with(IvyDescriptorFileGenerator(DefaultIvyPublicationIdentity(customDepsOrg, moduleName, intellijVersion))) {
addConfiguration(DefaultIvyConfiguration("default"))
addConfiguration(DefaultIvyConfiguration("sources"))
jarFiles.asFileTree.files.forEach {
if (it.isFile && it.extension == "jar") {
val relativeName = it.toRelativeString(baseDir).removeSuffix(".jar")
addArtifact(DefaultIvyArtifact(it, relativeName, "jar", "jar", null).also { it.conf = "default" })
}
}
if (sourcesJar != null) {
val sourcesArtifactName = sourcesJar.name.removeSuffix(".jar").substringBefore("-")
addArtifact(DefaultIvyArtifact(sourcesJar, sourcesArtifactName, "jar", "sources", "sources").also { it.conf = "sources" })
}
writeTo(File(customDepsRepoModulesDir, "$fileName.ivy.xml"))
}
}
val prepareIvyXmls by tasks.creating {
dependsOn(unzipIntellijCore, unzipJpsStandalone, copyIntellijSdkSources, copyJpsBuildTest, copyAsmShadedSources)
val intellijSdkDir = File(repoDir, intellij.name)
val intellijUltimateSdkDir = File(repoDir, intellijUltimate.name)
if (installIntellijCommunity) {
dependsOn(unzipIntellijSdk)
inputs.dir(intellijSdkDir)
outputs.file(File(repoDir, "${intellij.name}.ivy.xml"))
}
if (installIntellijUltimate) {
dependsOn(unzipIntellijUltimateSdk)
inputs.dir(intellijUltimateSdkDir)
outputs.file(File(repoDir, "${intellijUltimate.name}.ivy.xml"))
}
val flatDeps = listOf(`intellij-core`, `jps-standalone`, `jps-build-test`, `asm-shaded-sources`)
flatDeps.forEach {
inputs.dir(File(repoDir, it.name))
outputs.file(File(repoDir, "${it.name}.ivy.xml"))
}
inputs.dir(File(repoDir, sources.name))
if (intellijUltimateEnabled) {
dependsOn(unzipNodeJSPlugin)
inputs.dir(File(repoDir, `plugins-NodeJS`.name))
outputs.file(File(repoDir, "${`plugins-NodeJS`.name}.ivy.xml"))
}
doFirst {
val sourcesFile = if (sources.isEmpty) null else File(repoDir, "${sources.name}/${sources.singleFile.name}")
if (installIntellijCommunity) {
val libDir = File(intellijSdkDir, "lib")
writeIvyXml(intellij.name,
intellij.name,
fileTree(libDir).filter {
it.parentFile == libDir && !it.name.startsWith("kotlin-")
},
libDir,
sourcesFile)
File(intellijSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach {
writeIvyXml(it.name, "intellij.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), sourcesFile)
}
}
if (installIntellijUltimate) {
val libDir = File(intellijUltimateSdkDir, "lib")
writeIvyXml(intellij.name, // important! the module name should be "intellij"
intellijUltimate.name,
fileTree(libDir).filter {
it.parentFile == libDir && !it.name.startsWith("kotlin-")
},
libDir,
sourcesFile)
File(intellijUltimateSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach {
writeIvyXml(it.name, "intellijUltimate.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), sourcesFile)
}
}
flatDeps.forEach {
writeIvyXml(it.name, it.name, files("$repoDir/${it.name}"), File(repoDir, it.name), sourcesFile)
}
if (intellijUltimateEnabled) {
val nodeJsBaseDir = "${`plugins-NodeJS`.name}/NodeJS/lib"
writeIvyXml("NodeJS", `plugins-NodeJS`.name, files("$repoDir/$nodeJsBaseDir"), File(repoDir, nodeJsBaseDir), sourcesFile)
}
}
}
val build by tasks.creating {
dependsOn(prepareIvyXmls)
}
val clean by tasks.creating(Delete::class) {
delete(customDepsRepoModulesDir)
delete(buildDir)
}

3
buildSrc/settings.gradle Normal file
View File

@@ -0,0 +1,3 @@
include "prepare-deps:android-dx",
"prepare-deps:intellij-sdk"

View File

@@ -0,0 +1,14 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
import org.gradle.api.Project
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.kotlin.dsl.extra
fun RepositoryHandler.androidDxJarRepo(project: Project): IvyArtifactRepository = ivy {
val baseDir = File("${project.rootDir}/buildSrc/prepare-deps/android-dx/build/repo")
ivyPattern("${baseDir.canonicalPath}/[organisation]/[module]/[revision]/[module].ivy.xml")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[module]/[revision]/[artifact](-[classifier]).jar")
}
fun Project.androidDxJar() = "kotlin.build.custom.deps:android-dx:${rootProject.extra["versions.androidBuildTools"]}"

View File

@@ -1,35 +1,23 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
import org.gradle.api.*
import org.gradle.api.tasks.*
import org.gradle.kotlin.dsl.*
import org.gradle.api.plugins.JavaPluginConvention
import groovy.lang.Closure
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.file.SourceDirectorySet
import org.gradle.api.internal.AbstractTask
import org.gradle.jvm.tasks.Jar
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.SourceSetOutput
import org.gradle.kotlin.dsl.creating
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.the
import java.io.File
inline fun <reified T : Task> Project.task(noinline configuration: T.() -> Unit) = tasks.creating(T::class, configuration)
fun AbstractTask.dependsOnTaskIfExists(task: String, project: Project?, parentProject: Project?) {
val thisTask = this
val p = project ?: this.project
p.afterEvaluate {
p.tasks.firstOrNull { it.name == task }?.also {
if (parentProject != null) {
parentProject.evaluationDependsOn(p.path)
}
thisTask.dependsOn(it)
}
}
}
fun AbstractTask.dependsOnTaskIfExistsRec(task: String, project: Project? = null, parentProject: Project? = null) {
dependsOnTaskIfExists(task, project, parentProject)
(project ?: this.project).subprojects.forEach {
dependsOnTaskIfExistsRec(task, it, this.project)
}
fun Project.callGroovy(name: String, vararg args: Any?): Any? {
return (property(name) as Closure<*>).call(*args)
}
inline fun<T: Any> Project.withJavaPlugin(crossinline body: () -> T?): T? {
@@ -68,3 +56,9 @@ fun Project.generator(fqName: String) = task<JavaExec> {
main = fqName
workingDir = rootDir
}
fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty(name)?.let {
val v = it.toString()
if (v.isBlank()) true
else v.toBoolean()
}

View File

@@ -36,10 +36,12 @@ fun Project.classesDirsArtifact(): FileCollection {
return classesDirs
}
private const val MAGIC_DO_NOT_CHANGE_TEST_JAR_TASK_NAME = "testJar"
fun Project.testsJar(body: Jar.() -> Unit = {}): Jar {
val testsJarCfg = configurations.getOrCreate("tests-jar").extendsFrom(configurations["testCompile"])
return task<Jar>("testsJar") {
return task<Jar>(MAGIC_DO_NOT_CHANGE_TEST_JAR_TASK_NAME) {
dependsOn("testClasses")
pluginManager.withPlugin("java") {
from(project.the<JavaPluginConvention>().sourceSets.getByName("test").output)
@@ -51,7 +53,12 @@ fun Project.testsJar(body: Jar.() -> Unit = {}): Jar {
}
fun Project.noDefaultJar() {
tasks.findByName("jar")?.enabled = false
tasks.findByName("jar")?.let { defaultJarTask ->
defaultJarTask.enabled = false
configurations.findByName("archives")?.artifacts?.removeAll {
(it as? ArchivePublishArtifact)?.archiveTask?.let { it == defaultJarTask } ?: false
}
}
}
fun<T> Project.runtimeJarArtifactBy(task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) {
@@ -74,18 +81,19 @@ fun<T: Jar> Project.runtimeJar(task: T, body: T.() -> Unit = {}): T {
fun Project.runtimeJar(taskName: String = "jar", body: Jar.() -> Unit = {}): Jar = runtimeJar(getOrCreateTask(taskName, body))
fun Project.sourcesJar(body: Jar.() -> Unit = {}): Jar =
fun Project.sourcesJar(sourceSet: String? = "main", body: Jar.() -> Unit = {}): Jar =
getOrCreateTask("sourcesJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
classifier = "sources"
try {
project.pluginManager.withPlugin("java-base") {
from(project.the<JavaPluginConvention>().sourceSets["main"].allSource)
if (sourceSet != null) {
project.pluginManager.withPlugin("java-base") {
from(project.the<JavaPluginConvention>().sourceSets[sourceSet].allSource)
}
}
} catch (e: UnknownDomainObjectException) {
// skip default sources location
}
tasks.findByName("classes")?.let { dependsOn(it) }
body()
project.addArtifact("archives", this, this)
}

View File

@@ -2,10 +2,11 @@
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.tasks.AbstractCopyTask
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.project
import java.io.File
@@ -14,14 +15,24 @@ import java.io.File
fun Project.commonDep(coord: String): String {
val parts = coord.split(':')
return when (parts.size) {
1 -> "$coord:$coord:${rootProject.extra["versions.$coord"]}"
2 -> "${parts[0]}:${parts[1]}:${rootProject.extra["versions.${parts[1]}"]}"
1 -> "$coord:$coord:${commonVer(coord, coord)}"
2 -> "${parts[0]}:${parts[1]}:${commonVer(parts[0], parts[1])}"
3 -> coord
else -> throw IllegalArgumentException("Illegal maven coordinates: $coord")
}
}
fun Project.commonDep(group: String, artifact: String): String = "$group:$artifact:${rootProject.extra["versions.$artifact"]}"
fun Project.commonDep(group: String, artifact: String, vararg suffixesAndClassifiers: String): String {
val (classifiers, artifactSuffixes) = suffixesAndClassifiers.partition { it.startsWith(':') }
return "$group:$artifact${artifactSuffixes.joinToString("")}:${commonVer(group, artifact)}${classifiers.joinToString("")}"
}
fun Project.commonVer(group: String, artifact: String) =
when {
rootProject.extra.has("versions.$artifact") -> rootProject.extra["versions.$artifact"]
rootProject.extra.has("versions.$group") -> rootProject.extra["versions.$group"]
else -> throw GradleException("Neither versions.$artifact nor versions.$group is defined in the root project's extra")
}
fun Project.preloadedDeps(vararg artifactBaseNames: String, baseDir: File = File(rootDir, "dependencies"), subdir: String? = null, optional: Boolean = false): ConfigurableFileCollection {
val dir = if (subdir != null) File(baseDir, subdir) else baseDir
@@ -44,25 +55,6 @@ fun Project.ideaUltimatePreloadedDeps(vararg artifactBaseNames: String, subdir:
else files()
}
fun Project.ideaSdkDeps(vararg artifactBaseNames: String, subdir: String = "lib", optional: Boolean = false): ConfigurableFileCollection =
preloadedDeps(*artifactBaseNames, baseDir = File(rootDir, "ideaSDK"), subdir = subdir, optional = optional)
fun Project.ideaUltimateSdkDeps(vararg artifactBaseNames: String, subdir: String = "lib"): ConfigurableFileCollection {
val ultimateSdkDir = File(rootDir, "ultimate", "ideaSDK")
return if (ultimateSdkDir.isDirectory) preloadedDeps(*artifactBaseNames, baseDir = ultimateSdkDir, subdir = subdir)
else files()
}
fun Project.ideaSdkCoreDeps(vararg artifactBaseNames: String): ConfigurableFileCollection = ideaSdkDeps(*artifactBaseNames, subdir = "core")
fun Project.ideaUltimateSdkCoreDeps(vararg artifactBaseNames: String): ConfigurableFileCollection = ideaUltimateSdkDeps(*artifactBaseNames, subdir = "core")
fun Project.ideaPluginDeps(vararg artifactBaseNames: String, plugin: String, subdir: String = "lib", optional: Boolean = false): ConfigurableFileCollection =
ideaSdkDeps(*artifactBaseNames, subdir = "plugins/$plugin/$subdir", optional = optional)
fun Project.ideaUltimatePluginDeps(vararg artifactBaseNames: String, plugin: String, subdir: String = "lib"): ConfigurableFileCollection =
ideaUltimateSdkDeps(*artifactBaseNames, subdir = "plugins/$plugin/$subdir")
fun Project.kotlinDep(artifactBaseName: String, version: String): String = "org.jetbrains.kotlin:kotlin-$artifactBaseName:$version"
fun DependencyHandler.projectDist(name: String): ProjectDependency = project(name, configuration = "distJar").apply { isTransitive = false }
@@ -72,15 +64,15 @@ fun DependencyHandler.projectArchives(name: String): ProjectDependency = project
fun DependencyHandler.projectClasses(name: String): ProjectDependency = project(name, configuration = "classes-dirs")
val protobufLiteProject = ":custom-dependencies:protobuf-lite"
val protobufRelocatedProject = ":custom-dependencies:protobuf-relocated"
fun DependencyHandler.protobufLite(): ProjectDependency =
project(protobufLiteProject, configuration = "default").apply { isTransitive = false }
val protobufLiteTask = "$protobufLiteProject:prepare"
fun DependencyHandler.protobufFull(): ProjectDependency =
project(protobufLiteProject, configuration = "relocated").apply { isTransitive = false }
val protobufFullTask = "$protobufLiteProject:prepare-relocated-protobuf"
project(protobufRelocatedProject, configuration = "default").apply { isTransitive = false }
private fun File.matchMaybeVersionedArtifact(baseName: String) = name.matches(baseName.toMaybeVersionedJarRegex())
fun File.matchMaybeVersionedArtifact(baseName: String) = name.matches(baseName.toMaybeVersionedJarRegex())
private val wildcardsRe = """[^*?]+|(\*)|(\?)""".toRegex()
@@ -101,10 +93,29 @@ private fun String.toMaybeVersionedJarRegex(): Regex {
}
private val jreHome = System.getProperty("java.home")
fun firstFromJavaHomeThatExists(vararg paths: String): File =
paths.mapNotNull { File(jreHome, it).takeIf { it.exists() } }.firstOrNull()
?: throw GradleException("Cannot find under '$jreHome' neither of: ${paths.joinToString()}")
fun Project.firstFromJavaHomeThatExists(vararg paths: String, jdkHome: File = File(this.property("JDK_18") as String)): File? =
paths.map { File(jdkHome, it) }.firstOrNull { it.exists() }.also {
if (it == null)
logger.warn("Cannot find file by paths: ${paths.toList()} in $jdkHome")
}
fun toolsJar(): File = firstFromJavaHomeThatExists("../lib/tools.jar", "../Classes/tools.jar")
fun Project.toolsJar(jdkHome: File = File(this.property("JDK_18") as String)): File? =
firstFromJavaHomeThatExists("lib/tools.jar", jdkHome = jdkHome)
object EmbeddedComponents {
val CONFIGURATION_NAME = "embeddedComponents"
}
fun Project.containsEmbeddedComponents() {
configurations.create(EmbeddedComponents.CONFIGURATION_NAME)
}
fun AbstractCopyTask.fromEmbeddedComponents() {
val embeddedComponents = project.configurations.getByName(EmbeddedComponents.CONFIGURATION_NAME)
if (this is ShadowJar) {
from(embeddedComponents)
} else {
embeddedComponents.forEach { from(if (it.isDirectory) it else project.zipTree(it)) }
}
}

View File

@@ -1,10 +1,8 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.tasks.bundling.Zip
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.task
import org.gradle.kotlin.dsl.*
@@ -18,9 +16,10 @@ val packagesToRelocate =
"org.apache",
"org.jdom",
"org.picocontainer",
"jline",
"org.jline",
"gnu",
"org.fusesource")
"org.fusesource",
"kotlinx.coroutines")
// The shaded compiler "dummy" is used to rewrite dependencies in projects that are used with the embeddable compiler
// on the runtime and use some shaded dependencies from the compiler
@@ -41,7 +40,6 @@ val packagesToExcludeFromDummy =
"one/util/streamex/**",
"org/iq80/snappy/**",
"org/jline/**",
"org/json/**",
"org/xmlpull/**",
"*.txt")
@@ -105,23 +103,22 @@ fun Project.embeddableCompilerDummyForDependenciesRewriting(taskName: String = "
}
}
fun Project.rewriteDepsToShadedJar(originalJarTask: Jar, shadowJarTask: Zip, body: Jar.() -> Unit = {}): Jar {
val originalFiles by lazy {
val jarContents = zipTree(originalJarTask.outputs.files.singleFile).files
val basePath = jarContents.find { it.name == "MANIFEST.MF" }?.parentFile?.parentFile ?: throw GradleException("cannot determine the jar root dir")
jarContents.map { it.relativeTo(basePath).path }.toSet()
fun Project.rewriteDepsToShadedJar(originalJarTask: Jar, shadowJarTask: Jar, body: Jar.() -> Unit = {}): Jar {
originalJarTask.apply {
classifier = "original"
}
return task<Jar>("rewrittenDepsJar") {
originalJarTask.apply {
classifier = "original"
}
shadowJarTask.apply {
dependsOn(originalJarTask)
from(originalJarTask)// { include("**") }
classifier = "shadow"
}
dependsOn(shadowJarTask)
from(project.zipTree(shadowJarTask.outputs.files.singleFile)) { include { originalFiles.any { originalFile -> it.file.canonicalPath.endsWith(originalFile) } } }
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
return shadowJarTask.apply {
dependsOn(originalJarTask)
from(originalJarTask)// { include("**") }
// When Gradle traverses the inputs, reject the shaded compiler JAR,
// which leads to the content of that JAR being excluded as well:
exclude { it.file == compilerDummyJarFile }
classifier = null
body()
}
}

View File

@@ -17,6 +17,7 @@
*/
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
@@ -51,6 +52,12 @@ fun Project.configureInstrumentation() {
}
}
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
dependencies {
instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all", "jgoodies-forms") }
}
afterEvaluate {
the<JavaPluginConvention>().sourceSets.all { sourceSetParam ->
// This copy will ignore filters, but they are unlikely to be used.
@@ -66,6 +73,7 @@ fun Project.configureInstrumentation() {
instrumentTask.apply {
dependsOn(sourceSetParam.classesTaskName).onlyIf { !classesDirsCopy.isEmpty }
sourceSet = sourceSetParam
instrumentationClasspath = instrumentationClasspathCfg
originalClassesDirs = classesDirsCopy
output = instrumentedClassesDir
}
@@ -88,6 +96,8 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
var sourceSet: SourceSet? = null
var instrumentationClasspath: Configuration? = null
@Input
var originalClassesDirs: FileCollection? = null
@@ -101,9 +111,10 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
@TaskAction
fun instrumentClasses() {
logger.info("input files are: ${originalClassesDirs?.joinToString("; ", transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)" }"})}")
output?.deleteRecursively()
copyOriginalClasses()
val classpath = project.ideaSdkDeps("javac2.jar", "jdom.jar", "asm-all.jar", "jgoodies-forms.jar")
val classpath = instrumentationClasspath!!
ant.withGroovyBuilder {
"taskdef"("name" to "instrumentIdeaExtensions",
@@ -113,7 +124,7 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
}
logger.info("Compiling forms and instrumenting code with nullability preconditions")
val instrumentNotNull = prepareNotNullInstrumenting(classpath)
val instrumentNotNull = prepareNotNullInstrumenting(classpath.asPath)
instrumentCode(sourceDirs, instrumentNotNull)
}
@@ -124,10 +135,10 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
}
}
private fun prepareNotNullInstrumenting(classpath: ConfigurableFileCollection): Boolean {
private fun prepareNotNullInstrumenting(classpath: String): Boolean {
ant.withGroovyBuilder {
"typedef"("name" to "skip",
"classpath" to classpath.asPath,
"classpath" to classpath,
"loaderref" to LOADER_REF,
"classname" to FILTER_ANNOTATION_REGEXP_CLASS)
}

View File

@@ -0,0 +1,167 @@
/*
* Copyright 2010-2017 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.
*/
@file:Suppress("unused") // usages in build scripts are not tracked properly
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.ModuleDependency
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.JavaExec
import org.gradle.kotlin.dsl.*
import java.io.File
private fun Project.intellijRepoDir() = File("${project.rootDir.absoluteFile}/buildSrc/prepare-deps/intellij-sdk/build/repo")
fun RepositoryHandler.intellijSdkRepo(project: Project): IvyArtifactRepository = ivy {
val baseDir = project.intellijRepoDir()
val intellijEnforceCommunitySdk = project.getBooleanProperty("intellijEnforceCommunitySdk") == true
setUrl(baseDir)
if (!intellijEnforceCommunitySdk) {
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]Ultimate.ivy.xml")
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellijUltimate.plugin.[module].ivy.xml")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]Ultimate/lib/[artifact](-[classifier]).jar")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellijUltimate/plugins/[module]/lib/[artifact](-[classifier]).jar")
}
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module].ivy.xml")
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellij.plugin.[module].ivy.xml")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/lib/[artifact](-[classifier]).jar")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellij/plugins/[module]/lib/[artifact](-[classifier]).jar")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/plugins-[module]/[module]/lib/[artifact](-[classifier]).jar")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/[artifact].jar")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/[artifact](-[revision])(-[classifier]).jar")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/sources/[artifact]-[revision]-[classifier].[ext]")
}
fun Project.intellijDep(module: String = "intellij") = "kotlin.build.custom.deps:$module:${rootProject.extra["versions.intellijSdk"]}"
fun Project.intellijCoreDep() = intellijDep("intellij-core")
fun Project.intellijPluginDep(plugin: String) = intellijDep(plugin)
fun Project.intellijUltimateDep() = intellijDep("intellij")
fun Project.intellijUltimatePluginDep(plugin: String) = intellijDep(plugin)
fun ModuleDependency.includeJars(vararg names: String, rootProject: Project? = null) {
names.forEach {
var baseName = it.removeSuffix(".jar")
if (rootProject != null && rootProject.extra.has("ignore.jar.$baseName")) {
return@forEach
}
if (rootProject != null && rootProject.extra.has("versions.jar.$baseName")) {
baseName += "-${rootProject.extra["versions.jar.$baseName"]}"
}
artifact {
name = baseName
type = "jar"
extension = "jar"
}
}
}
// Workaround. Top-level Kotlin function in a default package can't be called from a non-default package
object IntellijRootUtils {
fun getRepositoryRootDir(project: Project): File = with (project.rootProject) {
return File(intellijRepoDir(), "kotlin.build.custom.deps/${extra["versions.intellijSdk"]}")
}
fun getIntellijRootDir(project: Project): File = with (project.rootProject) {
return File(getRepositoryRootDir(this), "intellij${if (isIntellijCommunityAvailable()) "" else "Ultimate"}")
}
}
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) =
includeJars(*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter { jarsFilterPredicate(it) }.toTypedArray(), rootProject = project.rootProject)
fun Project.isIntellijCommunityAvailable() = !(rootProject.extra["intellijUltimateEnabled"] as Boolean) || rootProject.extra["intellijSeparateSdks"] as Boolean
fun Project.isIntellijUltimateSdkAvailable() = (rootProject.extra["intellijUltimateEnabled"] as Boolean)
fun Project.intellijRootDir() = IntellijRootUtils.getIntellijRootDir(project)
fun Project.intellijUltimateRootDir() =
if (isIntellijUltimateSdkAvailable())
File(intellijRepoDir(), "kotlin.build.custom.deps/${rootProject.extra["versions.intellijSdk"]}/intellijUltimate")
else
throw GradleException("intellij ultimate SDK is not available")
fun DependencyHandlerScope.excludeInAndroidStudio(rootProject: Project, block: DependencyHandlerScope.() -> Unit) {
if (!rootProject.extra.has("versions.androidStudioRelease")) {
block()
}
}
fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File, body: JavaExec.() -> Unit): JavaExec {
return task<JavaExec>(name) {
val ideaSandboxConfigDir = File(ideaSandboxDir, "config")
classpath = the<JavaPluginConvention>().sourceSets["main"].runtimeClasspath
main = "com.intellij.idea.Main"
workingDir = File(intellijRootDir(), "bin")
jvmArgs(
"-Xmx1250m",
"-XX:ReservedCodeCacheSize=240m",
"-XX:+HeapDumpOnOutOfMemoryError",
"-ea",
"-Didea.is.internal=true",
"-Didea.debug.mode=true",
"-Didea.system.path=$ideaSandboxDir",
"-Didea.config.path=$ideaSandboxConfigDir",
"-Dapple.laf.useScreenMenuBar=true",
"-Dapple.awt.graphics.UseQuartz=true",
"-Dsun.io.useCanonCaches=false",
"-Dplugin.path=${ideaPluginDir.absolutePath}",
"-Dkotlin.internal.mode.enabled=true",
"-Didea.additional.classpath=../idea-kotlin-runtime/kotlin-runtime.jar,../idea-kotlin-runtime/kotlin-reflect.jar"
)
if (rootProject.findProperty("versions.androidStudioRelease") != null) {
jvmArgs("-Didea.platform.prefix=AndroidStudio")
}
if (project.hasProperty("noPCE")) {
jvmArgs("-Didea.ProcessCanceledException=disabled")
}
args()
doFirst {
val disabledPluginsFile = File(ideaSandboxConfigDir, "disabled_plugins.txt")
val disabledPluginsContents = disabledPluginsFile.takeIf { it.isFile }?.readLines()
val filteredContents = disabledPluginsContents?.filterNot { it.contains("org.jetbrains.kotlin") }
if (filteredContents != null && filteredContents.size != disabledPluginsContents.size) {
with(disabledPluginsFile.printWriter()) {
filteredContents.forEach(this::println)
}
}
}
body()
}
}

View File

@@ -9,7 +9,7 @@ import net.rubygrapefruit.platform.WindowsRegistry.Key.HKEY_LOCAL_MACHINE
import org.gradle.internal.os.OperatingSystem
enum class JdkMajorVersion {
JDK_16, JDK_17, JDK_18, JDK_9
JDK_16, JDK_17, JDK_18, JDK_9, JDK_10
}
val jdkAlternativeVarNames = mapOf(JdkMajorVersion.JDK_9 to listOf("JDK_19"))
@@ -149,7 +149,9 @@ fun MutableCollection<JdkId>.discoverJdksOnUnix(project: Project) {
private val windowsConventionalJdkRegistryPaths = listOf(
"SOFTWARE\\JavaSoft\\Java Development Kit",
"SOFTWARE\\Wow6432Node\\JavaSoft\\Java Development Kit")
"SOFTWARE\\Wow6432Node\\JavaSoft\\Java Development Kit",
"SOFTWARE\\JavaSoft\\JDK",
"SOFTWARE\\Wow6432Node\\JavaSoft\\JDK")
fun MutableCollection<JdkId>.discoverJdksOnWindows(project: Project) {
val registry = Native.get(WindowsRegistry::class.java)

View File

@@ -0,0 +1,15 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import org.gradle.api.artifacts.*
class DependencyMapper(
val group: String,
val module: String,
vararg val configurations: String,
val mapping: (ResolvedDependency) -> MappedDependency?
)
class MappedDependency(val main: PDependency, val deferred: List<PDependency> = emptyList())
class ParserContext(val dependencyMappers: List<DependencyMapper>)

View File

@@ -0,0 +1,186 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.internal.file.copy.SingleParentCopySpec
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.tasks.Copy
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.extra
import org.jetbrains.kotlin.pill.ArtifactElement.*
import org.jetbrains.kotlin.pill.POrderRoot.*
import java.io.File
class PArtifact(val artifactName: String, val outputDir: File, private val contents: ArtifactElement.Root) {
fun render(context: PathContext) = xml("component", "name" to "ArtifactManager") {
xml("artifact", "name" to artifactName) {
xml("output-path") {
raw(context(outputDir))
}
add(contents.renderRecursively(context))
}
}
}
sealed class ArtifactElement {
private val myChildren = mutableListOf<ArtifactElement>()
val children get() = myChildren
fun add(child: ArtifactElement) {
myChildren += child
}
abstract fun render(context: PathContext): xml
fun renderRecursively(context: PathContext): xml {
return render(context).apply {
children.forEach { add(it.renderRecursively(context)) }
}
}
fun getDirectory(path: String): ArtifactElement {
if (path.isEmpty()) {
return this
}
var current: ArtifactElement = this
for (segment in path.split("/")) {
val existing = current.children.firstOrNull { it is Directory && it.name == segment }
if (existing != null) {
current = existing
continue
}
current = Directory(segment).also { current.add(it) }
}
return current
}
class Root : ArtifactElement() {
override fun render(context: PathContext) = xml("root", "id" to "root")
}
data class Directory(val name: String) : ArtifactElement() {
override fun render(context: PathContext) = xml("element", "id" to "directory", "name" to name)
}
data class Archive(val name: String) : ArtifactElement() {
override fun render(context: PathContext) = xml("element", "id" to "archive", "name" to name)
}
data class ModuleOutput(val moduleName: String) : ArtifactElement() {
override fun render(context: PathContext) = xml("element", "id" to "module-output", "name" to moduleName)
}
data class FileCopy(val source: File) : ArtifactElement() {
override fun render(context: PathContext) = xml("element", "id" to "file-copy", "path" to context(source))
}
data class DirectoryCopy(val source: File) : ArtifactElement() {
override fun render(context: PathContext) = xml("element", "id" to "dir-copy", "path" to context(source))
}
data class ProjectLibrary(val name: String) : ArtifactElement() {
override fun render(context: PathContext) = xml("element", "id" to "library", "level" to "project", "name" to name)
}
data class ExtractedDirectory(val archive: File, val pathInJar: String = "/") : ArtifactElement() {
override fun render(context: PathContext) =
xml("element", "id" to "extracted-dir", "path" to context(archive), "path-in-jar" to pathInJar)
}
}
fun generateKotlinPluginArtifactFile(rootProject: Project): PFile {
val mainIdeaPluginTask = rootProject.tasks.getByName("ideaPlugin") as Copy
val gradleArtifactDir = mainIdeaPluginTask.destinationDir
val ideaPluginTasks = mainIdeaPluginTask.taskDependencies
.getDependencies(mainIdeaPluginTask)
.filter { it.name == "ideaPlugin" }
.filterIsInstance<Copy>()
val root = Root()
// Copy kotlinc directory
root.add(Directory("kotlinc").apply {
val kotlincDirectory = rootProject.extra["distKotlinHomeDir"].toString()
add(DirectoryCopy(File(kotlincDirectory)))
})
for (task in ideaPluginTasks) {
val spec = task.rootSpec.children.filterIsInstance<SingleParentCopySpec>().singleOrNull()
?: error("Copy spec is not unique in ${rootProject.name}. Available specs: ${task.rootSpec.children}")
val sourcePaths = spec.sourcePaths
for (sourcePath in sourcePaths) {
if (sourcePath is ShadowJar) {
if (sourcePath.project.path == ":prepare:idea-plugin") {
val kotlinPluginJar = Archive(sourcePath.archiveName).also { root.getDirectory("lib").add(it) }
kotlinPluginJar.add(FileCopy(File(rootProject.projectDir, "resources/kotlinManifest.properties")))
for (jarFile in sourcePath.project.configurations.getByName("packedJars").resolve()) {
kotlinPluginJar.add(ExtractedDirectory(jarFile))
}
@Suppress("UNCHECKED_CAST")
for (projectPath in sourcePath.project.extra["projectsToShadow"] as List<String>) {
val jpsModuleName = rootProject.findProject(projectPath)!!.name + ".src"
kotlinPluginJar.add(ModuleOutput(jpsModuleName))
}
continue
}
}
when (sourcePath) {
is Jar -> {
val targetDir = ("lib/" + task.destinationDir.toRelativeString(gradleArtifactDir)).withoutSlash()
val archiveForJar = Archive(sourcePath.project.name + ".jar").apply {
if (task.project.plugins.hasPlugin(JavaPlugin::class.java)) {
add(ModuleOutput(sourcePath.project.name + ".src"))
}
root.getDirectory(targetDir).add(this)
}
val embeddedComponents = sourcePath.project.configurations
.findByName(EmbeddedComponents.CONFIGURATION_NAME)?.resolvedConfiguration
if (embeddedComponents != null) {
for ((_, _, dependency) in listOf(embeddedComponents to Scope.COMPILE).collectDependencies()) {
if (dependency.configuration == "runtimeElements") {
archiveForJar.add(ModuleOutput(dependency.moduleName + ".src"))
} else if (dependency.configuration == "tests-jar" || dependency.configuration == "jpsTest") {
error("Test configurations are not allowed here")
} else {
for (file in dependency.moduleArtifacts.map { it.file }) {
archiveForJar.add(ExtractedDirectory(file))
}
}
}
}
}
is Configuration -> {
require(sourcePath.name == "sideJars") { "Configurations other than 'sideJars' are not supported" }
for (file in sourcePath.resolve()) {
root.getDirectory("lib").add(FileCopy(file))
}
}
else -> error("${task.name} Unexpected task type ${task.javaClass.name}")
}
}
}
val artifact = PArtifact("KotlinPlugin", File(rootProject.projectDir, "out/artifacts/Kotlin"), root)
return PFile(
File(rootProject.projectDir, ".idea/artifacts/${artifact.artifactName}.xml"),
artifact.render(ProjectContext(rootProject))
)
}

View File

@@ -0,0 +1,379 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import org.gradle.api.Project
import org.gradle.api.artifacts.*
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.kotlin.dsl.configure
import org.gradle.plugins.ide.idea.IdeaPlugin
import org.gradle.api.file.SourceDirectorySet
import org.gradle.api.internal.HasConvention
import org.jetbrains.kotlin.pill.POrderRoot.*
import org.jetbrains.kotlin.pill.PSourceRoot.*
import java.io.File
import java.util.LinkedList
data class PProject(
val name: String,
val rootDirectory: File,
val modules: List<PModule>,
val libraries: List<PLibrary>
)
data class PModule(
val name: String,
val bundleName: String,
val rootDirectory: File,
val moduleFile: File,
val contentRoots: List<PContentRoot>,
val orderRoots: List<POrderRoot>,
val moduleForProductionSources: PModule? = null,
val group: String? = null
)
data class PContentRoot(
val path: File,
val forTests: Boolean,
val sourceRoots: List<PSourceRoot>,
val excludedDirectories: List<File>
)
data class PSourceRoot(
val path: File,
val kind: Kind
) {
enum class Kind {
PRODUCTION, TEST, RESOURCES, TEST_RESOURCES;
val isResources get() = this == RESOURCES || this == TEST_RESOURCES
}
}
data class POrderRoot(
val dependency: PDependency,
val scope: Scope,
val isExported: Boolean = false,
val isProductionOnTestDependency: Boolean = false
) {
enum class Scope { COMPILE, TEST, RUNTIME, PROVIDED }
}
sealed class PDependency {
data class Module(val name: String) : PDependency()
data class Library(val name: String) : PDependency()
data class ModuleLibrary(val library: PLibrary) : PDependency()
}
data class PLibrary(
val name: String,
val classes: List<File>,
val javadoc: List<File> = emptyList(),
val sources: List<File> = emptyList(),
val annotations: List<File> = emptyList(),
val dependencies: List<PLibrary> = emptyList()
) {
fun attachSource(file: File): PLibrary {
return this.copy(sources = this.sources + listOf(file))
}
}
fun parse(project: Project, libraries: List<PLibrary>, context: ParserContext): PProject = with (context) {
if (project != project.rootProject) {
error("$project is not a root project")
}
val modules = project.allprojects
.filter { it.plugins.hasPlugin(JpsCompatiblePlugin::class.java) }
.flatMap { parseModules(it) }
return PProject("Kotlin", project.projectDir, modules, libraries)
}
/*
Ordering here and below is significant.
Placing 'runtime' configuration dependencies on the top make 'idea' tests to run normally.
('idea' module has 'intellij-core' as transitive dependency, and we really need to get rid of it.)
*/
private val CONFIGURATION_MAPPING = mapOf(
listOf("runtime") to Scope.RUNTIME,
listOf("compile") to Scope.COMPILE,
listOf("compileOnly") to Scope.PROVIDED
)
private val TEST_CONFIGURATION_MAPPING = mapOf(
listOf("runtime", "testRuntime") to Scope.RUNTIME,
listOf("compile", "testCompile") to Scope.COMPILE,
listOf("compileOnly", "testCompileOnly") to Scope.PROVIDED,
listOf("jpsTest") to Scope.TEST
)
private val SOURCE_SET_MAPPING = mapOf(
"main" to Kind.PRODUCTION,
"test" to Kind.TEST
)
private fun ParserContext.parseModules(project: Project): List<PModule> {
val (productionContentRoots, testContentRoots) = parseContentRoots(project).partition { !it.forTests }
val modules = mutableListOf<PModule>()
fun getJavaExcludedDirs() = project.plugins.findPlugin(IdeaPlugin::class.java)
?.model?.module?.excludeDirs?.toList() ?: emptyList()
val allExcludedDirs = getJavaExcludedDirs() + project.buildDir
var productionSourcesModule: PModule? = null
fun getModuleFile(suffix: String = ""): File {
val relativePath = File(project.projectDir, project.name + suffix + ".iml")
.toRelativeString(project.rootProject.projectDir)
return File(project.rootProject.projectDir, ".idea/modules/$relativePath")
}
for ((nameSuffix, roots) in mapOf(".src" to productionContentRoots, ".test" to testContentRoots)) {
if (roots.isEmpty()) {
continue
}
val mainRoot = roots.first()
var dependencies = parseDependencies(project, mainRoot.forTests)
if (productionContentRoots.isNotEmpty() && mainRoot.forTests) {
val productionModuleDependency = PDependency.Module(project.name + ".src")
dependencies += POrderRoot(productionModuleDependency, Scope.COMPILE, true)
}
val module = PModule(
project.name + nameSuffix,
project.name,
mainRoot.path,
getModuleFile(nameSuffix),
roots,
dependencies,
productionSourcesModule
)
modules += module
if (!mainRoot.forTests) {
productionSourcesModule = module
}
}
val mainModuleFileRelativePath = when {
project == project.rootProject -> File(project.rootProject.projectDir, project.name + ".iml")
else -> getModuleFile()
}
modules += PModule(
project.name,
project.name,
project.projectDir,
mainModuleFileRelativePath,
listOf(PContentRoot(project.projectDir, false, emptyList(), allExcludedDirs)),
if (modules.isEmpty()) parseDependencies(project, false) else emptyList()
)
return modules
}
private fun parseContentRoots(project: Project): List<PContentRoot> {
val sourceRoots = parseSourceRoots(project).groupBy { it.kind }
fun getRoots(kind: PSourceRoot.Kind) = sourceRoots[kind] ?: emptyList()
val productionSourceRoots = getRoots(Kind.PRODUCTION) + getRoots(Kind.RESOURCES)
val testSourceRoots = getRoots(Kind.TEST) + getRoots(Kind.TEST_RESOURCES)
fun createContentRoots(sourceRoots: List<PSourceRoot>, forTests: Boolean): List<PContentRoot> {
return sourceRoots.map { PContentRoot(it.path, forTests, listOf(it), emptyList()) }
}
return createContentRoots(productionSourceRoots, forTests = false) +
createContentRoots(testSourceRoots, forTests = true)
}
private fun parseSourceRoots(project: Project): List<PSourceRoot> {
if (!project.plugins.hasPlugin(JavaPlugin::class.java)) {
return emptyList()
}
val sourceRoots = mutableListOf<PSourceRoot>()
project.configure<JavaPluginConvention> {
for ((sourceSetName, kind) in SOURCE_SET_MAPPING) {
val sourceSet = sourceSets.findByName(sourceSetName) ?: continue
fun Any.getKotlin(): SourceDirectorySet {
val kotlinMethod = javaClass.getMethod("getKotlin")
val oldIsAccessible = kotlinMethod.isAccessible
try {
kotlinMethod.isAccessible = true
return kotlinMethod(this) as SourceDirectorySet
} finally {
kotlinMethod.isAccessible = oldIsAccessible
}
}
val kotlinSourceDirectories = (sourceSet as HasConvention).convention
.plugins["kotlin"]?.getKotlin()?.srcDirs
?: emptySet()
val directories = (sourceSet.java.sourceDirectories.files + kotlinSourceDirectories).toList()
.filter { it.exists() }
.takeIf { it.isNotEmpty() }
?: continue
for (resourceRoot in sourceSet.resources.sourceDirectories.files) {
if (!resourceRoot.exists() || resourceRoot in directories) {
continue
}
val resourceRootKind = when (kind) {
Kind.PRODUCTION -> Kind.RESOURCES
Kind.TEST -> Kind.TEST_RESOURCES
else -> error("Invalid source root kind $kind")
}
sourceRoots += PSourceRoot(resourceRoot, resourceRootKind)
}
for (directory in directories) {
sourceRoots += PSourceRoot(directory, kind)
}
}
}
return sourceRoots
}
private fun ParserContext.parseDependencies(project: Project, forTests: Boolean): List<POrderRoot> {
val configurationMapping = if (forTests) TEST_CONFIGURATION_MAPPING else CONFIGURATION_MAPPING
with(project.configurations) {
val mainRoots = mutableListOf<POrderRoot>()
val deferredRoots = mutableListOf<POrderRoot>()
fun collectConfigurations(): List<Pair<ResolvedConfiguration, Scope>> {
val configurations = mutableListOf<Pair<ResolvedConfiguration, Scope>>()
for ((configurationNames, scope) in configurationMapping) {
for (configurationName in configurationNames) {
val configuration = findByName(configurationName)?.also { it.resolve() } ?: continue
configurations += Pair(configuration.resolvedConfiguration, scope)
}
}
return configurations
}
nextDependency@ for ((configuration, scope, dependency) in collectConfigurations().collectDependencies()) {
for (mapper in dependencyMappers) {
if (dependency.moduleGroup == mapper.group
&& dependency.moduleName == mapper.module
&& dependency.configuration in mapper.configurations
) {
val mappedDependency = mapper.mapping(dependency)
if (mappedDependency != null) {
val orderRoot = POrderRoot(mappedDependency.main, scope)
if (mappedDependency.main is PDependency.Module) {
mainRoots += orderRoot
} else {
mainRoots += orderRoot
}
for (deferredDep in mappedDependency.deferred) {
deferredRoots += POrderRoot(deferredDep, scope)
}
}
continue@nextDependency
}
}
if (dependency.configuration == "runtimeElements" && scope != Scope.TEST) {
mainRoots += POrderRoot(PDependency.Module(dependency.moduleName + ".src"), scope)
} else if (dependency.configuration == "tests-jar" || dependency.configuration == "jpsTest") {
mainRoots += POrderRoot(
PDependency.Module(dependency.moduleName + ".test"),
scope,
isProductionOnTestDependency = true
)
} else {
val classes = dependency.moduleArtifacts.map { it.file }
val library = PLibrary(dependency.moduleName, classes)
mainRoots += POrderRoot(PDependency.ModuleLibrary(library), scope)
}
}
return removeDuplicates(mainRoots + deferredRoots)
}
}
private fun removeDuplicates(roots: List<POrderRoot>): List<POrderRoot> {
val dependenciesByScope = roots.groupBy { it.scope }.mapValues { it.value.mapTo(mutableSetOf()) { it.dependency } }
fun depenciesFor(scope: Scope) = dependenciesByScope[scope] ?: emptySet<PDependency>()
val result = mutableSetOf<POrderRoot>()
for (root in roots.distinct()) {
val scope = root.scope
val dependency = root.dependency
if (root in result) {
continue
}
if ((scope == Scope.PROVIDED || scope == Scope.RUNTIME) && dependency in depenciesFor(Scope.COMPILE)) {
continue
}
if (scope == Scope.PROVIDED && dependency in depenciesFor(Scope.RUNTIME)) {
result += POrderRoot(dependency, Scope.COMPILE)
continue
}
if (scope == Scope.RUNTIME && dependency in depenciesFor(Scope.PROVIDED)) {
result += POrderRoot(dependency, Scope.COMPILE)
continue
}
result += root
}
return result.toList()
}
data class DependencyInfo(val configuration: ResolvedConfiguration, val scope: Scope, val dependency: ResolvedDependency)
fun List<Pair<ResolvedConfiguration, Scope>>.collectDependencies(): List<DependencyInfo> {
val dependencies = mutableListOf<DependencyInfo>()
val unprocessed = LinkedList<DependencyInfo>()
val existing = mutableSetOf<Pair<Scope, ResolvedDependency>>()
for ((configuration, scope) in this) {
for (dependency in configuration.firstLevelModuleDependencies) {
unprocessed += DependencyInfo(configuration, scope, dependency)
}
}
while (unprocessed.isNotEmpty()) {
val info = unprocessed.removeAt(0)
dependencies += info
val data = Pair(info.scope, info.dependency)
existing += data
for (child in info.dependency.children) {
if (child.moduleGroup != "org.jetbrains.kotlin" && Pair(info.scope, child) in existing) {
continue
}
unprocessed += DependencyInfo(info.configuration, info.scope, child)
}
}
return dependencies
}

View File

@@ -0,0 +1,43 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import org.gradle.api.Project
import java.io.File
interface PathContext {
operator fun invoke(file: File): String
fun url(file: File): Pair<String, String> {
val path = when {
file.isFile && file.extension.toLowerCase() == "jar" -> "jar://" + this(file) + "!/"
else -> "file://" + this(file)
}
return Pair("url", path)
}
}
class ProjectContext private constructor(val projectDir: File) : PathContext {
constructor(project: PProject) : this(project.rootDirectory)
constructor(project: Project) : this(project.projectDir)
override fun invoke(file: File): String {
return file.absolutePath.replace(projectDir.absolutePath, "\$PROJECT_DIR\$")
}
}
class ModuleContext(val project: PProject, val module: PModule) : PathContext {
override fun invoke(file: File): String {
if (!file.startsWith(project.rootDirectory)) {
return file.absolutePath
}
return "\$MODULE_DIR\$/" +
project.rootDirectory.toRelativeString(module.moduleFile.parentFile).withSlash() +
module.rootDirectory.toRelativeString(project.rootDirectory).withSlash() +
file.toRelativeString(module.rootDirectory)
}
}
fun String.withSlash() = if (this.endsWith("/")) this else (this + "/")
fun String.withoutSlash() = this.trimEnd('/')

View File

@@ -0,0 +1,276 @@
package org.jetbrains.kotlin.pill
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.BasePluginConvention
import org.gradle.kotlin.dsl.extra
import shadow.org.jdom2.input.SAXBuilder
import shadow.org.jdom2.*
import shadow.org.jdom2.output.Format
import shadow.org.jdom2.output.XMLOutputter
import java.io.File
class JpsCompatiblePlugin : Plugin<Project> {
companion object {
private const val JPS_LIBRARY_PATH = "jpsLibraryPath"
private fun mapper(module: String, vararg configurations: String): DependencyMapper {
return DependencyMapper("org.jetbrains.kotlin", module, *configurations) { MappedDependency(PDependency.Library(module)) }
}
private fun getDependencyMappers(projectLibraries: List<PLibrary>): List<DependencyMapper> {
val mappersForKotlinLibrariesExeptStdlib = projectLibraries
.filter { it.name != "kotlin-stdlib" }
.mapTo(mutableListOf()) { mapper(it.name, "default", "distJar", "runtimeElements") }
return mappersForKotlinLibrariesExeptStdlib + listOf(
DependencyMapper("org.jetbrains.kotlin", "kotlin-stdlib", "distJar", "runtimeElements") {
MappedDependency(
PDependency.Library("kotlin-stdlib"),
listOf(PDependency.Library("annotations-13.0"))
)
},
DependencyMapper("org.jetbrains.kotlin", "kotlin-reflect-api", "runtimeElements") {
MappedDependency(PDependency.Library("kotlin-reflect"))
},
DependencyMapper("org.jetbrains.kotlin", "kotlin-compiler-embeddable", "runtimeJar") { null },
DependencyMapper("org.jetbrains.kotlin", "kotlin-stdlib-js", "distJar") { null },
DependencyMapper("org.jetbrains.kotlin", "kotlin-compiler", "runtimeJar") { null },
DependencyMapper("org.jetbrains.kotlin", "compiler", "runtimeElements") { null }
)
}
fun getProjectLibraries(rootProject: Project): List<PLibrary> {
fun distJar(name: String) = File(rootProject.projectDir, "dist/kotlinc/lib/$name.jar")
fun projectFile(path: String) = File(rootProject.projectDir, path)
val libraries = rootProject.allprojects
.filter { it.extra.has(JPS_LIBRARY_PATH) }
.map { library ->
val libraryPath = library.extra.get(JPS_LIBRARY_PATH).toString()
val archivesBaseName = library.convention.findPlugin(BasePluginConvention::class.java)?.archivesBaseName ?: library.name
fun List<File>.filterExisting() = filter { it.exists() }
PLibrary(
library.name,
classes = listOf(File(libraryPath, archivesBaseName + ".jar")).filterExisting(),
sources = listOf(File(libraryPath, archivesBaseName + "-sources.jar")).filterExisting()
)
}
return libraries + PLibrary("annotations-13.0", classes = listOf(distJar("annotations-13.0")))
}
}
override fun apply(project: Project) {
// 'jpsTest' does not require the 'tests-jar' artifact
project.configurations.create("jpsTest")
if (project == project.rootProject) {
project.tasks.create("pill") {
doLast { pill(project) }
TaskUtils.useAndroidSdk(this)
TaskUtils.useAndroidJar(this)
}
project.tasks.create("unpill") {
doLast { unpill(project) }
}
}
}
private lateinit var projectDir: File
private lateinit var platformVersion: String
private lateinit var platformBaseNumber: String
private lateinit var platformDir: File
private fun initEnvironment(project: Project) {
projectDir = project.projectDir
platformVersion = project.extensions.extraProperties.get("versions.intellijSdk").toString()
platformBaseNumber = platformVersion.substringBefore(".", "").takeIf { it.isNotEmpty() }
?: error("Invalid platform version: $platformVersion")
platformDir = IntellijRootUtils.getIntellijRootDir(project)
}
private fun pill(rootProject: Project) {
initEnvironment(rootProject)
val projectLibraries = getProjectLibraries(rootProject)
val parserContext = ParserContext(getDependencyMappers(projectLibraries))
val jpsProject = parse(rootProject, projectLibraries, parserContext)
.mapLibraries(this::attachPlatformSources, this::attachAsmSources)
generateKotlinPluginArtifactFile(rootProject).write()
val files = render(jpsProject)
removeExistingIdeaLibrariesAndModules()
removeJpsRunConfigurations()
copyRunConfigurations()
setOptionsForDefaultJunitRunConfiguration(rootProject)
files.forEach { it.write() }
}
private fun unpill(project: Project) {
initEnvironment(project)
removeExistingIdeaLibrariesAndModules()
removeJpsRunConfigurations()
}
private fun removeExistingIdeaLibrariesAndModules() {
File(projectDir, ".idea/libraries").deleteRecursively()
File(projectDir, ".idea/modules").deleteRecursively()
}
private fun removeJpsRunConfigurations() {
File(projectDir, ".idea/runConfigurations")
.walk()
.filter { it.name.startsWith("JPS_") && it.extension.toLowerCase() == "xml" }
.forEach { it.delete() }
}
private fun copyRunConfigurations() {
val runConfigurationsDir = File(projectDir, "buildSrc/src/main/resources/runConfigurations")
val targetDir = File(projectDir, ".idea/runConfigurations")
val platformDirProjectRelative = "\$PROJECT_DIR\$/" + platformDir.toRelativeString(projectDir)
targetDir.mkdirs()
runConfigurationsDir.listFiles()
.filter { it.extension == "xml" }
.map { it.name to it.readText().replace("\$IDEA_HOME_PATH\$", platformDirProjectRelative) }
.forEach { File(targetDir, it.first).writeText(it.second) }
}
/*
This sets a proper (project root) working directory and a "idea.home.path" property to the default JUnit configuration,
so one does not need to make these changes manually.
*/
private fun setOptionsForDefaultJunitRunConfiguration(project: Project) {
val workspaceFile = File(projectDir, ".idea/workspace.xml")
if (!workspaceFile.exists()) {
project.logger.warn("${workspaceFile.name} does not exist, JUnit default run configuration was not modified")
return
}
val document = SAXBuilder().build(workspaceFile)
val rootElement = document.rootElement
fun Element.getOrCreateChild(name: String, vararg attributes: Pair<String, String>): Element {
for (child in getChildren(name)) {
if (attributes.all { (attribute, value) -> child.getAttributeValue(attribute) == value }) {
return child
}
}
return Element(name).apply {
for ((attributeName, value) in attributes) {
setAttribute(attributeName, value)
}
this@getOrCreateChild.addContent(this@apply)
}
}
val platformDirProjectRelative = "\$PROJECT_DIR\$/" + platformDir.toRelativeString(projectDir)
val runManagerComponent = rootElement.getOrCreateChild("component", "name" to "RunManager")
val junitConfiguration = runManagerComponent.getOrCreateChild(
"configuration",
"default" to "true",
"type" to "JUnit",
"factoryName" to "JUnit"
)
junitConfiguration.apply {
getOrCreateChild("option", "name" to "WORKING_DIRECTORY").setAttribute("value", "file://\$PROJECT_DIR\$")
getOrCreateChild("option", "name" to "VM_PARAMETERS").also { vmParams ->
var options = vmParams.getAttributeValue("value", "")
.split(' ')
.map { it.trim() }
.filter { it.isNotEmpty() }
fun addOrReplaceOptionValue(name: String, value: Any) {
options = options.filter { !it.startsWith("-D$name=") } + listOf("-D$name=$value")
}
val robolectricClasspath = project.rootProject
.project(":plugins:android-extensions-compiler")
.configurations.getByName("robolectricClasspath")
.files.joinToString(File.pathSeparator)
val androidJarPath = project.configurations.getByName("androidJar").singleFile
val androidSdkPath = project.configurations.getByName("androidSdk").singleFile
addOrReplaceOptionValue("idea.home.path", platformDirProjectRelative)
addOrReplaceOptionValue("ideaSdk.androidPlugin.path", platformDirProjectRelative + "/plugins/android/lib")
addOrReplaceOptionValue("robolectric.classpath", robolectricClasspath)
addOrReplaceOptionValue("use.pill", "true")
addOrReplaceOptionValue("android.sdk", "\$PROJECT_DIR\$/" + androidSdkPath.toRelativeString(projectDir))
addOrReplaceOptionValue("android.jar", "\$PROJECT_DIR\$/" + androidJarPath.toRelativeString(projectDir))
vmParams.setAttribute("value", options.joinToString(" "))
}
}
val output = XMLOutputter().also {
it.format = Format.getPrettyFormat().apply {
setEscapeStrategy { Verifier.isHighSurrogate(it) || it == '"' }
setIndent(" ")
setTextMode(Format.TextMode.TRIM)
setOmitEncoding(false)
setOmitDeclaration(false)
}
}
val postProcessedXml = output.outputString(document)
.replace("&#x22;", "&quot;")
.replace("&#xA;", "&#10;")
.replace("&#xC;", "&#13;")
workspaceFile.writeText(postProcessedXml)
}
private fun attachPlatformSources(library: PLibrary): PLibrary {
val platformSourcesJar = File(platformDir, "../sources/ideaIC-$platformVersion-sources.jar")
if (library.classes.any { it.startsWith(platformDir) }) {
return library.attachSource(platformSourcesJar)
}
return library
}
private fun attachAsmSources(library: PLibrary): PLibrary {
val asmSourcesJar = File(platformDir, "../asm-shaded-sources/asm-src-$platformBaseNumber.jar")
val asmAllJar = File(platformDir, "lib/asm-all.jar")
if (library.classes.any { it == asmAllJar }) {
return library.attachSource(asmSourcesJar)
}
return library
}
private fun PProject.mapLibraries(vararg mappers: (PLibrary) -> PLibrary): PProject {
fun mapLibrary(root: POrderRoot): POrderRoot {
val dependency = root.dependency
if (dependency is PDependency.ModuleLibrary) {
val newLibrary = mappers.fold(dependency.library) { lib, mapper -> mapper(lib) }
return root.copy(dependency = dependency.copy(library = newLibrary))
}
return root
}
val modules = this.modules.map { it.copy(orderRoots = it.orderRoots.map(::mapLibrary)) }
return this.copy(modules = modules)
}
}

View File

@@ -0,0 +1,155 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import java.io.File
class PFile(val path: File, val text: String) {
fun write() {
path.parentFile.mkdirs()
path.writeText(text)
}
}
fun PFile(path: File, xml: xml) = PFile(path, xml.toString())
fun render(project: PProject): List<PFile> {
val files = mutableListOf<PFile>()
files += renderModulesFile(project)
project.modules.forEach { files += renderModule(project, it) }
project.libraries.forEach { files += renderLibrary(project, it) }
return files
}
private fun renderModulesFile(project: PProject) = PFile(
File(project.rootDirectory, ".idea/modules.xml"),
xml("project", "version" to 4) {
xml("component", "name" to "ProjectModuleManager") {
xml("modules") {
val pathContext = ProjectContext(project)
for (module in project.modules) {
val moduleFilePath = pathContext(module.moduleFile)
if (module.group != null) {
xml("module", "fileurl" to "file://$moduleFilePath", "filepath" to moduleFilePath, "group" to module.group)
} else {
xml("module", "fileurl" to "file://$moduleFilePath", "filepath" to moduleFilePath)
}
}
}
}
}
)
private fun renderModule(project: PProject, module: PModule) = PFile(
module.moduleFile,
xml("module",
"type" to "JAVA_MODULE",
"version" to 4
) {
val moduleForProductionSources = module.moduleForProductionSources
if (moduleForProductionSources != null) {
xml("component", "name" to "TestModuleProperties", "production-module" to moduleForProductionSources.name)
}
xml("component", "name" to "NewModuleRootManager", "inherit-compiler-output" to "true") {
xml("exclude-output")
val pathContext = ModuleContext(project, module)
for (contentRoot in module.contentRoots) {
xml("content", pathContext.url(contentRoot.path)) {
for (sourceRoot in contentRoot.sourceRoots) {
var args = arrayOf(pathContext.url(sourceRoot.path))
args += when (sourceRoot.kind) {
PSourceRoot.Kind.PRODUCTION -> ("isTestSource" to "false")
PSourceRoot.Kind.TEST -> ("isTestSource" to "true")
PSourceRoot.Kind.RESOURCES -> ("type" to "java-resource")
PSourceRoot.Kind.TEST_RESOURCES -> ("type" to "java-test-resource")
}
xml("sourceFolder", *args)
}
for (excludedDir in contentRoot.excludedDirectories) {
xml("excludeFolder", pathContext.url(excludedDir))
}
}
}
xml("orderEntry", "type" to "inheritedJdk")
for (orderRoot in module.orderRoots) {
val dependency = orderRoot.dependency
var args = when (dependency) {
is PDependency.ModuleLibrary -> arrayOf(
"type" to "module-library"
)
is PDependency.Module -> arrayOf(
"type" to "module",
"module-name" to dependency.name
)
is PDependency.Library -> arrayOf(
"type" to "library",
"name" to dependency.name,
"level" to "project"
)
else -> error("Unsupported dependency type: $dependency")
}
if (dependency is PDependency.Module && orderRoot.isProductionOnTestDependency) {
args += ("production-on-test" to "")
}
args += ("scope" to orderRoot.scope.toString())
if (orderRoot.isExported) {
args += ("exported" to "")
}
xml("orderEntry", *args) {
if (dependency is PDependency.ModuleLibrary) {
add(renderLibraryToXml(dependency.library, pathContext, named = false))
}
}
}
}
}
)
private fun renderLibrary(project: PProject, library: PLibrary): PFile {
val pathContext = ProjectContext(project)
// TODO find how IDEA escapes library names
val escapedName = library.renderName().replace(" ", "_").replace(".", "_").replace("-", "_")
return PFile(
File(project.rootDirectory, ".idea/libraries/$escapedName.xml"),
xml("component", "name" to "libraryTable") {
add(renderLibraryToXml(library, pathContext))
})
}
private fun renderLibraryToXml(library: PLibrary, pathContext: PathContext, named: Boolean = true): xml {
val args = if (named) arrayOf("name" to library.renderName()) else emptyArray()
return xml("library", *args) {
xml("CLASSES") {
library.classes.forEach { xml("root", pathContext.url(it)) }
}
xml("JAVADOC") {
library.javadoc.forEach { xml("root", pathContext.url(it)) }
}
xml("SOURCES") {
library.sources.forEach { xml("root", pathContext.url(it)) }
}
}
}
fun PLibrary.renderName() = name?.takeIf { it != "unspecified" } ?: classes.first().nameWithoutExtension

View File

@@ -0,0 +1,61 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import shadow.org.jdom2.Document
import shadow.org.jdom2.Element
import shadow.org.jdom2.output.Format
import shadow.org.jdom2.output.XMLOutputter
class xml(val name: String, vararg val args: Pair<String, Any>, block: xml.() -> Unit = {}) {
private companion object {
fun makeXml(name: String, vararg args: Pair<String, Any>, block: xml.() -> Unit = {}): xml {
return xml(name, *args, block = block)
}
}
private val children = mutableListOf<xml>()
private var value: Any? = null
init {
@Suppress("UNUSED_EXPRESSION")
block()
}
fun xml(name: String, vararg args: Pair<String, Any>, block: xml.() -> Unit = {}) {
children += makeXml(name, *args, block = block)
}
fun add(xml: xml) {
children += xml
}
fun raw(text: String) {
value = text
}
private fun toElement(): Element {
val element = Element(name)
for (arg in args) {
element.setAttribute(arg.first, arg.second.toString())
}
require(value == null || children.isEmpty())
value?.let { value ->
element.addContent(value.toString())
}
for (child in children) {
element.addContent(child.toElement())
}
return element
}
override fun toString(): String {
val document = Document().also { it.rootElement = toElement() }
val output = XMLOutputter().also { it.format = Format.getPrettyFormat() }
return output.outputString(document)
}
}

View File

@@ -23,11 +23,11 @@ import java.io.File
open class DexMethodCount : DefaultTask() {
data class Counts(
val total: Int,
val totalOwnPackages: Int?,
val totalOtherPackages: Int?,
val byPackage: Map<String, Int>,
val byClass: Map<String, Int>
val total: Int,
val totalOwnPackages: Int?,
val totalOtherPackages: Int?,
val byPackage: Map<String, Int>,
val byClass: Map<String, Int>
)
@InputFile
@@ -58,7 +58,7 @@ open class DexMethodCount : DefaultTask() {
@TaskAction
fun invoke() {
val methods = DexMethods.list(jarFile)
val methods = dexMethods(jarFile)
val counts = methods.getCounts().also { this.counts = it }
@@ -73,16 +73,18 @@ open class DexMethodCount : DefaultTask() {
val ownPackages = ownPackages?.map { it + '.' }
val byOwnPackages = if (ownPackages != null) {
this.partition { method -> ownPackages.any { method.declaringType.startsWith(it) }}.let {
this.partition { method -> ownPackages.any { method.declaringType.startsWith(it) } }.let {
it.first.size to it.second.size
}
} else (null to null)
return Counts(total = this.size,
totalOwnPackages = byOwnPackages.first,
totalOtherPackages = byOwnPackages.second,
byPackage = byPackage,
byClass = byClass)
return Counts(
total = this.size,
totalOwnPackages = byOwnPackages.first,
totalOtherPackages = byOwnPackages.second,
byPackage = byPackage,
byClass = byClass
)
}
private fun printTotals(counts: Counts) {

View File

@@ -24,6 +24,7 @@ import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.task
import org.gradle.kotlin.dsl.the
import org.gradle.kotlin.dsl.*
import java.lang.Character.isLowerCase
import java.lang.Character.isUpperCase
@@ -81,3 +82,41 @@ private inline fun String.isFirstChar(f: (Char) -> Boolean) = isNotEmpty() && f(
inline fun <reified T : Task> Project.getOrCreateTask(taskName: String, body: T.() -> Unit): T =
(tasks.findByName(taskName)?.let { it as T } ?: task<T>(taskName)).apply { body() }
object TaskUtils {
fun useAndroidSdk(task: Task) {
task.useAndroidConfiguration(systemPropertyName = "android.sdk", configName = "androidSdk")
}
fun useAndroidJar(task: Task) {
task.useAndroidConfiguration(systemPropertyName = "android.jar", configName = "androidJar")
}
}
private fun Task.useAndroidConfiguration(systemPropertyName: String, configName: String) {
val configuration = with(project) {
configurations.getOrCreate(configName)
.also {
dependencies.add(
configName,
dependencies.project(":custom-dependencies:android-sdk", configuration = configName)
)
}
}
dependsOn(configuration)
if (this is Test) {
doFirst {
systemProperty(systemPropertyName, configuration.singleFile.canonicalPath)
}
}
}
fun Task.useAndroidSdk() {
TaskUtils.useAndroidSdk(this)
}
fun Task.useAndroidJar() {
TaskUtils.useAndroidJar(this)
}

View File

@@ -0,0 +1 @@
implementation-class=org.jetbrains.kotlin.pill.JpsCompatiblePlugin

View File

@@ -0,0 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[JPS] All Compiler Tests" type="CompoundRunConfigurationType" factoryName="Compound Run Configuration">
<toRun type="JUnit" name="[JPS] Compiler Tests" />
<toRun type="JUnit" name="[JPS] JS Backend Tests" />
<toRun type="JUnit" name="[JPS] Java 8 Tests" />
<method />
</configuration>
</component>

View File

@@ -0,0 +1,37 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[JPS] All IDEA Plugin Tests" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
<pattern>
<option name="PATTERN" value="org.jetbrains.kotlin.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<module name="idea.test" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" value="org.jetbrains.kotlin" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1250m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Didea.home.path=$IDEA_HOME_PATH$" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="Profile " />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
</component>

View File

@@ -0,0 +1,35 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[JPS] Compiler Tests" type="JUnit" factoryName="JUnit">
<module name="compiler.test" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="org.jetbrains.kotlin.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" value="org.jetbrains.kotlin.codegen" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Didea.home.path=$IDEA_HOME_PATH$" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<patterns />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="Profile " />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
</component>

View File

@@ -0,0 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[JPS] Generate All Tests" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="org.jetbrains.kotlin.pill.generateAllTests.Main" />
<module name="generate-all-tests.test" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<method />
</configuration>
</component>

View File

@@ -0,0 +1,41 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[JPS] IDEA" type="Application" factoryName="Application" singleton="true">
<log_file alias="idea.log" path="$PROJECT_DIR$/ideaSDK/system-idea/log/idea.log" />
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
<module name="idea-runner" />
<option name="VM_PARAMETERS" value="-Xmx1250m -XX:ReservedCodeCacheSize=240m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=$IDEA_HOME_PATH$/system -Didea.config.path=$IDEA_HOME_PATH$/config -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Dkotlin.internal.mode.enabled=true" />
<option name="WORKING_DIRECTORY" value="file://$IDEA_HOME_PATH$" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="JavaRebel">
<option name="bootstrapPath" />
<option name="jrebelArgs" value="" />
<option name="loggingEnabled" value="false" />
<option name="useBootstrapDefaults" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="JavaRebel Debug">
<option name="bootstrapPath" />
<option name="debugPort" value="" />
<option name="jrebelArgs" value="" />
<option name="loggingEnabled" value="false" />
<option name="transport" value="0" />
<option name="useBootstrapDefaults" value="true" />
<option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="Profile " />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Profile " />
<ConfigurationWrapper RunnerId="Run" />
<method>
<option name="BuildArtifacts" enabled="true">
<artifact name="KotlinPlugin" />
</option>
</method>
</configuration>
</component>

View File

@@ -0,0 +1,41 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[JPS] IDEA (No ProcessCanceledException)" type="Application" factoryName="Application" singleton="true">
<log_file alias="idea.log" path="$PROJECT_DIR$/ideaSDK/system-idea/log/idea.log" />
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
<module name="idea-runner" />
<option name="VM_PARAMETERS" value="-Xmx1250m -XX:ReservedCodeCacheSize=240m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=$IDEA_HOME_PATH$/system -Didea.config.path=$IDEA_HOME_PATH$/config -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Dkotlin.internal.mode.enabled=true -Didea.ProcessCanceledException=disabled" />
<option name="WORKING_DIRECTORY" value="file://$IDEA_HOME_PATH$" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="JavaRebel">
<option name="bootstrapPath" />
<option name="jrebelArgs" value="" />
<option name="loggingEnabled" value="false" />
<option name="useBootstrapDefaults" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="JavaRebel Debug">
<option name="bootstrapPath" />
<option name="debugPort" value="" />
<option name="jrebelArgs" value="" />
<option name="loggingEnabled" value="false" />
<option name="transport" value="0" />
<option name="useBootstrapDefaults" value="true" />
<option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="Profile " />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Profile " />
<ConfigurationWrapper RunnerId="Run" />
<method>
<option name="BuildArtifacts" enabled="true">
<artifact name="KotlinPlugin" />
</option>
</method>
</configuration>
</component>

View File

@@ -0,0 +1,28 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[JPS] JS Backend Tests" type="JUnit" factoryName="JUnit">
<module name="js.tests.test" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" value="org.jetbrains.kotlin.js.test" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1250m -XX:+UseCodeCacheFlushing -Djna.nosys=true -Dkotlin.js.skipMinificationTest=false" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<patterns />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
</component>

View File

@@ -0,0 +1,26 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[JPS] Java 8 Tests" type="JUnit" factoryName="JUnit">
<module name="tests-java8.test" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="org.jetbrains.kotlin.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="1.8" />
<option name="PACKAGE_NAME" value="org.jetbrains.kotlin" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Dkotlin.colors.enabled=false -Didea.home.path=$IDEA_HOME_PATH$" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<patterns />
<method />
</configuration>
</component>

View File

@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[JPS] Refresh JPS Model" type="GradleRunConfiguration" factoryName="Gradle" singleton="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="pill" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<method />
</configuration>
</component>

View File

@@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -22,7 +22,7 @@ repositories {
android {
compileSdkVersion 19
buildToolsVersion "26.0.2"
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "org.jetbrains.kotlin.android.tests"
@@ -32,6 +32,7 @@ android {
versionName "1.0"
testApplicationId "org.jetbrains.kotlin.android.tests.gradle"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
multiDexEnabled true
}
buildTypes {
debug {
@@ -67,9 +68,8 @@ android {
dexOptions {
dexInProcess false
javaMaxHeapSize "600m"
//default is 4 and Total Memory = maxProcessCount * javaMaxHeapSize
maxProcessCount 1
javaMaxHeapSize "1200m"
maxProcessCount 4
additionalParameters "--debug"
}
}
@@ -91,4 +91,5 @@ tasks.withType(JavaCompile) {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
}

View File

@@ -1,5 +1,6 @@
apply { plugin("kotlin") }
apply { plugin("jps-compatible") }
jvmTarget = "1.6"
@@ -10,18 +11,17 @@ dependencies {
compile(project(":compiler:backend"))
compile(projectTests(":compiler:tests-common"))
compile(commonDep("junit:junit"))
compile(ideaSdkDeps("openapi"))
compileOnly(intellijDep()) { includeJars("openapi") }
testCompile(project(":compiler:incremental-compilation-impl"))
testCompile(project(":core:descriptors"))
testCompile(project(":core:descriptors.jvm"))
testCompile(project(":compiler:frontend.java"))
testCompile(projectTests(":jps-plugin"))
testCompile(ideaSdkDeps("jps-model.jar", subdir = "jps"))
testCompile(ideaSdkDeps("groovy-all"))
testCompile(ideaSdkDeps("idea", "idea_rt"))
testCompile(ideaSdkDeps("jps-build-test", subdir = "jps/test"))
testCompile(ideaSdkDeps("jps-builders"))
testCompile(commonDep("junit:junit"))
testCompile(intellijDep()) { includeJars("openapi", "idea", "idea_rt", "groovy-all", "jps-builders", rootProject = rootProject) }
testCompile(intellijDep("jps-standalone")) { includeJars("jps-model") }
testCompile(intellijDep("jps-build-test"))
}
sourceSets {
@@ -30,5 +30,9 @@ sourceSets {
}
projectTest {
doFirst {
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
environment("kotlin.tests.android.timeout", "45")
}
workingDir = rootDir
}

View File

@@ -152,7 +152,9 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
private fun parseSingleReportInFolder(reportFolder: String): List<TestCase> {
val folder = File(reportFolder)
val files = folder.listFiles()!!
assert(files.size == 1)
assert(files.size == 1) {
"Expecting one file but ${files.size}: ${files.joinToString { it.name }}"
}
val reportFile = files[0]
val dbFactory = DocumentBuilderFactory.newInstance()

View File

@@ -38,12 +38,11 @@ public class SDKDownloader {
private final PathManager pathManager;
//NOTE: PLATFORM_TOOLS 23.1.0 requires only 64 bit build agents
private static final String PLATFORM_TOOLS = "23.0.1";
private static final String SDK_TOOLS = "25.1.1";
public static final String BUILD_TOOLS = "26.0.2";
private static final String PLATFORM_TOOLS = "27.0.1";
private static final String SDK_TOOLS = "25.1.6";
public static final String BUILD_TOOLS = "27.0.3";
private static final int ANDROID_VERSION = 19;
public static final String GRADLE_VERSION = "4.3";
public static final String GRADLE_VERSION = "4.5.1";
public SDKDownloader(PathManager pathManager) {

View File

@@ -157,7 +157,7 @@ public class Emulator {
bootCheckCommand.addParameter("sys.boot_completed");
int counter = 0;
RunResult execute = RunUtils.execute(bootCheckCommand);
while (counter < 12) {
while (counter < 20) {
String output = execute.getOutput();
if (output.trim().endsWith("1")) {
System.out.println("Emulator fully booted!");

View File

@@ -31,11 +31,14 @@ private val packagePattern = Pattern.compile("(?m)^\\s*package[ |\t]+([\\w|\\.]*
private val importPattern = Pattern.compile("import[ |\t]([\\w|]*\\.)")
internal fun genFiles(file: File, fileContent: String, filesHolder: CodegenTestsOnAndroidGenerator.FilesWriter): FqName? {
val testFiles = createTestFiles(file, fileContent)
if (testFiles.filter { it.name.endsWith(".java") }.isNotEmpty()) {
internal fun patchFiles(
file: File,
testFiles: List<CodegenTestCase.TestFile>,
filesHolder: CodegenTestsOnAndroidGenerator.FilesWriter
): FqName? {
if (testFiles.any { it.name.endsWith(".java") }) {
//TODO support java files
return null;
return null
}
val ktFiles = testFiles.filter { it.name.endsWith(".kt") }
if (ktFiles.isEmpty()) return null
@@ -82,16 +85,6 @@ internal fun genFiles(file: File, fileContent: String, filesHolder: CodegenTests
return boxFiles.last().newClassId
}
private fun createTestFiles(file: File, expectedText: String): List<CodegenTestCase.TestFile> {
val files = KotlinTestUtils.createTestFiles(file.name, expectedText, object : KotlinTestUtils.TestFileFactoryNoModules<CodegenTestCase.TestFile>() {
override fun create(fileName: String, text: String, directives: Map<String, String>): CodegenTestCase.TestFile {
return CodegenTestCase.TestFile(fileName, text)
}
})
return files
}
private fun hasBoxMethod(text: String): Boolean {
return text.contains("fun box()")
}

View File

@@ -1,319 +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.android.tests;
import com.google.common.collect.Lists;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection;
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsKt;
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
import org.jetbrains.kotlin.codegen.CodegenTestFiles;
import org.jetbrains.kotlin.codegen.GenerationUtils;
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.config.CommonConfigurationKeys;
import org.jetbrains.kotlin.config.CompilerConfiguration;
import org.jetbrains.kotlin.config.JVMConfigurationKeys;
import org.jetbrains.kotlin.idea.KotlinFileType;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.NameUtils;
import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.test.*;
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase;
import org.jetbrains.kotlin.utils.Printer;
import org.junit.Assert;
import org.junit.Ignore;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@Ignore
public class CodegenTestsOnAndroidGenerator extends KtUsefulTestCase {
private final PathManager pathManager;
private static final String testClassPackage = "org.jetbrains.kotlin.android.tests";
private static final String testClassName = "CodegenTestCaseOnAndroid";
private static final String baseTestClassPackage = "org.jetbrains.kotlin.android.tests";
private static final String baseTestClassName = "AbstractCodegenTestCaseOnAndroid";
private static final String generatorName = "CodegenTestsOnAndroidGenerator";
private static int MODULE_INDEX = 1;
private int WRITED_FILES_COUNT = 0;
private final List<String> generatedTestNames = Lists.newArrayList();
public static void generate(PathManager pathManager) throws Throwable {
new CodegenTestsOnAndroidGenerator(pathManager).generateOutputFiles();
}
private CodegenTestsOnAndroidGenerator(PathManager pathManager) {
this.pathManager = pathManager;
}
private void generateOutputFiles() throws Throwable {
prepareAndroidModule();
generateAndSave();
}
private void prepareAndroidModule() throws IOException {
System.out.println("Copying kotlin-runtime.jar and kotlin-reflect.jar in android module...");
copyKotlinRuntimeJars();
System.out.println("Check \"libs\" folder in tested android module...");
File libsFolderInTestedModule = new File(pathManager.getLibsFolderInAndroidTestedModuleTmpFolder());
if (!libsFolderInTestedModule.exists()) {
libsFolderInTestedModule.mkdirs();
}
}
private void copyKotlinRuntimeJars() throws IOException {
FileUtil.copy(
ForTestCompileRuntime.runtimeJarForTests(),
new File(pathManager.getLibsFolderInAndroidTmpFolder() + "/kotlin-runtime.jar")
);
FileUtil.copy(
ForTestCompileRuntime.reflectJarForTests(),
new File(pathManager.getLibsFolderInAndroidTmpFolder() + "/kotlin-reflect.jar")
);
FileUtil.copy(
ForTestCompileRuntime.kotlinTestJarForTests(),
new File(pathManager.getLibsFolderInAndroidTmpFolder() + "/kotlin-test.jar")
);
}
private void generateAndSave() throws Throwable {
System.out.println("Generating test files...");
StringBuilder out = new StringBuilder();
Printer p = new Printer(out);
p.print(FileUtil.loadFile(new File("license/LICENSE.txt")));
p.println("package " + testClassPackage + ";");
p.println();
p.println("import ", baseTestClassPackage, ".", baseTestClassName, ";");
p.println();
p.println("/* This class is generated by " + generatorName + ". DO NOT MODIFY MANUALLY */");
p.println("public class ", testClassName, " extends ", baseTestClassName, " {");
p.pushIndent();
generateTestMethodsForDirectories(p, new File("compiler/testData/codegen/box"), new File("compiler/testData/codegen/boxInline"));
p.popIndent();
p.println("}");
String testSourceFilePath =
pathManager.getSrcFolderInAndroidTmpFolder() + "/" + testClassPackage.replace(".", "/") + "/" + testClassName + ".java";
FileUtil.writeToFile(new File(testSourceFilePath), out.toString());
}
private void generateTestMethodsForDirectories(Printer p, File... dirs) throws IOException {
FilesWriter holderMock = new FilesWriter(false, false);
FilesWriter holderFull = new FilesWriter(true, false);
FilesWriter holderInheritMFP = new FilesWriter(true, true);
for (File dir : dirs) {
File[] files = dir.listFiles();
Assert.assertNotNull("Folder with testData is empty: " + dir.getAbsolutePath(), files);
processFiles(p, files, holderFull, holderMock, holderInheritMFP);
}
holderFull.writeFilesOnDisk();
holderMock.writeFilesOnDisk();
holderInheritMFP.writeFilesOnDisk();
}
class FilesWriter {
private final boolean isFullJdkAndRuntime;
private final boolean inheritMultifileParts;
public List<KtFile> files = new ArrayList<>();
private KotlinCoreEnvironment environment;
private Disposable disposable;
private FilesWriter(boolean isFullJdkAndRuntime, boolean inheritMultifileParts) {
this.isFullJdkAndRuntime = isFullJdkAndRuntime;
this.inheritMultifileParts = inheritMultifileParts;
this.disposable = new TestDisposable();
this.environment = createEnvironment(isFullJdkAndRuntime, disposable);
}
private KotlinCoreEnvironment createEnvironment(boolean isFullJdkAndRuntime, @NotNull Disposable disposable) {
ConfigurationKind configurationKind = isFullJdkAndRuntime ? ConfigurationKind.ALL : ConfigurationKind.NO_KOTLIN_REFLECT;
TestJdkKind testJdkKind = isFullJdkAndRuntime ? TestJdkKind.FULL_JDK : TestJdkKind.MOCK_JDK;
CompilerConfiguration configuration =
KotlinTestUtils.newConfiguration(configurationKind, testJdkKind, KotlinTestUtils.getAnnotationsJar());
configuration.put(CommonConfigurationKeys.MODULE_NAME, "android-module-" + MODULE_INDEX++);
if (inheritMultifileParts) {
configuration.put(JVMConfigurationKeys.INHERIT_MULTIFILE_PARTS, true);
}
return KotlinCoreEnvironment.createForTests(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
}
public boolean shouldWriteFilesOnDisk() {
return files.size() > 300;
}
public void writeFilesOnDiskIfNeeded() {
if (shouldWriteFilesOnDisk()) {
writeFilesOnDisk();
}
}
public void writeFilesOnDisk() {
writeFiles(files);
files = new ArrayList<>();
if (disposable != null) {
Disposer.dispose(disposable);
disposable = new TestDisposable();
}
environment = createEnvironment(isFullJdkAndRuntime, disposable);
}
public void addFile(String name, String content) {
try {
files.add(CodegenTestFiles.create(name, content, environment.getProject()).getPsiFile());
}
catch (Throwable e) {
throw new RuntimeException("Problem during creating file " + name + ": \n" + content, e);
}
}
private void writeFiles(List<KtFile> filesToCompile) {
if (filesToCompile.isEmpty()) return;
//1000 files per folder, each folder would be jared by build.gradle script
// We can't create one big jar with all test cause dex has problem with memory on teamcity
WRITED_FILES_COUNT += filesToCompile.size();
File outputDir = new File(pathManager.getOutputForCompiledFiles(WRITED_FILES_COUNT / 1000));
System.out.println("Generating " + filesToCompile.size() + " files" +
(inheritMultifileParts
? " (JVM.INHERIT_MULTIFILE_PARTS)"
: isFullJdkAndRuntime ? " (full jdk and runtime)" : "") + " into " + outputDir.getName() + "...");
OutputFileCollection outputFiles;
GenerationState state = null;
try {
state = GenerationUtils.compileFiles(filesToCompile, environment);
outputFiles = state.getFactory();
}
catch (Throwable e) {
throw new RuntimeException(e);
}
finally {
if (state != null) {
state.destroy();
}
}
if (!outputDir.exists()) {
outputDir.mkdirs();
}
Assert.assertTrue("Cannot create directory for compiled files", outputDir.exists());
OutputUtilsKt.writeAllTo(outputFiles, outputDir);
}
}
private void processFiles(
@NotNull Printer printer,
@NotNull File[] files,
@NotNull FilesWriter holderFull,
@NotNull FilesWriter holderMock,
@NotNull FilesWriter holderInheritMFP
) throws IOException {
holderFull.writeFilesOnDiskIfNeeded();
holderMock.writeFilesOnDiskIfNeeded();
holderInheritMFP.writeFilesOnDiskIfNeeded();
for (File file : files) {
if (SpecialFiles.getExcludedFiles().contains(file.getName())) {
continue;
}
if (file.isDirectory()) {
File[] listFiles = file.listFiles();
if (listFiles != null) {
processFiles(printer, listFiles, holderFull, holderMock, holderInheritMFP);
}
}
else if (!FileUtilRt.getExtension(file.getName()).equals(KotlinFileType.INSTANCE.getDefaultExtension())) {
// skip non kotlin files
}
else {
String fullFileText = FileUtil.loadFile(file, true);
if (!InTextDirectivesUtils.isPassingTarget(TargetBackend.JVM, file)) {
continue;
}
//TODO: support LANGUAGE_VERSION
if (InTextDirectivesUtils.isDirectiveDefined(fullFileText, "LANGUAGE_VERSION:")) {
continue;
}
//TODO: support multifile facades
//TODO: support multifile facades hierarchies
if (hasBoxMethod(fullFileText)) {
FilesWriter filesHolder = InTextDirectivesUtils.isDirectiveDefined(fullFileText, "FULL_JDK") ||
InTextDirectivesUtils.isDirectiveDefined(fullFileText, "WITH_RUNTIME") ||
InTextDirectivesUtils.isDirectiveDefined(fullFileText, "WITH_REFLECT") ? holderFull : holderMock;
filesHolder = fullFileText.contains("+JVM.INHERIT_MULTIFILE_PARTS") ? holderInheritMFP : filesHolder;
FqName classWithBoxMethod = AndroidTestGeneratorKt.genFiles(file, fullFileText, filesHolder);
if (classWithBoxMethod == null)
continue;
String generatedTestName = generateTestName(file.getName());
generateTestMethod(printer, generatedTestName, classWithBoxMethod.asString(), StringUtil.escapeStringCharacters(file.getPath()));
}
}
}
}
private static boolean hasBoxMethod(String text) {
return text.contains("fun box()");
}
private static void generateTestMethod(Printer p, String testName, String className, String filePath) {
p.println("public void test" + testName + "() throws Exception {");
p.pushIndent();
p.println("invokeBoxMethod(" + className + ".class, \"" + filePath + "\", \"OK\");");
p.popIndent();
p.println("}");
p.println();
}
private String generateTestName(String fileName) {
String result = NameUtils.sanitizeAsJavaIdentifier(FileUtil.getNameWithoutExtension(StringUtil.capitalize(fileName)));
int i = 0;
while (generatedTestNames.contains(result)) {
result += "_" + i++;
}
generatedTestNames.add(result);
return result;
}
}

View File

@@ -0,0 +1,294 @@
/*
* 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.android.tests
import com.google.common.collect.Lists
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.util.io.FileUtilRt
import com.intellij.openapi.util.text.StringUtil
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection
import org.jetbrains.kotlin.cli.common.output.outputUtils.writeAllTo
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.codegen.CodegenTestCase
import org.jetbrains.kotlin.codegen.CodegenTestFiles
import org.jetbrains.kotlin.codegen.GenerationUtils
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.name.NameUtils
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.*
import org.jetbrains.kotlin.utils.Printer
import org.junit.Assert
import org.junit.Ignore
import java.io.File
import java.io.FileWriter
import java.io.IOException
import java.util.*
data class ConfigurationKey(val kind: ConfigurationKind, val jdkKind: TestJdkKind, val configuration: String)
@Ignore
class CodegenTestsOnAndroidGenerator private constructor(private val pathManager: PathManager) : CodegenTestCase() {
private var writtenFilesCount = 0
private var currentModuleIndex = 1
private val generatedTestNames = Lists.newArrayList<String>()
private fun generateOutputFiles() {
prepareAndroidModule()
generateAndSave()
}
private fun prepareAndroidModule() {
println("Copying kotlin-runtime.jar and kotlin-reflect.jar in android module...")
copyKotlinRuntimeJars()
println("Check 'libs' folder in tested android module...")
val libsFolderInTestedModule = File(pathManager.libsFolderInAndroidTestedModuleTmpFolder)
if (!libsFolderInTestedModule.exists()) {
libsFolderInTestedModule.mkdirs()
}
}
private fun copyKotlinRuntimeJars() {
FileUtil.copy(
ForTestCompileRuntime.runtimeJarForTests(),
File(pathManager.libsFolderInAndroidTmpFolder + "/kotlin-runtime.jar")
)
FileUtil.copy(
ForTestCompileRuntime.reflectJarForTests(),
File(pathManager.libsFolderInAndroidTmpFolder + "/kotlin-reflect.jar")
)
FileUtil.copy(
ForTestCompileRuntime.kotlinTestJarForTests(),
File(pathManager.libsFolderInAndroidTmpFolder + "/kotlin-test.jar")
)
}
private fun generateAndSave() {
println("Generating test files...")
val testSourceFilePath =
pathManager.srcFolderInAndroidTmpFolder + "/" + testClassPackage.replace(".", "/") + "/" + testClassName + ".java"
FileWriter(File(testSourceFilePath)).use {
val p = Printer(it)
p.print(FileUtil.loadFile(File("license/LICENSE.txt")))
p.println(
"""package $testClassPackage;
|
|import $baseTestClassPackage.$baseTestClassName;
|
|/* This class is generated by $generatorName. DO NOT MODIFY MANUALLY */
|public class $testClassName extends $baseTestClassName {
|
""".trimMargin()
)
p.pushIndent()
generateTestMethodsForDirectories(p, File("compiler/testData/codegen/box"), File("compiler/testData/codegen/boxInline"))
p.popIndent()
p.println("}")
}
}
private fun generateTestMethodsForDirectories(p: Printer, vararg dirs: File) {
val holders = mutableMapOf<ConfigurationKey, FilesWriter>()
for (dir in dirs) {
val files = dir.listFiles() ?: error("Folder with testData is empty: ${dir.absolutePath}")
processFiles(p, files, holders)
}
holders.values.forEach {
it.writeFilesOnDisk()
}
}
internal inner class FilesWriter(
private val configuration: CompilerConfiguration
) {
private val rawFiles: MutableList<Pair<String, String>> = ArrayList()
private fun shouldWriteFilesOnDisk(): Boolean = rawFiles.size > 300
fun writeFilesOnDiskIfNeeded() {
if (shouldWriteFilesOnDisk()) {
writeFilesOnDisk()
}
}
fun writeFilesOnDisk() {
val disposable = TestDisposable()
val environment = KotlinCoreEnvironment.createForTests(
disposable,
configuration.copy().apply { put(CommonConfigurationKeys.MODULE_NAME, "android-module-" + currentModuleIndex++) },
EnvironmentConfigFiles.JVM_CONFIG_FILES
)
writeFiles(
rawFiles.map {
CodegenTestFiles.create(it.first, it.second, environment.project).psiFile
}, environment
)
Disposer.dispose(disposable)
rawFiles.clear()
}
fun addFile(name: String, content: String) {
rawFiles.add(name to content)
}
private fun writeFiles(filesToCompile: List<KtFile>, environment: KotlinCoreEnvironment) {
if (filesToCompile.isEmpty()) return
//1000 files per folder, each folder would be jared by build.gradle script
// We can't create one big jar with all test cause dex has problem with memory on teamcity
writtenFilesCount += filesToCompile.size
val outputDir = File(pathManager.getOutputForCompiledFiles(writtenFilesCount / 1000))
println("Generating ${filesToCompile.size} files into ${outputDir.name}, configuration: '${environment.configuration}'...")
val outputFiles = GenerationUtils.compileFiles(filesToCompile, environment).run { destroy(); factory }
if (!outputDir.exists()) {
outputDir.mkdirs()
}
Assert.assertTrue("Cannot create directory for compiled files", outputDir.exists())
outputFiles.writeAllTo(outputDir)
}
}
@Throws(IOException::class)
private fun processFiles(
printer: Printer,
files: Array<File>,
holders: MutableMap<ConfigurationKey, FilesWriter>
) {
holders.values.forEach {
it.writeFilesOnDiskIfNeeded()
}
for (file in files) {
if (SpecialFiles.getExcludedFiles().contains(file.name)) {
continue
}
if (file.isDirectory) {
val listFiles = file.listFiles()
if (listFiles != null) {
processFiles(printer, listFiles, holders)
}
} else if (FileUtilRt.getExtension(file.name) != KotlinFileType.EXTENSION) {
// skip non kotlin files
} else {
if (!InTextDirectivesUtils.isPassingTarget(TargetBackend.JVM, file)) {
continue
}
val fullFileText = FileUtil.loadFile(file, true)
//TODO support JvmPackageName
if (fullFileText.contains("@file:JvmPackageName(")) continue
if (hasBoxMethod(fullFileText)) {
val testFiles = createTestFiles(file, fullFileText)
val kind = extractConfigurationKind(testFiles)
val jdkKind = getJdkKind(testFiles)
val keyConfiguration = CompilerConfiguration()
updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
val key = ConfigurationKey(kind, jdkKind, keyConfiguration.toString())
val filesHolder = holders.getOrPut(key) {
FilesWriter(KotlinTestUtils.newConfiguration(kind, jdkKind, KotlinTestUtils.getAnnotationsJar()).apply {
println("Creating new configuration by $key")
updateConfigurationByDirectivesInTestFiles(testFiles, this)
})
}
val classWithBoxMethod = patchFiles(file, testFiles, filesHolder) ?: continue
val generatedTestName = generateTestName(file.name)
generateTestMethod(
printer,
generatedTestName,
classWithBoxMethod.asString(),
StringUtil.escapeStringCharacters(file.path)
)
}
}
}
}
private fun createTestFiles(file: File, expectedText: String): List<CodegenTestCase.TestFile> =
KotlinTestUtils.createTestFiles(
file.name,
expectedText,
object : KotlinTestUtils.TestFileFactoryNoModules<CodegenTestCase.TestFile>() {
override fun create(fileName: String, text: String, directives: Map<String, String>): CodegenTestCase.TestFile {
return CodegenTestCase.TestFile(fileName, text)
}
})
private fun generateTestName(fileName: String): String {
var result = NameUtils.sanitizeAsJavaIdentifier(FileUtil.getNameWithoutExtension(StringUtil.capitalize(fileName)))
var i = 0
while (generatedTestNames.contains(result)) {
result += "_" + i++
}
generatedTestNames.add(result)
return result
}
companion object {
private const val testClassPackage = "org.jetbrains.kotlin.android.tests"
private const val testClassName = "CodegenTestCaseOnAndroid"
private const val baseTestClassPackage = "org.jetbrains.kotlin.android.tests"
private const val baseTestClassName = "AbstractCodegenTestCaseOnAndroid"
private const val generatorName = "CodegenTestsOnAndroidGenerator"
@JvmStatic
@Throws(Throwable::class)
fun generate(pathManager: PathManager) {
CodegenTestsOnAndroidGenerator(pathManager).generateOutputFiles()
}
private fun hasBoxMethod(text: String): Boolean {
return text.contains("fun box()")
}
private fun generateTestMethod(p: Printer, testName: String, className: String, filePath: String) {
p.println("public void test$testName() throws Exception {")
p.pushIndent()
p.println("invokeBoxMethod($className.class, \"$filePath\", \"OK\");")
p.popIndent()
p.println("}")
p.println()
}
}
}

View File

@@ -48,6 +48,11 @@ public class SpecialFiles {
excludedFiles.add("enumKClassAnnotation.kt");
excludedFiles.add("primitivesAndArrays.kt");
excludedFiles.add("getDelegateWithoutReflection.kt");
excludedFiles.add("parameterAnnotationInDefaultImpls.kt");
excludedFiles.add("kt17091.kt");
excludedFiles.add("kt17091_2.kt");
excludedFiles.add("kt17091_3.kt");
excludedFiles.add("kt22906.kt");
// Reflection is used to check full class name
excludedFiles.add("native");
@@ -127,9 +132,8 @@ public class SpecialFiles {
//wrong function resolution after package renaming
excludedFiles.add("apiVersionAtLeast1.kt");
//special flags
excludedFiles.add("inlineFunInConstructorCallWithEnabledNormalization.kt");
excludedFiles.add("kt9532_lv10.kt");
//special symbols in names
excludedFiles.add("nameWithWhitespace.kt");
}
private SpecialFiles() {

View File

@@ -1,5 +1,6 @@
apply { plugin("kotlin") }
apply { plugin("jps-compatible") }
jvmTarget = "1.6"
@@ -9,7 +10,7 @@ dependencies {
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":compiler:ir.tree"))
compile(project(":compiler:cli-common"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
sourceSets {

View File

@@ -20,14 +20,18 @@ import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.backend.common.bridges.findInterfaceImplementation
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.hasExpectModifier
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver
import org.jetbrains.kotlin.types.KotlinType
object CodegenUtil {
@@ -146,14 +150,14 @@ object CodegenUtil {
@JvmStatic
fun BindingContext.isExhaustive(whenExpression: KtWhenExpression, isStatement: Boolean): Boolean {
val slice = if (isStatement && !whenExpression.isUsedAsExpression(this)) {
fun isExhaustive(bindingContext: BindingContext, whenExpression: KtWhenExpression, isStatement: Boolean): Boolean {
val slice = if (isStatement && !whenExpression.isUsedAsExpression(bindingContext)) {
BindingContext.IMPLICIT_EXHAUSTIVE_WHEN
}
else {
BindingContext.EXHAUSTIVE_WHEN
}
return this[slice, whenExpression] == true
return bindingContext[slice, whenExpression] == true
}
@JvmStatic
@@ -166,4 +170,37 @@ object CodegenUtil {
@JvmStatic
fun getActualDeclarations(file: KtFile): List<KtDeclaration> =
file.declarations.filterNot(KtDeclaration::hasExpectModifier)
@JvmStatic
fun findExpectedFunctionForActual(descriptor: FunctionDescriptor): FunctionDescriptor? {
val compatibleExpectedFunctions = with(ExpectedActualResolver) {
descriptor.findCompatibleExpectedForActual(DescriptorUtils.getContainingModule(descriptor))
}
return compatibleExpectedFunctions.firstOrNull() as FunctionDescriptor?
}
@JvmStatic
fun getFunctionParametersForDefaultValueGeneration(
descriptor: FunctionDescriptor,
trace: DiagnosticSink?
): List<ValueParameterDescriptor> {
if (descriptor.isActual) {
val expected = CodegenUtil.findExpectedFunctionForActual(descriptor)
if (expected != null && expected.valueParameters.any(ValueParameterDescriptor::declaresDefaultValue)) {
val element = DescriptorToSourceUtils.descriptorToDeclaration(expected)
if (element == null) {
if (trace != null) {
val actualDeclaration = DescriptorToSourceUtils.descriptorToDeclaration(descriptor)
?: error("Not a source declaration: $descriptor")
trace.report(Errors.EXPECTED_FUNCTION_SOURCE_WITH_DEFAULT_ARGUMENTS_NOT_FOUND.on(actualDeclaration))
}
return descriptor.valueParameters
}
return expected.valueParameters
}
}
return descriptor.valueParameters
}
}

View File

@@ -17,20 +17,18 @@
package org.jetbrains.kotlin.backend.common.bridges
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.OverridingUtil
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.isOrOverridesSynthesized
fun <Signature> generateBridgesForFunctionDescriptor(
descriptor: FunctionDescriptor,
signature: (FunctionDescriptor) -> Signature,
isBodyOwner: (DeclarationDescriptor) -> Boolean
descriptor: FunctionDescriptor,
signature: (FunctionDescriptor) -> Signature,
areDeclarationAndDefinitionSame: (CallableMemberDescriptor) -> Boolean
): Set<Bridge<Signature>> {
return generateBridges(DescriptorBasedFunctionHandle(descriptor, isBodyOwner), { signature(it.descriptor) })
return generateBridges(DescriptorBasedFunctionHandle(descriptor, areDeclarationAndDefinitionSame), { signature(it.descriptor) })
}
/**
@@ -51,26 +49,28 @@ fun <Signature> generateBridgesForFunctionDescriptor(
* eases the process of determining what bridges are already generated in our supertypes and need to be inherited, not regenerated.
*/
class DescriptorBasedFunctionHandle(
val descriptor: FunctionDescriptor,
/*
To generate proper bridges for non-abstract function
we should know if the function declaration and its definition in the target platform are the same or not.
For JS and JVM8 they are placed in interface classes and we need generate bridge for such function ('isAbstract' will return false).
For JVM6 target function body generated in separate place (DefaultImpl) and method in interface is abstract
For JVM6 target function body is generated in a separate place (DefaultImpls) and
the method in the interface is abstract so we must not generate bridges for such cases.
*/
isBodyOwner: (DeclarationDescriptor) -> Boolean
val descriptor: FunctionDescriptor,
/*
To generate proper bridges for non-abstract function
we should know if the function declaration and its definition in the target platform are the same or not.
For JS and @JvmDefault JVM members they are placed in interface classes and
we need generate bridge for such function ('isAbstract' will return false).
For non-@JvmDefault function, its body is generated in a separate place (DefaultImpls) and
the method in the interface is abstract so we must not generate bridges for such cases.
*/
areDeclarationAndDefinitionSame: (CallableMemberDescriptor) -> Boolean
) : FunctionHandle {
private val overridden = descriptor.overriddenDescriptors.map { DescriptorBasedFunctionHandle(it.original, isBodyOwner) }
private val overridden = descriptor.overriddenDescriptors.map {
DescriptorBasedFunctionHandle(
it.original,
areDeclarationAndDefinitionSame
)
}
override val isDeclaration: Boolean =
descriptor.kind.isReal ||
findInterfaceImplementation(descriptor) != null
override val isDeclaration: Boolean = descriptor.kind.isReal || findInterfaceImplementation(descriptor) != null
override val isAbstract: Boolean =
descriptor.modality == Modality.ABSTRACT ||
isBodyOwner(descriptor.containingDeclaration)
descriptor.modality == Modality.ABSTRACT || !areDeclarationAndDefinitionSame(descriptor)
override val isInterfaceDeclaration: Boolean
get() = DescriptorUtils.isInterface(descriptor.containingDeclaration)

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