Commit Graph

680 Commits

Author SHA1 Message Date
Pavel V. Talanov 44dffa7bbc Minor: remove a couple of usages of KotlinBuiltIns.getInstance() 2015-07-15 19:44:17 +03:00
Denis Zharkov d19cb747be Emit not-null assertions for enhanced types 2015-07-15 10:01:14 +03:00
Valentin Kipyatkov d32ba08cb7 KT-8394 ReplaceWith for Delegates.lazy fails outside of stdlib
#KT-8394 Fixed
2015-07-13 19:41:42 +03:00
Alexander Udalov c62f19ee82 Move getterName/setterName to JvmAbi
Reuse in RuntimeTypeMapper in reflection
2015-07-10 20:10:13 +03:00
Alexander Udalov 9b832d4b87 Container of value parameter is always a callable 2015-07-10 20:10:12 +03:00
Alexander Udalov c3b97e0668 Simplify function hierarchy in reflection
Get rid of all classes except kotlin.reflect.KFunction, which will be used to
represent all kinds of simple functions.

Lots of changes to test data are related to the fact that KFunction is not an
extension function (as opposed to KMemberFunction and KExtensionFunction who
were) and so a member or an extension function reference now requires all
arguments be passed to it in the parentheses, including receivers. This is
probably temporary until we support calling any function both as a free
function and as an extension. In JS, functions and extension functions are not
interchangeable, so tests on this behavior are removed until this is supported
2015-07-10 20:10:08 +03:00
Denis Zharkov 8b49a1d660 Add PurelyImplements annotation
It's parameter is FQ-name of class (currently only from builtins) that added as supertype to annotated Java class.

Parameters of annotated class used as non-flexible arguments of added supertype, that helps to propagate more precise types when using in Kotlin.
Some standard JDK collections loaded as they annotated with PurelyImplements.

See tests for clarification.
Before: ArrayList<Int>.add(x: Int!) // possible to add null
After: ArrayList<Int>.add(x: Int)   // impossible to add null

 #KT-7628 Fixed
 #KT-7835 Fixed
2015-07-09 16:36:47 +03:00
Denis Zharkov e13f34a8a0 Minor. Use getOrElse from stdlib 2015-07-09 16:36:43 +03:00
Denis Zharkov fd43799c6e Use original descriptor when working with errors in KotlinSignature
Otherwise enhanced version are treated differently
2015-07-09 16:36:43 +03:00
Denis Zharkov 1469a0aa6f Make computation of indexed JavaTypeQualifiers eager 2015-07-09 16:36:42 +03:00
Denis Zharkov c01c59d562 Use doSubstitute when enhacing types of Java method
Before this commit old type parameters were inserted into new descriptor,
and that broke a simple contract: desc.child.getContainingDeclaration() == desc.

We use `doSubstitute` here because it does exactly what we need:
1. creates full copy of descriptor
2. copies method's type parameters (with new containing declaration) and properly substitute to them in value parameters, return type and etc.

But we had to customize `doSubstitute`: add some parameters like `newReturnType`

NOTE: Strange testData change.
(Mutable)List<in T!>! after substitution becomes MutableList<in T!>..List<*>?.

But it's not wrong because List<in T> behaves exactly as List<*>, and the same happens when substituing Java class scope:
public class A<E> {
    <T> void foo(List<? super T> x) {}
}

Kotlin:
A.foo(), type of first value parameter --- (Mutable)List<in T!>
A<String>().foo(), type of first value parameter --- MutableList<in T!>..List<*>?
2015-07-09 16:36:42 +03:00
Denis Zharkov f6c4ec1533 Move creation of enhanced ValueParameterDescriptor to JavaCallableMemberDescriptor
It's needed because new parameter owner is not created while enhacing types
(It was containing declaration of old value parameter that is wrong)

Also simplified SignatureParts' logic: `replaceType` is always an identity function
2015-07-09 16:32:25 +03:00
Denis Zharkov 4710168c5a Minor. Specify visibility for some declarations in typeEnhacement 2015-07-09 16:32:25 +03:00
Denis Zharkov c769748cb0 Move type enhacement parts to separate package in runtime
It's needed to enhace types when loading descriptors via reflection.
Also get rid of `enhanceSignatures` method in ExternalSignatureResolver as enhancement does not use external signature at all
2015-07-09 16:32:25 +03:00
Andrey Breslav c6b91b0f81 Java type annotations supported in LazyJavaTypeResolver 2015-07-09 16:32:25 +03:00
Andrey Breslav eaae88133c Minor FilteredAnnotations moved out of Java-specific code 2015-07-09 16:32:25 +03:00
Andrey Breslav 31f4ff749c Type annotations supported in Java elements
Reflection-related implementations are pending
2015-07-09 16:32:25 +03:00
Andrey Breslav 694af022c8 Type Enhancement for Java fields and constructors supported as well 2015-07-09 16:32:25 +03:00
Andrey Breslav a8b5698145 Proper enhancement for SAM adapters 2015-07-09 16:32:25 +03:00
Andrey Breslav f376b2ba70 Stub infrastructure for enhancing platform signatures 2015-07-09 16:32:24 +03:00
Andrey Breslav 991f0fcf2e Type enhancement and qualifier extraction 2015-07-09 16:32:24 +03:00
Andrey Breslav d140e83386 Minor. Methods renamed to reflect tha fact that they handle more types than just collections 2015-07-09 16:32:24 +03:00
Andrey Breslav 579ca9c1f2 Minor. Typo 2015-07-09 16:32:24 +03:00
Andrey Breslav 2de3a3b59e Minor. Rename addToScope -> addFakeOverride 2015-07-09 16:32:24 +03:00
Alexander Udalov f9afb4f95b Make CLASS default class kind in binary metadata
Don't write the kind to the class file if it's CLASS to save some bytes
2015-07-06 16:19:57 +03:00
Alexander Udalov feb4dd7b8f Drop 'OBJECT$' field deprecated in M11 2015-07-06 16:19:54 +03:00
Alexander Udalov cd847b7cb9 Minor, make JavaMethod#getReturnType non-null
PsiMethod#getReturnType only returns null for constructors, and JavaMethod is
not created for constructors (JavaConstructor is)
2015-07-03 15:32:17 +03:00
Ilya Gorbunov 86f4a1b6e4 Compiler&plugin deprecations cleanup: replace streams with sequences. 2015-06-29 17:06:40 +03:00
Ilya Gorbunov 5779b89ff0 Deprecations cleanup: sequence -> asSequence 2015-06-29 17:06:33 +03:00
Denis Zharkov eb7114bd53 Add 'constructor' keyword in whole project where needed 2015-06-12 09:55:15 +03:00
Denis Zharkov 9245cfaa7f Load Class-object from java annotated entity as KClass 2015-06-12 09:55:08 +03:00
Denis Zharkov 2e284718ce Revert "Create additional constructor for java annotation with Class-parameter"
This reverts commit 8f0e290dec.
2015-06-12 09:55:06 +03:00
Denis Zharkov 9080b57635 Revert "Load annotation parameter's type for ctr as contravariant"
This reverts commit 294eb1dceb.
2015-06-12 09:55:03 +03:00
Denis Zharkov 200dee2761 Replace deprecated annotations in whole project 2015-06-12 09:23:32 +03:00
Alexander Udalov 64b60718e3 Finish off old deprecated function/extension function classes
This reverts commit d14e5b8a72.
2015-06-10 14:41:57 +03:00
Alexander Udalov 5394abc83e Don't use reflection in JetType.getCapability 2015-06-10 14:41:56 +03:00
Alexander Udalov d4c18b3d55 Drop PsiBasedMethodSignatureChecker 2015-06-10 14:41:56 +03:00
Valentin Kipyatkov a1ff2f20ed Got rid of DescriptorRendererBuilder providing new scheme for creating DescriptorRenderer's 2015-06-10 11:34:58 +03:00
Alexander Udalov b474fa9278 Refactor fictitious function class kinds, reuse in J<->K map 2015-06-04 23:08:21 +03:00
Alexander Udalov d1df234cfe Support annotations as annotation arguments in reflection, add test
A follow-up to 281acb8 where this was supported in the compiler
2015-06-02 17:31:19 +03:00
Alexander Udalov dff3e17d88 Minor, swap order of parameters for clarity 2015-05-28 22:09:24 +03:00
Alexander Udalov d14e5b8a72 Restore and deprecate Function{n}/ExtensionFunction{n} classes for easier migration
Users' Java code will not break in common cases (when passing functions to
Kotlin), and deprecation warnings will be reported.

Provide an inspection with a quick fix which allows to replace deprecated
function class usages to the new classes. Include this fix to the "code
cleanup" action
2015-05-28 01:20:05 +03:00
Valentin Kipyatkov 281acb860e Loading of annotation class arguments from compiled classes 2015-05-27 16:15:50 +03:00
Alexander Udalov 48b18f18d3 Restore explicit imports of Kotlin function types in Java
This is a follow-up to 738a84e259 and
d4965a4f3e. Optimize imports in all files
affected in those commits, drop temporary _.kt
2015-05-26 18:46:27 +03:00
Alexander Udalov 34c6af0039 Advance stub and JVM ABI versions due to function type reform 2015-05-26 15:04:58 +03:00
Alexander Udalov 4141e0a8df Introduce fictitious numbered Function class descriptors 2015-05-26 15:04:54 +03:00
Alexander Udalov 738a84e259 Temporary hack to migrate functions to package kotlin.jvm.functions
Add a file in package 'kotlin.jvm.functions' to the project and replace
explicit imports of functions 'kotlin.Function{n}' to two imports 'kotlin.*'
and 'kotlin.jvm.functions.*', so that the codebase can be compiled both by the
old and by the new compiler
2015-05-26 15:04:34 +03:00
Michael Nedzelsky 6b64dcc4ee JvmProtoBuf: reuse one instance of ExtensionRegistryLite 2015-05-21 02:30:35 +03:00
Michael Nedzelsky ea8234adb9 convert JvmProtoBufUtil.java to kotlin, step 2: convert content 2015-05-21 02:30:32 +03:00
Michael Nedzelsky 2a6cd3dd96 convert JvmProtoBufUtil.java to kotlin, step 1: rename extentsion 2015-05-21 02:30:27 +03:00