Commit Graph

718 Commits

Author SHA1 Message Date
Alexander Udalov 0d9b60dcbc Fix "Class name must not be root" assertion + inline some utilities
Fix EA-60649, EA-65875; do not lookup classes with an empty name.
No test added since no steps to reproduce are known
2015-07-29 23:44:22 +03:00
Alexander Udalov d0562b7b90 Add SourceElement to AnnotationDescriptor
Use KotlinSourceElement in the compiler for annotations resolved from PSI,
introduce ReflectAnnotationSource for reflection
2015-07-29 23:44:18 +03:00
Alexander Udalov 95be8b11f5 Don't write JetValueParameter to the bytecode
The class itself can't be deleted at this point because it's used in the old
bytecode and tools (e.g. proguard) will complain if they can't find it in the
new runtime
2015-07-29 21:36:39 +03:00
Alexander Udalov b0db9c5b03 Fix reflection on enhanced Java methods, call getOriginal()
Also use the provided mechanism for binding overrides instead of a custom for
loop, because it also binds corresponding value parameters
2015-07-29 21:36:38 +03:00
Mikhail Glukhikh 41500c916b java Retention + Repeatable = kotlin.annotation.annotation (but java Repeatable is still intact), a few tests 2015-07-29 16:28:36 +03:00
Michael Nedzelsky e9d7bbf493 fix KT-8648 Exception from incremental compilation
#KT-8648 Fixed
2015-07-29 15:14:45 +03:00
Mikhail Glukhikh b657713f1c JavaAnnotationMapper code cleanup (imports) 2015-07-29 11:36:24 +03:00
Michael Nedzelsky 75f178fec2 JvmProtoBufUtil: add readClassDataFrom(data: ByteArray) 2015-07-28 19:48:54 +03:00
Michael Nedzelsky 459eed7d28 introduce custom options for messages in proto files 2015-07-28 19:48:44 +03:00
Mikhail Glukhikh dbf6da89b7 java.lang.annotation.Repeatable is deprecated + test in a new group: diagnostic tests with Java 8. 2015-07-28 19:03:55 +03:00
Mikhail Glukhikh a86857fbb5 Java Deprecated is mapped in accordance with Java Target / Retention, some diagnostic changed 2015-07-28 17:13:37 +03:00
Pavel V. Talanov 0830e48029 Minor: FakePureImplementationsProvider does not need builtins, just fq names 2015-07-24 13:47:54 +03:00
Pavel V. Talanov 83503b66d2 Minor: get rid of minor KotlinBuiltins.getInstance usage 2015-07-24 13:47:53 +03:00
Mikhail Glukhikh f551d64ea2 Refactoring: AnnotationTarget / AnnotationRetention renamed to KotlinTarget / KotlinRetention
(for not clashing with the same built-in classes)
2015-07-22 19:01:25 +03:00
Mikhail Glukhikh 414c44ade5 Make retention of 'kotlin.annotation.annotation' to SOURCE. Serialize / deserialize it instead. Some fixed tests. 2015-07-22 19:00:51 +03:00
Mikhail Glukhikh 11f87e6ca1 No more java Target / Retention loaded. Render java Retention / Target. Related test changes. 2015-07-22 19:00:39 +03:00
Mikhail Glukhikh c2480d1183 Java to Kotlin annotation retention mapping + new test + JvmLoader test adaptation 2015-07-22 19:00:26 +03:00
Zalim Bashorov 1a96b45f27 To avoid NoSuchMethodError when overriden method declare more specific return type and the super method has an argument with default value (KT-5785) 2015-07-21 22:27:26 +03:00
Zalim Bashorov df4f43267b Provide location parameter in delegations 2015-07-21 22:27:26 +03:00
Zalim Bashorov 41449c107e Location.NOWHERE -> UsageLocation.NO_LOCATION 2015-07-21 22:27:25 +03:00
Zalim Bashorov e2e3520c3d Add location parameter to JetScope::getClassifier 2015-07-21 22:27:25 +03:00
Zalim Bashorov 0f92036353 Add location parameter to JetScope::getFunctions 2015-07-21 22:27:25 +03:00
Zalim Bashorov f79155df97 Add location parameter to JetScope::getProperties 2015-07-21 22:27:24 +03:00
Dmitry Jemerov aa1f6f2252 code cleanup: core modules 2015-07-21 16:21:45 +02:00
Valentin Kipyatkov 4cfe92f1e5 Renamed method 2015-07-21 16:00:10 +03:00
Mikhail Glukhikh 9e7a67fabf Warning about java.lang.annotation.Target annotation usage 2015-07-21 15:20:37 +03:00
Mikhail Glukhikh 1309c1f95f Annotation mapper is introduced to map java annotation targets to kotlin targets + a set of new / fixed tests 2015-07-21 15:20:31 +03:00
Denis Zharkov 97af85da9c Change default upper bound of Java type parameters to Any!
#KT-7672 Fixed
2015-07-21 15:16:05 +03:00
Ilya Ryzhenkov 84236992cb Replace Injected properties with constructor parameters when it doesn't cause cycles 2015-07-20 20:58:19 +03:00
Valentin Kipyatkov c1b2ea0b48 More elegant way to achieve the same + fixed KT-7746 Top level package name completion does not work inside class body
#KT-7746 Fixed
2015-07-16 14:03:37 +03:00
Valentin Kipyatkov 17442617bb Synthetic extensions suggested in completion 2015-07-16 13:49:13 +03:00
Valentin Kipyatkov c92b43c94b Added JetScope.getSyntheticExtensionProperties() 2015-07-16 13:49:13 +03:00
Pavel V. Talanov c313887641 Split CompileTimeConstant into two entities
1. ConstantValue
	* just holds some value and its type
	* implementations for concrete constants
2. CompileTimeConstant
	* is only produced by ConstantExpressionEvaluator
	* has additional flags (canBeUsedInAnnotation etc)
	* has two implementations TypedCompileTimeConstant containing a constant value
		and IntegerValueConstant which does not have exact type
	* can be converted to ConstantValue

Adjustt usages to use ConstantValue if flags are not needed
Add tests for some uncovered cases
2015-07-16 02:28:05 +03:00
Pavel V. Talanov 5dc5d77e60 Inject builtins in constants 2015-07-15 21:09:52 +03:00
Pavel V. Talanov ea1a85e78c Introduce CompileTimeConstantFactory 2015-07-15 21:09:40 +03:00
Pavel V. Talanov b0a4520710 Refactor compile constants to reduce boolean parameter hell 2015-07-15 20:57:02 +03:00
Pavel V. Talanov f97767e159 Drop ArrayValue redundant constructor parameter 2015-07-15 20:56:55 +03:00
Pavel V. Talanov ae88dd3f1f Convert compile constant classes to kotlin: prettify 2015-07-15 20:56:48 +03:00
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