Commit Graph

1148 Commits

Author SHA1 Message Date
Stanislav Erokhin feec3566a4 Refactoring. Minor refactoring and cleanup in FlexibleTypes. 2016-04-25 15:28:47 +03:00
Stanislav Erokhin 0a4ad3f267 Refactoring. Rename FlexibleTypeCapabilities -> FlexibleTypeFactory. Also use factory.create instead of DelegatingFlexibleType.create. 2016-04-25 15:28:46 +03:00
Stanislav Erokhin c25e2e34a2 Optimization. Do not create objects for flexible type capabilities. 2016-04-25 15:28:45 +03:00
Alexander Udalov 027cc898e7 Minor, fix warnings in core/ modules 2016-04-17 13:35:17 +03:00
Alexander Udalov 48664a2ba7 Refactor AbstractBinaryClassAnnotationAndConstantLoader#findClassWithAnnotationsAndInitializers
Extract all special cases to getSpecialCaseContainerClass
2016-04-14 21:08:36 +03:00
Alexander Udalov 1f3850da6e Store outer class in ProtoContainer instead of only its kind 2016-04-14 21:08:36 +03:00
Alexander Udalov 88106bb13b Get rid of BinarySource interface, use SourceElement instead 2016-04-14 21:08:36 +03:00
Alexander Udalov ad068ed4ac Do not call findKotlinClass when loading class annotations
The main change is in AbstractBinaryClassAnnotationAndConstantLoader, where we
no longer perform unnecessary IO operations for classes which are already
loaded to memory
2016-04-14 21:08:36 +03:00
Alexander Udalov 7620d66019 Minor, rename PackagePartSource -> BinarySource 2016-04-14 21:08:36 +03:00
Alexander Udalov ac92be12c6 Minor, take ProtoContainer in AnnotationAndConstantLoader#loadClassAnnotations 2016-04-14 21:08:36 +03:00
Alexander Udalov 2ab68d53fa J2K KotlinJvmBinaryClass & AnnotationAndConstantLoader: convert 2016-04-14 21:08:36 +03:00
Alexander Udalov 9c7e4f3dcc J2K KotlinJvmBinaryClass & AnnotationAndConstantLoader: rename .java -> .kt 2016-04-14 21:08:36 +03:00
Alexander Udalov c091bb990b Make LazyJavaPackageFragment#javaScope private 2016-04-14 21:08:36 +03:00
Alexander Udalov a34aaa5955 Move package part-related code from LazyJavaPackageScope to LazyJavaPackageFragment 2016-04-14 21:08:36 +03:00
Alexander Udalov e516b695ae Minor, do not store FqName in LazyJavaClassDescriptor 2016-04-14 21:08:36 +03:00
Alexander Udalov 836a62d4b3 Minor, move resolveKotlinBinaryClass closer to single usage 2016-04-14 21:08:36 +03:00
Dmitry Petrov 4c4141ea49 KT-11410: write multifile class code generation scheme to extra field (xi) in kotlin.Metadata. 2016-04-01 10:13:22 +03:00
Denis Zharkov 935355ad2f Refine isVisible for protected visibility
#KT-7437 Fixed
 #KT-7971 Fixed
 #KT-7051 Fixed
 #KT-6125 Fixed
 #KT-6186 Fixed
2016-03-31 14:51:57 +03:00
Mikhail Glukhikh 4c03aaabd4 Implicit nothing / intersection types are now checked also for member functions #KT-11666 Fixed 2016-03-31 11:59:17 +03:00
Pavel V. Talanov e19cc04c63 KT-11678 Support navigation from Java source to Kotlin binaries
Introduce LightMemberOriginForCompiledElement which holds logic for finding corresponding decompiled declaration
ByJvmSignatureIndexer stores the required information while building decompiled text

Some are unsolved in this commit:
   - constructors
   - @Jvm* and other unregular generated members
   - annotation methods

 #KT-11678 Fixed
2016-03-30 21:35:23 +03:00
Alexander Udalov a8bebeb48d Load annotations of const properties from multifile classes
Rework backing field generation logic in PropertyCodegen to switch the
ClassBuilder instance for a multifile part to that of the corresponding facade
class. This became needed because multifile parts, and their metadata, are
generated _before_ the multifile facade class and otherwise we would never
record that there's a synthetic '$annotations' method for a const val and would
not write that to the protobuf message for the property.

See also bad83200

 #KT-10892 Fixed
2016-03-28 21:11:14 +03:00
Alexander Udalov 8d64ed7f3f Do not produce error classes for not found annotations 2016-03-28 14:13:59 +03:00
Alexander Udalov e915e1548c Fix multiple 'unresolved java classifier' errors
Use the same component (NotFoundClasses) as in loading of compiled Kotlin
symbols.

Some tests were changed to avoid a diagnostic that is now reported when a
non-found class is encountered in a signature (e.g. staticMethod.1.java where
JDK seems to be not configured)

 #KT-10493 Fixed
 #KT-10820 Fixed
 #KT-11368 Fixed
2016-03-28 14:13:59 +03:00
Denis Zharkov 56477f0af8 Fix loading container type from Java
Load immutable flexible upper bound for 'Iterable<? super T>'

We load 'Collection<? super CharSequence>' as 'MutableCollection<in CharSequence>'
instead of 'MutableCollection<in CharSequence>..Collection<*>'
because it's obviously not typesafe to use any 'Collection<*>'
as argument for such type.

But there'se nothing bad with loading 'Iterable<? super CharSequence>'
as 'MutableIterable<*>..Collection<*>'. Same for other declarations that have
covariant mutable representation (currently Iterator, ListIterator).

Also there are useful use-cases when it's neccessary to use 'Iterable<*>'
as an argument for parameter with type 'Iterable<? super T>' (see matchers.kt test).

NB: Star-projections appear in examples because types like 'Collection<in CharSequence>'
with conflicting use-site projections are invalid in Kotlin, but they are valid in Java.
2016-03-21 16:46:46 +03:00
Denis Zharkov c3e44ec199 Fix loading Java type arguments
Type arguments with use variance in java contradicting to Kotlin declaration-site variance should be loaded as star-projections

 #KT-11492 Fixed
2016-03-18 19:07:27 +03:00
Denis Zharkov 838fcf9a57 Load contavariantly projected collections in Java as mutable
#KT-3068 Fixed
2016-03-18 19:07:27 +03:00
Denis Zharkov e54b25a35a Fix StackOverflowError while mapping recursive intersection-type
#KT-10972 Fixed
2016-03-18 19:07:27 +03:00
Alexander Udalov 0fd8bec2ef Convert Java model to Kotlin, put in several files
Also move JavaPropertyInitializerEvaluator to ../components/
2016-03-18 14:48:58 +03:00
Alexander Udalov 0d74fc2290 Minor cleanup in Java model: fix warnings, remove unused 2016-03-18 14:48:57 +03:00
Alexander Udalov 0a54464420 Minor, JavaClass#getOriginKind -> isKotlinLightClass 2016-03-18 14:48:56 +03:00
Alexander Udalov 291c713d8b Cleanup JavaElement model from methods used only in substitutor
Downcast everything used in JavaTypeSubstitutorImpl to *Impl, remove methods
from interfaces, inline/move some of them
2016-03-18 14:48:55 +03:00
Alexander Udalov 26bf0dca13 Remove interface JavaTypeSubstitutor, use implementation
After 151e55b JavaTypeSubstitutor is only used from inside PSI-based
implementation of Java structure
2016-03-18 14:48:55 +03:00
Alexander Udalov 13ae3d96ab Simplify TypeConstructorImpl, extend it from AbstractClassTypeConstructor 2016-03-18 14:20:43 +03:00
Denis Zharkov fecb64560b Minor. Decrease method visibility 2016-03-16 20:23:42 +03:00
Denis Zharkov 26081bf817 Support loading Java annotations with TYPE_PARAMETER target 2016-03-16 20:23:01 +03:00
Denis Zharkov c9c9f7ff38 Minor. Simplify LazyJavaClassMemberScope.getFunctionsFromSupertypes 2016-03-16 20:22:58 +03:00
Denis Zharkov 78c9dffe00 Refine return type of MemberScope.getContributedFunctions 2016-03-16 20:22:58 +03:00
Denis Zharkov 151e55b2fa Use descriptors for building SAM constructors
It helps to get rid of semantics duplicating and fixes known bugs

- SOE in OnlyAbstractMethodFinder.find
- type enhancement for SAM constructors

 #KT-11287 Fixed
 #KT-11322 Fixed
 EA-77989 Fixed
2016-03-10 16:49:00 +03:00
Denis Zharkov b8b48c5f98 Extract common logic into AbstractTypeConstructor
Mostly it's about detecting loops in supertypes

Test data changes:
- Loops are being disconnected in Java classes too
- functions.kt: loops disconnection mechanism runs supertypes calculation,
so when we start check T it forces F' supertypes calculation, that ends
with CYCLIC_GENERIC_UPPER_BOUND reported on F

 #KT-11287 In Progress
2016-03-10 16:49:00 +03:00
Alexander Udalov 4553afbd0c Make PropertyAccessorDescriptor#hasBody a front-end utility 2016-03-03 16:08:18 +03:00
Alexander Udalov 6429dd4b04 Preserve JavaPropertyDescriptor type in substitution/copy
JavaPropertyDescriptor.substitute should return JavaPropertyDescriptor,
similarly to what's happening in JavaMethodDescriptor
2016-03-03 16:08:18 +03:00
Alexander Udalov 371051b1d6 Filter out package members from other facades in KPackageImpl
#KT-10690 Fixed
2016-03-03 16:08:18 +03:00
Valentin Kipyatkov 5aca50b4ca Enhanced constructor descriptor should not loose its source!
#KT-11256 Fixed
2016-03-02 21:43:43 +03:00
Denis Zharkov eb2c584578 Rename JetTypeMapper 2016-03-02 13:38:46 +03:00
Denis Zharkov 4583283515 Search classes by JavaClass through package scope 2016-03-02 13:38:46 +03:00
Denis Zharkov 3652cd9c18 Optimize top level class searching in LazyJavaPackageScope
Do not try to search something, that is known not to exist
2016-03-02 13:38:46 +03:00
Alexander Udalov 1a5a077bd6 Replace map + filterNotNull -> mapNotNull in project 2016-02-20 19:05:30 +03:00
Alexander Udalov 1b8f934b54 Delete deprecated enum 'values' property 2016-02-19 22:28:44 +03:00
Dmitry Petrov 30c2abba3c KT-9550: distinguish signature conflict on override from signature conflict of inherited members.
Add a common OverridingStrategy class for cases where we don't care (yet) about precise diagnostics.
2016-02-19 15:59:08 +03:00
Michael Bogdanov af3437626b Properly calculate isConst for java properties 2016-02-17 16:53:17 +03:00