Commit Graph

670 Commits

Author SHA1 Message Date
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
Nikolay Krasko edeea5e399 Refactoring: move JavaDescriptorResolver extensions to idea-analysis module 2015-05-19 13:04:55 +03:00
Mikhail Glukhikh fdf0ea5546 Enum warnings fixed: deprecated delimiters, short super constructors, both in project and in libraries 2015-05-18 16:08:16 +03:00
Denis Zharkov 02659ca22d Adjust project code to new labels syntax 2015-04-30 10:16:42 +03:00
Dmitry Jemerov cce1be3892 rename JetClass.isTrait() to isInterface(); rename ClassKind.TRAIT to INTERACE 2015-04-29 16:50:19 +02:00
Alexander Udalov 890d18e7be Support external annotations in IDE when approximating flexible types 2015-04-29 01:09:36 +03:00
Alexander Udalov 2271ca1e81 Further simplify Java annotation resolution
Filter annotations by FQ name, get rid of unneeded properties, lazy values,
static import some stuff
2015-04-29 01:09:36 +03:00
Alexander Udalov d7c810a4d0 Copy only nullability/mutability annotations to types
Also don't render copied annotations
2015-04-29 01:09:35 +03:00
Alexander Udalov 3369da94e4 Rename annotationUtils.kt -> LazyJavaAnnotations.kt 2015-04-29 01:03:57 +03:00
Alexander Udalov 24bad39e76 Don't use external annotations in compiler
External annotations will be re-enabled in the IDE later.

This fixes LazyJavaAnnotations which was breaking the contract of Annotations:
findAnnotation(FqName) was looking for external annotations, while iterator()
did not. This resulted in some inconsistencies in the compiler and IDE tests.

The other way, i.e. making iterator() look up external annotations, would have
been too costly for the compiler and with no clear benefit at the moment.
2015-04-29 01:03:57 +03:00
Alexander Udalov fe602d34ce Support type annotations in cls stub builder
Also add test on decompiler
2015-04-29 01:03:56 +03:00