Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UpdateTypeRefactor to move source code files #117

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

chiknas
Copy link
Contributor

@chiknas chiknas commented Apr 3, 2024

This Pull Request includes the following high level changes:

  • UpdateTypeRefactor will now move files to their new location.
    • This is limited to top level types. When moving a nested class, no file movement will be performed
    • This is limited to moving classes in the same module. Can not move a class across different modules.
  • Introduced CompilationUnitProperty to allow high level metadata to be appended on generated CompilationUnit instances.
    • In this case we are using this to communicate the absolute path of the source file to be used for the move operation.
  • AstraUtils.readAsCompilationUnit is changed to accept File object. This is how we add the File's absolute path on the generated CompilationUnit as a property (using CompilationUnitProperty#ABSOLUTE_PATH as the key).

@@ -201,26 +202,26 @@ protected void applyOperationsAndSave(File javaFile, Set<? extends ASTOperation>
* @param fileContentBefore Source file content before any operations are applied
* @param operations Operations to apply
*/
public String applyOperationsToFile(String fileContentBefore, Set<? extends ASTOperation> operations, String[] sources, String[] classpath) throws BadLocationException {
public String applyOperationsToFile(File file, String fileContentBefore, Set<? extends ASTOperation> operations, String[] sources, String[] classpath) throws BadLocationException {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of this change being on a public method (API), I think we need a minor version bump on the library if this goes in.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for calling this out, agreed

@RadikalJin RadikalJin merged commit 2d81c73 into alfasoftware:main Apr 15, 2024
@RadikalJin
Copy link
Member

Thanks for introducing this excellent change, @chiknas. This has now been merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants