Slide 1

Slide 1 text

+,ίϯόʔλΛΧελϚΠζ͢Δ MPWF@LPUMJOWPM QBSBZB ͠Ύͬͪΐ͏͹Μ

Slide 2

Slide 2 text

ࣗݾ঺հ ɾ ࡾӜՂ༞QBSBZB ɾ גࣜձࣾΠάχεॴଐ ɾ XJUI"OESPJE୲౰ ɾ ,PUMJO͸ͷࠒ͔Β ೥ఔ

Slide 3

Slide 3 text

ςʔϚ ɾ +BWB͔Β,PUMJOʹม׵͢Δͷ͸ͱͯ΋େม ɾ ,PUMJOԽ͢Δ্Ͱ௨ৗͷํ๏Ҏ֎ʹ΋΍Γํ ͸͋Δ

Slide 4

Slide 4 text

΋͘͡ ɾ +BWB͔Β,PUMJOʹม׵͢Δࡍʹۤ࿑͢Δ఺ ɾ +,ίϯόʔλΛΧελϚΠζ

Slide 5

Slide 5 text

+BWB͔Β,PUMJOʹม׵͢Δ ࡍʹۤ࿑͢Δ఺

Slide 6

Slide 6 text

௨ৗ+BWB͔Β,PUMJOʹม׵͢ Δࡍ͸ɺ"OESPJE4UVEJP *OUFMMJK*%&"͔Βίϯόʔτ͢ Δͱࢥ͍·͢

Slide 7

Slide 7 text

"OESPJE4UVEJP*OUFMMJK*%&" Ͱͷ+,ίϯόʔτ ϝχϡʔ ➔ Code ➔ Convert Java File to Kotlin File

Slide 8

Slide 8 text

ͨͩ͠ɺ͜ͷ௨ৗͷ+,ίϯ όʔλΛ༻͍ͨ,PUMJOԽͷํ ๏ʹ͸໰୊͕͋Γ·ͨ͠

Slide 9

Slide 9 text

+,ίϯόʔλ͕ڧ੍తʹ /PO/VMMม׵ͯ͠͠·͏ ໰୊

Slide 10

Slide 10 text

७ਖ਼+,ίϯόʔλ͕ڧ੍తʹ /PO/VMMม׵͢Δ໰୊ public interface SampleInterface { String getText(Context context); int getValue(Context context); } interface SampleInterface { fun getText(context: Context): String fun getValue(context: Context): Int } /VMMBCMFͳ ίʔυͩͬͨͷ͕ /PO/VMMίʔυʹ ม׵͞Εͯ͠·͏ ʁ͕ͳ͍ʂ +BWB ,PUMJO

Slide 11

Slide 11 text

७ਖ਼+,ίϯόʔλ͕ڧ੍తʹ /PO/VMMม׵͢Δ໰୊ +BWBίʔυଆ͔Β͸/PU/VMMΞϊςʔγϣϯ෇͍ͯ ΔͷʹOVMMΛ୅ೖͯ͠ΔΑXBSOJOH͕දࣔ͞Εͯ͠ ·͏ʂʂ +BWB

Slide 12

Slide 12 text

७ਖ਼+,ίϯόʔλ͕ڧ੍తʹ /PO/VMMม׵͢Δ໰୊ Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter context at org.paradrops.sample.SampleClass.getText(SampleClass.kt) at org.paradrops.sample.Main2Activity.onCreate(Main2Activity.java:14) at android.app.Activity.performCreate(Activity.java:6664) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599) IllegalArgumentException: Parameter specified as non-null is null Ϋϥογϡͯ͠͠·͏ʂʂ

Slide 13

Slide 13 text

७ਖ਼+,ίϯόʔλ͕ڧ੍తʹ /PO/VMMม׵͢Δ ɾ ਌$MBTT*OUFSGBDFBCTUSBDUΫϥεͳͲϝιο υΛܧঝPS࣮૷ͨ͠৔߹ɺҾ਺ʹ/VMMBCMFΞ ϊςʔγϣϯ͕ͳ͍৔߹͸+,͕/PO/VMMม׵ ͯ͠͠·͏ ɾ ,PUMJO͸/PO/VMMɺ+BWB͸/VMMBCMF؀ڥʹͳͬ ͯ͠·͍ͱͯ΋Ϋϥογϡ͠΍͍͢

Slide 14

Slide 14 text

Ͳ͏ղܾ͢Δ͔ʁ ղܾࡦ͸ͲΜͳ΋ͷ͕͋Δ͔ʁ

Slide 15

Slide 15 text

ղܾҊ ɾ ख௚͠Ҋɿ֤Ҿ਺໭Γ஋ͷܕͷ/VMMBCMF /PO/VMM͕ਖ਼͍͔͠ɺ໨ࢹͰνΣοΫͯ͠ख ௚͢͠Δ ɾ શಈ࡞νΣοΫҊɿͱΓ͋͑ͣ,PUMJOԽͯ͠ ΞϓϦͷશಈ࡞νΣοΫͯ͠मਖ਼͢Δ

Slide 16

Slide 16 text

ͲͪΒ΋͵͘΋ΓҲΕ͍ͯΔର ԠͰͱͯ΋΍Γͨ͘ͳ͍ ,PUMJOԽ͢Δͱߦͷίʔυ ม׵ͱ͔ී௨ʹ͋Δɻ ͦΕΛख࡞ۀͰमਖ਼ͨ͠ίʔυ ͷϨϏϡʔ͢Δͷ͸ਏ͗͢Δ

Slide 17

Slide 17 text

͜͜·Ͱߟ͑ͯҰͭ ࢥ͍͖ͭ·ͨ͠

Slide 18

Slide 18 text

,PUMJOͬͯ044ͩ͠ ίϯόʔλΛվ଄͢Ε͹Α͍ ͷͰ͸ʜʁ

Slide 19

Slide 19 text

+BWB͸/VMMBCMF͕ඪ४ͩ͠ɺ ,PUJOଆ΋Ҿ਺ͱ໭Γ஋Λ /VMMBCMFʹ͢Ε͹͍͚ͦ͏

Slide 20

Slide 20 text

΍ΔՁ஋͸͋Δ

Slide 21

Slide 21 text

+,ίϯόʔλΛ ΧελϚΠζ͢Δ

Slide 22

Slide 22 text

+,ίϯόʔλΧελϚΠζ· Ͱͷεςοϓ ɾ ,PUMJOͷ։ൃ؀ڥΛ༻ҙ͢Δ ɾ ,PUMJOͷ5ZQF$POWFSUFSLUΛฤू͢Δ ɾ ,PUMJOΛνϟΠϧυ*%&"࣮ߦ͢Δ ɾ ίʔυΛίϯόʔτͯ͠ΈΔ

Slide 23

Slide 23 text

,PUMJOͷ։ൃ؀ڥΛ༻ҙ ɾ *OUFMMJ+*%&" ɾ +%, ɾ CSFXJOTUBMMBOU ɾ IUUQTHJUIVCDPN+FU#SBJOTLPUMJO ɾ ৄࡉ͸!TIJSBKJ͞ΜͷϒϩάهࣄͳͲͰIUUQT TIJSBKJHJUIVCJPCMPHIPXUPLPOUSJCVUF WTFUVQ

Slide 24

Slide 24 text

,PUMJOͷ5ZQF$POWFSUFSLUΛฤ ू͢Δ IUUQTHJUIVCDPN+FU#SBJOTLPUMJOCMPCNBTUFS KLTSDPSHKFUCSBJOTLPUMJOKL5ZQF$POWFSUFSLU fun variableNullability(variable: PsiVariable): Nullability = Nullability.Nullable fun methodNullability(method: PsiMethod): Nullability = Nullability.Nullable

Slide 25

Slide 25 text

,PUMJOΛνϟΠϧυ*%&"࣮ߦ͢ Δ

Slide 26

Slide 26 text

࣮ࡍʹ,PUMJOίʔυίϯόʔτ ͯ͠ΈΔ public interface SampleInterface { String getText(Context context); int getValue(Context context); } interface SampleInterface { fun getText(context: Context?): String? fun getValue(context: Context?): Int } /VMMBCMFͳ +BWBίʔυ ͩͬͨͷ͕ ͔ͬ͠Γͱ /VMMBCMFΛ อ࣋ͨ͠·· ม׵͞Ε͍ͯΔ +BWB ,PUMJO

Slide 27

Slide 27 text

࣮ࡍʹΧελϜ+,Ͱίϯόʔ τͨ͠ίʔυΛ࢖ͬͯΈΔ /VMMBCMFʹOVMMΛ୅ೖ͢Δͷ͸ී௨ͷ͜ͱͳͷͰ XBSOJOH͸ग़ͣɺΫϥογϡ΋͠ͳ͍ ར༻͢Δ+BWBίʔυଆʹมߋΛՃ͑Δඞཁͳ͠

Slide 28

Slide 28 text

ͿͬͪΌ͚ΧελϜίϯόʔλ ͷ࢖༻ײͲ͏ʁ ɾ ࢖͍࢝Ίͨͷ͸ࠓ೥ͷࠒ ɾ ϦϦʔε➔Ϋϥογϡ➔IPUGJYͷܹݮ ɾ ίϯόʔλ͕ੜ੒͢Δίʔυʹ৴པײˠίʔ υϨϏϡʔͷ؆ૉԽ ɾ ,PUMJOԽ͕ؾܰʹͰ͖ΔΑ͏ʹ➔͜Εେࣄ

Slide 29

Slide 29 text

͓·͚

Slide 30

Slide 30 text

ΧελϜ+,ίϯόʔλ΋ͬͯ ͖ͨΑ

Slide 31

Slide 31 text

͓·͚ͷXJUI·Μ͕ IUUQIFMQXJUIJT Q Α͔ͬͨΒಡΜͰΈͯͶ ແྉͩΑʂ ͠Ύͬͪΐ͏͹Μ

Slide 32

Slide 32 text

͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ ͠Ύͬͪΐ͏͹Μ

Slide 33

Slide 33 text

XJUI͸"OESPJEΤϯδχΞΛେઈࢍืूதʂ ϕςϥϯ,PUMJOΤϯδχΞ͕αϙʔτ͢ΔͷͰ ॳ৺ऀͰ΋,PUMJOʹڵຯ͕͋ΔͳΒ ؾܰʹԠืͯ͠ΈͯͶʂ IUUQTXXXXBOUFEMZDPNQSPKFDUT ͠Ύͬͪΐ͏͹Μ