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

Javaのバージョニング問題の話しよっか

 Javaのバージョニング問題の話しよっか

2016/01/21(木)に行われた第1回ゆるゆる高専エンジニアLT大会 at FULLER

の発表資料です。

RyotaMurohoshi

January 21, 2016
Tweet

More Decks by RyotaMurohoshi

Other Decks in Technology

Transcript

  1. ͜ͷΫϥεΛؚΉϥΠϒϥϦ͕͋Γ·͢(core_v1.jar) package com.mrstar.versioning_problem.core; public final class Core { private Core()

    {} public static String getTitle() { return "΄͛;͕"; } public final static String MESSAGE = "ͽΑͽΑʂ"; }
  2. ͖ͬ͞ͷϥΠϒϥϦʹґଘ͢ΔϥΠϒϥϦ͕͋Γ·͢(framework.jar) package com.mrstar.versioning_problem.framework; import com.mrstar.versioning_problem.core.Core; public class Framework { private

    Framework(){ } public static void showTitle() { System.out.println(Core.getTitle()); } public static void showMessage() { System.out.println(Core.MESSAGE); } }
  3. ͜Μͳײ͡Ͱ࢖͍·͢ package com.mrstar; import com.mrstar.versioning_problem.framework.Framework; public class Main { public

    static void main(String[] args) { Framework.showTitle(); Framework.showMessage(); } }
  4. ࣮ߦ͢Δͱɽɽɽ package com.mrstar; import com.mrstar.versioning_problem.framework.Framework; public class Main { public

    static void main(String[] args) { Framework.showTitle(); // ʮ΄͛;͕ʯͬͯදࣔ͞ΕΔ Framework.showMessage(); // ʮͽΑͽΑʂʯͬͯදࣔ͞ΕΔ } }
  5. ԾͷจݴΛຊ൪༻ʹมߋ͠ɺόʔδϣϯΞοϓʢcore_v2.jarʣ package com.mrstar.versioning_problem.core; public final class Core { private Core()

    {} public static String getTitle() { return "ϝΠϯϖʔδ"; //ɹ͖ͬ͞·Ͱʮ΄͛;͕ʯ } // ͖ͬ͞·ͰʮͽΑͽΑʂʯ public final static String MESSAGE = "͜Μʹͪ͸ʂ"; }
  6. core_v2.jarʹஔ͖׵͑ͯɺframework.jar͸ͦͷ··Ͱ package com.mrstar; import com.mrstar.versioning_problem.framework.Framework; public class Main { public

    static void main(String[] args) { Framework.showTitle(); // Q1 ͳΜͯදࣔ͞ΕΔʁ Framework.showMessage(); // Q2 ͳΜͯදࣔ͞ΕΔʁ } }
  7. framework.jarͷFramework.java(࠶ܝ) package com.mrstar.versioning_problem.framework; import com.mrstar.versioning_problem.core.Core; public class Framework { private

    Framework(){ } public static void showTitle() { System.out.println(Core.getTitle()); } public static void showMessage() { System.out.println(Core.MESSAGE); } }
  8. σίϯύΠϧͨ͠Framework.class package com.mrstar.versioning_problem.framework; import com.mrstar.versioning_problem.core.Core; public class Framework { private

    Framework() {} public static void showTitle() { System.out.println(Core.getTitle()); } public static void showMessage() { System.out.println("ͽΑͽΑʂ"); } }
  9. Framework.javaͷίʔυ package com.mrstar.versioning_problem.framework; import com.mrstar.versioning_problem.core.Core; public class Framework { private

    Framework(){ } public static void showTitle() { System.out.println(Core.getTitle()); } public static void showMessage() { System.out.println(Core.MESSAGE); } }
  10. σίϯύΠϧͨ͠Framework.class package com.mrstar.versioning_problem.framework; import com.mrstar.versioning_problem.core.Core; public class Framework { private

    Framework() {} public static void showTitle() { System.out.println(Core.getTitle()); } public static void showMessage() { System.out.println("ͽΑͽΑʂ"); } }
  11. RΫϥεͷϦιʔεIDར༻ྫ public class MainActivity extends Activity { @Override protected void

    onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ͜ΕʂʂʂϏϧυ͢Δͱ੔਺Ϧςϥϧʹ setContentView(R.layout.activity_main); } }