Commit Graph

288 Commits

Author SHA1 Message Date
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
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
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 22797114c7 J2K: correct handling of properties with "is" notation 2015-09-25 13:02:46 +03:00
Valentin Kipyatkov c8b6db4e57 Renamed test data folder 2015-09-25 13:02:46 +03:00
Valentin Kipyatkov c05232bbb7 J2K: generate accessor bodies in expression form if possible 2015-09-25 13:02:46 +03:00
Valentin Kipyatkov ee5a853faa Generate accessor with delegation to super when it's necessary 2015-09-25 13:02:45 +03:00
Valentin Kipyatkov b1b5af8e1e More correct detection of super property 2015-09-25 13:02:45 +03:00
Valentin Kipyatkov 320102bbdb J2K: get/set-methods converted to properties (but lot of TODOs left) 2015-09-25 13:02:45 +03:00
Dmitry Jemerov 4ca434da54 remove support for 'trait' keyword 2015-09-22 15:00:24 +02:00
Valentin Kipyatkov 0cc2158ec1 J2K: do not produce redundant "internal" words for members in an internal class 2015-09-18 15:44:19 +03:00
Valentin Kipyatkov 7caccd7578 J2K: all annotations should be with "@" 2015-09-18 15:44:18 +03:00
Valentin Kipyatkov cc4aa6ed21 J2K: preserving of visibility modifier for override members when access level was higher 2015-09-18 15:44:18 +03:00
Valentin Kipyatkov 6f12db9cde J2K: no explicit type required for public declarations 2015-09-18 15:44:18 +03:00
Valentin Kipyatkov c3ddd5d32b J2K: adapted for default visibility modifier 'public' 2015-09-18 15:44:18 +03:00
Nikolay Krasko ae6731698c Fix test data - Strictfp is not applicable 2015-09-12 21:12:32 +03:00
Natalia Ukhorskaya ee860fdde5 J2K: Insert class body for anonymous classes
#KT-8952 Fixed
2015-09-11 15:21:39 +03:00
Valentin Kipyatkov 97cf562dea Made convert to string template inspection less eager 2015-09-07 19:48:05 +03:00
Valentin Kipyatkov 988b42bba8 J2K to not generate obsolete syntax for accessing java class 2015-09-07 17:44:14 +03:00