Code Monkey home page Code Monkey logo

explorer's Introduction

👋 Hi there

I’m a Japanese backend engineer, livining in Osaka, Japan.

Top Langs tanimon's github stats

explorer's People

Contributors

a3636tako avatar dependabot[bot] avatar h-matsuo avatar hnyma avatar keigo01 avatar mtj0928 avatar shinsuke-mat avatar tanimon avatar ty-v1 avatar yoshikihigo avatar

explorer's Issues

定義・参照間距離の計測方法変更

as is

各参照からその定義までの距離を計測している.

to be

各参照から,その変数の直近の状態の変化(再代入,参照しているインスタンスの状態の変化)までの距離を計測する.

VariantSelection で IllegalArgumentException が発生することがある

==================== kGenProg Configuration ====================
targetProject = example/refactoring/Foo
executionTests = []
workingDir = /var/folders/fg/bcs1pclj33j6vfjs6ljs58s00000gn/T/kgenprog-work4556390598327865833
outDir = kgenprog-out
mutationGeneratingCount = 40
crossoverGeneratingCount = 0
headcount = 30
maxGeneration = 100
timeLimit = PT30M
testTimeLimit = PT10S
requiredSolutionsCount = 10
logLevel = INFO
randomSeed = 0
scope = PACKAGE
needNotOutput = false
currentDirectory = /Users/a-tanikd/src/github.com/a-tanikd/kgenprog
================================================================
2019-01-01 19:44:01 [main] [INFO]  KGenProgMain - entered the era of 1st generation.
2019-01-01 19:44:03 [main] [INFO]  KGenProgMain - 
----------------------------------------------------------------
Elapsed time: 1 seconds
Variants: generated 40, syntax-valid 11, build-succeeded 2
Fitness: max 24.0(1), min 21.0(1), ave 22.5
----------------------------------------------------------------

2019-01-01 19:44:03 [main] [INFO]  KGenProgMain - entered the era of 2nd generation.
2019-01-01 19:44:04 [main] [INFO]  KGenProgMain - 
----------------------------------------------------------------
Elapsed time: 2 seconds
Variants: generated 40, syntax-valid 0, build-succeeded 0
Fitness: max --, min --, ave NaN
----------------------------------------------------------------

java.lang.IllegalArgumentException: Comparison method violates its general contract!
    at java.util.TimSort.mergeHi(TimSort.java:899)
    at java.util.TimSort.mergeAt(TimSort.java:516)
    at java.util.TimSort.mergeCollapse(TimSort.java:441)
    at java.util.TimSort.sort(TimSort.java:245)
    at java.util.Arrays.sort(Arrays.java:1512)
    at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:348)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at jp.kusumotolab.kgenprog.ga.selection.AscendingVariantSelection.exec(AscendingVariantSelection.java:22)
    at jp.kusumotolab.kgenprog.Strategies.execVariantSelection(Strategies.java:76)
    at jp.kusumotolab.kgenprog.ga.variant.VariantStore.proceedNextGeneration(VariantStore.java:149)
    at jp.kusumotolab.kgenprog.KGenProgMain.run(KGenProgMain.java:116)
    at jp.kusumotolab.kgenprog.CUILauncher.launch(CUILauncher.java:58)
    at jp.kusumotolab.kgenprog.CUILauncher.main(CUILauncher.java:30)

java.lang.IllegalArgumentException: Node is not inside the AST が多発する

問題は?

JDTOperation#applyjava.lang.IllegalArgumentException: Node is not inside the AST というエラーが多発する.

原因は?

発生箇所はここ.
https://github.com/a-tanikd/kGenProg/blob/ba946119fb4c19062c51baae98280f7dbc7284ba/src/main/java/jp/kusumotolab/kgenprog/project/jdt/SwapOperation.java#L26

次の条件が成り立つときに例外が発生する.

astNode.getAST() != astRewrite.getAST()

リファクタリングするメソッドを指定できるようにする

as is

プログラム全体をリファクタリングする.
どのメソッドがリファクタリングされるかは分からない.

to be

どのメソッドをリファクタリングするか指定できるようにし,それ以外のメソッドが編集されないようにする.

SmellLocalizationTest のアサーションが緩い

SmellLocalizationTest#testNestedSuspiciousness でネストされた要素に対して Suspiciousness が計測されているかをテストしている.
しかし,内実は要素数をカウントしているだけ.
より厳密にテストする.

ReorderingMutation の入れ替え対象候補の選択が不適切

KGenProgMain#run でこうしてる

mutation.setCandidates(initialVariant.getGeneratedSourceCode()
    .getProductAsts());

2つの問題が絡んでる

  • 入れ替え対象候補がプロジェクトの全体から選択されている
  • 初期状態のコードから入れ替え対象候補を選択している

JDTASTLocation#locate の結果がズレることがある

問題は?

JDTASTLocation#locate を呼び出したときに,Location が内部で保持している ASTNode に対応するものが返ってこないことがある.

再現手順

java -jar build/libs/kGenProg-1.1.0.jar \
-r example/refactoring/SumOf1To3 \
-s example/refactoring/SumOf1To3/src/example/Sum.java \
-t example/refactoring/SumOf1To3/src/example/SumTest.java \
--refactored-method example.Sum#sum \
--max-generation 100 \
--time-limit 60 \
--mutation-generating-count 20 \
--crossover-generating-count 0 \
--headcount 10 \
--required-solutions 10 \
-v

以下のように,MoveAfterOperation 内で,Location が内部で保持している ASTNode と,locate 結果の ASTNode を表示している.
https://github.com/a-tanikd/kGenProg/blob/01b9830d87159a2317a604cc21af22c40a3b782b/src/main/java/jp/kusumotolab/kgenprog/project/jdt/MoveAfterOperation.java#L28-L29

しかし,以下のログの最終行のように,これらが一致しないことがある.

...
2019-01-30 14:22:30 [main] [INFO]  KGenProgMain - entered the era of 2nd generation.
2019-01-30 14:22:30 [main] [DEBUG] MoveAfterOperation - src : c=3;
 -> c=3;

2019-01-30 14:22:30 [main] [DEBUG] MoveAfterOperation - dest: return a + b + c;
 -> return a + b + c;

2019-01-30 14:22:30 [main] [DEBUG] MoveAfterOperation - src : int a;
 -> int a;

2019-01-30 14:22:30 [main] [DEBUG] MoveAfterOperation - dest: c=3;
 -> c=3;

2019-01-30 14:22:30 [main] [DEBUG] MoveAfterOperation - src : c=3;
 -> int a;
...

メトリクスの値が大きい Variant が選択されている

DefaultVariantSelection では Fitness がより大きい Variant を選択している.
しかし,並べ替えリファクタリングでは Fitness(= メトリクス値)が小さいものを選択したい.

Fitness がより小さい Variant を選択する VariantSelection を実装する.

MetricValidation の Fitness 計測でクラス以外を読み込むとバグる

Interface や Enum を読み込むとバグる

Exception in thread "main" spoon.SpoonException: parseClass only considers classes (and not interfaces and enums). Please consider using a Launcher object for more advanced usage.
	at spoon.Launcher.parseClass(Launcher.java:875)
	at jp.kusumotolab.kgenprog.ga.MetricValidation.calculateFitness(MetricValidation.java:31)

移動対象の変更

as is

定義までの距離が長い参照を移動対象にしている.

to be

各参照までの距離が長い定義を移動対象にする.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.