Commit Graph

1166 Commits

Author SHA1 Message Date
Alexander Udalov a3055edda9 Minor, move SpecialNames.isSafeIdentifier check a little earlier 2016-04-29 15:21:26 +03:00
Alexander Udalov 785877d1de Combine Java package scope and Kotlin scopes in JvmPackageScope
Use it in LazyJavaPackageFragment#scope instead of a weird lazy chained scope.
Also move lookup tracker records to it, to prevent them from being written in
each package scope individually (this was hurting performance)
2016-04-29 15:21:26 +03:00
Denis Zharkov d259b91143 Add MutableMap.remove(K, V) as built-in declaration
Use PlatformDependent annotation to guarantee it's only be available for JDK8
Also adjust type-safe bridges and mutable collection stubs generation
2016-04-29 15:08:54 +03:00
Denis Zharkov 55c4f875c8 Use signatures instead of fq-names in special built-ins
It's necessary to distinguish overloads,
e.g. MutableMap.remove now has two versions
2016-04-29 15:08:54 +03:00
Valentin Kipyatkov b551886889 Code cleanup: removed redundant semicolons 2016-04-29 11:26:25 +03:00
Stanislav Erokhin 926da77abe Refactoring. Remove getSubstitution from KotlinType. 2016-04-27 14:13:59 +03:00
Stanislav Erokhin 5fe48313e9 Refactoring. Merge CustomSubstitutionCapability, CustomFlexibleRendering and RawTypeTag into RawTypeCapability. 2016-04-27 14:13:58 +03:00
Denis Zharkov fc25d70edc Expand JVM built-ins blacklist
Add Enum.getDeclaringClass, Enum.finalize and List.sort
2016-04-25 17:41:08 +03:00
Denis Zharkov 62f2bddda9 Add AdditionalBuiltInsMembersSignatureListsTest
This test checks that every signature listed within
JvmBuiltInsAdditionalClassPartsProvider corresponds to some real JDK member
2016-04-25 17:41:08 +03:00
Denis Zharkov 7d729a1fe0 Minor. Inline helper properties 2016-04-25 17:41:08 +03:00
Denis Zharkov 9bf2538e4c Introduce predefined enhancement info
It can be used to specify enhanced signature for standard JDK methods
without them be actually annotated

 #KT-9194 In Progress
 #KT-5175 In Progress
 #KT-10370 In Progress
 #KT-7127 In Progress
2016-04-25 17:41:08 +03:00
Denis Zharkov 3bda613317 Minor. Rename BuiltInClassesAreSerializableOnJvm -> JvmBuiltInsAdditionalClassPartsProvider 2016-04-25 17:41:08 +03:00
Denis Zharkov 2819c69bc1 Introduce BLACK_LIST_CONSTRUCTOR_SIGNATURES
To prevent loading senseless constructors to built-in classes from JDK
2016-04-25 17:41:08 +03:00
Denis Zharkov 1efed64014 Use JVM signatures instead of FQ-names for additional built-ins 2016-04-25 17:41:08 +03:00
Denis Zharkov 8cf29ea4f3 Extract JVM descriptors type mapping from backend to core
Also unbind it from ASM types
2016-04-25 17:41:08 +03:00
Denis Zharkov 12bbbb6ff1 Refactor Java resolver components
- Move components from LazyJavaResolverContext to JavaResolverComponents
- Drop LazyJavaClassResolver replacing it's usages with module resolver
(now enum entries from another module as annotation arguments are being resolved, see test)
2016-04-25 17:41:08 +03:00
Denis Zharkov bbbc910e02 Load additional built-in classes constructors from JDK
#KT-9194 In Progress
 #KT-5175 In Progress
 #KT-10370 In Progress
 #KT-7127 In Progress
2016-04-25 17:41:08 +03:00
Denis Zharkov 5bc5722051 Load additional JDK functions into built-ins member scope
#KT-5990 Fixed
 #KT-7127 Fixed
 #KT-10370 Fixed
2016-04-25 17:41:08 +03:00
Denis Zharkov e316ab2ee6 Refactor function descriptors copy mechanism
Pull up CopyBuilder to interface and inline some custom usages
2016-04-25 17:41:08 +03:00
Denis Zharkov 51a4b81d3e Minor. Rename AdditionalSupertypes -> AdditionalClassPartsProvider
And relevant methods
2016-04-25 17:41:08 +03:00
Denis Zharkov 7fe5a9db8d Remove JavaToKotlinClassMap dependency on built-ins instance 2016-04-25 17:41:08 +03:00
Stanislav Erokhin f9130ae133 Do not force calculation of lower and upper bounds in java flexible type. 2016-04-25 15:28:49 +03:00
Stanislav Erokhin 45ac1d2cb5 Refactoring. Remove FlexibleTypeFactoryDeserializer. 2016-04-25 15:28:49 +03:00
Stanislav Erokhin 8f32eeb663 Refactoring. Merge Specificity and NullAwareness into Flexibility. 2016-04-25 15:28:47 +03:00
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