Upgrade to Pro — share decks privately, control downloads, hide ads and more …

J2K failure story : UNIT

Paraya
August 24, 2018

J2K failure story : UNIT

Paraya

August 24, 2018
Tweet

More Decks by Paraya

Other Decks in Programming

Transcript

  1. Ҿ਺7PJEΛ࣋ͭϝιου public interface UseCase<Input, OutPut> { OutPut execute(Input input); }

    public interface SaveActionUseCase extends UseCase<Void, Void> { } class SaveActionUseCaseImpl implements SaveActionUseCase { @Override public Void execute(Void input) { // save boolean value return null; } } δΣωϦΫεΛ࢖ͬͨॲཧͰҾ਺7PJEʹOVMMΛ ड͚౉͢ͱ͍͏έʔε͕ଘࡏ͠·͢ ྫ͑͹$MFBO"SDIJUFDUVSFͰͷ6TF$BTF࣮૷
  2. Ҿ਺7PJEϝιουΛ,PUMJOԽͯ͠ΈΔ interface SaveActionUseCase : UseCase<Unit, Unit> class SaveActionUseCaseImpl : SaveActionUseCase

    { override fun execute(input: Unit) { // save boolean value } } 6TF$BTFΛ,PUMJOԽͯ͠Έ·͢ ߋʹҾ਺7PJEΛ6OJUʹͯ͠Έ·ͨ͠ +BWBͷ7PJE͸,PUMJOͰ͸6OJUͰ͢͠Ͷ
  3. Ҿ਺7PJEϝιουΛ,PUMJOԽͯ͠ΈΔ Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null:

    method kotlin.jvm.internal.Intrinsics.checkParameter IsNotNull, parameter input ͔͠͠+BWB͔Β࣮ߦ͢Δͱ࣮ߦ࣌Τϥʔ *MMFHBM"SHVNFOU&YDFQUJPO͕ൃੜͯ͠͠·͏ʜ
  4. 6OJU*/45"/$&Λ࢖ͬͯΈΔ private void saveByJava() { saveActionUseCase.execute(Unit.INSTANCE); } private fun saveByKotlin()

    { saveActionUseCase.execute(Unit) } ݺͼग़͠ଆΛ6OJUΛ౉͢ܗʹॻ͖׵͑·͢ɻ 6OJU͸PCKFDUDMBTTͱͯ͠ఆٛ͞Ε͍ͯΔͷͰ ΠϯελϯεΛ౉ͤ·͢ ͜Ε͸Τϥʔ΋ى͖ͣҰݟ໰୊ͳͦ͞͏ʜ
  5. ,PUMJOԽͷӨڹൣғ private void saveByJava1() { saveActionUseCase.execute(Unit.INSTANCE); } private void saveByJava2()

    { saveActionUseCase.execute(null); // Ϋϥογϡ!! } ݺͼग़͠Օॴ͕ͭͳΒ͍͍͚Ͳɺෳ਺͋Δͱͦ ΕΒΛશ෦ॻ͖׵͑Δ࡞ۀ͕ඞཁͰ͢ɻ Ͱ͖Ε͹,PUMJOԽͰͷมߋ͸ɺ,PUMJOԽͨ͠Ϋ ϥε಺ʹཹΊ͍ͨ
  6. 7PJE ·ͨ͸6OJU Λ࢖͓͏ interface SaveActionUseCase : UseCase<Unit?, Unit> class SaveActionUseCaseImpl

    : SaveActionUseCase { override fun execute(input: Unit?) { } } interface SaveActionUseCase : UseCase<Void?, Void?> class SaveActionUseCaseImpl : SaveActionUseCase { override fun execute(input: Void?): Void? { return null } } 6OJU ͷ΄͏͕ΑΓ,PUMJOΆ͍͕+,ίϯόʔτ ޙͷίʔυ͸7PJE ͷ΄͏͕͍ۙɻ͓޷ΈͰɻ