Commit Graph

49937 Commits

Author SHA1 Message Date
Mikhail Glukhikh 700bcb5984 Unused symbol: fix false positives on inline class constructors
#KT-27434 Fixed
2018-10-27 12:13:52 +03:00
Mikhail Glukhikh 506f7aaa68 Replace toString with string template: fix grammar 2018-10-27 12:13:50 +03:00
Mikhail Glukhikh 6e10235208 Make "Add name(s) to call arguments" available for generic arguments
#KT-15550 Fixed
2018-10-27 12:13:42 +03:00
peter e93a90bc09 fix some cases of "Cls delegate shouldn't be loaded for not too complex ultra-light classes" 2018-10-26 20:41:56 +02:00
Alexander Udalov cfffd21fa9 Fix KtLightAnnotationsValues.kt for 173
See 17076cd05e
2018-10-26 20:17:52 +02:00
Mikhail Glukhikh cb92009862 Fix maven build + ~50 compiler tests broken by UNUSED_PARAMETER in main 2018-10-26 19:51:20 +03:00
peter c54eb7db97 Merge remote-tracking branch 'origin/master' 2018-10-26 18:44:12 +02:00
peter cd1560e0b4 provide correct context for method return type
to fix generics in

class A<E> {
   fun foo(): E = null!!
}

public class B {
   public static void main(String[] args) {
       A<String> a = new A<>();
       a.foo().length(); // Unresolved length, because it thinks that `a.foo()` returns E
   }
}
2018-10-26 18:42:41 +02:00
Vyacheslav Gerasimov 87af14849d as34: Restore compatibility with 183 platform in AS 3.4 2018-10-26 18:25:22 +03:00
Vyacheslav Gerasimov 99924c3df5 as34: Update idea-version 2018-10-26 18:25:21 +03:00
Vyacheslav Gerasimov c6ecc6c21c as34: Update versions.gradle.kts 2018-10-26 18:25:21 +03:00
Vyacheslav Gerasimov 4076923a26 as34: Apply changes from AS 3.3 2018-10-26 18:25:20 +03:00
Vyacheslav Gerasimov 25e6916469 Derive as34 bunch from 183 2018-10-26 18:24:33 +03:00
Nikolay Krasko 7009b261d6 Don't rank local classes (KT-27712)
Allow enable ranking even for single source file in tests

 #KT-27712
2018-10-26 18:02:36 +03:00
Nikolay Krasko 214785d9b7 Do not ruin breakpoints when there's failure in ranking (KT-27712) 2018-10-26 18:02:36 +03:00
Nikolay Krasko 8d7829be31 Allow to assert rank value in ranking test
Update test data for lambdas.kt because of same rank check bug fixed.
2018-10-26 18:02:36 +03:00
Nikolay Krasko 122fba20da Do not wait for not generated classes in LowLevelDebuggerTestBase 2018-10-26 18:02:35 +03:00
Nikolay Krasko 651d76f4ef Allow disable strict mode in ranking tests 2018-10-26 18:02:35 +03:00
Andrey Uskov 1c7cab61c9 Add platform AS34 2018-10-26 17:58:11 +03:00
Ilya Gorbunov c833272392 stdlib-gen, minor: rename property 2018-10-26 16:27:43 +03:00
Ilya Gorbunov 138ab13364 Remove experimental coroutines usages from stdlib generator 2018-10-26 16:27:42 +03:00
Mikhail Glukhikh e39953c4a0 Check also drop-box content in multi-module line marker tests
Related to KT-26957
2018-10-26 16:21:49 +03:00
Alexander Udalov f4c77ec66f Minor, rework groovyTraitsWithFields integration test
Declaring Groovy and Kotlin classes in the same project is not necessary
for this test, split them to two projects instead to avoid the hack with
modifying task dependencies manually
2018-10-26 14:40:13 +02:00
Nicolay Mitropolsky 274fcd6237 183: PsiElementChecker: the 55-th method textRangeInParent was added in 183 2018-10-26 15:09:19 +03:00
Nicolay Mitropolsky 23d2269aac 183: Update IDEA version to 183.3975.18 2018-10-26 12:13:22 +03:00
Pavel Punegov 4d5b00d3e3 Ignore test in native: uses Array.fill 2018-10-26 11:33:14 +03:00
Mikhael Bogdanov 09d0d2c71c Keep android tests in libs/test folder
To avoid 'com.android.dex.DexException: Too many classes in --main-dex-list, main dex capacity exceeded
2018-10-26 09:51:14 +02:00
Alexander Udalov 9df02b2366 Support Groovy $Trait$FieldHelper classes in new class file reader
Preface: for Groovy traits with fields, the Groovy compiler generates
synthetic "$Trait$FieldHelper" classes which posed several problems to
our class file reader, caused by the fact that the contents of the
InnerClasses attribute broke some assumptions about how names on the JVM
are formed and used.

For a trait named `A`, the Groovy compiler will additionally generate a
synthetic class file `A$Trait$FieldHelper` with the following in the
InnerClasses attribute:

InnerClasses:
     public static #15= #2 of #14; //FieldHelper=class A$Trait$FieldHelper of class A

i.e. the simple name of the class is `FieldHelper`, the name of its
outer class is `A`, but the full internal name is `A$Trait$FieldHelper`,
which is surprising considering that the names are usually obtained by
separating the outer and inner names via the dollar sign.

Another detail is that in some usages of this synthetic class, the
InnerClasses attribute was missing at all. For example, if an empty
class `B` extends `A`, then there's no InnerClasses attribute in `B`'s
class file, which is surprising because we might decode the same name
differently depending on the class file we encounter it in.

In this change, we attempt to treat these synthetic classes as top-level
by refusing to read "invalid" InnerClasses attribute values (they are
not technically invalid because they still conform to JVMS), fixing the
problem of "unresolved supertypes" error which occurred when these
classes were used as supertypes in a class file in a dependency.

1) In ClassifierResolutionContext.mapInternalNameToClassId, do not use
   the ad-hoc logic (copy-pasted from intellij-core) to determine class
   id heuristically from the internal name. For $Trait$FieldHelper
   classes this logic attempted to replace all dollar signs with dots,
   which was semantically incorrect: dollars there were used as
   synthetic characters, not as a separator between outer and inner
   classes.
2) In isNotTopLevelClass (Other.kt), only consider "valid" InnerClasses
   attribute values, where the full name of the class is obtained by
   separating the outer name and the inner name with a dollar character.
   This way, we'll be able to treat class files with invalid attribute
   values as top-level and avoid breaking any other assumptions in the
   class file loader.
3) In BinaryJavaClass.visitInnerClass, record all valid InnerClasses
   attribute values present in the class file, not just those related to
   the class in question itself. This is needed now because previously,
   the removed heuristics (see p.1) transformed mentioned inner class
   names to class ids correctly >99% of the time. Now that the
   heuristics are gone, we'll use the information present in the class
   file to map names correctly and predictably. According to JVMS, this
   attribute should contain information about all inner classes
   mentioned in the class file, and this is true at least for class
   files produced by javac.

 #KT-18592 Fixed
2018-10-25 22:15:22 +02:00
Yan Zhulanow cd88209cf4 Fix Android Extension imports resolution after project reopening (KT-27793) 2018-10-25 23:10:41 +03:00
peter beba8f215e fix registry bean registration for ultra-light classes 2018-10-25 19:54:35 +02:00
Mikhael Bogdanov 0edd2d326b Add LocalVariablesSorter to MethodRemaper in RemappingClassBuilder to keep old behavior
#KT-27774 In Progress
2018-10-25 19:53:27 +02:00
Mikhael Bogdanov 0468a354e0 Get rid of deprecated asm remapping api
#KT-27774 In Progress
2018-10-25 19:53:20 +02:00
Toshiaki Kameyama ad8c58d176 Lift return out refactoring: extract function for problem report 2018-10-25 19:51:36 +03:00
Toshiaki Kameyama 3e6007e3d3 Lift return out: report also on 'return' keywords #KT-27173 Fixed 2018-10-25 19:51:36 +03:00
Toshiaki Kameyama f771ed5dd8 Reformat & cleanup: LiftReturnOrAssignmentInspection 2018-10-25 19:51:35 +03:00
peter ebc998d710 add ultra-light classes/members that work without backend in simple cases 2018-10-25 18:22:33 +02:00
Mikhail Glukhikh 387efc3791 Highlight unused parameters in main function in 1.3 (KT-26999) 2018-10-25 19:11:45 +03:00
Mikhail Glukhikh 17da136420 KotlinPsiCheckerAndHighlightingUpdater: convert to Kotlin 2018-10-25 19:11:43 +03:00
Mikhail Glukhikh b73bcbb06d KotlinPsiCheckerAndHighlightingUpdater: .java -> .kt 2018-10-25 19:11:42 +03:00
Mikhail Glukhikh f3555daa60 Report UNUSED_PARAMETER on main parameter in 1.3+ #KT-26999 Fixed 2018-10-25 19:10:39 +03:00
Mikhail Glukhikh b9161c5293 Gradle configurator: handle kotlin options correctly with new-mpp plugin
#KT-27052 Fixed
2018-10-25 18:13:08 +03:00
Mikhail Glukhikh d050629589 Show expect / actual for parameters & enum entries in drop-box
#KT-26957 Fixed
2018-10-25 18:11:47 +03:00
Mikhail Glukhikh bb19d4c598 Do not create expect / actual markers for parameters & enum entries
Part of KT-26957
2018-10-25 18:11:45 +03:00
Alexander Udalov 17076cd05e Support class literal values in light annotations correctly
Map Kotlin built-in classes (e.g. Throwable) to corresponding Java
classes, do not map Unit to void, support arrays of primitives and
arrays of wrapper types
2018-10-25 16:27:23 +02:00
Alexander Udalov 266a8dae3f Fix KClassValue behavior for reified type parameter literals
#KT-27799 Open
2018-10-25 16:27:23 +02:00
Alexander Udalov c1ab08c8ce Refactor KClassValue to store ClassLiteralValue internally
Only invariant array projections and non-null element types will be
supported soon (see KT-26568), so it makes no sense to store the
complete type in KClassValue. What we need is only the ClassId of the
class, and the number of times it's wrapped into kotlin/Array, which is
exactly what ClassLiteralValue represents.

This change helps in decoupling annotation values from
descriptors/types. The only constant value that depends on descriptors
is now AnnotationValue.

 #KT-26582 Fixed
2018-10-25 16:27:23 +02:00
Alexander Udalov bad30a4b99 Add module to ExperimentalMarkerDeclarationAnnotationChecker
Will be used in a subsequent commit
2018-10-25 16:27:22 +02:00
Alexander Udalov 2ab33026fb Move ClassLiteralId to 'descriptors', rename to ClassLiteralValue 2018-10-25 16:27:22 +02:00
Alexander Udalov 19c79b906f Minor, add utility to get class name from StringTable via ClassId 2018-10-25 16:27:22 +02:00
Alexander Udalov 9183d7ca27 Add ModuleDescriptor to AnnotationCodegen 2018-10-25 16:27:22 +02:00