Upgrade Java version to 25 on iteration 3#2
Open
moonct wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Java Version Upgrade — Executive Report
Project: Bytecode Viewer 2.13.2 | Date: 2026-05-11 | Target: Java 25
1. 📋 Executive Summary
Bytecode Viewer, an open-source Java/Android reverse engineering suite, was successfully upgraded from Java 8 to Java 25 using an automated OpenRewrite migration pipeline combined with AI-assisted compilation fix-up via Amazon Kiro CLI. The automated tooling handled the bulk of the migration across 80+ source files in under 4 minutes. A post-migration compilation failure caused by unresolved OpenRewrite template placeholders was identified and fully resolved by Kiro, resulting in a clean build with zero compilation errors and all tests passing.
2. 🗂️ Application Changes
3. 🛠️ Tools Used
com.amazonaws.java.migrate.UpgradeToJava254. 🔧 Code Changes
Automated by OpenRewrite
pom.xml— Java version properties and maven-compiler-plugin updated to release 25instanceofpattern matching —if (x instanceof Foo) { Foo f = (Foo) x; }→if (x instanceof Foo f)across 15+ files (FileDrop,FieldCallSearch,MethodCallSearch,LDCSearch,ArrayParser,MethodCallParser,ConditionalParser,MyVoidVisitor,FieldAccessParser,ParserUtil,ClassViewer,TabComponent,GoToAction,ExtendedJOptionPane,ASMResourceUtil, and more)switchstatements converted to switch expressions (HexViewer,InstructionPrinter,BytecodeViewPanelUpdater,ClassViewer)String.formatted()—String.format(...)→"...".formatted(...)(FileHeaderUtils,MalwareCodeScanner,StackFramesRemover,PluginManager)"""..."""(APKExport,JavaBytecodeTokenMaker,ClassViewer)URLconstructor →URI.create()— Deprecatednew URL(...)replaced withURI.create(...).toURL()(PingBack,Boot,UpdateCheck)Paths.get()→Path.of()— (JRTExtractor,DirectoryResourceImporter)SequencedCollectionAPIs —list.get(0)→list.getFirst(),list.get(list.size()-1)→list.getLast()(MiscUtils,JRTExtractor,Settings,APKExport,ClassNodeDecompiler,MethodNodeDecompiler,FieldNodeDecompiler,MainViewerGUI,ResourceListIconRenderer,MyErrorStripe,GoToAction)_— Unused lambda/catch parameters renamed to_across 30+ files@Serialannotation — Added toserialVersionUIDfields in Swing componentsSystem.out→IO.println()— In applicable contexts across CLI and utility classespublic static void main(String[] args)modernized inBytecodeViewerandIconDemoClassLoader.defineClass— Migrated deprecated API inLibraryClassLoaderBootState,CLIAction,ContextMenuType,DecompilerViewComponent,New,GoToBinaryPositionMode)Manual fixes by Kiro CLI (post-OpenRewrite)
InstructionPrinter.java— OpenRewrite left 16 broken__P__.<String>p()placeholders in a pattern-matching switch. Restored the originalif-instanceofdispatch chain callingprintVarInsnNode(),printIntInsnNode(), etc.AllatoriStringDecrypter.java— OpenRewrite replaced a complex 70-lineif-instanceofblock with broken placeholders. Fully restored the Allatori string decryption logic (LDC tracking, invokestatic detection, class loading, and InvokeDynamic handling).BytecodeViewPanelUpdater.java(×2) —yield __P__.nullp()placeholder in switch expressiondefaultbranches replaced withyield null.ClassViewer.java(×1) — Sameyield __P__.nullp()placeholder replaced withyield null.5. ⏱️ Time Savings Estimate
AllatoriStringDecrypterlogic6. 🚀 Next Steps
Validation
java -jaron JDK 25Improvement Recommendations
__P__.<T>p()/__P__.nullp()unresolved template issue to the OpenRewrite project; these indicate theIfElseIfConstructToSwitch+SwitchCaseReturnsToSwitchExpressionrecipe chain fails silently on complex method bodiescom.amazonaws.java.migrate.UpgradeToJava25recipe version inrewrite.ymlto ensure reproducible future runs--enable-previewin the Maven compiler config to access Java 25 preview features (value types, etc.) if needed in future iterations