tsantalis / JDeodorant

JDeodorant
https://marketplace.eclipse.org/content/jdeodorant
MIT License
139 stars 59 forks source link

Wrong order of original class field initializers in Product class for Extract Class Refactoring #76

Closed 123a6bcw closed 4 years ago

123a6bcw commented 4 years ago

Please consider this file https://github.com/JetBrains-Research/IntelliJDeodorant/blob/god-class-apply-refactoring-merge/src/test/resources/testdata/ide/refactoring/godclass/TestSimple/initial/Test.java

And the results I got from your plugin https://github.com/JetBrains-Research/IntelliJDeodorant/blob/god-class-apply-refactoring-merge/src/test/resources/testdata/ide/refactoring/godclass/TestSimple/expected/TestProduct.java

This will give a compilation error Cannot reference a field before it is defined because field SIZE initializes after array. The possible solution is to extract the source class fields to the product class in the same order as in the source class.