Commit Graph

157 Commits

Author SHA1 Message Date
Natalia Ukhorskaya 9d66852ae2 J2K: convert method references according to special methods 2016-01-25 15:02:48 +03:00
Ilya Gorbunov 31ec7bcbea Deprecate String.concat with error severity.
Fix concat j2k conversion.
Add expected deprecation errors for Java String constructors that must be converted to special Kotlin String methods.
2016-01-22 05:54:38 +03:00
Ilya Gorbunov f4822cd757 Fix testData in compiler: add collections and ranges package to fq-names. 2016-01-22 05:54:38 +03:00
Yan Zhulanow 4cd2ff040d J2K: convert hex Java literal to hex Kotlin literal 2016-01-19 23:29:58 +09:00
Valentin Kipyatkov 552359ce03 KT-7443 Inspection + intention to replace assert (x != null) with "!!" or elvis
#KT-7443 Fixed
2016-01-18 15:34:20 +03:00
Ilya Gorbunov ddcafdd9b3 J2K: Avoid to convert to deprecated String methods, namely toByteArray. 2016-01-14 18:30:44 +03:00
Natalia Ukhorskaya 128440b16f Use intention to simplify for in j2k
#KT-7157 Fixed
2016-01-14 13:41:54 +03:00
Natalia Ukhorskaya 513c4a4562 J2K: transform loops with double, float and char range with while
#KT-899 Fixed
2015-12-18 16:14:17 +03:00
Natalia Ukhorskaya ecdef71580 J2K: cast right operand of equals for primitive types to left operand type
#KT-9997 Fixed
2015-12-18 16:14:16 +03:00
Natalia Ukhorskaya 1d787ed222 J2K: Insert initializer type for properties with primitive type if necessary 2015-12-18 16:14:15 +03:00
Mikhail Glukhikh 3fb04aceb9 Check backing field availability for AnnotationTarget.FIELD #KT-10387 Fixed
Some duplicated checks deleted (UseSiteTargetChecker / JvmFieldApplicabilityChecker)
2015-12-17 15:06:58 +03:00
Natalia Ukhorskaya 3f7b8554dd J2K: parenthesize receiver if needed
#KT-10121 Fixed
2015-12-17 11:11:20 +03:00
Natalia Ukhorskaya f3a6c541ec J2K: Convert usages of kotlin functions from library correctly
#KT-6115 Fixed
2015-12-17 11:11:18 +03:00
Natalia Ukhorskaya 68101eeffa J2K: do not drop formatting for expressions with operator 2015-12-17 11:11:15 +03:00
Alexey Tsvetkov 199827635f Reserve 'typeof' as a keyword 2015-12-10 21:26:41 +03:00
Andrey Breslav 434082cadb 'yield' reserved as a keyword 2015-12-09 17:10:30 +03:00
Denis Zharkov 406e31f54a Change default rules for declaration-site wildcards
Mostly this commit is about skipping wildcards that are redundant in some sense.
The motivation is that they looks `long` in Java code.

There are basically two important parts: return types and value parameters.

1. For return types default behaviour is skipping all declaration-site wildcards.
The intuition behind this rule is simple: return types are basically used in subtype position
(as an argument for another call), and here everything works well in case of 'out'-variance.
For example we have 'Out<Out<T>>>' as subtype both for 'Out<Out<T>>>' and 'Out<? extends Out<? extends T>>>',
so values of such type is more flexible in contrast to `Out<? extends Out<? extends T>>>` that could be used only
for the second case.

But we have choosen to treat `in`-variance in a different way: argument itself
should be rendered without wildcard while nested arguments are rendered by the rules
described further (see second part).

For example: 'In<Out<OpenClass>>' will have generic signature 'In<Out<? extends OpenClass>>'.
If we omit all wildcards here, then value of type 'In<Out<OpenClass>>'
will be impossible to use as argument for function expecting 'In<? super Out<? extends Derived>>'
where Derived <: OpenClass (you can check it manually :]).

And this exception should not be very inconvinient because in-variance is rather rare.

2. For value parameters we decided to skip wildcards if it doesn't make obtained signature weaker
in a sense of set of acceptable arguments.

More precisely:
    a. We write wildcard for 'Out<T>' iff T ``can have subtypes ignoring nullability''
    b. We write wildcard for 'In<T>' iff T is not equal to it's class upper bound (ignoring nullability again)

Definition of ``can have subtypes ignoring nullability'' is straightforward and you can see it in commit.

 #KT-9801 Fixed
 #KT-9890 Fixed
2015-12-01 08:20:59 +03:00
Andrey Breslav 8544a5ab5f Remove "This" keyword 2015-11-30 19:36:33 +03:00
Yan Zhulanow a3ff3ffc45 Fix tests: "Placing function type parameters after the function name" error 2015-11-27 15:51:11 +03:00
Valentin Kipyatkov f98b354bc1 KT-10005 Java to Kotlin: do not convert type cast to cast to nullable if it should not be null
#KT-10005 Fixed
2015-11-24 12:17:51 +03:00
Valentin Kipyatkov d78390e489 KT-10004 Java to Kotlin: array.length is converted to array.size() instead of array.size
#KT-10004 Fixed
2015-11-24 12:17:51 +03:00
Ilya Gorbunov 775755dfac Introduce String.toCharArray() instead of String.getChars()
Make special method conversion for java.lang.String.getChars() in J2K
2015-11-21 00:54:29 +03:00
Mikhail Glukhikh f81a5c06ea Protected in allowed in companion objects but forbidden in other objects, relevant test fixes 2015-11-20 16:32:59 +03:00
Mikhail Glukhikh 4e44466cf9 Exposed visibility deprecation warnings made errors + relevant test fixes 2015-11-20 15:21:01 +03:00
Valentin Kipyatkov 891e033d5b KT-9664 Add quickfix to convert a piece of code to pretty look SAM-style
#KT-9664 Fixed
2015-10-27 15:07:59 +03:00
Alexey Sedunov 3fd6864461 Extraction Engine: When extracting to enum class body, place new declaration after the last entry
#KT-9629 Fixed
2015-10-24 19:50:52 +03:00
Valentin Kipyatkov 66310806ca KT-9628 Intention&inspection to replace use of "set" operator function with []
#KT-9628 Fixed
2015-10-22 18:48:15 +03:00
Valentin Kipyatkov 36ea9cfbfc J2K: fixed conversion of Throwable.getMessage(), Throwable.getCause(), Map.Entry.getKey() and Map.Entry.getValue() 2015-10-21 13:46:57 +03:00
Pavel V. Talanov 300aeb83b0 Fix test data for j2k conversion
(cherry picked from commit e3bac5e)
2015-10-19 16:03:21 +03:00
Svetlana Isakova bb9f7094e0 Report 'TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH'
on call element, not on callee expression
2015-10-19 14:15:05 +03:00
Valentin Kipyatkov fc10fa66be J2K does not convert usages of java "get" methods into "[]" (explicit "operator" modifier is required) 2015-10-19 09:43:13 +03:00
Valentin Kipyatkov 55575b7f10 J2K adds "operator" modifier to methods that look like operator on conversion 2015-10-19 09:43:12 +03:00
Valentin Kipyatkov 4e73fe0f39 Renamed test data folder 2015-10-19 09:43:11 +03:00
Valentin Kipyatkov dc909ac166 J2K: coversion of specially mapped built-in methods + replacing "get" with "[]" where possible 2015-10-19 09:43:11 +03:00
Ilya Gorbunov 7ff0e140f0 Update MockJDK to include Pattern.class required in tests for #KT-7732 2015-10-12 00:13:37 +03:00
Ilya Gorbunov 77a46cab92 J2K: Special conversion for java.lang.String methods: tests for lastIndexOf
#KT-7732
2015-10-12 00:12:55 +03:00
Pavel V. Talanov 679748e1ee j2k tests: INSTANCE$ -> INSTANCE 2015-10-09 16:25:17 +03:00
Michael Bogdanov 60d1736b97 Instance field generation in objects 2015-10-09 16:25:16 +03:00
Natalia Ukhorskaya a2d3607b5b J2K: Generate assert with lambda
#KT-9191 Fixed
2015-10-07 20:29:54 +03:00
Ilya Gorbunov d7da8b7bd3 J2K: Special conversion for java.lang.String methods.
#KT-7732
2015-10-06 18:24:24 +03:00
Valentin Kipyatkov 110d53b4a6 No setter parameter type required 2015-10-05 15:35:17 +03:00
Valentin Kipyatkov 596635270e J2K: more correct comment placement 2015-10-05 15:35:17 +03:00
Valentin Kipyatkov 1fb01dcfbb Minor correction 2015-10-05 15:35:17 +03:00
Ilya Gorbunov ca18613049 J2K: Special conversion for java.lang.String.replaceAll.
#KT-7732
2015-10-05 01:54:21 +03:00
Mikhail Glukhikh 8ab746d6a3 J2K: visibility modifiers are no more applicable to local classes 2015-10-02 12:52:57 +03:00
Pavel V. Talanov caefb2cf50 Adjust test data for converter test
Due to type inference change
2015-10-01 17:53:20 +03:00
Valentin Kipyatkov 94d8e3f4b6 "is" getter naming allowed for non-booleans too 2015-09-29 18:32:25 +03:00
Valentin Kipyatkov 20bddce18d No synthetic property for false get-method like "issue()" 2015-09-29 18:32:25 +03:00
Yan Zhulanow 080dcf882e Minor: fix broken tests 2015-09-26 03:29:09 +03:00
Valentin Kipyatkov c8a244cc40 Minor corrections on code review 2015-09-25 13:02:47 +03:00