java-runtime-decompiler icon indicating copy to clipboard operation
java-runtime-decompiler copied to clipboard

Decomposition of frontend classes

Open AurumTheEnd opened this issue 3 years ago • 1 comments

Currently, a lot of frontend classes are too complicated:

  • line count in the hundreds:
[ohrdlicka@ohrdlicka frontend]$ sloc --details        --format cli-table --keys total,source,empty,comment .
┌────────────────────────────────────────────────────────┬──────────┬────────┬───────┬─────────┐
│ Path                                                   │ Physical │ Source │ Empty │ Comment │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ utility/AgentApiGenerator.java                         │ 379      │ 339    │ 37    │ 3       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ utility/CommonUtils.java                               │ 169      │ 147    │ 19    │ 3       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ utility/ImageButtonFactory.java                        │ 182      │ 142    │ 39    │ 3       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ utility/ScreenFinder.java                              │ 129      │ 76     │ 14    │ 39      │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ utility/TeeOutputStream.java                           │ 44       │ 26     │ 10    │ 8       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/about/AboutView.java                             │ 53       │ 44     │ 9     │ 1       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/filesystem/NewFsVmView.java                      │ 189      │ 162    │ 27    │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/filesystem/NewFsVmController.java                │ 81       │ 62     │ 19    │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/license/LicenseView.java                         │ 51       │ 42     │ 9     │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/overwrite/FileToClassValidator.java              │ 111      │ 91     │ 15    │ 5       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/overwrite/LatestPaths.java                       │ 67       │ 53     │ 14    │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/overwrite/OverwriteClassDialog.java              │ 828      │ 742    │ 83    │ 3       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/remote/NewConnectionController.java              │ 51       │ 37     │ 9     │ 5       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/remote/NewConnectionView.java                    │ 136      │ 117    │ 19    │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/settings/SettingsView.java                       │ 413      │ 336    │ 76    │ 3       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/plugins/ConfigPanel.java                         │ 66       │ 54     │ 11    │ 1       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/plugins/FileSelectorArrayAddRow.java             │ 34       │ 24     │ 10    │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/plugins/FileSelectorArrayPanel.java              │ 78       │ 62     │ 14    │ 2       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/plugins/FileSelectorArrayRow.java                │ 108      │ 89     │ 19    │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/plugins/FileSelectorPanel.java                   │ 72       │ 57     │ 15    │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/plugins/MessagePanel.java                        │ 19       │ 14     │ 5     │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/plugins/OkCancelPanel.java                       │ 59       │ 47     │ 9     │ 3       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/plugins/PluginConfigurationEditorController.java │ 318      │ 273    │ 45    │ 1       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/plugins/PluginConfigurationEditorView.java       │ 90       │ 70     │ 15    │ 5       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/plugins/PluginListPanel.java                     │ 32       │ 24     │ 8     │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/plugins/PluginTopOptionPanel.java                │ 60       │ 49     │ 11    │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/plugins/TextInputPanel.java                      │ 36       │ 28     │ 8     │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/main/BytecodeDecompilerView.java                 │ 948      │ 783    │ 143   │ 30      │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/main/DecompilationController.java                │ 611      │ 529    │ 64    │ 21      │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/main/GlobalConsole.java                          │ 169      │ 151    │ 16    │ 2       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/main/LoadingDialog.java                          │ 51       │ 41     │ 10    │ 0       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/main/MainFrameView.java                          │ 482      │ 379    │ 65    │ 41      │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/main/OverridesManager.java                       │ 147      │ 131    │ 15    │ 1       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/main/popup/ClassListPopupMenu.java               │ 67       │ 51     │ 15    │ 1       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/main/renderer/ClassListRenderer.java             │ 87       │ 64     │ 23    │ 1       │
├────────────────────────────────────────────────────────┼──────────┼────────┼───────┼─────────┤
│ frame/main/renderer/VmListRenderer.java                │ 106      │ 90     │ 16    │ 1       │
└────────────────────────────────────────────────────────┴──────────┴────────┴───────┴─────────┘

  • contain a lot of inner classes (deduct 1 for the top-level class)
[ohrdlicka@ohrdlicka frontend]$ find $(pwd) -name "*.java" -exec echo {} \; -exec grep -c -E \\sclass\\s[A-Z] {} \; -exec echo \;

/home/ohrdlicka/Projects/java-runtime-decompiler/runtime-decompiler/src/main/java/org/jrd/frontend/frame/main/BytecodeDecompilerView.java
4

/home/ohrdlicka/Projects/java-runtime-decompiler/runtime-decompiler/src/main/java/org/jrd/frontend/frame/main/DecompilationController.java
4

/home/ohrdlicka/Projects/java-runtime-decompiler/runtime-decompiler/src/main/java/org/jrd/frontend/frame/main/MainFrameView.java
2

/home/ohrdlicka/Projects/java-runtime-decompiler/runtime-decompiler/src/main/java/org/jrd/frontend/frame/remote/NewConnectionView.java
2

/home/ohrdlicka/Projects/java-runtime-decompiler/runtime-decompiler/src/main/java/org/jrd/frontend/frame/settings/SettingsView.java
5

/home/ohrdlicka/Projects/java-runtime-decompiler/runtime-decompiler/src/main/java/org/jrd/frontend/frame/overwrite/OverwriteClassDialog.java
6

/home/ohrdlicka/Projects/java-runtime-decompiler/runtime-decompiler/src/main/java/org/jrd/frontend/frame/overwrite/FileToClassValidator.java
2

/home/ohrdlicka/Projects/java-runtime-decompiler/runtime-decompiler/src/main/java/org/jrd/frontend/frame/filesystem/NewFsVmController.java
2

/home/ohrdlicka/Projects/java-runtime-decompiler/runtime-decompiler/src/main/java/org/jrd/frontend/frame/filesystem/NewFsVmView.java
2

/home/ohrdlicka/Projects/java-runtime-decompiler/runtime-decompiler/src/main/java/org/jrd/frontend/utility/CommonUtils.java
2

/home/ohrdlicka/Projects/java-runtime-decompiler/runtime-decompiler/src/main/java/org/jrd/frontend/utility/AgentApiGenerator.java
4
  • holding a lot of JComponents as fields, requiring each's initialization in the constructor, making constructors overly long

Notable outliers are of cource MainFrameView, BytecodeDecompilerView, and OverwriteClassDialog.

AurumTheEnd avatar Oct 20 '21 07:10 AurumTheEnd

thats the spirirt!

judovana avatar Oct 20 '21 10:10 judovana