4 ms·
Huh? Refactor the class name in virtually any Java supporting IDE and the file name and invocations will be changed along with it. The license term seems petty
by dcminter 4y ago
Huh? Refactor the class name in virtually any Java supporting IDE and the file name and invocations will be changed along with it.
The license term seems petty, and would be annoying, but the workaround is trivial.
- whartung 4y agoIf you do that, you have to rename every class file it impacts as well, because now those files are changed. A lot of refactoring systems don't take into account the ancillary files (like build files, start scripts, etc.). So, the workaround can be quite impactful in the end. Renaming the entirety of the code base, potentially.
- dcminter 4y agoOh, duh, now I get it. That's very annoying.
- layer8 4y agoIn principle, you could rename the classes on the class-file level after compilation, back to the original names. That wouldn’t violate the license. Moreover, under the following definition in the license: `Modification' of a file means any procedure that produces a derivative file under any applicable law -- that is, a file containing the original file or a significant portion of it, either verbatim or with modifications and/or translated into another language. …compilation would count as modification (“translated into another language”), and compilation also changes the file name (from .java to .class), so distributing the compilation output should be fine. Furthermore, any changes to the sources can be distributed as a diff patch, which also has a different file name.
- thangalin 4y ago> but the workaround is trivial. If you have a trivial solution to rename hundreds of Java classes and their references en masse without breaking the build and without renaming each file one-at-a-time, do tell. You can find more details about potential solutions I've tried here: https://stackoverflow.com/questions/75154524/bulk-rename-of-java-classes/ https://stackoverflow.com/questions/75154524/bulk-rename-of-... FYI, the following plug-in for IDEA supports regular expressions (as of Jan 20, 2023), so it may be a viable solution: https://plugins.jetbrains.com/plugin/17455-rename-files-refactor-batch https://plugins.jetbrains.com/plugin/17455-rename-files-refa...
- counttheforks 4y agoPosted a solution on your other comment: https://news.ycombinator.com/item?id=34493760 https://news.ycombinator.com/item?id=34493760
- playingalong 4y agoI bet Open Rewrite can handle that quite easily: https://docs.openrewrite.org/ https://docs.openrewrite.org/
- thangalin 4y agoI wasn't able to find a recipe that performs a regular expression rename. That is, there doesn't seem to be anything like: --- type: specs.openrewrite.org/v1beta/recipe name: com.yourorg.ChangeTypeExample displayName: Change type example recipeList: - org.openrewrite.java.ChangeType: oldFullyQualifiedTypeName: (.+) newFullyQualifiedTypeName: Kt$1
- Someone 4y agoI would do that the hacker way: - build the current TeX.jar - jar tf TeX.jar | grep whatever to get a list of to-be-renamed classes - use sed or manual editing to generate a large list of recipes - run those recipes Instead of jar tf, grep for “^package foo.bar.baz” and “class (complex regex)” in the source code to get a list of package and class names, or use the directory structure. Maybe do all of them, and compare the results for robustness. That list will be large and it may not go perfect in one go, but it’s a one-off job, and you‘ll get there.
- deleted 4y ago[deleted]
- dangerlibrary 4y agoThis feels like something where the right solution is to drop down to the terminal and use the old standbys - sed/grep/find, etc. Could probably wrap it all up in `make` or `just` if this is something you do regularly.