JJUG_CCC_2017_Spring_to_upload.pdf

4ccf6c02807d06f043a71435c48ce86a?s=47 Kengo TODA
May 23, 2017
11

 JJUG_CCC_2017_Spring_to_upload.pdf

4ccf6c02807d06f043a71435c48ce86a?s=128

Kengo TODA

May 23, 2017
Tweet

Transcript

  1. © Works Applications Co.,Ltd. #ccc_f3 2017 May/20th, JJUG CCC 2017

    Spring SpotBugs(FindBugs)ʹΑΔ େن໛ERPͷίʔυ඼࣭վળ 1
  2. © Works Applications Co.,Ltd. #ccc_f3 Agenda ‣ ࣗݾ঺հ ‣ 2017೥5݄ݱࡏͷJava੩తղੳπʔϧػೳɾಈ޲ൺֱ

    ‣ େن໛ERPͷίʔυ඼๊࣭͕͑Δ໰୊ͱͦͷղܾ ‣ ։ൃ͍ͯ͠Δ૊৫ͱͦͷ੡඼ ‣ ߦ͍ͬͯΔ޻෉ͱࠓޙͷల๬ 2
  3. © Works Applications Co.,Ltd. #ccc_f3 ͜ͷηογϣϯͰಘΒΕΔ΋ͷ ‣ େن໛։ൃʹͯӡ༻Մೳͳίʔυ඼࣭վળख๏ ‣ άϩʔόϧͰେن໛ͳJava։ൃʹ͓͍ͯඞਢͱͳΔ


    ʮίʔυ඼࣭ͷఈ্͛ʯͷ࣮ફతͳख๏ ‣ ࣾ಺FW΍ϥΠϒϥϦͷ࢖͍ํΛ޿ΊΔख๏ͱͯ͠
 ׆༻Ͱ͖Δ੩తղੳπʔϧϓϥάΠϯͷ։ൃख๏ 3
  4. © Works Applications Co.,Ltd. #ccc_f3 ಥવͷQuiz 4

  5. © Works Applications Co.,Ltd. #ccc_f3 JJUG CCCͷCCCͱ͸ʁ 1. ΫϥεɾνϣοτɾίϯύΠϧσΩϧ 2.

    ௒ɾίʔσΟϯάɾίϯςετ 3. ΫϩεɾίϛϡχςΟɾΧϯϑΝϨϯε 5
  6. © Works Applications Co.,Ltd. #ccc_f3 ࣗݾ঺հ ✤ https://github.com/ KengoTODA/ ✤

    ᷂ϫʔΫεΞϓϦέʔγϣϯζ
 ݚڀ։ൃΤϯδχΞ ✤ ήʔϜ͕࡞Γͨͯ͘HSP2ʹ
 खΛग़͠ɺϑϦʔιϑτ΢ΣΞ ࡞ՈΛܦͯɺೖࣾ͠R&Dʹ ✤ SpotBugsͷதͷਓ JVM Simulator Maven3 ebook 6
  7. © Works Applications Co.,Ltd. #ccc_f3 1. 2017೥5݄ݱࡏͷ
 Java੩తղੳπʔϧػೳɾಈ޲ൺֱ 7

  8. © Works Applications Co.,Ltd. #ccc_f3 ੩తղੳπʔϧͷྑ͍ͱ͜Ζ ✤ ࢖͍खʹܦݧ΍ਂ͍஌͕ࣝͳͯ͘΋ɺ ✤ ϨϏϡʔલ΍σϓϩΠલͳͲૣ͍ஈ֊Ͱɺ

    ✤ ໰୊ΛൃݟͰ͖Δ 8
  9. © Works Applications Co.,Ltd. #ccc_f3 ൺֱର৅Java੩తղੳπʔϧ ‣ Checkstyle ‣ PMD

    ‣ FindBugs / SpotBugs ‣ Checker Framework ‣ Google error-prone 9
  10. © Works Applications Co.,Ltd. #ccc_f3 Checkstyle ‣ ιʔείʔυղੳͳͷͰίϯύΠϧͳ͠Ͱ࣮ߦͰ͖Δ ‣ ଟ࠼ͳIDEɾϏϧυπʔϧʹରԠ

    ‣ ίʔσΟϯάن໿ͷ֬ೝ͕ओ໨త ‣ ϓϥάΠϯ࣮૷ʹඞཁͳ஌͕ࣝগͳ͍ ‣ http://checkstyle.sourceforge.net/ 10
  11. © Works Applications Co.,Ltd. #ccc_f3 PMD ‣ ιʔείʔυղੳͳͷͰίϯύΠϧͳ͠Ͱ࣮ߦͰ͖Δ ‣ ଟ࠼ͳIDEɾϏϧυπʔϧͦͯ͠ݴޠʹରԠ

    ‣ CPDʢίϐϖݕग़ʣػೳ΋౥ࡌ ‣ ϓϥάΠϯ࣮૷͸ΘΓͱෳࡶ ‣ https://pmd.github.io/ 11
  12. © Works Applications Co.,Ltd. #ccc_f3 FindBugs ‣ όΠτίʔυղੳͳͷͰίʔυʹͳ͍৘ใʢ਌Ϋϥεɺ
 ґଘઌɺΞϊςʔγϣϯ౳ʣ΋CLASSPATH͔Βิ׬Ͱ͖Δ ‣

    ଟ࠼ͳIDEɾϏϧυπʔϧʹରԠ ‣ ϓϥάΠϯ࣮૷ʹ͸JVM΍όΠτίʔυͷ஌͕ࣝ͋Δͱྑ ͍ ‣ https://spotbugs.github.io/ 12
  13. © Works Applications Co.,Ltd. #ccc_f3 SpotBugsͱ͸ʁ ‣ FindBugsͷ։ൃ͕͠͹Β͘ࢭ·͍ͬͯͨʢ3.0.1͸2೥ ऑલͷϦϦʔεʣ ‣

    3.1.0ϦϦʔε४උˍίϛϡχςΟܗ੒த ✤ FindBugsίϛϡχςΟʹ͓͚Δྫͷ݅ͷహ຤ɺͦ͠ ͯSpotBugsͱ͸Կ͔ 13
  14. © Works Applications Co.,Ltd. #ccc_f3 ࢀߟɿJSR305Ξϊςʔγϣϯͷࠓ ‣ javax.annotation ύοέʔδʹؚ·ΕΔ
 ˏNonnull

    ΍ˏUntaintedͳͲͷΞϊςʔγϣϯ ‣ JSR305͕Dormantͱͳͬͨޙ΋FindBugs͕഑෍͍ͯͨ͠ ‣ SpotBugsʹΑΔϝϯςφϯε༧ఆແ͠ ‣ ܕύϥϝʔλʹ࢖͏͜ͱ΋Ͱ͖ͳ͍ͷͰ
 ࠓޙԺ΍͔ʹஔ͖׵͑ΒΕ͍ͯ͘ͷͰ͸ 14
  15. © Works Applications Co.,Ltd. #ccc_f3 Checker Framework ‣ Java8ͷJSR 308

    (Annotations on Java Types) Λར༻͢Δ ‣ ଟ࠼ͳIDEɾϏϧυπʔϧʹରԠ ‣ JDKʹؚ·ΕΔΫϥεͷৼΔ෣͍Λσʔλϕʔεʹ࣋ͭ ‣ https://checkerframework.org/ 15
  16. © Works Applications Co.,Ltd. #ccc_f3 Google error-prone ‣ ίϯύΠϧ࣌ʹղੳ͢ΔͷͰίʔυʹͳ͍৘ใ΋र͍΍͍͢ ‣

    ιʔείʔυͷࣗಈमਖ਼Λ౰ॳ͔Βҙ͍ࣝͯ͠Δʁ ‣ EclipseඇରԠʢcom.sun.* ύοέʔδʹґଘͷͨΊʣ ‣ ৭ʑϞμϯͰϓϥάΠϯ࣮૷΋͠΍͍͢ ‣ GoogleࣾһҎ֎͔ΒͷPR͸ʢ࣮੷ͱͯ͠ʣड͚෇͚ͯͳ͍ ‣ http://errorprone.info/ 16 Refs: http://dl.acm.org/citation.cfm?id=2486877
  17. © Works Applications Co.,Ltd. #ccc_f3 ࠓ࢖͏ͳΒͲͷπʔϧʁ 17 ʘ Target Standard

    Rules Note Checkstyle 7.7 AST 152 checks codingن໿ PMD 5.6.1 AST 287 rules (PMD Java) ଟݴޠରԠ SpotBugs 3.1.0−RC2 Bytecode 453 patterns (+9 experimentals) plugin๛෋ Checker Fw 2.1.11 AST (Compiler֦ு) 19 checkers JSR308ରԠ error-prone v2.0.19 AST (Compiler֦ு) 145 patterns (+61 experimentals) কདྷʹظ଴
  18. © Works Applications Co.,Ltd. #ccc_f3 ࠓ࢖͏ͳΒͲͷπʔϧʁ ‣ ͱʹ͔͘਺Λग़͍ͨ͠ ‣ SpotBugs

    + Checker Framework ‣ Type AnnotationΛ࢖͑͹SpotBugsʹݟ͚ͭΒΕͳ͍໰୊΋
 ᖰΓग़ͤΔՄೳੑ͕͋Δ ‣ ղੳʹ࣌ؒΛ͔͚ͨ͘ͳ͍ ‣ error-proneͰίϯύΠϧ࣌νΣοΫ ‣ PMDΛίϯύΠϥͱฒྻ࣮ߦ 18
  19. © Works Applications Co.,Ltd. #ccc_f3 ࠓ࢖͏ͳΒͲͷπʔϧʁ ‣ JavaεΩϧͷߴ͍։ൃऀ͕ἧ͍ͬͯΔ ‣ Ξϊςʔγϣϯͷར༻Λଅਐ͠Checker

    FrameworkΛ׆༻͢Δ ‣ ఆظతͳSpotBugsͰࡉ͔͍໰୊΋ᖰΓग़͢ ‣ ։ൃऀͷJavaεΩϧʹ͹Β͖͕ͭ͋Δ ‣ CheckstyleͰ࠷௿ݶͷಡΈ΍͢͞Λ୲อ͢Δ ‣ CPDͰίϐϖʹܯࠂΛ͢Δʢઅ౓ͷ͋ΔίϐϖΛଅ͢ʣ ‣ ಈ࡞Λܰͨ͘͠PMD΍SpotBugsΛ͜·Ίʹճ͠࠷௿ݶͷϛεΛ๷͙ 19
  20. © Works Applications Co.,Ltd. #ccc_f3 Agenda ‣ ࣗݾ঺հ ‣ 2017೥5݄ݱࡏͷJava੩తղੳπʔϧػೳɾಈ޲ൺֱ

    ‣ େن໛ERPͷίʔυ඼๊࣭͕͑Δ໰୊ͱͦͷղܾ ‣ ։ൃ͍ͯ͠Δ૊৫ͱͦͷ੡඼ ‣ ߦ͍ͬͯΔ޻෉ͱࠓޙͷల๬ 20
  21. © Works Applications Co.,Ltd. #ccc_f3 2. େن໛ERPͷίʔυ඼࣭͕ ๊͑Δ໰୊ 21

  22. © Works Applications Co.,Ltd. #ccc_f3 גࣜձࣾ ϫʔΫεΞϓϦέʔγϣϯζͱ͸ ✤ ERPύοέʔδͷ։ൃΛߦ͍ͬͯΔاۀ ✤

    γϯΨϙʔϧɺதࠃɺΠϯυɺΞϝϦΧ౳ʹ΋ڌ఺ ✤ ίϯγϡʔϚΞϓϦͷΑ͏ͳϢʔβϏϦςΟͱ
 εϐʔυΛ࣋ͭERPʮHUEʢAI WorksʣʯΛ
 ։ൃɾఏڙ 22
  23. © Works Applications Co.,Ltd. #ccc_f3 HUEͷ࣮૷ ✤ ୤RDB͢ΔͳͲ଎౓ʹͩ͜Θ͍ͬͯͯɺ ✤ MSA͠ͳ͍ͱࢮ͵ఔ౓ʹ͸ࢁ΄ͲαʔϏε͕͋Γɺ

    ✤ ಙౡʹݚڀॴ࡞ΔϨϕϧͰࣗવݴޠॲཧʹຊؾͰɺ ✤ 100msୡ੒ͷͨΊʹAWS LambdaΛಋೖ͢ΔͳͲ
 ৽͍͜͠ͱ΋৭ʑ΍͍ͬͯΔɻ 23
  24. © Works Applications Co.,Ltd. #ccc_f3 HUEͷ࣮૷Λࢧ͑Δਓ ✤ ඇৗʹଟ࠼Ͱ௕ॴ΋ଟ͍ ✤ ౦ژɾେࡕɾνΣϯφΠɾ্ւɾγϯΨϙʔϧͳͲʹ


    ։ൃڌ఺͕෼ࢄ͍ͯ͠Δ ✤ ड͚ͨڭҭ΍ৗ͔ࣝΒͯ͠େ͖͘ҧ͏ ✤ ϑϩϯτΤϯυɺϑϨʔϜϫʔΫɺϞόΠϧɺػցֶशɺ
 όονɺ෼ࢄॲཧͱ͍༷ͬͨʑͳઐ໳Ո͕ڞଘ ✤ εΩϧͷͳ͍৽ਓ͕૿͑ଓ͚͍ͯΔঢ়ଶ 24
  25. © Works Applications Co.,Ltd. #ccc_f3 HUEͷ࣮૷Λࢧ͑Δਓ ✤ ඇৗʹଟ࠼Ͱ௕ॴ΋ଟ͍ ✤ ౦ژɾେࡕɾνΣϯφΠɾ্ւɾγϯΨϙʔϧͳͲʹ


    ։ൃڌ఺͕෼ࢄ͍ͯ͠Δ ✤ ड͚ͨڭҭ΍ৗ͔ࣝΒͯ͠େ͖͘ҧ͏ ✤ ϑϩϯτΤϯυɺϑϨʔϜϫʔΫɺϞόΠϧɺػցֶशɺ
 όονɺ෼ࢄॲཧͱ͍༷ͬͨʑͳઐ໳Ո͕ڞଘ ✤ εΩϧͷͳ͍৽ਓ͕૿͑ଓ͚͍ͯΔঢ়ଶ 25 ໰ɿ ߴ଎ʹ૿͍͑ͯ͘ ։ൃऀͷΩϟονΞοϓΛ গͳ͍ίϛϡχέʔγϣϯͰ ͲͷΑ͏ʹॿ͚Δ͔ʁ
  26. © Works Applications Co.,Ltd. #ccc_f3 ͳͥSpotBugs͔ ✤ ࣾ಺ͷਓࡐͱࢿ࢈ ✤ ಺෦࣮૷ʹ໌Δ͍ෳ਺ͷ։ൃऀ

    ✤ ϓϥάΠϯ࣮૷ܦݧͷ஝ੵ ✤ Eclipse࿈ܞ ✤ HUE͸EclipseΛඪ४IDEͱ͍ͯ͠Δ ✤ Java8αϙʔτ ✤ FindBugs 3.0.1͸Lambdaͷѻ͍ʹ
 ໰୊͕͋Δ 26
  27. © Works Applications Co.,Ltd. #ccc_f3 Agenda ‣ ࣗݾ঺հ ‣ 2017೥5݄ݱࡏͷJava੩తղੳπʔϧػೳɾಈ޲ൺֱ

    ‣ େن໛ERPͷίʔυ඼๊࣭͕͑Δ໰୊ͱͦͷղܾ ‣ ։ൃ͍ͯ͠Δ૊৫ͱͦͷ੡඼ ‣ ߦ͍ͬͯΔ޻෉ͱࠓޙͷల๬ 27
  28. © Works Applications Co.,Ltd. #ccc_f3 3. HUE͕ߦ͍ͬͯΔ޻෉ͱ ࠓޙͷల๬ 28

  29. © Works Applications Co.,Ltd. #ccc_f3 աڈͷࣦഊ ✤ σϑΥϧτઃఆͷ··FindBugs΍CheckstyleΛ
 ϩʔΧϧϏϧυ΍ϓϨϚʔδϏϧυʹಋೖ͠ɺ
 ੜ࢈ੑΛେ͖͘Լ͛ͨ

    ✤ ϓϨϚʔδϏϧυ͕1͔͔࣌ؒۙͬͯ͘͠·ͬͨ ✤ mvn -Dfindbugs.skip ΍ <findbugs.skip>true
 </findbugs.skip> ͕౰ͨΓલʹͳͬͯ͠·ͬͨ 29
  30. © Works Applications Co.,Ltd. #ccc_f3 աڈͷࣦഊ ✤ σϑΥϧτઃఆͷ··FindBugsΛEclipseʹಋೖ͠ɺ
 ੜ࢈ੑΛେ͖͘Լ͛ͨ ✤

    ϫʔΫεϖʔεʹ10Λ௒͑ΔϓϩδΣΫτΛৗ࣌༻ ҙͯ͠։ൃ͢Δਓ͕ଟ͔ͬͨ ✤ Eclipse PluginʹύϑΥʔϚϯε্ͷ͕ܽؕ͋ͬͨ 30
  31. © Works Applications Co.,Ltd. #ccc_f3 ͦ΋ͦ΋ɺ ✤ MSAΛ໨ࢦ͍ͯ͠Δͷʹ૊৫ԣஅͳղੳ͸ඞཁ͔ʁ ✤ ֤αʔϏε։ൃऀ͕޷͖ʹ΍Ε͹͍͍ͷͰ͸ʁ

    ✤ ࣏ࣗͰ͖Δ׆ಈΛ։ൃޮ཰Λ௿Լͤͯ͞·Ͱ
 ԣஅతʹ΍Δʁ 31
  32. © Works Applications Co.,Ltd. #ccc_f3 MSAͰ૊৫ԣஅͳղੳ͸ඞཁ͔ʁ ✤ ඞཁ ✤ ੩తղੳ͸nice

    to haveͰ͸ͳ͘must to have ✤ ͦΕͧΕҟͳΔਓࡐɾ޻਺Λ͍࣋ͬͯΔͷͰ
 ׬શʹ࣏ࣗʹ೚ͤΔͱ͍࣮ͭࢪ͞ΕΔͷ͔ෆ໌ྎ ✤ ։ൃޮ཰ΛԼ͛ͳ͍ํ๏Λ୳͢ඞཁ͕͋Δ 32
  33. © Works Applications Co.,Ltd. #ccc_f3 ༏ઌ౓ ໢ཏੑ ʢϝϦοτʣ ࣦഊΛ౿·͑ͯ ✤

    ։ൃޮ཰ʹଥڠ͠ͳ͍ ✤ ۃྗ։ൃऀͷ೔ৗۀ຿Λ
 ϒϩοΫ͠ͳ͍ख๏Λ୳͢ ✤ ޮ཰௿ԼΛೲಘͤ͞ΒΕΔ
 Ձ஋Λग़͢ ✤ ͪΌΜͱத਎Λཧղͯ͠࢖͏ ✤ ݁ہ͸όονϓϩάϥϜͳͷͰ
 ׳Εͨख๏ͰϓϩϑΝΠϧՄೳ ։ൃޮ཰ ʢೲಘʣ 33
  34. © Works Applications Co.,Ltd. #ccc_f3 ௐࠪɿͳͥFindBugs͸஗͍ͷ͔ʁ ✤ 10਺೥લͷৗࣝʹ΋ͱ͍࣮ͮͨ૷ ʢSpotBugs 3.1.0-RC1Ͱղফʣ

    ✤ MapΛ࢖ͬͨ String#intern() ૬౰ͷࣗલॲཧ ✤ ListΠϯελϯεΛ࢖͍·Θͨ͢Ίͷܭࢉॲཧ ✤ Eclipse GUIΛසൟʹߋ৽͗͢͠Δ ʢSpotBugs 3.1.0-RC2Ͱղফʣ ✤ ղੳର৅͕มΘΔͨͼʹUIΛߋ৽ ✤ γϯάϧεϨουʢίΞΛ࢖͍੾Εͳ͍ʣ 34
  35. © Works Applications Co.,Ltd. #ccc_f3 ௐࠪɿ؀ڥมߋͰߴ଎ԽͰ͖Δʁ ✤ ΄΅Ͱ͖ͳ͍ ✤ FindBugs͸CPU

    bound͕ͩγϯάϧεϨουͳόον ✤ ෳ਺ίΞΛ৯͍੾͍ͬͯΔͷ͸JITίϯύΠϥͷεϨου
 ʢ-XX:CICompilerCountͰ૿ݮՄ͕ͩ଎౓ʹ΄΅د༩ͳ͠ʣ ✤ OOME΍GC stormΛى͜͞ͳ͍ఔ౓ͷϝϞϦΛ༩͑Ε͹
 ͋ͱ͸CPUίΞ૿΍ͯ͠΋ϝϞϦ૿΍ͯ͠΋มԽͳ͠ 35
  36. © Works Applications Co.,Ltd. #ccc_f3 ௐࠪɿGuava v19.0ղੳͷϚΠΫϩϕϯν ʢ4 CPU coresʣ

    36 128m 256m 512m 1g 2
 (Default) OOME 18.2s 18.0s 18.2s 3 OOME 19.2s 18.2s 18.0s 4 OOME 24.8s 24.7s 23.6s -XX:CICompilerCount -Xmx & -Xms refs: https://github.com/spotbugs/spotbugs/pull/128
  37. © Works Applications Co.,Ltd. #ccc_f3 ௐࠪɿGuava v19.0ղੳͷϚΠΫϩϕϯν ʢ2 CPU coresʣ

    37 2g Default 26.0s G1GC 28.7s G1GC + UseStringDeduplication 29.1s GCઃఆʢJava8ʣ -Xmx & -Xms refs: https://github.com/spotbugs/spotbugs/pull/128
  38. © Works Applications Co.,Ltd. #ccc_f3 ௐࠪɿઃఆͰfindbugs-maven-pluginΛ ߴ଎Խ͢Δʹ͸ ✤ onlyAnalyzeͰର৅ΫϥεΛ࡟Γɺ
 visitorsͰར༻DetectorΛ࡟Δ͜ͱͰߴ଎ʹͳΔ

    ✤ ൃݟ͍ͨ͠όάʹ༏ઌ౓Λ͚ͭΔ͜ͱ͕؊ཁ ✤ ExcludeFilterͰର৅ϑΝΠϧΛ࡟ͬͯ΋଎͘ͳΒͳ͍ ✤ Filter͸ॲཧͷ݁Ռʹରͯ͠Өڹ͢ΔͨΊ 38
  39. © Works Applications Co.,Ltd. #ccc_f3 ௐࠪɿeffortͷޮՌʢTBUʣ 39 ACCUR ATE_EX CEPTIO

    NS MODEL _INSTA NCEOF TRACK _GUAR ANTEE D_VAL UE_DER EFS_IN_ NULL_P OINTER _ANAL YSIS TRACK _VALUE _NUMB ERS_IN_ NULL_P OINTER _ANAL YSIS INTERP ROCED URAL_ ANALY SIS INTERP ROCED URAL_ ANALY SIS_OF_ REFERE NCED_ CLASSE S CONSE RVE_SP ACE SKIP_ HUGE _MET HODS min ✓ ✓ less ✓ ✓ ✓ default, more ✓ ✓ ✓ ✓ ✓ ✓ max ✓ ✓ ✓ ✓ ✓ ✓ Refs: FindBugs.java
  40. © Works Applications Co.,Ltd. #ccc_f3 Ҏ্Λ౿·͑ͯ 40

  41. © Works Applications Co.,Ltd. #ccc_f3 ํ਑ ✤ ଎౓ॏࢹͷૈ͍ղੳͱɺ໢ཏੑॏࢹͷղੳΛ૊Έ߹Θ ͤΔ ✤

    ϓϨϚʔδϏϧυͰ͸มߋ͞ΕͨΫϥε͚ͩΛղੳ ✤ र͍࿙ΕΔ໰୊͸೔࣍ͷղੳͰൃݟɾใࠂ 41
  42. © Works Applications Co.,Ltd. #ccc_f3 ॏ͘໢ཏੑͷߴ͍ղੳʢ֓ཁʣ ✤ Jenkins + SonarQubeͰ։ൃ͕׆ൃͰͳ͍࣌ؒଳʹ࣮ࢪ

    ✤ ॏେͰͳ͍Ϩϕϧͷϧʔϧ΋ؚΊ࣮ͯࢪ ✤ ։ൃऀ͕͍ͭͰ΋ΞΫηεͰ͖ΔSonarQubeΛఏڙ ✤ Readme΍ϓϩδΣΫτҰཡϖʔδʹBadgeΛදࣔ͠
 ҰཡੑͱSonarQube΁ͷಋઢΛ֬อ 42
  43. © Works Applications Co.,Ltd. #ccc_f3 ॏ͘໢ཏੑͷߴ͍ղੳʢ݁Ռʣ ✤ 50ͷϓϩδΣΫτ͔Β3,000ͷ໰୊Λݟ͚ͭɺ
 1ϲ݄Ͱ͏ͪ900Λղফͨ͠ ✤

    String.format() ΍ logger.info() ͷϑΥʔϚοτҟৗ ✤ ϚϧνεϨουϓϩάϥϛϯάΞϯνύλʔϯ 43
  44. © Works Applications Co.,Ltd. #ccc_f3 ૉૣ͘ૈ͍ղੳʢ֓ཁʣ ✤ ॏେͳ໰୊Λத৺ʹௐࠪ ✤ ಠࣗMavenϓϥάΠϯͰfindbugs-maven-pluginΛ

    ϥοϓ ✤ มߋ͞Εͨ.javaϑΝΠϧҰཡ͔Βߋ৽͞ΕͨՄೳੑ ͷ͋ΔclassϑΝΠϧͷҰཡΛSpotBugsʹ౉͢ 44
  45. © Works Applications Co.,Ltd. #ccc_f3 ૉૣ͘ૈ͍ղੳʢ݁Ռʣ ✤ SpotBugsʹ͔͔Δ࣌ؒΛฏۉ93ˋ࡟ݮ ✤ େ͖ͳϦϙδτϦͰ΋1෼Ҏ಺ʹղੳΛऴ͑ΒΕΔ


    ✤ र͍͖Εͳ͍໰୊͸ඞͣग़Δ ✤ ྫɿˏNonNullΛΠϯλϑΣʔεʹ௥Ճͨ͠৔߹ 45
  46. © Works Applications Co.,Ltd. #ccc_f3 ࠓޙͷల๬ ✤ ͞Βʹଟ͘ͷϦϙδτϦ΁ͷಋೖ ✤ Type

    AnnotationΛஈ֊తʹಋೖ͢Δ ✤ ٕज़ʹͩ͜ΘΓͷڧ͍ɺڞ௨Ϟδϡʔϧ։ൃऀʹ
 ڠྗΛґཔ͢Δ 46
  47. © Works Applications Co.,Ltd. #ccc_f3 4. ࣾ಺FWࢧԉͷͨΊͷ SpotBugsϓϥάΠϯ࣮૷ํ๏ 47

  48. © Works Applications Co.,Ltd. #ccc_f3 େ·͔ͳྲྀΕ ✤ ཁ݅ͷ໌֬Խ ✤ ϓϩδΣΫτͷ࡞੒

    ✤ JUnitͰՔಇ֬ೝ͠ͳ͕Β࣮૷ ✤ Messageͷ࡞੒ 48
  49. © Works Applications Co.,Ltd. #ccc_f3 ཁ݅ͷ໌֬Խ 49 ✤ ཁ݅ʹԠ֦ͯ͡ு͢΂͖਌Ϋϥε͕มΘΔ ✤

    OperandStackͷঢ়ଶΛ௥͏ˠOpcodeStackDetector ✤ ΞϊςʔγϣϯΛ֬ೝ͢ΔˠAnnotationDetector
  50. © Works Applications Co.,Ltd. #ccc_f3 ϓϩδΣΫτͷ࡞੒ 50 $ mvn archetype:generate

    \ -DarchetypeGroupId=com.github.spotbugs \ -DarchetypeArtifactId=spotbugs-archetype \ -DarchetypeVersion=0.1.0 Refs: https://github.com/spotbugs/spotbugs-archetype
  51. © Works Applications Co.,Ltd. #ccc_f3 JUnitͰಈ࡞֬ೝ͠ͳ͕Β࣮૷ 51 ✤ ʮόάͱͯ͠ݟ͚͍ͭͨঢ়ଶʯΛ࣮૷ ✤

    ʮόάͱͯ͠ݟ͔ͭΔ΂͖Ͱͳ͍ঢ়ଶʯΛ࣮૷ ✤ classϑΝΠϧΛςετ࣮ߦલʹੜ੒
  52. © Works Applications Co.,Ltd. #ccc_f3 52 Refs: https://github.com/spotbugs/spotbugs/tree/master/test-harness

  53. © Works Applications Co.,Ltd. #ccc_f3 Messageͷ࡞੒ ✤ src/main/resources/messages.xmlͷվม ✤ ʮԿ͕໰୊͔ʯ͚ͩͰͳ͘ʮͲ͏मਖ਼Ͱ͖Δ͔ʯ΋


    ࢦೆ͢Δ͜ͱ͕๬·͍͠ 53 Refs: http://dl.acm.org/citation.cfm?id=2486877
  54. © Works Applications Co.,Ltd. #ccc_f3 Live demo 54

  55. © Works Applications Co.,Ltd. #ccc_f3 5. ·ͱΊ 55

  56. © Works Applications Co.,Ltd. #ccc_f3 େن໛։ൃʹ͓͚Δίʔυ඼࣭վળ ✤ ϓϩδΣΫτͷ਺ͱن໛͕େ͖͍MSAͰ͸ӡ༻ͷ
 ೉౓্͕͕Δ ✤

    ֤αʔϏε։ൃऀ͕੩తղੳπʔϧͷϝϦοτΛ
 ڗडͰ͖Δ؀ڥͷߏங͕ඞཁ 56
  57. © Works Applications Co.,Ltd. #ccc_f3 େن໛։ൃʹ͓͚Δίʔυ඼࣭վળ ✤ FindBugs/SpotBugsͷΫηΛཧղ͢Ε͹
 େن໛։ൃͰ΋αΫαΫར༻Ͱ͖Δ ✤

    ύϥϝʔλͷมߋͰ࣮ߦϧʔϧͱର৅ίʔυΛ
 ߜΓࠐΉɺࠩ෼ղੳͱόον࣮ߦΛ෼͚Δ 57
  58. © Works Applications Co.,Ltd. #ccc_f3 େن໛։ൃʹ͓͚Δίʔυ඼࣭վળ ✤ SpotBugsϓϥάΠϯΛ։ൃ͢Ε͹ࣾ಺ϑϨʔϜϫʔΫ ݻ༗ͷ໰୊΋੩తղੳπʔϧͰൃݟͰ͖Δ ✤

    ࣮૷ʹ͸ඞͣ͠΋JVM΍όΠτίʔυͷ஌ࣝ͸ඞཁ ͱ͠ͳ͍ 58
  59. © Works Applications Co.,Ltd. #ccc_f3 6. ࠾༻৘ใ 59

  60. © Works Applications Co.,Ltd. #ccc_f3 ੈքΛ໨ࢦ͢ΤϯδχΞΛ ืू͍ͯ͠·͢ 60

  61. © Works Applications Co.,Ltd. #ccc_f3 ۩ମతͳ࿩Λฉ͖͍ͨํ΁ ✤ ൃදޙʹࢲʹฉ͖ʹདྷ͍ͯͩ͘͞ʂ ✤ CIɺMSAɺϚΠάϨʔγϣϯɺ։ൃϓϩηεɺ


    ଟڌ఺։ൃ͸ઐ໳ͳͷͰ৭ʑ͓࿩Ͱ͖·͢. 61
  62. © Works Applications Co.,Ltd. #ccc_f3 Thank you! ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ 62

  63. © Works Applications Co.,Ltd. #ccc_f3 7. ࢀߟࢿྉ 63

  64. © Works Applications Co.,Ltd. #ccc_f3 ࢀߟ৘ใ ‣ ιʔείʔυͷ඼࣭޲্ͷͨΊͷޮՌతͰޮ཰తͳ
 ίʔυϨϏϡʔ ‣

    https://www.slideshare.net/MoriharuOhzu/ ss-9224836 64
  65. © Works Applications Co.,Ltd. #ccc_f3 ࢀߟ৘ใ ‣ ϥϜμࣜ΍ετϦʔϜ API ΍৽͍͠೔࣌

    API ͚ͩ ͡Όͳ͍ʂ
 Java8 ͷλΠϓɾΞϊςʔγϣϯ͋ͷख͜ͷख ‣ http://waman.hatenablog.com/entry/ 2014/05/08/063959 65
  66. © Works Applications Co.,Ltd. #ccc_f3 ࢀߟ৘ใ ‣ Type Annotation for

    Static Program Analysis ‣ https://www.slideshare.net/skrb/type-annotation- for-static-program-analysis 66
  67. © Works Applications Co.,Ltd. #ccc_f3 ࢀߟ৘ใ ✤ G1: from garbage

    collector to waste management consultant ✤ https://blogs.oracle.com/java-platform-group/ g1%3a-from-garbage-collector-to-waste- management-consultant 67
  68. © Works Applications Co.,Ltd. #ccc_f3 ࢀߟ৘ใ ✤ G1 GC ͓͞Β͍ͱ

    #jjug_ccc Ͱൃදͨ͠࿩ ✤ http://cco.hatenablog.jp/entry/ 2015/12/01/011223 68
  69. © Works Applications Co.,Ltd. #ccc_f3 ࢀߟ৘ใ ✤ The Google FindBugs

    fixit ✤ http://dl.acm.org/citation.cfm?id=1831738 69