Public report of zhkl0228/unidbg, published 17 November 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 17 November 2026, 18:39 UTC · Survey ID cd_ea469f99cce2402c879682afa5c23996

zhkl0228/unidbg

Measured 17 November 2026, 18:38 UTC, at code version cb848be

First survey, so nothing to compare with yet Knowledge freshness: not measured

Knowledge freshness is not measured: Freshness signal contradicted by repo activity.

CAI score 54.7out of 100 Adequate
CriticalWeakAdequateStrongExemplary

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A medium codebase: 82,228 lines of product code in 10 projects, tests not counted · Estimated rebuild effort: about 0.7 person-years · Weakest lens: Production Readiness, 46.8

Findings by how serious they are

18 critical 1320 serious 72 minor

16 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
17 November 2026, 18:38 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that implements it, and today the Canine Code Analyzer is the only one that does.

The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

55of 55 dimensions measured by tools.
1395of 1410 findings point to an exact file and line, so you can open each one in the code. The other 15 concern the repository as a whole, such as missing documentation.
55dimensions across 5 lenses, read from 82,228 lines of product code in 10 projects.
Chapters

Executive summary

zhkl0228/unidbg falls short of our standard for a preview release because we found no automated security scanning of the code, its secrets or its dependencies. It scores 54.7 out of 100 and is rated Adequate, and 15 of its 18 critical findings are security problems in its servers and containers and in the build pipeline.

Production Readiness, at 46.8, is the weakest lens and counts most in the score. The best first step is replacing the three packages under a banned licence, worth about 7.2 points. Making the naming consistent comes next, worth about 2.6 points. Raising Production Readiness to 62 would lift the score to about 60.3.

Fourteen settings leave the servers or containers unsafe. Three packages carry licence risk, and one pipeline tool is referenced by a changeable name, so the build pipeline can be tampered with. Correcting the unsafe settings, replacing or clearing the banned-licence packages and pinning the tool to an exact version would close these risks.

The product code is 82,228 lines, about €100,000 to rebuild. Two of our security checks couldn't finish, among them the one for known security holes in its packages, so those results are missing, not clean passes.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Production Readiness 46.8 · counts for 47%Code Health 55.6 · counts for 26%Maturity 60.0 · counts for 14%Security and Compliance 69.1 · counts for 8%Architecture 91.8 · counts for 4%

If Production Readiness rose from 46.8 to 62, the lowest score rated Strong, the score would rise from 54.7 to about 60.3.

Code composition: what the lines of code are
Product code 94%Tests 6%
Rebuild cost: about €100,000 · Estimate
Cost to rebuild€35,000 to €170,000, for 581 to 1,842 hours of work, about 0.7 person-years for 1 to 2 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.8 at a score of 55. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeMedium: 82,228 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
Resolve the 3 Banned license finding(s) in License Compliance.
Raises the score by about 7.2 points · Low effort · License Compliance
2
Resolve the 1 `AndroidElfLoader` spells `Elf` where 17 names in the project spell it… finding(s) in Naming Consistency — start with AndroidElfLoader.java.
Raises the score by about 2.6 points · Low effort · Naming Consistency
3
Add a SAST step to CI running what this repository's stack ships: spotbugs with find-sec-bugs — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.
Raises the score by about 6.2 points · Medium effort · Security & performance tooling

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Where the investment is most exposed · Value at risk
This code would cost about €100,000 to build again, about 0.7 person-years of work. Its weakest lens is Production Readiness, at 46.8 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 3 Banned license finding(s) in License Compliance. Of all the actions in this report, it raises the score most for the work it takes: about 7.2 points for low effort, because it clears the 3 License Compliance findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.0 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 7% to 17% on every change. The history of the code shows how much it changes: about 6,544 lines over the last 90 days, which is about 26,540 lines a year. At that pace, the extra work comes to an estimated 4.9 to 29.6 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.

arch dynarmic dynarmic kvm kvm unicorn unicorn unidbg-android unidbg-android unidbg-api unidbg-api unidbg-android->unidbg-api unidbg-dynarmic unidbg-dynarmic unidbg-dynarmic->unidbg-api unidbg-hypervisor unidbg-hypervisor unidbg-hypervisor->unidbg-api unidbg-ios unidbg-ios unidbg-ios->unidbg-api unidbg-kvm unidbg-kvm unidbg-kvm->unidbg-api unidbg-unicorn2 unidbg-unicorn2 unidbg-unicorn2->unidbg-api

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

74 modules, with 306 dependencies between them. 3 loops run through 32 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 34 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 pointer2 signal3 debugger4 thread5 arm.backend.hypervisor6 arm.backend7 arm.context8 file9 unix10 spi11 memory12 hook13 unwind14 arm15 linux.android.dvm16 com.github.unidbg17 hook.hookzz18 ios.objc.processor19 ios.patch20 ios.signal21 linux.android22 linux.signal23 unix.struct24 virtualmodule.android25 ios.struct.objc26 linux.struct27 linux.thread28 file.linux29 ios.hook30 ios.objc31 ios32 linux33 ios.struct.sysctl34 ios.struct.kernel35 file.ios36 ios.thread37 ios.file38 ios.ipa39 ios.kevent40 ios.dmg
1 pointer2106
2 signal21
3 debugger1236
4 thread110217
5 arm.backend.hypervisor4101
6 arm.backend12212
7 arm.context623
8 file24
9 unix111412
10 spi31122243118
11 memory6135
12 hook2311615
13 unwind413
14 arm81714224121239
15 linux.android.dvm831236253
16 com.github.unidbg5431612189121
17 hook.hookzz3510620
18 ios.objc.processor516
19 ios.patch31118
20 ios.signal2213
21 linux.android2443101246122243
22 linux.signal22125
23 unix.struct104
24 virtualmodule.android4112316
25 ios.struct.objc121233
26 linux.struct8222
27 linux.thread6145344162
28 file.linux15312
29 ios.hook491
30 ios.objc2781
31 ios14354418174649311128
32 linux3323212711914
33 ios.struct.sysctl232252
34 ios.struct.kernel9934232
35 file.ios1432
36 ios.thread34213281
37 ios.file9913720
38 ios.ipa326131334279
39 ios.kevent1211
40 ios.dmg1215232
Uses a module listed above itPart of a loopThe module itself
1 pointer2 signal3 debugger4 thread5 arm.backend.hypervisor6 arm.backend7 arm.context8 file9 unix10 spi11 memory12 hook13 unwind14 arm15 linux.android.dvm16 com.github.unidbg17 hook.hookzz18 ios.objc.processor19 ios.patch20 ios.signal21 linux.android22 linux.signal23 unix.struct24 virtualmodule.android25 ios.struct.objc26 linux.struct27 linux.thread28 file.linux29 ios.hook30 ios.objc31 ios32 linux33 ios.struct.sysctl34 ios.struct.kernel35 file.ios36 ios.thread37 ios.file38 ios.ipa39 ios.kevent40 ios.dmgpointer1signal2debugger3thread4arm.backend.hypervisor5arm.backend6arm.context7file8unix9spi10memory11hook12unwind13arm14linux.android.dvm15com.github.unidbg16hook.hookzz17ios.objc.processor18ios.patch19ios.signal20linux.android21linux.signal22unix.struct23virtualmodule.android24ios.struct.objc25linux.struct26linux.thread27file.linux28ios.hook29ios.objc30ios31linux32ios.struct.sysctl33ios.struct.kernel34file.ios35ios.thread36ios.file37ios.ipa38ios.kevent39ios.dmg40210621123611021741011221262324111412311222431186135231161541381714224121239831236253543161218912135106205163111822132443101246122243221251044112316121233822261453441621531249127811435441817464931112833232127119142322529934232143234213281991372032613133427912111215232+34 more modules (most-connected shown)

At a glance — Code Health · 55.6 · Adequate · gated by D4, X5 ·

At a glance — Architecture · 91.8 · Adequate · gated by D26 ·

At a glance — Maturity · 60.0 · Adequate · gated by M2 ·

At a glance — Readiness · 46.8 · Adequate · gated by P3 ·

At a glance — Security · 69.1 · Checked 5 of 11 · gated by D31, D36 ·

Security & Compliance — OWASP Top-10 mapping

Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).

OWASP categoryFindingsSeverity
A02:2025 — Security Misconfiguration28High / Critical
A05:2025 — Injection5High / Critical
A03:2025 — Software Supply Chain Failures5Medium

Roadmap

Top priorities: Resolve the 3 Banned license finding(s) in License Compliance; Add a SAST step to CI running what this repository's stack ships: spotbugs with find-sec-bugs — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing; Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Resolve the 3 Banned license finding(s) in License Compliance.+7.2 ptsLowLicense Compliance
Resolve the 1 `AndroidElfLoader` spells `Elf` where 17 names in the project spell it… finding(s) in Naming Consistency — start with AndroidElfLoader.java.+2.6 ptsLowNaming Consistency
Add a SAST step to CI running what this repository's stack ships: spotbugs with find-sec-bugs — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.+6.2 ptsMediumSecurity & performance tooling
Resolve the 1 `notifyCallSVC` spells `SVC` where 13 names in the project spell it… finding(s) in Naming Consistency — start with InterruptHookNotifier.java.+2.6 ptsLowNaming Consistency
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.+3.0 ptsMediumArchitecture documentation
Declare the default where Java declares it: `@NullMarked` (org.jspecify.annotations) in each package's `package-info.java`, or once in `module-info.java`, and run NullAway (Error Prone) or the Checker Framework so the declaration is enforced. Then annotate the real exceptions `@Nullable` and resolve the suppressions rather than adding to them: a `@SuppressWarnings("NullAway")` or `castToNonNull(x)` on a value the checker could show to be null is a `NullPointerException` waiting for the path that makes it true — where the value genuinely cannot be null, say something the checker can see instead (a null check, `Objects.requireNonNull`, a non-null field initialised in the constructor).+2.8 ptsMediumNullable reference types
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.+2.6 ptsMediumDeployment & Rollback
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.+2.6 ptsMediumRelease Hygiene

File quality

Per-file score 0–10 — a quality signature. Of 192 files carrying findings, judged against the Preview bar: 3% slop · 5% mixed · 92% near-clean.

FileScoreBandWorst signal
REDACTED0.6SlopIaC & Container Security: High IaC: REDACTED
REDACTED1.4SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.1SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java4.8MixedCyclomatic Complexity: AbstractJni.callObjectMethodV (cyclomatic 79)
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.3MixedStatic Analysis (SAST): Medium: REDACTED
unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java5.5MixedCyclomatic Complexity: AndroidSyscallHandler.futex (cyclomatic 24)
unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java5.5MixedCode Duplication: Edited copy of a member (34 corresponding lines)
unidbg-api/src/main/java/com/github/unidbg/spi/AbstractLoader.java5.9MixedCyclomatic Complexity: AbstractLoader.munmap (cyclomatic 19)
unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java6.0MixedExplicit Debt: TodoComment
unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java6.0MixedExplicit Debt: TodoComment
unidbg-api/src/main/java/com/github/unidbg/arm/Arm64Hook.java6.3MixedCode Duplication: Duplicated block (11 lines × 2)
unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java6.5MixedCyclomatic Complexity: AndroidElfLoader.loadInternal (cyclomatic 105)
unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java7.0Near-cleanCyclomatic Complexity: ARM32SyscallHandler.hook (cyclomatic 152)
unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java7.0Near-cleanCyclomatic Complexity: MachOLoader.loadInternalPhase (cyclomatic 151)
unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java7.0Near-cleanCyclomatic Complexity: AbstractARMDebugger.handleCommon (cyclomatic 132)
unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java7.0Near-cleanCyclomatic Complexity: ARM.showRegs64 (cyclomatic 111)

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it — and it is a grade, not a gap.

Critical — 18

A definite problem that already costs you something and drags the score down: a missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here tends to cause failures elsewhere.

Serious — 1320

Likely wrong, but not failing yet. It degrades the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to carry for two years either.

Minor — 72

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 16

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 55 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.8, the weighted average across measured dimensions.

Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.

What we checked — 55 dimensions across the health lenses
D1D2D3D4D5D6D10D13D14D15D16D17D19D21D26D27D28D29D31D35D36D44AX10AX3AX5AX6GD1IC1M1M2M3M4P1P10P2P3P4P6X12X14X15X16X18X19X20X21X23X25X27X28X29X3X30X4X5

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report — three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 1395 of 1410 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

This report answers yes to all three. That's the bar to hold any assessment to.

Tools & methods

The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Canine Code Analyzer duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic

Every finding is locatable in findings.md. Run 01a1eacd-b8f8-7614-bf75-2e60e71b16c8.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: test source is present (.java) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.java) and this repository declares a JVM test suite (repository root, Maven), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D12 Dependency Hygiene — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not scored — a Maven build resolved 17 artifact(s) (10 behind a shipped release, reported), but the build resolved only part of the graph, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is a COLLECTOR gap, not an environment fault: it declares a published package (pom.xml), but no published-package marker D22 reads admitted any project here, so this ecosystem's public API has no collector, and the remedy is to write one — no change to the scan image can close it.
  • D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D24 compares a comment's words with the identifiers, literals and constructs of the code it annotates, using English function-word and rationale lexicons. Comments in another script or language were left unread rather than counted as clean.
  • D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D30 Dependency Vulnerabilities — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Osv: osv-scanner exited 127 with no findings — dependency CVEs were not measured. 'osv-scanner' exited 127 and produced no findings, and that exit code has no documented repo-side meaning — so this run measured nothing, and nothing here is a statement about the repository.
  • D34 Knowledge Freshness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. File-level freshness contradicts repo activity: 35 commits in the last 90 days, yet 166 of 212 significant files carry no living knowledge. Those two readings cannot both be true, so the per-file recency signal is treated as unreliable here and freshness is not scored for this run.
  • D43 Malicious Dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Osv: osv-scanner exited 127 with no findings — dependency CVEs were not measured. 'osv-scanner' exited 127 and produced no findings, and that exit code has no documented repo-side meaning — so this run measured nothing, and nothing here is a statement about the repository.
  • AX1 Captive dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in unidbg-android/src/main/java/com/github/unidbg/linux/android/XHookImpl.java, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
  • C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
  • ED5 Idempotency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check decides whether a handler's mutation is safe to re-run by recognising its persistence writes (a database save, a repository write, an event publish) and its guards. Those markers are .NET member names, so in this repository's language a write such as `repository.save(order)` is not recognised and a same-named call on an unrelated library type could be. The handlers were found; their idempotency was neither confirmed nor ruled out.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • P1 CI/CD gates — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. A CI pipeline exists and the word "test" appears, but no explicit test-runner invocation (your stack's test command, or a test job) was matched — so either the gate runs tests through a step this pass could not recognise, or "test" is incidental here (a path, "latest", a reporter). Which of the two it is cannot be settled from this dimension's evidence; the coverage dimensions report whether a suite exists at all. You can widen what we reach: name the test runner explicitly in the pipeline step (your stack's test command, or a job named for the suite) so the gate is unambiguous to a reader and to this pass.
  • P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
  • S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.

Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.

Limitations & what we did not check

We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity5.5 / 10Adequate✓ Tool-verified

What it measures: How tangled the control flow is — methods with many branches are hard to test and change.

Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.

Maturity: Documented → Verified → Prevented · effective 5.5 / 10 · rule-coverage 100% · ceiling Prevented

87 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was ARM64SyscallHandler.hook at 168. A further 25 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being KvmBackend64.reg_write at 69 — they are counted neither in the figure above nor in this dimension's score. 8 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java (KvmBackend64.reg_write at 69), backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/arm64/SimpleMemorySizeDetector.java (SimpleMemorySizeDetector.detectReadSize at 42), backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend64.java (DynarmicBackend64.reg_write at 37), unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java (AndroidServer.processCommand at 23), backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend32.java (KvmBackend32.reg_write at 21), and 3 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

ARM64SyscallHandler.hook (cyclomatic 168)unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:146
ARM32SyscallHandler.hook (cyclomatic 152)unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:70
MachOLoader.loadInternalPhase (cyclomatic 151)unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:298
ARM32SyscallHandler.hook (cyclomatic 137)unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:133
AbstractARMDebugger.handleCommon (cyclomatic 132)unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:626

+ 81 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 15 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with ARM64SyscallHandler.hook (cyclomatic 168), ARM32SyscallHandler.hook (cyclomatic 152), MachOLoader.loadInternalPhase (cyclomatic 151). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 15 together lifts Cyclomatic Complexity from 5.5 to about 6.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity5.0 / 10Adequate✓ Tool-verified

What it measures: How hard the code is for a person to follow, beyond raw branching.

Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.

Maturity: Documented → Verified → Prevented · effective 5.0 / 10 · rule-coverage 100% · ceiling Prevented

135 method(s) exceeded the cognitive complexity threshold of 15; the worst was AbstractARMDebugger.handleCommon at 254.

AbstractARMDebugger.handleCommon (cognitive 254)unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:626
MachOLoader.loadInternalPhase (cognitive 236)unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:298
ARM64SyscallHandler.sysctl (cognitive 221)unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1825
AndroidElfLoader.loadInternal (cognitive 186)unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:311
ARM64SyscallHandler.mach_msg_trap (cognitive 186)unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2714

+ 127 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 19 bodies over 60 down to 60 or less in Cognitive Complexity — start with AbstractARMDebugger.handleCommon (cognitive 254), MachOLoader.loadInternalPhase (cognitive 236), ARM64SyscallHandler.sysctl (cognitive 221). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 19 together lifts Cognitive Complexity from 5.0 to about 6.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes7.3 / 10Strong✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: Documented → Verified → Prevented · effective 7.3 / 10 · rule-coverage 100% · ceiling Prevented

108 god class(es) detected.

TooManyMethods: ARM64SyscallHandler · ×34unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:132
MethodTooLong: DalvikVM64.<init> · ×29unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:36
ClassTooLong: MachO · ×25unidbg-ios/src/main/java/io/kaitai/MachO.java:15
FileTooLong: ios/ARM64SyscallHandler.java · ×20unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java

What to do

  1. Resolve the 34 TooManyMethods finding(s) in God Classes — start with ARM64SyscallHandler.java (2), ARM32SyscallHandler.java (2), JniFunction.java. — One of this dimension's main actionable groups (34 warning-level).
  2. Resolve the 29 MethodTooLong finding(s) in God Classes — start with ARM64SyscallHandler.java (4), ARM32SyscallHandler.java (4), Dyld64.java (2). — One of this dimension's main actionable groups (29 warning-level).
  3. Resolve the 25 ClassTooLong finding(s) in God Classes — start with ARM64SyscallHandler.java (2), ARM32SyscallHandler.java (2), MachO.java. — One of this dimension's main actionable groups (25 warning-level).

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication0.0 / 10Critical✓ Tool-verified

What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Verified

683 duplicated block group(s) detected. 27.3 % of the production lines (22,485 of 82,228) are in a reported copy. A further 259 rows report members as variants of one another; the share counts each copied line once, however many rows cite it.

Duplicated block (7 lines × 2) · ×61backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:244
Duplicated block (9 lines × 2) · ×48unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:100
Duplicated block (8 lines × 2) · ×47backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:235
Duplicated block (10 lines × 2) · ×44backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:93
Duplicated block (6 lines × 2) · ×44backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:178

+ 241 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 61 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with ARM32SyscallHandler.java (9), Unicorn2Backend.java (7), Dynarmic.java (4). — One of this dimension's main actionable groups (61 warning-level).
  2. Resolve the 48 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with ARM32SyscallHandler.java (9), DalvikVM.java (9), ARM64SyscallHandler.java (5). — One of this dimension's main actionable groups (48 warning-level).
  3. Resolve the 47 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with ARM32SyscallHandler.java (7), DalvikVM.java (6), ProxyJni.java (6). — One of this dimension's main actionable groups (47 warning-level).

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D5 · Coupling10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

10 production modules (Maven+CMake), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 0 module(s) off the main sequence, with abstractness counted on 7 of the 10 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

✓ On the Gold path — maintain.

Detailed fixes: d5_recommendation.md.

D6 · Cohesion (LCOM4)9.6 / 10Stronggated by 6 serious findings✓ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Verified

6 of 194 classes have LCOM4 above 3.

Low cohesion: AndroidSyscallHandler (LCOM4 6) · ×6unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:56

What to do

  1. Resolve the 6 Low cohesion finding(s) in Cohesion (LCOM4) — start with AndroidSyscallHandler.java, AbstractARM64Emulator.java, AbstractARMEmulator.java. — One of this dimension's main actionable groups (6 warning-level).

Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.

D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the tests truly assert behaviour rather than just running the code.

Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 21 tests.

✓ On the Gold path — maintain.

Detailed fixes: d10_recommendation.md.

D13 · Secret Scanning10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.

Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D14 · License Compliance4.0 / 10Weak✓ Tool-verified

What it measures: Whether the licenses of third-party packages are compatible with your policy.

Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.

Maturity: Documented → Verified → Prevented · effective 4.0 / 10 · rule-coverage 100% · ceiling Verified

3 of 14 declared JVM dependency artifact(s) use a banned license. Licences were resolved from the POMs Maven Central publishes, over the coordinates this repository's 8 Maven/Gradle manifest(s) declare with a version resolvable from the manifest itself — the same declaration-site closure this analysis reads for dependency currency. The JVM has no lockfile a checkout is guaranteed to carry, so this is deliberately NOT the transitive closure. 14 further coordinate(s) are declared with no version at the declaration site — inherited from a parent POM, a BOM or an unresolved Gradle version reference — and are NOT graded: this verdict covers what the checkout pins, not the full transitive graph.

Banned license: com.github.zhkl0228:unicorn · ×3

What to do

  1. Resolve the 3 Banned license finding(s) in License Compliance. — One of this dimension's main actionable groups (3 issue-level).

Detailed fixes: d14_recommendation.md · top locations in Appendix A, every location in findings.md.

D15 · Churn × Complexity Hotspots9.4 / 10Stronggated by 1 serious finding✓ Tool-verified

What it measures: Files that change often and are also complex — the riskiest hotspots.

Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.

Maturity: Documented → Verified → Prevented · effective 9.4 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java (4×105=420)

Hotspot: unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.javaunidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:311

What to do

  1. Resolve the 1 Hotspot finding(s) in Churn × Complexity Hotspots — start with AndroidElfLoader.java. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor8.7 / 10Strong✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

Maturity: Documented → Verified → Prevented · effective 8.7 / 10 · rule-coverage 100% · ceiling Documented

26 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java. Counted over 198 of the 752 production source files in this repository: 540 are under the ~2,400-byte size floor this dimension measures over, and the remaining 14 have no attributable history left to measure.

Off-boarding risk: anonymized user #1 · ×2
Further sole-owners (lower concentration)

What to do

  1. Resolve the 2 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (2 recommendation-level).
  2. Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.

D17 · Explicit Debt10.0 / 10Stronggated by 6 serious findings✓ Tool-verified

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

6 deducted task-comment markers across 82228 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

TodoComment · ×6unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:833

What to do

  1. Resolve the 6 TodoComment finding(s) in Explicit Debt — start with ARM32SyscallHandler.java (4), ARM64SyscallHandler.java (2). — One of this dimension's main actionable groups (6 warning-level).

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

2 of 2 documentation facets pass in full. 11 document(s) read across 8 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D21 · Naming Consistency0.0 / 10Critical✓ Tool-verified

What it measures: Whether names — types, methods, variables — are clear and consistent.

Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Verified

2 naming inconsistencies among 19 declarations measured against a convention their peers follow.

`AndroidElfLoader` spells `Elf` where 17 names in the project spell it `ELF`unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:58
`notifyCallSVC` spells `SVC` where 13 names in the project spell it `Svc`unidbg-api/src/main/java/com/github/unidbg/arm/backend/InterruptHookNotifier.java:13

What to do

  1. Resolve the 1 `AndroidElfLoader` spells `Elf` where 17 names in the project spell it… finding(s) in Naming Consistency — start with AndroidElfLoader.java. — One of this dimension's main actionable groups (1 recommendation-level).
  2. Resolve the 1 `notifyCallSVC` spells `SVC` where 13 names in the project spell it… finding(s) in Naming Consistency — start with InterruptHookNotifier.java. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.

D26 · Project Cohesion1.4 / 10Critical✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic.

Maturity: Documented → Verified → Prevented · effective 1.4 / 10 · rule-coverage 100% · ceiling Documented

3 of 7 build units (Maven) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion · ×3unidbg-android/pom.xml:1

What to do

  1. Resolve the 3 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with pom.xml (3). — One of this dimension's main actionable groups (3 recommendation-level).

Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.

D27 · Navigability8.9 / 10Strong✓ Tool-verified

What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.

Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.

Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.

Maturity: Documented → Verified → Prevented · effective 8.9 / 10 · rule-coverage 100% · ceiling Documented

33 % of calls cross a namespace and 10 % go through an interface, but 65 % of collaborators are co-located — so following a call takes several hops. Baseline: small — navigation cost is tolerated.

Detailed fixes: d27_recommendation.md.

D28 · Secrets (history)10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

gitleaks scanned the full history AND the current working tree and found no secrets.

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)8.1 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.

Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.

Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).

Maturity: Documented → Verified → Prevented · effective 8.1 / 10 · rule-coverage 100% · ceiling Documented

5 finding(s): 0 critical, 1 high, 4 medium, 0 low. 1 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 20 file(s) — `REDACTED` (line 19), `backend/dynarmic/src/main/native/dynarmic/com_github_unidbg_arm_backend_dynarmic_Dynarmic.h` (line 15, line 23, line 31, …), `backend/dynarmic/src/main/native/dynarmic/khash.h` (line 306, line 307, lines 307–313, …), `backend/hypervisor/src/main/native/hypervisor/com_github_unidbg_arm_backend_HypervisorFactory.h` (line 15, line 23, line 31, …), `backend/hypervisor/src/main/native/hypervisor/khash.h` (line 306, line 307, lines 307–313, …), … (+15 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 1 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3). — One of this dimension's main actionable groups (3 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
  3. No action in Static Analysis (SAST) — all 1 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (1 issue-level, 0 of them charged here).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D31 · IaC & Container Security3.9 / 10Weak✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (REDACTED/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 3.9 / 10 · rule-coverage 100% · ceiling Documented

28 finding(s): 0 critical, 14 high, 14 medium, 0 low.

REDACTED
REDACTED

What to do

  1. Resolve the 14 High IaC finding(s) in IaC & Container Security — start with REDACTED (10), REDACTED (4). — One of this dimension's main actionable groups (14 issue-level).
  2. Resolve the 14 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (9), REDACTED (5). — One of this dimension's main actionable groups (14 warning-level).

Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.

D35 · Change Coupling9.9 / 10Stronggated by 5 serious findings✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: AbstractJni.java↔JniFunction.java 97%; Arm64Hook.java↔ArmHook.java 91%; AbstractJni.java↔ProxyJni.java 79%

Change coupling: AbstractJni.java ↔ JniFunction.java · ×5unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:1

What to do

  1. Resolve the 5 Change coupling finding(s) in Change Coupling — start with AbstractJni.java (2), ARM64SyscallHandler.java (2), Arm64Hook.java. — One of this dimension's main actionable groups (5 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D36 · Supply-chain Provenance & Signing2.5 / 10Weak✓ Tool-verified

What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.

Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.

Maturity: Documented → Verified → Prevented · effective 2.5 / 10 · rule-coverage 100% · ceiling Documented

1/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.

Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 0 platform declaration(s) and 21 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AX10 · Code composition10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

AX5 · Architecture & structure10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.

Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.

AX6 · Interface segregation9.7 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').

Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.

  • `Jni` declares 109 abstract methods: `acceptField`, `acceptMethod`, `allocObject`, `callBooleanMethod`, `callBooleanMethod`, `callBooleanMethodV`, `callBooleanMethodV`, `callByteMethodV`, `callByteMethodV`, `callCharMethodV`, `callCharMethodV`, `callDoubleMethod`, `callDoubleMethod`, `callFloatMethodV`, `callFloatMethodV`, `callIntMethod`, `callIntMethod`, `callIntMethodV`, `callIntMethodV`, `callLongMethod`, `callLongMethod`, `callLongMethodV`, `callLongMethodV`, `callObjectMethod`, `callObjectMethod`, `callObjectMethodV`, `callObjectMethodV`, `callShortMethodV`, `callShortMethodV`, `callStaticBooleanMethod`, `callStaticBooleanMethod`, `callStaticBooleanMethodV`, `callStaticBooleanMethodV`, `callStaticDoubleMethod`, `callStaticDoubleMethod`, `callStaticFloatMethod`, `callStaticFloatMethod`, `callStaticIntMethod`, `callStaticIntMethod`, `callStaticIntMethodV`, and 69 more. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 109 declarations carry 56 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 56 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/Jni.java:3
  • `VM` declares 30 abstract methods: `addGlobalObject`, `addLocalObject`, `addNotFoundClass`, `callJNI_OnLoad`, `findClass`, `findLibrary`, `getEmulator`, `getJNIEnv`, `getJavaVM`, `getManifestXml`, `getObject`, `getPackageName`, `getSignatures`, `getVersionCode`, `getVersionName`, `loadLibrary`, `loadLibrary`, `loadLibrary`, `openAsset`, `printMemoryInfo`, `resolveClass`, `setAssetResolver`, `setDvmClassFactory`, `setHashFunction`, `setJni`, `setVerbose`, `setVerboseFieldOperation`, `setVerboseMethodOperation`, `throwException`, `unzip`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 30 declarations carry 28 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 28 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VM.java:13
  • `Backend` declares 36 abstract methods: `addBreakPoint`, `context_alloc`, `context_free`, `context_restore`, `context_save`, `debugger_add`, `destroy`, `emu_start`, `emu_stop`, `enableVFP`, `getCpuFeatures`, `getMemAllocatedSize`, `getMemResidentSize`, `getPageSize`, `hook_add_new`, `hook_add_new`, `hook_add_new`, `hook_add_new`, `hook_add_new`, `hook_add_new`, `mem_map`, `mem_protect`, `mem_read`, `mem_unmap`, `mem_write`, `onInitialize`, `reg_read`, `reg_read_vector`, `reg_write`, `reg_write_vector`, `registerEmuCountHook`, `removeBreakPoint`, `removeJitCodeCache`, `setFastDebug`, `setSingleStep`, `switchUserMode`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 36 declarations carry 31 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 31 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — unidbg-api/src/main/java/com/github/unidbg/arm/backend/Backend.java:8
  • `Arm32RegisterContext` declares 39 abstract methods: `getR0Int`, `getR0Long`, `getR0Pointer`, `getR10Int`, `getR10Long`, `getR10Pointer`, `getR11Int`, `getR11Long`, `getR11Pointer`, `getR12Int`, `getR12Long`, `getR12Pointer`, `getR1Int`, `getR1Long`, `getR1Pointer`, `getR2Int`, `getR2Long`, `getR2Pointer`, `getR3Int`, `getR3Long`, `getR3Pointer`, `getR4Int`, `getR4Long`, `getR4Pointer`, `getR5Int`, `getR5Long`, `getR5Pointer`, `getR6Int`, `getR6Long`, `getR6Pointer`, `getR7Int`, `getR7Long`, `getR7Pointer`, `getR8Int`, `getR8Long`, `getR8Pointer`, `getR9Int`, `getR9Long`, `getR9Pointer`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — unidbg-api/src/main/java/com/github/unidbg/arm/context/Arm32RegisterContext.java:5
  • `FileIO` declares 23 abstract methods: `bind`, `close`, `connect`, `dup2`, `fcntl`, `ftruncate`, `getPath`, `getpeername`, `getsockname`, `getsockopt`, `ioctl`, `isStdIO`, `listen`, `llseek`, `lseek`, `mmap2`, `pread`, `read`, `recvfrom`, `sendto`, `setsockopt`, `shutdown`, `write`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — unidbg-api/src/main/java/com/github/unidbg/file/FileIO.java:9
  • `Debugger` declares 17 abstract methods under just 11 distinct name(s): `addBreakPoint`, `addBreakPoint`, `addBreakPoint`, `addBreakPoint`, `addBreakPoint`, `addBreakPoint`, `addMcpTool`, `close`, `disassembleBlock`, `getBreakPoints`, `hasRunnable`, `isDebugging`, `removeBreakPoint`, `run`, `setDebugListener`, `traceFunctionCall`, `traceFunctionCall`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. That is an OVERLOAD SET, not 17 separate responsibilities: a caller binds to 11 operation(s) and uses the overload it selected, so the Interface-Segregation harm does NOT apply on the caller's side and splitting this into role-interfaces would scatter one operation without relieving anything. The burden that does remain is the IMPLEMENTER's — all 17 signatures must be written and kept in step. Reduce it by collapsing overloads (optional or default parameters, or an options object) rather than by segregating the interface. — unidbg-api/src/main/java/com/github/unidbg/debugger/Debugger.java:10
  • `Memory` declares 20 abstract methods: `allocateStack`, `allocateThreadIndex`, `allocateThreadStack`, `brk`, `freeThreadIndex`, `getLastErrno`, `getMMapListener`, `getMemoryMap`, `getStackBase`, `getStackPoint`, `getStackSize`, `malloc`, `mmap`, `mmap2`, `mprotect`, `munmap`, `pointer`, `setErrno`, `setMMapListener`, `setStackPoint`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — unidbg-api/src/main/java/com/github/unidbg/memory/Memory.java:11
  • `Loader` declares 19 abstract methods under just 15 distinct name(s): `addHookListener`, `addModuleListener`, `disableCallInitFunction`, `dlclose`, `dlopen`, `dlopen`, `dlsym`, `findModule`, `findModuleByAddress`, `getLoadedModules`, `getMaxLengthLibraryName`, `getMaxSizeOfLibrary`, `load`, `load`, `load`, `load`, `loadVirtualModule`, `setCallInitFunction`, `setLibraryResolver`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. That is an OVERLOAD SET, not 19 separate responsibilities: a caller binds to 15 operation(s) and uses the overload it selected, so the Interface-Segregation harm does NOT apply on the caller's side and splitting this into role-interfaces would scatter one operation without relieving anything. The burden that does remain is the IMPLEMENTER's — all 19 signatures must be written and kept in step. Reduce it by collapsing overloads (optional or default parameters, or an options object) rather than by segregating the interface. — unidbg-api/src/main/java/com/github/unidbg/spi/Loader.java:15
  • `Emulator<T>` declares 43 abstract methods: `attach`, `attach`, `createURLibraryFile`, `eEntry`, `eFunc`, `emulateSignal`, `get`, `getBackend`, `getContext`, `getDlfcn`, `getFamily`, `getFileSystem`, `getMemory`, `getPageAlign`, `getPid`, `getPointerSize`, `getProcessName`, `getReturnAddress`, `getSvcMemory`, `getSyscallHandler`, `getThreadDispatcher`, `getUnwinder`, `is32Bit`, `is64Bit`, `isRunning`, `loadLibrary`, `loadLibrary`, `popContext`, `pushContext`, `set`, `setTimeout`, `setTraceSystemMemoryWrite`, `showRegs`, `showRegs`, `traceCode`, `traceCode`, `traceCode`, `traceRead`, `traceRead`, `traceRead`, and 3 more. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 43 declarations carry 34 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 34 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — unidbg-api/src/main/java/com/github/unidbg/Emulator.java:33

What to do

  • Split fat interfaces into focused role-interfaces so clients depend only on what they use.
  • Where the width is an overload set rather than separate responsibilities, collapse the overloads instead — segregating those relieves no caller.
GD1 · Unfinished & placeholder code10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Unreviewed-generation residue in this repository's Java: methods whose whole body only throws a "not implemented" or bare unsupported-operation exception, or returns a default value (or nothing) under a TODO/FIXME marker, and placeholder text (lorem ipsum, changeme/replace_me…) left in strings of non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.

Method: Roslyn syntax scan: NotImplementedException throws and placeholder string literals in non-test, non-generated shipped code. Deterministic, code-shape signature.

IC1 · Incompleteness & stubs10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Unfinished work detected by code SHAPE, not keywords, in this repository's Java: methods that only throw a "not implemented" exception, methods that take inputs and return a constant or do nothing, dead `if (false)` branches, and skeleton classes most of whose methods are holes.

Method: Roslyn syntax scan: incompleteness by code shape (constant-returning methods, async-never-await, #if false branches, guards that return what the code already falls through to, tests an earlier guard already decided, comparisons against NaN, skeleton types), not keyword-gated. Deterministic, code-shape heuristic.

M1 · Documentation (README)7.8 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
M2 · Architecture documentation0.0 / 10Critical✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
  • No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
  • Add a C4 context/container diagram (Structurizr, PlantUML or Mermaid) or an architecture.md overview.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.

Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.

P1 · CI/CD gates8.5 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

What to do

  • Run the test suite in CI via an explicit runner step (`mvn test` for the toolchain this pipeline already uses) and gate merges on it.
P10 · Library API & versioning10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

  • 1 public type in `com.github.unidbg.linux.android` is marked as implementation by its own namespace, folder or name: `XHookImpl` (unidbg-android/src/main/java/com/github/unidbg/linux/android/XHookImpl.java:12, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — unidbg-android/src/main/java/com/github/unidbg/linux/android/XHookImpl.java:12
  • 2 public types in `com.github.unidbg.hook.hookzz` are marked as implementation by their own namespace, folder or name: `HookZzArm32RegisterContextImpl` (unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZzArm32RegisterContextImpl.java:11, name ends in `Impl`), `HookZzArm64RegisterContextImpl` (unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZzArm64RegisterContextImpl.java:10, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZzArm32RegisterContextImpl.java:11
  • 1 public type in `com.github.unidbg.memory` is marked as implementation by its own namespace, folder or name: `MemoryBlockImpl` (unidbg-api/src/main/java/com/github/unidbg/memory/MemoryBlockImpl.java:7, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — unidbg-api/src/main/java/com/github/unidbg/memory/MemoryBlockImpl.java:7

What to do

  • Hide `com.github.unidbg.linux.android` (`XHookImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `com.github.unidbg.hook.hookzz` (`HookZzArm32RegisterContextImpl`, `HookZzArm64RegisterContextImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `com.github.unidbg.memory` (`MemoryBlockImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
P2 · Observability7.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

What to do

  • Add a health-check endpoint (Spring Boot Actuator's /actuator/health, or a /health route) so orchestrators and load balancers can probe liveness/readiness.
P3 · Security & performance tooling0.0 / 10Critical✓ Tool-verified

Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.

  • No static application security testing detected. For this repository's stack, add spotbugs with find-sec-bugs (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 1 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
  • `pom.xml` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — pom.xml:128

What to do

  • Add a SAST step to CI running what this repository's stack ships: spotbugs with find-sec-bugs — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.
  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback5.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.

Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.

What to do

  • Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
P6 · Release Hygiene5.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

  • No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)

What to do

  • Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.

Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.

Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.

X16 · Unfloored truncation loop10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.

Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.

X18 · Disposal-pattern correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.

Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.

X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.

Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.

X20 · Mistyped argument guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether an argument guard throws the exception its own condition describes — a guard that rejects a value for being EMPTY and reports it as `NullPointerException` (Java, Kotlin, Scala), `ArgumentError.notNull` (Dart) or `ArgumentNullException` (F#'s `nullArg`) tells the caller a parameter was null when it provably was not.

Method: Roslyn syntax: `throw new ArgumentNullException(nameof(p))` statements (or a repository exception type deriving from it) controlled by an `if` — directly or through the `using`, `lock` or `try` that wraps the throw — whose condition is read for a test that is true of a NON-null `p` — an emptiness test that dereferences it (`p.Count == 0`, `!p.Any()`) or a BCL predicate documented true of the empty value (`string.IsNullOrEmpty(p)`); in the `else` branch, for a conjunct of the admitting condition that is FALSE of a non-null `p`. Range guards are read for bounds that leave nothing and for a `p > C.Count` bound whose index then reaches `C[p]`, `C.RemoveAt(p)` or a method of the same type that indexes with it. Deterministic, provable per finding. Advisory.

X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.

Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.

X23 · Unguarded diagnostic materialisation10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.

Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.

X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.

Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.

X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether an enhanced `for` leaves the collection it is walking alone — a body that adds to or removes from the very collection the loop is iterating invalidates the fail-fast iterator it is holding, so the next `next()` throws `ConcurrentModificationException` and the remaining elements are never seen.

Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.

X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.

Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.

X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.

Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.

X3 · Exception handling7.3 / 10Strong✓ Tool-verified

Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.

Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.

  • `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×3) — unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARM64Emulator.java:126, unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARMEmulator.java:112, unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:508
  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×9) — unidbg-ios/assets/gpb.js:244, unidbg-ios/assets/gpb.js:302, unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:838, …
  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch. (×2) — unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:389, unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:398

What to do

  • Swallowed exception (caught, then discarded)
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.

Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.

X4 · Structured logging7.9 / 10Strong✓ Tool-verified

Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.

Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.

  • `debug` at line 1680 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.debug("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1680
  • `debug` at line 2894 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.debug("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2894
  • `trace` at line 1892 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.trace("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1892
  • `warn` at line 269 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — unidbg-android/src/main/java/net/fornwall/jelf/ElfDynamicStructure.java:269

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types2.0 / 10Critical✓ Tool-verified

Other · Code Health — Whether Java packages are null-marked and not undermined by heavy nullness suppression — a package under `@NullMarked` (or `@NonNullApi`, `@ParametersAreNonnullByDefault`, `@NonNullByDefault`, or a NullAway/Checker Framework configuration naming it) makes an unannotated reference exclude null, and `@SuppressWarnings("NullAway")`, `("nullness")`, `("null")` and `castToNonNull(…)` are what silence it.

Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.

  • 0/79 of this repository's Java package directories are under a non-null default: a `package-info.java` declaring `@NullMarked` (JSpecify) or `@NonNullApi`, `@ParametersAreNonnullByDefault`, `@NonNullByDefault`, `@DefaultQualifier(NonNull.class)`; a `module-info.java` declaring `@NullMarked`; every type in it `@NullMarked`; or a build that runs NullAway with the package in `AnnotatedPackages`, or the Checker Framework's `NullnessChecker`. Elsewhere every reference admits null and no checker warns on the dereference that throws a `NullPointerException`.

What to do

  • Declare the default where Java declares it: `@NullMarked` (org.jspecify.annotations) in each package's `package-info.java`, or once in `module-info.java`, and run NullAway (Error Prone) or the Checker Framework so the declaration is enforced. Then annotate the real exceptions `@Nullable` and resolve the suppressions rather than adding to them: a `@SuppressWarnings("NullAway")` or `castToNonNull(x)` on a value the checker could show to be null is a `NullPointerException` waiting for the path that makes it true — where the value genuinely cannot be null, say something the checker can see instead (a null check, `Objects.requireNonNull`, a non-null field initialised in the constructor).

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health55.6Adequate — gated by D4, X5Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture91.8Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity60.0Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness46.8Adequate — gated by P3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security69.1Checked 5 of 11Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Unscored — 2 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • X10 Duplicated predicate — 38 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 56 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No class in this Java code is a Spring, JSR-330 or CDI singleton bean. No Swift request handler (a Vapor, Hummingbird, Kitura, Swifter or Perfect route handler, as a method or a registered closure) is declared, so no state is shared between request threads. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX4 Dependency direction — not applicable to a CQRS architecture (the inward-dependency rule is for layered/clean styles)
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — no test/production split to check
  • AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — docker build failed (exit 1) — s "/bin/sh -c sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-*.repo && sed -i 's|^#[ ]*baseurl=http://mirror.centos.org|baseurl=https://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && yum install -y gcc make git pkgconfig java-1.8.0-openjdk-devel && yum clean all" did not complete successfully: exit code: 1; likely cause (the repository): a RUN step of the repository's REDACTED exited with code 1 (`/bin/sh -c sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-*.repo && sed -i 's|^#[ ]*baseurl=http://m…`): the build's own command failed, for example a compile or test error; runtime evidence skipped The cause is in the repository, not in our sandbox: a RUN step of the repository's REDACTED exited with code 1 (`/bin/sh -c sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-*.repo && sed -i 's|^#[ ]*baseurl=http://m…`): the build's own command failed, for example a compile or test error. Nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • D11 Test Reliability — Test reliability not included — the .java suite was found but not re-run
  • D12 Dependency Hygiene — Not scored — a Maven build resolved 17 artifact(s) (10 behind a shipped release, reported), but the build resolved only part of the graph, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D20 ADR Quality — N/A — ADRs are expected on deployable products with a user-facing host, not consumed libraries; no ADR log is required here.
  • D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — 28 of 28 comment blocks were not judged (28 in a language other than English): redundancy is judged by word overlap with the code's identifiers, which cannot be measured across languages.
  • D25 ADR Conformance — no ADRs to check
  • D30 Dependency Vulnerabilities — Scanner failed to run — not a clean result
  • D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
  • D34 Knowledge Freshness — knowledge concentrated in recent work — freshness signal contradicted by repo activity
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D43 Malicious Dependencies — Scanner failed to run — not a clean result
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not included — suite not readable by the collector
  • DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 65 value object(s); 2 domain event(s); its domain events are published by services or handlers — no domain entity raises one
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and this analysis resolves a call's owner only where the receiver's type is written down in the source. Reported as guidance rather than measured
  • ED5 Idempotency — Not assessed, and this one is on us: 7 command handler(s) or message consumer(s) were found here, but this check does not yet recognise persistence writes in this repository's language. Idempotency was neither confirmed nor ruled out — this is a limit of the analyzer, not a finding about your code.
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JVM, JavaScript/TypeScript source, so there is no service whose uptime a failing dependency could take down
  • P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
  • P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `@Benchmark` in a Java, Kotlin or Scala file importing JMH or kotlinx-benchmark, Jetpack Benchmark's `measureRepeated` in a file importing androidx.benchmark, or JMH/kotlinx-benchmark/androidx.benchmark in a pom.xml, Gradle or sbt build, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • PF3 Async & latency hygiene — Not applicable: this repository declares no async functions, so there is no asynchronous code for a blocking call to stall.
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • X1 Async correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X2 Cancellation propagation — no C# was loaded; this repository's Java was read, and no request in it can be cancelled by a caller — a Java request off Android takes no token: it is cancelled through the handle it returns (Future.cancel, Call.cancel, a Disposable), ambiently (io.grpc.Context) or by interrupting its thread, not through a parameter
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 18 finding(s)
D31 · IaC & Container Security · High IaC · ×14
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D14 · License Compliance · Banned license · ×3
  • Banned license: com.github.zhkl0228:unicorn — `com.github.zhkl0228:unicorn` 1.0.15 is published on Maven Central under `GPL-2.0`, which this policy bans, and this repository declares it in a Maven or Gradle manifest. The licence was read from the artifact's POM `<licenses>` block — following `<parent>` where the POM inherits them — and normalised to SPDX before it was judged, because Maven publishes the name as free text (`GNU Affero General Public License v3` is AGPL-3.0). Where a POM lists several licences they are read as a CHOICE, per Maven's own documentation, so this is charged only because EVERY listed licence is banned. Replace the dependency, or record an accepted exception.
  • Banned license: com.github.zhkl0228:keystone — `com.github.zhkl0228:keystone` 0.9.7 is published on Maven Central under `GPL-2.0`, which this policy bans, and this repository declares it in a Maven or Gradle manifest. The licence was read from the artifact's POM `<licenses>` block — following `<parent>` where the POM inherits them — and normalised to SPDX before it was judged, because Maven publishes the name as free text (`GNU Affero General Public License v3` is AGPL-3.0). Where a POM lists several licences they are read as a CHOICE, per Maven's own documentation, so this is charged only because EVERY listed licence is banned. Replace the dependency, or record an accepted exception.
  • Banned license: com.github.zhkl0228:demumble — `com.github.zhkl0228:demumble` 1.0.4 is published on Maven Central under `GPL-2.0`, which this policy bans, and this repository declares it in a Maven or Gradle manifest. The licence was read from the artifact's POM `<licenses>` block — following `<parent>` where the POM inherits them — and normalised to SPDX before it was judged, because Maven publishes the name as free text (`GNU Affero General Public License v3` is AGPL-3.0). Where a POM lists several licences they are read as a CHOICE, per Maven's own documentation, so this is charged only because EVERY listed licence is banned. Replace the dependency, or record an accepted exception.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
Serious — 1320 finding(s)
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×61
  • Duplicated block (7 lines × 2) backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:244 — backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:244-250 | unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java:219-225 — before extracting anything, compare `backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java` and `unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:244` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `Unicorn` names `com.github.unidbg.arm.backend.unicorn.Unicorn` in one and `unicorn.Unicorn` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 2) backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/unicorn/Unicorn.java:242 — backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/unicorn/Unicorn.java:242-248 | unidbg-api/src/main/java/com/github/unidbg/arm/backend/Backend.java:82-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/unicorn/Unicorn.java:242` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:869 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:869-875 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:552-558 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:869` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1411 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1411-1417 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:900-906 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1962 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1962-1968 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1477-1483 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1962` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:141 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:141-147 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1155-1161 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `emulator` to `Emulator<AndroidFileIO>` in one and `Emulator<?>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:229 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:229-235 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:275-281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `emulator` to `Emulator<?>` in one and `Emulator<AndroidFileIO>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:197 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:197-203 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:261-267 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:93 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:93-99 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:262-268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:35 — unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:35-41 | unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:61-67 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:35` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/ArmVarArg32.java:28 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/ArmVarArg32.java:28-34 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/ArmVarArg32.java:36-42 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/ArmVarArg32.java:28` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1332 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1332-1338 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1364-1370 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1332` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1587 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1587-1593 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1633-1639 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1587` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3027 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3027-3033 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3120-3126 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3027` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3034` calls `isDebugEnabled`, `debug` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3127` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1362 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1362-1368 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1394-1400 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1362` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java:62 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java:62-68 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmMethod.java:267-273 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java:62` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:168 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:168-174 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:184-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:168` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/DirectoryFileIO.java:75 — unidbg-android/src/main/java/com/github/unidbg/linux/file/DirectoryFileIO.java:75-81 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/DirectoryFileIO.java:61-67 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/file/DirectoryFileIO.java:75` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:38 — unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:38-44 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java:39-45 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:38` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:45` calls `onFileOpened` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java:46` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:234 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:234-240 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java:237-243 — before extracting anything, compare `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java` and `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:234` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:176 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:176-182 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:228-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:176` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:66 — unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:66-72 | unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARMDebugger.java:67-73 — before extracting anything, compare `unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java` and `unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARMDebugger.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:66` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall32.java:88 — unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall32.java:88-94 | unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall64.java:46-52 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall32.java:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `OpInfo` names `capstone.api.arm.OpInfo` in one and `capstone.api.arm64.OpInfo` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1337 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1337-1343 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1834-1840 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1337` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1416 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1416-1422 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1958-1964 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1416` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 36 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×48
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:100 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:100-108 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:162-170 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:100` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:110 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:110-118 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:172-180 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:110` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:942 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:942-950 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:649-657 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:942` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:939` calls `isDebugEnabled`, `debug` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:648` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1053 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1053-1061 | unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:525-533 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1459 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1459-1467 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:889-897 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1459` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:91 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:91-99 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:168-176 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:91` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:101 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:101-109 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:178-186 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:101` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:439 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:439-447 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:873-881 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `emulator` to `Emulator<AndroidFileIO>` in one and `Emulator<?>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1374 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1374-1382 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:504-512 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:597 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:597-605 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:616-624 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:597` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:228 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:228-236 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:256-264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:228` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:272 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:272-280 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:336-344 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:272` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:68 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:68-76 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:252-260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:292 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:292-300 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:320-328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:292` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:104 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:104-112 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:376-384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:200 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:200-208 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:205-213 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:200` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2882 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2882-2890 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2890-2898 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2882` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2917 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2917-2925 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2996-3004 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2917` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3475 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3475-3483 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3574-3582 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3475` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3602 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3602-3610 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3701-3709 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3602` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3885 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3885-3893 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:4006-4014 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3885` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:99 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:99-107 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:384-392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:99` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2622 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2622-2630 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2647-2655 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2622` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2982 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2982-2990 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3061-3069 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2982` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3001 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3001-3009 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3031-3039 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3001` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 23 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×47
  • Duplicated block (8 lines × 2) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:235 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:235-242 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java:218-225 — before extracting anything, compare `backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java` and `backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:235` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:125 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:125-132 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:186-193 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:125` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1865 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1865-1872 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1391-1398 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:802 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:802-809 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:660-667 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:802` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:518 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:518-525 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:528-535 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:518` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:267 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:267-274 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:568-575 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `emulator` to `Emulator<AndroidFileIO>` in one and `Emulator<?>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:381 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:381-388 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:588-595 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:381` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `emulator` to `Emulator<AndroidFileIO>` in one and `Emulator<?>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidARMEmulator.java:75 — unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidARMEmulator.java:75-82 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:259-266 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:240 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:240-247 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:388-395 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:304 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:304-311 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:482-489 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:133 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:133-140 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:355-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:133` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1506 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1506-1513 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2386-2393 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1506` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2929 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2929-2936 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2994-3001 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2929` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3289 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3289-3296 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3382-3389 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3289` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3380` calls `printf`, `getLRPointer` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3288` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3314 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3314-3321 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3410-3417 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3314` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3408` calls `printf`, `getLRPointer` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3313` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3332 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3332-3339 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3431-3438 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3332` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3429` calls `printf`, `getLRPointer` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3331` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:128 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:128-135 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:363-370 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:128` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2053 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2053-2060 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2078-2085 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2053` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:50 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:50-57 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:64-71 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:102 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:102-109 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:115-122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:128 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:128-135 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:141-148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:154 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:154-161 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:167-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:180 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:180-187 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:193-200 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:206 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:206-213 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:219-226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/DnsProxyDaemon.java:167 — unidbg-android/src/main/java/com/github/unidbg/linux/file/DnsProxyDaemon.java:167-174 | unidbg-android/src/main/java/com/github/unidbg/linux/file/DnsProxyDaemon.java:182-189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 22 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×44
  • Duplicated block (10 lines × 2) backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:93 — backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:93-102 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:105-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:93` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/file/linux/BaseAndroidFileIO.java:36 — unidbg-android/src/main/java/com/github/unidbg/file/linux/BaseAndroidFileIO.java:36-45 | unidbg-ios/src/main/java/com/github/unidbg/file/ios/BaseDarwinFileIO.java:449-458 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1052 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1052-1061 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2073-2082 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1494 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1494-1503 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:955-964 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1494` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1708 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1708-1717 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1203-1212 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:864 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:864-873 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3970-3979 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:818 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:818-827 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:852-861 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:818` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:235 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:235-244 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:299-308 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/URLibraryFile.java:56 — unidbg-android/src/main/java/com/github/unidbg/linux/android/URLibraryFile.java:56-65 | unidbg-ios/src/main/java/com/github/unidbg/ios/URLibraryFile.java:55-64 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:181 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:181-190 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:179-188 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:181` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:236 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:236-245 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:241-250 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:236` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:248 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:248-257 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:253-262 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:248` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:302 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:302-311 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:310-319 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:302` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:346 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:346-355 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:354-363 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:346` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:889 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:889-898 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2044-2053 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:889` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2773 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2773-2782 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2788-2797 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2773` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3342 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3342-3351 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3441-3450 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3342` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3444 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3444-3453 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3468-3477 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3444` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2643 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2643-2652 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3027-3036 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2643` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3543 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3543-3552 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3567-3576 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3543` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:234 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:234-243 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:251-260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:234` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:268 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:268-277 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:285-294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:268` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:302 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:302-311 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:370-379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:302` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:387 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:387-396 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:404-413 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:387` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:422 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:422-431 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:439-448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:422` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 19 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×44
  • Duplicated block (6 lines × 2) backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:178 — backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:178-183 | backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:209-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:178` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `callback` to `CodeHook` in one and `ReadHook` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1226 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1226-1231 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:746-751 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1226` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1805 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1805-1810 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2966-2971 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1805` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:660 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:660-665 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:636-641 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:660` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `SigAction` names `com.github.unidbg.ios.signal.SigAction` in one and `com.github.unidbg.linux.signal.SigAction` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:778 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:778-783 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1602-1607 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:778` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `emulator` to `Emulator<AndroidFileIO>` in one and `Emulator<?>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:471 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:471-476 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:479-484 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:471` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1326 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1326-1331 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1356-1361 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1358 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1358-1363 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1388-1393 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1562 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1562-1567 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1608-1613 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1562` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1634 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1634-1639 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1680-1685 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1634` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1660 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1660-1665 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1705-1710 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1660` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1715 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1715-1720 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1763-1768 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1715` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2610 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2610-2615 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3460-3465 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2610` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2608` calls `setInt` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3459` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3360 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3360-3365 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3459-3464 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2634 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2634-2639 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3559-3564 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2634` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2632` calls `setInt` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3558` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:48 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:48-53 | unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadClonePatcher32.java:45-50 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:48` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/JniGraphics.java:73 — unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/JniGraphics.java:73-78 | unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/JniGraphics.java:91-96 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/SystemProperties.java:36 — unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/SystemProperties.java:36-41 | unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/SystemProperties.java:52-57 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:814 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:814-819 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:821-826 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:814` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:40 — unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:40-45 | unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:91-96 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall32.java:38 — unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall32.java:38-43 | unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall64.java:27-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall32.java:100 — unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall32.java:100-105 | unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall64.java:58-63 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall32.java:100` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java:153 — unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java:153-158 | unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java:184-189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java:153` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `callback` to `CodeHook` in one and `ReadHook` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:484 — unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:484-489 | unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:496-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:484` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) unidbg-api/src/main/java/com/github/unidbg/mcp/McpServer.java:211 — unidbg-api/src/main/java/com/github/unidbg/mcp/McpServer.java:211-216 | unidbg-api/src/main/java/com/github/unidbg/mcp/McpServer.java:281-286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/mcp/McpServer.java:211` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • + 19 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×41
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:83 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:83-93 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:145-155 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:83` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:600 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:600-610 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1518-1528 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1207 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1207-1217 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:725-735 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1207` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1906 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1906-1916 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1448-1458 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1906` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:780 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:780-790 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:991-1001 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:780` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:62 — unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:62-72 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:947-957 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:62` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:145 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:145-155 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:202-212 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:145` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:317 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:317-327 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:374-384 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:317` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:306 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:306-316 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:350-360 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:306` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:458 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:458-468 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:466-476 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:458` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2050 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2050-2060 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2115-2125 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2050` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2538 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2538-2548 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2915-2925 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2538` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2619 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2619-2629 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2962-2972 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2619` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2631 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2631-2641 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2655-2665 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2631` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2701 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2701-2711 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2728-2738 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2701` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2740` calls `printf`, `getLRPointer` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2712` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3409 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3409-3419 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3508-3518 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3409` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3433 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3433-3443 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3532-3542 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3433` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:314 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:314-324 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:358-368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:314` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) REDACTED:60 — REDACTED:60-70 | REDACTED:59-69 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) REDACTED:102 — REDACTED:102-112 | REDACTED:75-85 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:98` calls `readInternal` and `REDACTED:74` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) REDACTED:159 — REDACTED:159-169 | REDACTED:117-127 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:159` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:128` calls `getSyscallHandler`, `isVerbose`, `printf` and `REDACTED:170` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin23.java:21 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin23.java:21-31 | unidbg-ios/src/main/java/com/github/unidbg/ios/thread/ThreadJoin64.java:22-32 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin23.java:21` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/thread/ThreadJoin64.java:20` calls `findModule` and `unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin23.java:19` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/Arm64Hook.java:72 — unidbg-api/src/main/java/com/github/unidbg/arm/Arm64Hook.java:72-82 | unidbg-api/src/main/java/com/github/unidbg/arm/ArmHook.java:63-73 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/Arm64Hook.java:72` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-api/src/main/java/com/github/unidbg/arm/Arm64Hook.java:71` calls `putInt` and `unidbg-api/src/main/java/com/github/unidbg/arm/ArmHook.java:62` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:54 — unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:54-64 | unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARMDebugger.java:55-65 — before extracting anything, compare `unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java` and `unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARMDebugger.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:54` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:170 — unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:170-180 | unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:230-240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:170` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `data` to `short[]` in one and `byte[]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • + 16 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×34
  • TooManyMethods: ARM64SyscallHandler unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:132 — TooManyMethods — 118 methods. The bar is 30 methods; this is 88 over it, 3.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: JniFunction unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/JniFunction.java:3 — TooManyMethods — 110 methods. The bar is 30 methods; this is 80 over it, 3.67× the bar. Most of these members implement dvm.Jni (56 of 57 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: AbstractJni unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:49 — TooManyMethods — 109 methods. The bar is 30 methods; this is 79 over it, 3.63× the bar. Most of these members implement dvm.Jni (56 of 56 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: ARM32SyscallHandler unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:56 — TooManyMethods — 96 methods. The bar is 30 methods; this is 66 over it, 3.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ARM32SyscallHandler unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:119 — TooManyMethods — 93 methods. The bar is 30 methods; this is 63 over it, 3.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Hypervisor backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:9 — TooManyMethods — 84 methods. The bar is 30 methods; this is 54 over it, 2.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: McpTools unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:43 — TooManyMethods — 75 methods. The bar is 30 methods; this is 45 over it, 2.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Unicorn backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/unicorn/Unicorn.java:13 — TooManyMethods — 69 methods. The bar is 30 methods; this is 39 over it, 2.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ARM64SyscallHandler unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:55 — TooManyMethods — 63 methods. The bar is 30 methods; this is 33 over it, 2.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Dynarmic backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:8 — TooManyMethods — 61 methods. The bar is 30 methods; this is 31 over it, 2.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Kvm backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java:8 — TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AbstractARMDebugger unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:46 — TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Arm32HookContext unidbg-api/src/main/java/com/github/unidbg/hook/Arm32HookContext.java:9 — TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. Most of these members implement context.Arm32RegisterContext (39 of 58 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: MachOLoader unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:72 — TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ProxyJni unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:22 — TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× the bar. Most of these members implement dvm.Jni (54 of 55 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: AbstractEmulator unidbg-api/src/main/java/com/github/unidbg/AbstractEmulator.java:49 — TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BackendArm32RegisterContext unidbg-api/src/main/java/com/github/unidbg/arm/context/BackendArm32RegisterContext.java:9 — TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× the bar. Most of these members implement context.Arm32RegisterContext (39 of 55 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: HookZzArm32RegisterContextImpl unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZzArm32RegisterContextImpl.java:11 — TooManyMethods — 53 methods. The bar is 30 methods; this is 23 over it, 1.77× the bar. Most of these members implement context.Arm32RegisterContext (39 of 53 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: UnidbgPointer unidbg-api/src/main/java/com/github/unidbg/pointer/UnidbgPointer.java:24 — TooManyMethods — 52 methods. The bar is 30 methods; this is 22 over it, 1.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DvmMethod unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmMethod.java:10 — TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: FallbackJni unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/FallbackJni.java:19 — TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. Most of these members implement dvm.Jni (42 of 43 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: DarwinSyscallHandler unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:49 — TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: UnixSyscallHandler unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:34 — TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BaseVM unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/BaseVM.java:23 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AbstractLoader unidbg-api/src/main/java/com/github/unidbg/spi/AbstractLoader.java:39 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 9 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×29
  • MethodTooLong: DalvikVM64.<init> unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:36 — MethodTooLong — <init> runs 2907 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2807 over it, 29.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: DalvikVM.<init> unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:41 — MethodTooLong — <init> runs 2807 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2707 over it, 28.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ARM64SyscallHandler.mach_msg_trap unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2714 — MethodTooLong — mach_msg_trap runs 806 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 706 over it, 8.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ARM32SyscallHandler.mach_msg_trap unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1796 — MethodTooLong — mach_msg_trap runs 628 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 528 over it, 6.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ARM64SyscallHandler.hook unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:146 — MethodTooLong — hook runs 481 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 381 over it, 4.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Dyld64.hook unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:773 — MethodTooLong — hook runs 465 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 365 over it, 4.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ARM32SyscallHandler.hook unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:70 — MethodTooLong — hook runs 444 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 344 over it, 4.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ARM64SyscallHandler.sysctl unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1825 — MethodTooLong — sysctl runs 435 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 335 over it, 4.35× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MachOLoader.loadInternalPhase unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:298 — MethodTooLong — loadInternalPhase runs 420 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 320 over it, 4.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ARM32SyscallHandler.hook unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:133 — MethodTooLong — hook runs 393 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 293 over it, 3.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SymbolResolver.hook unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:75 — MethodTooLong — hook runs 371 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 271 over it, 3.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Dyld64.<init> unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:37 — MethodTooLong — <init> runs 368 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 268 over it, 3.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AbstractARMDebugger.handleCommon unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:626 — MethodTooLong — handleCommon runs 361 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 261 over it, 3.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ARM.showRegs64 unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:277 — MethodTooLong — showRegs64 runs 356 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 256 over it, 3.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ARM64SyscallHandler.hook unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:69 — MethodTooLong — hook runs 320 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 220 over it, 3.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Dyld32.<init> unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:40 — MethodTooLong — <init> runs 288 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 188 over it, 2.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ARM32SyscallHandler.sysctl unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1328 — MethodTooLong — sysctl runs 283 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 183 over it, 2.83× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AndroidElfLoader.loadInternal unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:311 — MethodTooLong — loadInternal runs 273 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 173 over it, 2.73× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ArmLD64.hook unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:50 — MethodTooLong — hook runs 244 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 144 over it, 2.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LoadCommand._read unidbg-ios/src/main/java/io/kaitai/MachO.java:3758 — MethodTooLong — _read runs 226 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 126 over it, 2.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AbstractJni.callObjectMethodV unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:282 — MethodTooLong — callObjectMethodV runs 224 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 124 over it, 2.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ArmLD.hook unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:52 — MethodTooLong — hook runs 193 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 93 over it, 1.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: GnuEhFrameHeader.dwarf_get_loc unidbg-android/src/main/java/net/fornwall/jelf/GnuEhFrameHeader.java:415 — MethodTooLong — dwarf_get_loc runs 191 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 91 over it, 1.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ElfDynamicStructure.<init> unidbg-android/src/main/java/net/fornwall/jelf/ElfDynamicStructure.java:159 — MethodTooLong — <init> runs 188 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 88 over it, 1.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ARM.showRegs unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:63 — MethodTooLong — showRegs runs 177 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 77 over it, 1.77× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 4 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×25
  • ClassTooLong: MachO unidbg-ios/src/main/java/io/kaitai/MachO.java:15 — ClassTooLong — 3250 significant lines (blank, comment-only and punctuation-only lines excluded), 11 methods. The bar is 400 significant lines; this is 2850 over it, 8.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ARM64SyscallHandler unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:132 — ClassTooLong — 3149 significant lines (blank, comment-only and punctuation-only lines excluded), 118 methods. The bar is 400 significant lines; this is 2749 over it, 7.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DalvikVM64 unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:29 — ClassTooLong — 2925 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 2525 over it, 7.31× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DalvikVM unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:34 — ClassTooLong — 2827 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 2427 over it, 7.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ARM32SyscallHandler unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:119 — ClassTooLong — 2241 significant lines (blank, comment-only and punctuation-only lines excluded), 93 methods. The bar is 400 significant lines; this is 1841 over it, 5.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MachOLoader unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:72 — ClassTooLong — 1657 significant lines (blank, comment-only and punctuation-only lines excluded), 58 methods. The bar is 400 significant lines; this is 1257 over it, 4.14× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ARM32SyscallHandler unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:56 — ClassTooLong — 1604 significant lines (blank, comment-only and punctuation-only lines excluded), 96 methods. The bar is 400 significant lines; this is 1204 over it, 4.01× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: McpTools unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:43 — ClassTooLong — 1535 significant lines (blank, comment-only and punctuation-only lines excluded), 75 methods. The bar is 400 significant lines; this is 1135 over it, 3.84× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ARM64SyscallHandler unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:55 — ClassTooLong — 1212 significant lines (blank, comment-only and punctuation-only lines excluded), 63 methods. The bar is 400 significant lines; this is 812 over it, 3.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AbstractARMDebugger unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:46 — ClassTooLong — 1063 significant lines (blank, comment-only and punctuation-only lines excluded), 58 methods. The bar is 400 significant lines; this is 663 over it, 2.66× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Dyld64 unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:33 — ClassTooLong — 1029 significant lines (blank, comment-only and punctuation-only lines excluded), 5 methods. The bar is 400 significant lines; this is 629 over it, 2.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ARM unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:37 — ClassTooLong — 1011 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 611 over it, 2.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AbstractJni unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:49 — ClassTooLong — 864 significant lines (blank, comment-only and punctuation-only lines excluded), 109 methods. The bar is 400 significant lines; this is 464 over it, 2.16× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MachOModule unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:53 — ClassTooLong — 806 significant lines (blank, comment-only and punctuation-only lines excluded), 40 methods. The bar is 400 significant lines; this is 406 over it, 2.02× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ProxyJni unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:22 — ClassTooLong — 623 significant lines (blank, comment-only and punctuation-only lines excluded), 55 methods. The bar is 400 significant lines; this is 223 over it, 1.56× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: HypervisorBackend64 backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/HypervisorBackend64.java:32 — ClassTooLong — 614 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 214 over it, 1.54× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DarwinSyscallHandler unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:49 — ClassTooLong — 593 significant lines (blank, comment-only and punctuation-only lines excluded), 44 methods. The bar is 400 significant lines; this is 193 over it, 1.48× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AndroidElfLoader unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:58 — ClassTooLong — 591 significant lines (blank, comment-only and punctuation-only lines excluded), 22 methods. The bar is 400 significant lines; this is 191 over it, 1.48× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: GnuEhFrameHeader unidbg-android/src/main/java/net/fornwall/jelf/GnuEhFrameHeader.java:16 — ClassTooLong — 548 significant lines (blank, comment-only and punctuation-only lines excluded), 10 methods. The bar is 400 significant lines; this is 148 over it, 1.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AndroidSyscallHandler unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:56 — ClassTooLong — 538 significant lines (blank, comment-only and punctuation-only lines excluded), 39 methods. The bar is 400 significant lines; this is 138 over it, 1.35× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: JniFunction unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/JniFunction.java:3 — ClassTooLong — 491 significant lines (blank, comment-only and punctuation-only lines excluded), 110 methods. The bar is 400 significant lines; this is 91 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Dyld32 unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:36 — ClassTooLong — 460 significant lines (blank, comment-only and punctuation-only lines excluded), 5 methods. The bar is 400 significant lines; this is 60 over it, 1.15× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AndroidServer unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:34 — ClassTooLong — 434 significant lines (blank, comment-only and punctuation-only lines excluded), 34 methods. The bar is 400 significant lines; this is 34 over it, 1.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: UnixSyscallHandler unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:34 — ClassTooLong — 413 significant lines (blank, comment-only and punctuation-only lines excluded), 42 methods. The bar is 400 significant lines; this is 13 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SymbolResolver unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:31 — ClassTooLong — 405 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 5 over it, 1.01× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×24
  • Duplicated block (5 lines × 2) backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:174 — backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:174-178 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:183-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:174` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:697 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:697-701 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:476-480 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:697` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `SigAction` names `com.github.unidbg.ios.signal.SigAction` in one and `com.github.unidbg.linux.signal.SigAction` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (5 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:516 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:516-520 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:544-548 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:516` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2095 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2095-2099 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2137-2141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:164 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:164-168 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:198-202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VarArg.java:61 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VarArg.java:61-65 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:35-39 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VarArg.java:61` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java:48 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java:48-52 | unidbg-ios/src/main/java/com/github/unidbg/ios/thread/BsdThreadCreatePatcher64.java:59-63 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/thread/BsdThreadCreatePatcher64.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java:48` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:284 — unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:284-288 | unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:310-314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1675 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1675-1679 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2560-2564 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1675` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1807 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1807-1811 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2725-2729 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1807` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:262 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:262-266 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:277-281 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:262` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:363 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:363-367 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:380-384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:363` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:218 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:218-222 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2018-2022 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:218` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:117 — unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:117-121 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaLoader.java:155-159 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:117` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARM64Emulator.java:109 — unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARM64Emulator.java:109-113 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARMEmulator.java:95-99 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2003 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2003-2007 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1530-1534 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZzArm32RegisterContextImpl.java:16 — unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZzArm32RegisterContextImpl.java:16-20 | unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZzArm64RegisterContextImpl.java:15-19 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) unidbg-api/src/main/java/com/github/unidbg/hook/whale/Whale.java:78 — unidbg-api/src/main/java/com/github/unidbg/hook/whale/Whale.java:78-82 | unidbg-ios/src/main/java/com/github/unidbg/ios/hook/Substrate.java:120-124 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1758 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1758-1762 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2847-2851 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2847` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:964 — unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:964-968 | unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1000-1004 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1176 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1176-1180 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1701-1705 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1610 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1610-1614 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2223-2227 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1610` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2228` calls `debug` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1615` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1416 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1416-1420 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2474-2478 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1416` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:594 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:594-598 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:644-648 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:594` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:641` calls `isDebugEnabled`, `debug`, `toHexString` and `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:593` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D3 · God Classes · FileTooLong · ×20
  • FileTooLong: ios/ARM64SyscallHandler.java unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java — FileTooLong — 3276 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: ARM64SyscallHandler (132-4155). The bar is 500 significant lines; this is 2776 over it, 6.55× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: kaitai/MachO.java unidbg-ios/src/main/java/io/kaitai/MachO.java — FileTooLong — 3260 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: MachO (15-4322). The bar is 500 significant lines; this is 2760 over it, 6.52× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: dvm/DalvikVM64.java unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java — FileTooLong — 2950 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: DalvikVM64 (29-4037). The bar is 500 significant lines; this is 2450 over it, 5.90× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: dvm/DalvikVM.java unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java — FileTooLong — 2857 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: DalvikVM (34-3919). The bar is 500 significant lines; this is 2357 over it, 5.71× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: ios/ARM32SyscallHandler.java unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java — FileTooLong — 2352 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: ARM32SyscallHandler (119-2986). The bar is 500 significant lines; this is 1852 over it, 4.70× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: ios/MachOLoader.java unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java — FileTooLong — 1724 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: MachOLoader (72-2415). The bar is 500 significant lines; this is 1224 over it, 3.45× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: linux/ARM32SyscallHandler.java unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java — FileTooLong — 1653 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: ARM32SyscallHandler (56-2132). The bar is 500 significant lines; this is 1153 over it, 3.31× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: mcp/McpTools.java unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java — FileTooLong — 1574 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: McpTools (43-2049). The bar is 500 significant lines; this is 1074 over it, 3.15× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: linux/ARM64SyscallHandler.java unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java — FileTooLong — 1260 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: ARM64SyscallHandler (55-1624). The bar is 500 significant lines; this is 760 over it, 2.52× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: arm/AbstractARMDebugger.java unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java — FileTooLong — 1104 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: AbstractARMDebugger (46-1468). The bar is 500 significant lines; this is 604 over it, 2.21× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: ios/Dyld64.java unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java — FileTooLong — 1058 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: Dyld64 (33-1401). The bar is 500 significant lines; this is 558 over it, 2.12× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: arm/ARM.java unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java — FileTooLong — 1039 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: ARM (37-1304). The bar is 500 significant lines; this is 539 over it, 2.08× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: dvm/AbstractJni.java unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java — FileTooLong — 909 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: AbstractJni (49-1263). The bar is 500 significant lines; this is 409 over it, 1.82× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: ios/MachOModule.java unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java — FileTooLong — 855 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: MachOModule (53-1178). The bar is 500 significant lines; this is 355 over it, 1.71× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: linux/AndroidElfLoader.java unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java — FileTooLong — 644 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: AndroidElfLoader (58-900). The bar is 500 significant lines; this is 144 over it, 1.29× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: hypervisor/HypervisorBackend64.java backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/HypervisorBackend64.java — FileTooLong — 642 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: HypervisorBackend64 (32-946). The bar is 500 significant lines; this is 142 over it, 1.28× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: jni/ProxyJni.java unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java — FileTooLong — 641 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: ProxyJni (22-849). The bar is 500 significant lines; this is 141 over it, 1.28× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: ios/DarwinSyscallHandler.java unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java — FileTooLong — 638 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: DarwinSyscallHandler (49-877). The bar is 500 significant lines; this is 138 over it, 1.28× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: linux/AndroidSyscallHandler.java unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java — FileTooLong — 590 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: AndroidSyscallHandler (56-789). The bar is 500 significant lines; this is 90 over it, 1.18× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: jelf/GnuEhFrameHeader.java unidbg-android/src/main/java/net/fornwall/jelf/GnuEhFrameHeader.java — FileTooLong — 560 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: GnuEhFrameHeader (16-806). The bar is 500 significant lines; this is 60 over it, 1.12× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×19
  • Duplicated block (12 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1623 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1623-1634 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1115-1126 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2010 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2010-2021 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1537-1548 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidResolver.java:157 — unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidResolver.java:157-168 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinResolver.java:187-198 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidResolver.java:157` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `ByteArrayFileIO` names `com.github.unidbg.ios.file.ByteArrayFileIO` in one and `com.github.unidbg.linux.file.ByteArrayFileIO` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:159 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:159-170 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:216-227 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:159` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:358 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:358-369 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:366-377 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:358` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1683 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1683-1694 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1728-1739 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1683` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2984 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2984-2995 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3049-3060 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2984` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1692 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1692-1703 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2580-2591 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1692` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/Stdout.java:23 — unidbg-android/src/main/java/com/github/unidbg/linux/file/Stdout.java:23-34 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/Stdout.java:23-34 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/Stdout.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/Stdout.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) unidbg-api/src/main/java/com/github/unidbg/mcp/McpServer.java:244 — unidbg-api/src/main/java/com/github/unidbg/mcp/McpServer.java:244-255 | unidbg-api/src/main/java/com/github/unidbg/mcp/McpServer.java:311-322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-api/src/main/java/com/github/unidbg/mcp/McpServer.java:324` calls `getResponseHeaders`, `set`, `sendResponseHeaders` and `unidbg-api/src/main/java/com/github/unidbg/mcp/McpServer.java:257` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1083 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1083-1094 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1516-1527 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2949 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2949-2960 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:4118-4129 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2949` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1449 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1449-1460 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1481-1492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1449` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1630 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1630-1641 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:514-525 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1630` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2335 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2335-2346 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2364-2375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2335` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:38 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:38-49 | unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java:38-49 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARM64Emulator.java:118 — unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARM64Emulator.java:118-129 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARMEmulator.java:104-115 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARM64Emulator.java:118` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader64.java:10 — unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader64.java:10-21 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaLoader64.java:9-24 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:53 — unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:53-64 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java:53-64 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×18
  • Edited copy of a member (9 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:252 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:252-260 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:262-270 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-ios/src/main/java/io/kaitai/MachO.java:502 — unidbg-ios/src/main/java/io/kaitai/MachO.java:502-510 | unidbg-ios/src/main/java/io/kaitai/MachO.java:512-520 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:260 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:260-268 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:324-332 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:352 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:352-360 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:397-406 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:84 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:84-92 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:96-104 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:926 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:926-934 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1112-1120 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:916 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:916-924 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:845-855 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:576 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:576-585 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1010-1018 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-ios/src/main/java/io/kaitai/MachO.java:1354 — unidbg-ios/src/main/java/io/kaitai/MachO.java:1354-1362 | unidbg-ios/src/main/java/io/kaitai/MachO.java:3285-3293 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1864 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1864-1872 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1390-1398 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/service/Security.java:40 — unidbg-ios/src/main/java/com/github/unidbg/ios/service/Security.java:40-48 | unidbg-ios/src/main/java/com/github/unidbg/ios/service/Security.java:63-71 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1192 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1192-1200 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1785-1793 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1690 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1690-1698 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2350-2358 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/file/DriverFileIO.java:15 — unidbg-ios/src/main/java/com/github/unidbg/ios/file/DriverFileIO.java:15-23 | unidbg-ios/src/main/java/com/github/unidbg/ios/simulator/CoreSimulatorResolver.java:25-37 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-android/src/main/java/net/fornwall/jelf/ElfHashTable.java:42 — unidbg-android/src/main/java/net/fornwall/jelf/ElfHashTable.java:42-53 | unidbg-android/src/main/java/net/fornwall/jelf/ElfGnuHashTable.java:115-123 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-android/src/main/java/net/fornwall/jelf/ElfSection.java:248 — unidbg-android/src/main/java/net/fornwall/jelf/ElfSection.java:248-256 | unidbg-android/src/main/java/net/fornwall/jelf/ElfSection.java:259-267 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:259 — unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:259-267 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java:244-253 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/file/DirectoryFileIO.java:115 — unidbg-android/src/main/java/com/github/unidbg/linux/file/DirectoryFileIO.java:115-123 | unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:301-311 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×17
  • Edited copy of a member (10 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1384 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1384-1393 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2816-2826 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:178 — unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:178-187 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:192-201 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/unicorn/Unicorn.java:256 — backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/unicorn/Unicorn.java:256-269 | unidbg-api/src/main/java/com/github/unidbg/arm/backend/Backend.java:100-109 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:77 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:77-86 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:89-98 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/BundleLoader.java:103 — unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/BundleLoader.java:103-112 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaLoader.java:97-106 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:123 — unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:123-133 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaLoader.java:161-170 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:483 — unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:483-492 | unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:494-505 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:52 — unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:52-65 | unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:103-112 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/AndroidModule.java:101 — unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/AndroidModule.java:101-110 | unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/JniGraphics.java:125-135 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:186 — unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:186-195 | unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:472-481 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:175 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:175-184 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1279-1289 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/file/BaseFileSystem.java:158 — unidbg-api/src/main/java/com/github/unidbg/file/BaseFileSystem.java:158-167 | unidbg-api/src/main/java/com/github/unidbg/file/BaseFileSystem.java:176-187 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) backend/kvm/src/main/java/com/github/unidbg/arm/backend/KvmBackend.java:197 — backend/kvm/src/main/java/com/github/unidbg/arm/backend/KvmBackend.java:197-206 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/HypervisorBackend.java:193-202 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1038 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1038-1048 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1252-1261 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:90 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:90-102 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:82-91 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/thread/FutexNanoSleepWaiter.java:15 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/FutexNanoSleepWaiter.java:15-24 | unidbg-android/src/main/java/com/github/unidbg/linux/thread/NanoSleepWaiter.java:18-28 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/thread/FutexNanoSleepWaiter.java:27 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/FutexNanoSleepWaiter.java:27-37 | unidbg-android/src/main/java/com/github/unidbg/linux/thread/NanoSleepWaiter.java:55-64 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×17
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2074 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2074-2086 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:4001-4013 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/ArmVarArg32.java:10 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/ArmVarArg32.java:10-22 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/ArmVarArg64.java:15-27 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/ArmVarArg32.java:10` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:88 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:88-100 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:206-218 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:88` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2413 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2413-2425 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2491-2503 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2413` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2635 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2635-2647 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2975-2987 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2635` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2633` calls `printf`, `getLRPointer` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2974` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2754 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2754-2766 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2870-2882 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2754` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2867` calls `isDebugEnabled`, `debug` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2753` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2969 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2969-2981 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3034-3046 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2969` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3867 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3867-3879 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3979-3991 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3867` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:83 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:83-95 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:211-223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:83` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2659 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2659-2671 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3040-3052 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2659` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2657` calls `printf`, `getLRPointer` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3039` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2878 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2878-2890 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3085-3097 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2878` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/Stdin.java:32 — unidbg-android/src/main/java/com/github/unidbg/linux/file/Stdin.java:32-44 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/Stdin.java:35-47 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) REDACTED:190 — REDACTED:190-202 | REDACTED:216-228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:190` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:58 — unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:58-70 | unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:105-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:58` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:415 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:415-427 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:517-529 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:415` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1751 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1751-1763 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2655-2667 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1751` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1892 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1892-1904 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1432-1444 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1892` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×16
  • Duplicated block (16 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:519 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:519-534 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:394-409 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:519` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1011 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1011-1026 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:670-685 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1672 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1672-1687 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2527-2542 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1672` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2660 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2660-2675 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2684-2699 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2660` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2683 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2683-2698 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2710-2725 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2683` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3573 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3573-3588 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3672-3687 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3573` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:143 — unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:143-158 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java:96-111 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 117 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:143` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) REDACTED:275 — REDACTED:275-290 | REDACTED:236-251 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (16 lines × 2) unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:188 — unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:188-203 | unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:230-245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2069 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2069-2084 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2952-2967 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:534 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:534-549 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:658-673 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:534` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:578 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:578-593 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:625-640 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:578` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:641` calls `isDebugEnabled`, `debug`, `toHexString` and `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:594` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1858 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1858-1873 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:1083-1098 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1858` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) REDACTED:151 — REDACTED:151-166 | REDACTED:180-195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:151` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:214 — unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:214-229 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:240-255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:214` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) unidbg-api/src/main/java/com/github/unidbg/hook/HookContext.java:11 — unidbg-api/src/main/java/com/github/unidbg/hook/HookContext.java:11-26 | unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZzRegisterContext.java:14-44 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D31 · IaC & Container Security · Medium IaC · ×14
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×14
  • Edited copy of a member (11 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:587 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:587-597 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:599-609 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:632 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:632-642 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:1382-1392 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:320 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:320-330 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:335-345 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:240 — backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:240-250 | unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java:215-225 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/unicorn/Unicorn.java:235 — backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/unicorn/Unicorn.java:235-248 | unidbg-api/src/main/java/com/github/unidbg/arm/backend/Backend.java:78-88 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:869 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:869-879 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3816-3826 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:101 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:101-111 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:114-124 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/ArmSvc.java:34 — unidbg-api/src/main/java/com/github/unidbg/arm/ArmSvc.java:34-44 | unidbg-api/src/main/java/com/github/unidbg/arm/ThumbSvc.java:34-44 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/objc/processor/CDObjectiveC2Processor.java:25 — unidbg-ios/src/main/java/com/github/unidbg/ios/objc/processor/CDObjectiveC2Processor.java:25-38 | unidbg-ios/src/main/java/com/github/unidbg/ios/objc/processor/CDObjectiveC2Processor.java:41-51 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:104 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:104-114 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java:123-133 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:91 — unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:91-102 | unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:122-132 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:540 — unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:540-550 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:558-568 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend64.java:149 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend64.java:149-159 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/HypervisorBackend.java:57-67 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/unwind/SimpleARM64Unwinder.java:19 — unidbg-api/src/main/java/com/github/unidbg/unwind/SimpleARM64Unwinder.java:19-30 | unidbg-api/src/main/java/com/github/unidbg/unwind/SimpleARMUnwinder.java:20-30 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×14
  • Duplicated block (18 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1420 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1420-1437 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:909-926 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (18 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:210 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:210-227 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1996-2013 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:215 — unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:215-232 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:318-335 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:235` calls `allocateStack`, `getPointerSize` and `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:337` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:238 — unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:238-255 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:337-354 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:257` calls `allocateStack`, `getPointerSize`, `setInt` and `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:356` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2896 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2896-2913 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2963-2980 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2896` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3417 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3417-3434 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3446-3463 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3417` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (18 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3516 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3516-3533 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3545-3562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3516` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (18 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:239 — unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:239-256 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java:200-217 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (18 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2146 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2146-2163 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3026-3043 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2146` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:133 — unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:133-150 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:156-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:133` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:300 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:300-317 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:315-332 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:300` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:802 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:802-819 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2310-2327 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:802` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:733 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:733-750 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:756-773 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/objc/ObjcClass32.java:16 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/objc/ObjcClass32.java:16-33 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/objc/ObjcClass64.java:16-33 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×14
  • Duplicated block (14 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:71 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:71-84 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:148-161 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3050 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3050-3063 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3140-3153 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3050` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3073 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3073-3086 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3163-3176 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3073` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3489 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3489-3502 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3588-3601 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3489` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3519 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3519-3532 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3618-3631 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3519` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/signal/SignalTask.java:38 — unidbg-android/src/main/java/com/github/unidbg/linux/signal/SignalTask.java:38-51 | unidbg-ios/src/main/java/com/github/unidbg/ios/signal/SignalTask.java:31-44 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/signal/SignalTask.java:38` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java:56 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java:56-69 | unidbg-ios/src/main/java/com/github/unidbg/ios/thread/BsdThreadCreatePatcher64.java:67-80 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/thread/BsdThreadCreatePatcher64.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java:56` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (14 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:974 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:974-987 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1306-1319 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:974` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1041 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1041-1054 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1757-1770 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2101 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2101-2114 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2981-2994 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2101` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:500 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:500-513 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:618-631 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:221 — unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:221-234 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:249-262 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:221` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3237 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3237-3250 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3327-3340 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3237` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/ByteArrayFileIO.java:71 — unidbg-android/src/main/java/com/github/unidbg/linux/file/ByteArrayFileIO.java:71-84 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/ByteArrayFileIO.java:49-62 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×12
  • Edited copy of a member (7 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:65 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:65-71 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java:65-72 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:32 — unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:32-38 | unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARMDebugger.java:32-38 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/objc/ObjcClass.java:43 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/objc/ObjcClass.java:43-49 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/objc/ObjcClass.java:51-57 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) unidbg-ios/src/main/java/io/kaitai/MachO.java:621 — unidbg-ios/src/main/java/io/kaitai/MachO.java:621-627 | unidbg-ios/src/main/java/io/kaitai/MachO.java:1268-1274 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) unidbg-ios/src/main/java/io/kaitai/MachO.java:1941 — unidbg-ios/src/main/java/io/kaitai/MachO.java:1941-1947 | unidbg-ios/src/main/java/io/kaitai/MachO.java:2349-2358 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1793 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1793-1800 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1314-1320 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin19.java:32 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin19.java:32-38 | unidbg-ios/src/main/java/com/github/unidbg/ios/thread/ThreadJoin64.java:30-36 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidResolver.java:170 — unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidResolver.java:170-176 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinResolver.java:202-208 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/ByteArray.java:54 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/ByteArray.java:54-60 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/CharArray.java:61-67 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/BundleLoader.java:38 — unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/BundleLoader.java:38-45 | unidbg-ios/src/main/java/com/github/unidbg/ios/simulator/CoreSimulatorResolver.java:16-22 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:75 — backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:75-81 | unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java:73-79 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:202 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:202-208 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:274-281 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×11
  • Members sharing a duplicated core (4 members, 50+ identical tokens) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend32.java:36 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend32.java:36-67 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend32.java:70-106 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend32.java:87-120 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend32.java:123-165 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend64.java:36 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend64.java:36-85 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend64.java:88-146 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:187-270 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:273-367 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:70 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:70-541 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:69-418 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:133-554 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:146-657 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:798 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:798-875 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:877-950 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:485-558 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:584-657 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1117 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1117-1157 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1159-1200 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:801-842 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:659-708 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1523 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1523-1582 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1017-1075 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2900-2942 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:4069-4111 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1764 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1764-1791 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1284-1312 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2686-2714 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3889-3917 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1889 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1889-1923 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1373-1388 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1429-1470 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:503-514 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2025 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2025-2044 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1552-1571 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:684-703 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3846-3865 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/AttachExecutableEvent.java:14 — unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/AttachExecutableEvent.java:14-32 | unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/DetachEvent.java:12-21 | unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/LoadExecutableEvent.java:14-32 | unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/LoadModuleEvent.java:19-32 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1700 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1700-1737 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1739-1783 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2591-2624 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2626-2672 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×11
  • Duplicated block (10 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:257 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:257-266 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:324-333 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3516-3525 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:257` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1725 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1725-1734 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3022-3031 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3337-3346 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1725` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2601 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2601-2610 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2939-2948 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3004-3013 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2601` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2726 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2726-2735 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2810-2819 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2825-2834 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2726` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3156 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3156-3165 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3191-3200 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3212-3221 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3156` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3290 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3290-3299 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3315-3324 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3333-3342 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3290` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:262 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:262-271 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:332-341 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3615-3624 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:262` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3246 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3246-3255 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3281-3290 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3302-3311 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3246` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3383 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3383-3392 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3411-3420 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3432-3441 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3383` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1943 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1943-1952 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3659-3668 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3756-3765 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 3) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:773 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:773-782 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:784-793 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:795-804 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:773` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×11
  • Duplicated block (8 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:101 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:101-108 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:92-99 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:169-176 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:101` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1735 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1735-1742 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1244-1251 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:362-369 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1735` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:211 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:211-218 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:558-565 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:907-914 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:211` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:178 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:178-185 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2580-2587 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2922-2929 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:178` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:257 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:257-264 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3516-3523 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3570-3577 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:257` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:882 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:882-889 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:909-916 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2063-2070 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:882` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:262 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:262-269 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3615-3622 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3669-3676 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:262` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2864 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2864-2871 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2902-2909 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3583-3590 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2864` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2072 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2072-2079 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2955-2962 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3385-3392 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2072` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1218 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1218-1225 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1670-1677 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:543-550 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:395 — unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:395-403 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:409-416 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:422-430 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:395` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
X3 · Exception handling · Swallowed exception (empty catch) · ×11
  • Swallowed exception (empty catch) unidbg-ios/assets/gpb.js:244 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) unidbg-ios/assets/gpb.js:302 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:389 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:398 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:838 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1458 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1734 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1745 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1784 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:966 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:634 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×10
  • Edited copy of a member (12 corresponding lines) unidbg-android/src/main/java/net/fornwall/jelf/ElfDynamicStructure.java:347 — unidbg-android/src/main/java/net/fornwall/jelf/ElfDynamicStructure.java:347-358 | unidbg-android/src/main/java/net/fornwall/jelf/ElfDynamicStructure.java:363-374 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:819 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:819-830 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:832-844 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/thread/Function32.java:29 — unidbg-api/src/main/java/com/github/unidbg/thread/Function32.java:29-40 | unidbg-api/src/main/java/com/github/unidbg/thread/Function64.java:29-40 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1050 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1050-1063 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1944-1955 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) unidbg-ios/src/main/java/io/kaitai/MachO.java:1138 — unidbg-ios/src/main/java/io/kaitai/MachO.java:1138-1149 | unidbg-ios/src/main/java/io/kaitai/MachO.java:2980-2991 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:286 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:286-297 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:301-312 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:398 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:398-409 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:411-422 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/file/DirectoryFileIO.java:70 — unidbg-android/src/main/java/com/github/unidbg/linux/file/DirectoryFileIO.java:70-81 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/DirectoryFileIO.java:55-67 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:151 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:151-162 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:782-794 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) unidbg-ios/src/main/java/io/kaitai/MachO.java:3160 — unidbg-ios/src/main/java/io/kaitai/MachO.java:3160-3171 | unidbg-ios/src/main/java/io/kaitai/MachO.java:3335-3346 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×9
  • Edited copy of a member (8 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/hook/whale/Whale.java:85 — unidbg-api/src/main/java/com/github/unidbg/hook/whale/Whale.java:85-92 | unidbg-ios/src/main/java/com/github/unidbg/ios/hook/Substrate.java:127-134 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:742 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:742-749 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1444-1454 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:762 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:762-771 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:699-706 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:821 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:821-828 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:831-838 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:180 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:180-187 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:237-244 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1960 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1960-1969 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:877-884 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1489 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1489-1496 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3942-3950 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1291 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1291-1299 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:951-958 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/context/BaseRegisterContext.java:20 — unidbg-api/src/main/java/com/github/unidbg/arm/context/BaseRegisterContext.java:20-28 | unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZzArm64RegisterContextImpl.java:22-29 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×9
  • Duplicated block (9 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2856 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2856-2864 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2891-2899 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3484-3492 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2856` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2867 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2867-2875 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2888-2896 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3481-3489 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2867` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3247 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3247-3255 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3318-3326 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3336-3344 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3247` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3337 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3337-3345 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3414-3422 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3435-3443 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3337` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/file/RandomFileIO.java:21 — unidbg-android/src/main/java/com/github/unidbg/linux/file/RandomFileIO.java:21-29 | unidbg-android/src/main/java/com/github/unidbg/linux/file/ZeroFileIO.java:17-25 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/RandomFileIO.java:21-29 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/RandomFileIO.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/RandomFileIO.java` as WHOLE FILES: 82% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/file/RandomFileIO.java:21` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/file/RandomFileIO.java:20` calls `randBytes` and `unidbg-android/src/main/java/com/github/unidbg/linux/file/ZeroFileIO.java:16` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:55 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:55-63 | unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java:55-63 | unidbg-ios/src/main/java/com/github/unidbg/ios/thread/BsdThreadCreatePatcher64.java:66-74 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/thread/BsdThreadCreatePatcher64.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:54 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:54-62 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:72-80 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:90-98 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:54` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:995 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:995-1003 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1049-1057 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:434-442 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `emulator` to `Emulator<?>` in one and `Emulator<DarwinFileIO>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:65 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:65-73 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:75-83 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1634-1642 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `emulator` to `Emulator<?>` in one and `Emulator<AndroidFileIO>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×8
  • Edited copy of a member (15 corresponding lines) unidbg-ios/src/main/java/io/kaitai/MachO.java:1976 — unidbg-ios/src/main/java/io/kaitai/MachO.java:1976-1990 | unidbg-ios/src/main/java/io/kaitai/MachO.java:3608-3622 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1467 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1467-1482 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:193-207 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2009 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2009-2023 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1536-1550 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:803 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:803-817 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1797-1811 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1082 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1082-1096 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1515-1532 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidARMEmulator.java:66 — unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidARMEmulator.java:66-84 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:192-206 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend64.java:162 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend64.java:162-176 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/HypervisorBackend.java:70-84 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:705 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:705-719 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:928-942 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×8
  • Edited copy of a member (13 corresponding lines) unidbg-ios/src/main/java/io/kaitai/MachO.java:2010 — unidbg-ios/src/main/java/io/kaitai/MachO.java:2010-2023 | unidbg-ios/src/main/java/io/kaitai/MachO.java:3642-3654 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:510 — unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:510-526 | unidbg-api/src/main/java/com/github/unidbg/debugger/ida/AndroidServer.java:528-540 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1300 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1300-1314 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1783-1795 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:85 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:85-97 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:99-113 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/file/RandomFileIO.java:17 — unidbg-android/src/main/java/com/github/unidbg/linux/file/RandomFileIO.java:17-29 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/RandomFileIO.java:17-29 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:778 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:778-790 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:989-1001 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1122 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1122-1134 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1136-1152 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java:40 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java:40-52 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmMethod.java:46-58 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×8
  • Edited copy of a member (14 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:675 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:675-694 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:612-625 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/SystemProperties.java:34 — unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/SystemProperties.java:34-47 | unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/SystemProperties.java:50-63 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:266 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:266-283 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:567-580 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARM64Emulator.java:116 — unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARM64Emulator.java:116-129 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARMEmulator.java:102-115 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:696 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:696-709 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:475-488 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1586 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1586-1599 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1616-1632 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) unidbg-android/src/main/java/net/fornwall/jelf/GnuEhFrameHeader.java:115 — unidbg-android/src/main/java/net/fornwall/jelf/GnuEhFrameHeader.java:115-128 | unidbg-api/src/main/java/com/github/unidbg/Utils.java:52-67 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:37 — unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:37-51 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java:38-51 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×8
  • Duplicated block (23 lines × 2) backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/arm64/SimpleMemorySizeDetector.java:37 — backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/arm64/SimpleMemorySizeDetector.java:37-59 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/arm64/SimpleMemorySizeDetector.java:90-112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/arm64/SimpleMemorySizeDetector.java:37` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:663 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:663-685 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1146-1168 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (23 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:106 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:106-128 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:224-248 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:106` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:121 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:121-143 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:1193-1215 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:1191` calls `toHexString` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:120` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (23 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:125 — unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:125-147 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/UdpSocket.java:118-140 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/UdpSocket.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (23 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:479 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:479-501 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:594-616 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) unidbg-api/src/main/java/com/github/unidbg/ByteArrayNumber.java:7 — unidbg-api/src/main/java/com/github/unidbg/ByteArrayNumber.java:7-29 | unidbg-api/src/main/java/com/github/unidbg/StringNumber.java:7-34 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `value` to `byte[]` in one and `String` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (23 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/VmRegionBasicInfo.java:11 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/VmRegionBasicInfo.java:11-33 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/VmRegionBasicInfo64.java:11-33 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×8
  • Duplicated block (15 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1234 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1234-1248 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:754-768 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1234` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (15 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:122 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:122-136 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:129-143 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (15 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2943 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2943-2957 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3008-3022 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:668 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:668-682 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1175-1189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:668` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1172` calls `isConstructor`, `IllegalStateException` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:667` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:228 — unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:228-242 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java:173-187 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 117 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (15 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/Stdout.java:74 — unidbg-android/src/main/java/com/github/unidbg/linux/file/Stdout.java:74-88 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/Stdout.java:74-88 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/Stdout.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/Stdout.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (15 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:159 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:159-173 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:184-198 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:159` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:573 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:573-587 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:699-713 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:573` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×8
  • Duplicated block (7 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:720 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:720-726 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:884-890 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:670-676 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (7 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1285 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1285-1291 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2687-2693 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3890-3896 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1285` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:540 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:540-546 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:566-572 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:592-598 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:540` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:747 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:747-753 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:770-776 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1476-1482 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:747` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:618 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:618-624 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2382-2388 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2414-2420 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:618` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/DynarmicBackend.java:161 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/DynarmicBackend.java:161-167 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/HypervisorBackend.java:175-181 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/KvmBackend.java:211-217 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (7 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1313 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1313-1319 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:770-776 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3828-3834 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/DynarmicBackend.java:121 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/DynarmicBackend.java:121-127 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/DynarmicBackend.java:130-136 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/HypervisorBackend.java:108-114 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×7
  • Edited copy of a member (6 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1757 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1757-1762 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2845-2851 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:497 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:497-506 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:971-976 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:735 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:735-740 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1003-1008 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:127 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:127-132 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java:136-141 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/XHookImpl.java:75 — unidbg-android/src/main/java/com/github/unidbg/linux/android/XHookImpl.java:75-80 | unidbg-ios/src/main/java/com/github/unidbg/ios/hook/FishHook.java:55-61 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModuleInit.java:22 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModuleInit.java:22-28 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModuleInitOffset.java:17-22 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/debugger/ida/Utils.java:82 — unidbg-api/src/main/java/com/github/unidbg/debugger/ida/Utils.java:82-87 | unidbg-api/src/main/java/com/github/unidbg/memory/MemRegion.java:60-65 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×7
  • Duplicated block (17 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1985 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1985-2001 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1499-1515 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (17 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:560 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:560-576 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:345-361 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:560` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (17 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:74 — unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:74-90 | unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARMDebugger.java:75-91 — before extracting anything, compare `unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java` and `unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARMDebugger.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:74` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2521 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2521-2537 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3386-3402 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2521` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1668 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1668-1684 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:541-557 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:97 — unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:97-113 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:114-130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/SegmentCommand32.java:11 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/SegmentCommand32.java:11-27 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/SegmentCommand64.java:11-27 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×7
  • Duplicated block (8 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3424 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3424-3431 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3453-3460 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3523-3530 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3552-3559 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:176 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:176-183 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:458-465 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2604-2611 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2987-2994 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:176` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) REDACTED:187 — REDACTED:187-194 | REDACTED:213-220 | REDACTED:148-155 | REDACTED:177-184 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:187` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1727 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1727-1734 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1774-1781 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2614-2621 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2640-2647 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1735` calls `setPointer` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1782` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 4) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1864 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1864-1871 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2122-2129 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2785-2792 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3002-3009 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3441 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3441-3448 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3465-3472 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3540-3547 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3564-3571 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3441` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/DoubleArray.java:29 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/DoubleArray.java:29-36 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/FloatArray.java:29-36 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/IntArray.java:29-36 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/ShortArray.java:29-36 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D17 · Explicit Debt · TodoComment · ×6
  • TodoComment unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:833 — // TODO: implement — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:858 — // TODO: implement — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:864 — // TODO: implement — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:937 — // TODO: implement — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1209 — // TODO: implement — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1215 — // TODO: implement — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×6
  • Edited copy of a member (18 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:212 — unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:212-233 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:238-259 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/pointer/ByteArrayBackend.java:58 — unidbg-api/src/main/java/com/github/unidbg/pointer/ByteArrayBackend.java:58-79 | unidbg-api/src/main/java/com/github/unidbg/pointer/ByteArrayBackend.java:82-99 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:186 — backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:186-203 | unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java:161-178 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/HypervisorBackend64.java:100 — backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/HypervisorBackend64.java:100-120 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/HypervisorBackend64.java:282-299 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:551 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:551-568 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:466-483 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/signal/SignalTask.java:34 — unidbg-android/src/main/java/com/github/unidbg/linux/signal/SignalTask.java:34-51 | unidbg-ios/src/main/java/com/github/unidbg/ios/signal/SignalTask.java:27-44 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×6
  • Edited copy of a member (22 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:732 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:732-753 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:755-776 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/Dobby.java:162 — unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/Dobby.java:162-184 | unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZz.java:182-203 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:56 — unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:56-77 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/UdpSocket.java:49-70 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:80 — unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:80-101 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/UdpSocket.java:73-94 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:883 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:883-904 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:209-234 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1540 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1540-1561 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1563-1584 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×6
  • Duplicated block (11 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:542 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:542-552 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2792-2802 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1010-1020 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:542` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:993 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:993-1003 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1030-1040 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2219-2229 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:993` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:977 — unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:977-987 | unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1013-1023 | unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1134-1144 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:977` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2119 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2119-2129 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2999-3009 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3696-3706 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2204 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2204-2214 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2882-2892 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3584-3594 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/file/DirectoryFileIO.java:100 — unidbg-ios/src/main/java/com/github/unidbg/ios/file/DirectoryFileIO.java:100-110 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/JarEntryFileIO.java:35-45 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java:67-77 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D6 · Cohesion (LCOM4) · Low cohesion · ×6
  • Low cohesion: AndroidSyscallHandler (LCOM4 6) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:56 — AndroidSyscallHandler's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: AbstractARM64Emulator (LCOM4 4) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:47 — AbstractARM64Emulator's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: AbstractARMEmulator (LCOM4 4) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java:47 — AbstractARMEmulator's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: AbstractLoader (LCOM4 4) unidbg-api/src/main/java/com/github/unidbg/spi/AbstractLoader.java:39 — AbstractLoader's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: AbstractEmulator (LCOM4 4) unidbg-api/src/main/java/com/github/unidbg/AbstractEmulator.java:49 — AbstractEmulator's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Substrate (LCOM4 4) unidbg-ios/src/main/java/com/github/unidbg/ios/hook/Substrate.java:17 — Substrate's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D35 · Change Coupling · Change coupling · ×5
  • Change coupling: AbstractJni.java ↔ JniFunction.java unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:1 — `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/JniFunction.java` change together 97% of the time (32 of the 33 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 32 shared commits counted here, the most recent 3 are `c750e666` android: add ProxyClassFactory.fallbackJni; `aa90fe47` android: implement SetStaticBooleanField; `8175402b` add support for JNI Function SetStaticObjectField under ARM32 (#361) — run `git show` on any of them.
  • Change coupling: Arm64Hook.java ↔ ArmHook.java unidbg-api/src/main/java/com/github/unidbg/arm/Arm64Hook.java:1 — `unidbg-api/src/main/java/com/github/unidbg/arm/Arm64Hook.java` and `unidbg-api/src/main/java/com/github/unidbg/arm/ArmHook.java` change together 91% of the time (10 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `4610d636` Refactor ArmHook/Arm64Hook: save/restore registers on stack instead o…; `3c73988f` android: Android64Test.java support NestedRun.; `2367f5f8` api: Bug fix for ArmHook and Arm64Hook, thanks 噬血灬魔神 — run `git show` on any of them.
  • Change coupling: AbstractJni.java ↔ ProxyJni.java unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:1 — `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java` change together 79% of the time (31 of the 39 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 31 shared commits counted here, the most recent 3 are `c750e666` android: add ProxyClassFactory.fallbackJni; `aa90fe47` android: implement SetStaticBooleanField; `8175402b` add support for JNI Function SetStaticObjectField under ARM32 (#361) — run `git show` on any of them.
  • Change coupling: ARM64SyscallHandler.java ↔ DirectoryFileIO.java unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1 — `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/DirectoryFileIO.java` change together 69% of the time (11 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `a03ad935` ios: Update JarEntryFileIO.java and DirectoryFileIO.java; `20d2c767` ios: Update UIKit; `a70df842` Bug fix — run `git show` on any of them.
  • Change coupling: ARM64SyscallHandler.java ↔ SymbolResolver.java unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1 — `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java` change together 58% of the time (11 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `b037fca9` ios: Update SymbolResolver.java; `deb28d32` ios: Update LibDispatchPatcher.java; `fa874a42` ios: SubstrateTest.java tested. — run `git show` on any of them.
D4 · Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) · ×5
  • Edited copies of one member (3 members, 10+ corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:112 — unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:112-121 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/BundleLoader.java:118-127 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaLoader.java:150-159 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:708 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:708-717 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:893-903 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1163-1173 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1128 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1128-1137 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1316-1326 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1813-1823 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/AndroidModule.java:143 — unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/AndroidModule.java:143-152 | unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/AndroidModule.java:154-163 | unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/AndroidModule.java:165-174 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/StatFS.java:42 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/StatFS.java:42-51 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/StatFS.java:53-62 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/StatFS.java:64-73 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×5
  • Duplicated block (19 lines × 2) backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend32.java:34 — backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend32.java:34-52 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:46-64 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (19 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:107 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:107-125 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:102-120 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:107` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:217 — unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:217-235 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java:178-196 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (19 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:193 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:193-211 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java:198-216 — before extracting anything, compare `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java` and `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:193` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2906 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2906-2924 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:4075-4093 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2906` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×5
  • Duplicated block (9 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:260 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:260-268 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:327-335 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:265-273 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:335-343 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:260` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2598 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2598-2606 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2623-2631 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2936-2944 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2966-2974 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2598` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2633` calls `printf`, `getLRPointer` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2975` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2861 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2861-2869 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2875-2883 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2899-2907 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3082-3090 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2861` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2896` calls `isDebugEnabled`, `debug` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2874` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 4) unidbg-ios/src/main/java/io/kaitai/MachO.java:2384 — unidbg-ios/src/main/java/io/kaitai/MachO.java:2384-2392 | unidbg-ios/src/main/java/io/kaitai/MachO.java:2408-2416 | unidbg-ios/src/main/java/io/kaitai/MachO.java:2444-2452 | unidbg-ios/src/main/java/io/kaitai/MachO.java:2462-2470 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/io/kaitai/MachO.java:2384` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 4) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:742 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:742-750 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:752-760 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:944-952 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:954-962 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×5
  • Duplicated block (7 lines × 6) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1675 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1675-1681 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2530-2536 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1720-1726 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1749-1755 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2907-2913 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2935-2941 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1675` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 6) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2893 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2893-2899 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3100-3106 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3176-3182 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3225-3231 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3278-3284 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3303-3309 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2893` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 6) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3156 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3156-3162 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3191-3197 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3212-3218 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3246-3252 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3281-3287 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3302-3308 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3156` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 6) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3290 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3290-3296 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3315-3321 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3333-3339 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3383-3389 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3411-3417 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3432-3438 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3290` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 6) REDACTED:158 — REDACTED:158-164 | REDACTED:186-192 | unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:87-93 | REDACTED:116-122 | REDACTED:147-153 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/UdpSocket.java:80-86 — there are 6 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:158` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:194` calls `getOutputStream`, `BufferedInputStream`, `getInputStream` and `unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:95` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×5
  • Duplicated block (7 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2585 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2585-2591 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2927-2933 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2609-2615 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2992-2998 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2949 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2949-2955 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3435-3441 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3014-3020 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3534-3540 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2949` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:617 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:617-623 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:643-649 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:669-675 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1176-1182 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:617` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 4) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:160 — unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:160-166 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:217-223 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:476-482 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:589-595 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:160` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1355 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1355-1362 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:792-799 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2836-2843 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3989-3995 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×5
  • Duplicated block (6 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1890 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1890-1895 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1374-1379 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1430-1435 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:504-509 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:107 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:107-112 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:379-384 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:102-107 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:387-392 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:107` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2618 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2618-2623 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2961-2966 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2642-2647 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3026-3031 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2618` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) REDACTED:102 — REDACTED:102-107 | REDACTED:128-133 | REDACTED:157-162 | REDACTED:186-191 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:102` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 4) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:766 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:766-771 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:777-782 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:788-793 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:799-804 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:766` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×5
  • Duplicated block (5 lines × 3) backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/HypervisorBackend.java:42 — backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/HypervisorBackend.java:42-46 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend32.java:37-41 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:49-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/HypervisorBackend.java:42` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1806 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1806-1810 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2967-2971 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:4136-4140 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1806` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:950 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:950-954 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:986-990 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2095-2099 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:177 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:177-181 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:229-233 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:641-645 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:77 — unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:77-81 | unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:97-102 | unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:149-153 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:77` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:82` calls `add`, `toolSchema` and `unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:103` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×4
  • Edited copy of a member (26 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2096 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2096-2121 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1588-1613 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall32.java:87 — unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall32.java:87-112 | unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall64.java:45-70 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1202 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1202-1227 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1713-1738 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:192 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:192-217 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java:197-222 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×4
  • Edited copy of a member (17 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1010 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1010-1034 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:669-689 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) unidbg-android/src/main/java/net/fornwall/jelf/DwarfCursor32.java:13 — unidbg-android/src/main/java/net/fornwall/jelf/DwarfCursor32.java:13-29 | unidbg-android/src/main/java/net/fornwall/jelf/DwarfCursor64.java:13-29 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall32.java:37 — unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall32.java:37-54 | unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall64.java:26-42 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2944 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2944-2960 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:4113-4129 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×4
  • Edited copy of a member (19 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/patch/LibDispatchPatcher.java:26 — unidbg-ios/src/main/java/com/github/unidbg/ios/patch/LibDispatchPatcher.java:26-64 | unidbg-ios/src/main/java/com/github/unidbg/ios/patch/NewObjcPatcher.java:21-40 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:967 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:967-987 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1301-1319 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:138 — unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:138-156 | unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARMDebugger.java:140-159 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1020 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1020-1038 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1343-1362 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×4
  • Edited copy of a member (16 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:721 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:721-740 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1169-1184 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2787 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2787-2802 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1005-1020 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:233 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:233-248 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java:236-251 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1957 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1957-1972 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1472-1487 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×4
  • Duplicated block (30 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1817 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1817-1846 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2735-2764 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1817` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2766` calls `printf`, `getContext`, `getLRPointer` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1848` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (30 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1972 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1972-2001 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3544-3573 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1972` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (30 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2567 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2567-2596 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3432-3461 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2567` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (30 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/DumpFileIO.java:14 — unidbg-android/src/main/java/com/github/unidbg/linux/file/DumpFileIO.java:14-43 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/DumpFileIO.java:17-56 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×4
  • Duplicated block (25 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:205 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:205-229 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:269-293 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:205` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (25 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:67 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:67-91 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java:68-92 — before extracting anything, compare `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java` and `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:67` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2118 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2118-2142 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2998-3022 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2118` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1288 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1288-1312 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3893-3917 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1288` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×4
  • Duplicated block (21 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:279 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:279-299 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:287-307 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:279` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/LocalAndroidUdpSocket.java:84 — unidbg-android/src/main/java/com/github/unidbg/linux/file/LocalAndroidUdpSocket.java:84-104 | unidbg-android/src/main/java/com/github/unidbg/linux/file/LogCatFileIO.java:55-75 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/file/LocalAndroidUdpSocket.java:84` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/file/LogCatFileIO.java:76` calls `write`, `format`, `getBytes` and `unidbg-android/src/main/java/com/github/unidbg/linux/file/LocalAndroidUdpSocket.java:106` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (21 lines × 2) unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:207 — unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:207-227 | unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:249-269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:207` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (21 lines × 2) unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:58 — unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:58-78 | unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:262-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:58` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 4) · ×4
  • Duplicated block (15 lines × 4) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend32.java:37 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend32.java:37-51 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend32.java:71-85 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend32.java:88-102 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend32.java:124-138 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend32.java:37` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2030 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2030-2044 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1557-1571 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:689-703 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3851-3865 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2030` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:490 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:490-504 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1730-1744 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:499-513 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1778-1792 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:490` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1373 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1373-1387 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2241-2255 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1403-1417 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2320-2334 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1373` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×4
  • Duplicated block (14 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:953 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:953-966 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1534-1547 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2098-2111 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:953` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3147 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3147-3160 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3170-3183 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3595-3608 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3147` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2490 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2490-2503 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2609-2622 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3300-3313 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (14 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/TaskBasicInfoReply64V2.java:13 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/TaskBasicInfoReply64V2.java:13-26 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/TaskDyldInfoReply.java:13-26 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/TaskVmInfoReply64.java:13-26 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×4
  • Duplicated block (10 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:61 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:61-70 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:123-132 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:223-232 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:334-343 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:61` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:245 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:245-254 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:276-285 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:299-308 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3406-3415 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:245` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:186 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:186-195 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1773-1782 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3115-3124 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3436-3445 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:186` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:250 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:250-259 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:284-293 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:307-316 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3505-3514 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:250` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×4
  • Duplicated block (9–10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:721 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:721-730 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:885-893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:721` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:39 — unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:39-47 | unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:50-59 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:39` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–10 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:65 — unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:65-73 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaLoader.java:75-84 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:65` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1203 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1203-1212 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1455-1463 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1203` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 7) · ×4
  • Duplicated block (8 lines × 7) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1206 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1206-1214 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1458-1465 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:724-732 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:888-895 | unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:384-392 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2950-2958 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:4119-4127 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 7) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:233 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:233-240 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:343-350 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2723-2730 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2770-2777 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2785-2792 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2807-2814 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2822-2829 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:233` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 7) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1828 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1828-1835 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2009-2016 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2147-2154 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2746-2753 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2819-2826 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3027-3034 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:432-439 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 7) unidbg-ios/src/main/java/com/github/unidbg/ios/patch/LibDispatchPatcher.java:16 — unidbg-ios/src/main/java/com/github/unidbg/ios/patch/LibDispatchPatcher.java:16-23 | unidbg-ios/src/main/java/com/github/unidbg/ios/patch/LibDispatchPatcher.java:28-35 | unidbg-ios/src/main/java/com/github/unidbg/ios/patch/LibDispatchPatcher.java:38-45 | unidbg-ios/src/main/java/com/github/unidbg/ios/patch/LibDispatchPatcher.java:48-55 | unidbg-ios/src/main/java/com/github/unidbg/ios/patch/LibDispatchPatcher.java:57-64 | unidbg-ios/src/main/java/com/github/unidbg/ios/patch/NewObjcPatcher.java:23-30 | unidbg-ios/src/main/java/com/github/unidbg/ios/patch/NewObjcPatcher.java:32-39 — there are 7 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/patch/LibDispatchPatcher.java:57` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/patch/LibDispatchPatcher.java:26` calls `patch64` and `unidbg-ios/src/main/java/com/github/unidbg/ios/patch/LibDispatchPatcher.java:37` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×3
  • Edited copy of a member (24 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1222 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1222-1248 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:740-768 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/signal/SignalTask.java:55 — unidbg-android/src/main/java/com/github/unidbg/linux/signal/SignalTask.java:55-82 | unidbg-ios/src/main/java/com/github/unidbg/ios/signal/SignalTask.java:46-69 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) REDACTED:114 — REDACTED:114-137 | REDACTED:140-166 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (5 members, 50+ identical tokens) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:970 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:970-988 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1364-1382 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1487-1503 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:928-945 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:947-964 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:209 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:209-218 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:711-731 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:556-565 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:905-914 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:964-976 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:611 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:611-637 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:639-665 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2375-2405 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2407-2435 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2437-2469 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×3
  • Edited copy of a member (34 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/TaskDyldInfo.java:69 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/TaskDyldInfo.java:69-102 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/TaskDyldInfo.java:104-137 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:58 — unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARM64Emulator.java:58-91 | unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMEmulator.java:58-92 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:116 — unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:116-149 | unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:413-446 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×3
  • Edited copy of a member (23 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:554 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:554-576 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:339-361 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ExternalSymbol.java:20 — unidbg-ios/src/main/java/com/github/unidbg/ios/ExternalSymbol.java:20-42 | unidbg-ios/src/main/java/com/github/unidbg/ios/IndirectSymbol.java:20-48 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLibraryFile.java:55 — unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLibraryFile.java:55-77 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaLibraryFile.java:56-78 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 11+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 11+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:36 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:36-46 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:49-60 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:63-74 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:295 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:295-305 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:305-315 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java:175-185 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/DynarmicBackend.java:76 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/DynarmicBackend.java:76-86 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/HypervisorBackend.java:214-224 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/KvmBackend.java:222-233 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×3
  • Duplicated block (36 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2361 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2361-2396 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3171-3206 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2361` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (36 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2470 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2470-2505 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3280-3315 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2470` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (36 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/DyldAllImageInfos32.java:11 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/DyldAllImageInfos32.java:11-46 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/DyldAllImageInfos64.java:11-46 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×3
  • Duplicated block (31 lines × 2) backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:220 — backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:220-250 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:307-337 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:220` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (31 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidResolver.java:125 — unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidResolver.java:125-155 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinResolver.java:155-185 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidResolver.java:125` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `DirectoryFileIO` names `com.github.unidbg.ios.file.DirectoryFileIO` in one and `com.github.unidbg.linux.file.DirectoryFileIO` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (31 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java:70 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java:70-100 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmMethod.java:278-308 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×3
  • Duplicated block (24 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/Stdout.java:47 — unidbg-android/src/main/java/com/github/unidbg/linux/file/Stdout.java:47-70 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/Stdout.java:47-70 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/Stdout.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/Stdout.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (24 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:78 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:78-101 | unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadClonePatcher32.java:68-91 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:78` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1768 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1768-1791 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2691-2714 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1768` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×3
  • Duplicated block (22 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:240 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:240-261 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:688-709 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:240` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:116 — unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:116-137 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java:69-90 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 117 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (22 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1252 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1252-1273 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1670-1691 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1252` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×3
  • Duplicated block (14 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1554 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1554-1567 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1047-1060 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2926-2939 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:4095-4108 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1554` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `SocketIO` names `com.github.unidbg.ios.file.SocketIO` in one and `com.github.unidbg.linux.file.SocketIO` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (14 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:64 — unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:64-77 | unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:88-101 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/UdpSocket.java:57-70 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/UdpSocket.java:81-94 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/UdpSocket.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:64` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:403 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:403-416 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:428-441 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:411-424 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:436-449 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:403` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×3
  • Duplicated block (13 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1773 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1773-1785 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1294-1306 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2696-2708 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3899-3911 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1773` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 4) REDACTED:206 — REDACTED:206-218 | unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:57-69 | REDACTED:170-182 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/UdpSocket.java:50-62 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:206` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:220` calls `getOutputStream`, `BufferedInputStream`, `getInputStream` and `unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:71` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 4) unidbg-ios/src/main/java/io/kaitai/MachO.java:2376 — unidbg-ios/src/main/java/io/kaitai/MachO.java:2376-2388 | unidbg-ios/src/main/java/io/kaitai/MachO.java:2400-2412 | unidbg-ios/src/main/java/io/kaitai/MachO.java:2430-2442 | unidbg-ios/src/main/java/io/kaitai/MachO.java:2454-2466 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/io/kaitai/MachO.java:2376` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×3
  • Duplicated block (11 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:863 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:863-873 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1488-1498 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2119-2129 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2369-2379 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:863` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3383 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3383-3393 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3396-3406 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3482-3492 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3495-3505 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3383` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 4) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:101 — unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:101-111 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:118-128 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:135-145 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:152-162 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:101` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (10 lines × 8) · ×3
  • Duplicated block (10 lines × 8) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:317 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:317-326 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1618-1627 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1690-1699 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1715-1724 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1744-1753 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2508-2517 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2578-2587 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2930-2939 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:317` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2576` calls `setStaticIntField` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1688` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 8) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2039 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2039-2048 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2428-2437 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2458-2467 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2849-2858 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3238-3247 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3268-3277 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3349-3358 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3528-3537 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 8) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2488 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2488-2497 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2578-2587 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2607-2616 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3298-3307 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3323-3332 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3443-3452 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3464-3473 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3487-3496 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2588` calls `calculateSize`, `allocateAllImage` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2498` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 12) · ×3
  • Duplicated block (9 lines × 12) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:520 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:520-528 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:597-605 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:794-802 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:871-879 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:975-983 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1018-1026 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:529-537 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:606-614 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:784-792 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:861-869 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:982-990 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1048-1056 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:520` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 12) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3100 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3100-3108 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3121-3129 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3141-3149 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3176-3184 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3197-3205 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3225-3233 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3250-3258 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3278-3286 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3303-3311 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3321-3329 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3419-3427 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3448-3456 — all 12 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3100` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 12) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3190 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3190-3198 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3211-3219 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3231-3239 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3266-3274 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3287-3295 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3315-3323 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3340-3348 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3368-3376 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3396-3404 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3417-3425 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3518-3526 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3547-3555 — all 12 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3190` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 10) · ×3
  • Duplicated block (8 lines × 10) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2271 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2271-2278 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2294-2301 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2317-2324 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2354-2361 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2377-2384 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2350-2357 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2373-2380 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2396-2403 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2433-2440 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2456-2463 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2271` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 10) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2441 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2441-2448 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2487-2494 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2512-2519 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2540-2547 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2565-2572 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2519-2526 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2565-2572 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2589-2596 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2917-2924 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2945-2952 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2441` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2527` calls `valueOf`, `setStaticBooleanField` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2573` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 10) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2039 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2039-2046 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2428-2435 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2458-2465 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2849-2856 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3238-3245 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3268-3275 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3349-3356 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3382-3389 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3528-3535 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3728-3735 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3538` calls `nativeValue` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3737` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7 lines × 8) · ×3
  • Duplicated block (7 lines × 8) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:506 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:506-512 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1389-1395 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1746-1752 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2257-2263 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:515-521 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1419-1425 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1794-1800 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2336-2342 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:506` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 8) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3018 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3018-3024 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3034-3040 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3057-3063 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3080-3086 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3496-3502 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3147-3153 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3170-3176 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3595-3601 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3018` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 8) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2846 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2846-2852 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2887-2893 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3001-3007 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3031-3037 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3073-3079 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3101-3107 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3137-3143 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3160-3166 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2846` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2895` calls `getObject`, `toIntPeer` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2854` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 42) · ×3
  • Duplicated block (6 lines × 42) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:314 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:314-319 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:515-520 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:592-597 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:789-794 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:970-975 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1013-1018 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1398-1403 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1422-1427 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1467-1472 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1516-1521 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1755-1760 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1854-1859 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1966-1971 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2080-2085 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2167-2172 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2266-2271 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2289-2294 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2312-2317 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2349-2354 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:322-327 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:524-529 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:601-606 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:779-784 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:856-861 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:977-982 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1043-1048 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1428-1433 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1452-1457 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1476-1481 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1514-1519 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1538-1543 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1562-1567 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1803-1808 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1877-1882 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2014-2019 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2162-2167 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2204-2209 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2246-2251 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2345-2350 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2368-2373 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2391-2396 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2428-2433 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:314` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 42) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:620 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:620-625 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:646-651 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:679-684 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:719-724 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:759-764 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:817-822 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:843-848 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:895-900 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:936-941 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1041-1046 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1067-1072 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1554-1559 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1782-1787 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1807-1812 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1832-1837 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1881-1886 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1993-1998 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2194-2199 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2219-2224 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2413-2418 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:629-634 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:655-660 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:688-693 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:749-754 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:807-812 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:833-838 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:884-889 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:910-915 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:943-948 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1071-1076 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1097-1102 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1600-1605 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1830-1835 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1855-1860 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1904-1909 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1929-1934 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2041-2046 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2066-2071 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2140-2145 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2273-2278 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2298-2303 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2491-2496 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 42) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:168 — unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:168-173 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:175-180 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:182-187 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:189-194 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:196-201 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:203-208 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:210-215 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:225-230 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:232-237 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:239-244 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:246-251 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:253-258 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:260-265 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:484-489 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:491-496 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:498-503 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:505-510 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:512-517 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:519-524 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:526-531 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:533-538 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:540-545 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:547-552 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:554-559 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:561-566 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:568-573 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:575-580 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:582-587 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:597-602 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:604-609 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:611-616 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:618-623 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:625-630 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:632-637 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:639-644 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:646-651 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:653-658 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:660-665 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:667-672 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:674-679 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:681-686 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:688-693 — all 42 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:168` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×3
  • Duplicated block (6 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1813 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1813-1818 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1887-1892 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1999-2004 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2056-2061 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2200-2205 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1813` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2583 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2583-2588 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2925-2930 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:461-466 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2607-2612 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2990-2995 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2583` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1836 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1836-1841 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1910-1915 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2047-2052 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2121-2126 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2279-2284 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1836` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×3
  • Duplicated block (6 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:585 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:585-590 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:802-807 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:660-665 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2376 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2376-2381 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2408-2413 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2438-2443 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin19.java:23 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin19.java:23-28 | unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin23.java:20-25 | unidbg-ios/src/main/java/com/github/unidbg/ios/thread/ThreadJoin64.java:21-26 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/thread/ThreadJoin64.java:20` calls `findModule` and `unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin23.java:19` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×3
  • Swallowed exception (caught, then discarded) unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARM64Emulator.java:126 — `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARMEmulator.java:112 — `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:508 — `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
D4 · Code Duplication · Near-duplicate member family (4 members, 8 shared lines) · ×2
  • Near-duplicate member family (4 members, 8 shared lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1552 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1552-1573 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1625-1645 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1650-1671 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1676-1700 — These 4 members are variants of one another: a block of 8 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Near-duplicate member family (4 members, 8 shared lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1598 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1598-1619 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1671-1691 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1696-1716 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1721-1745 — These 4 members are variants of one another: a block of 8 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Edited copy of a member (45 corresponding lines) · ×2
  • Edited copy of a member (45 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidResolver.java:124 — unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidResolver.java:124-168 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinResolver.java:154-198 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (45 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:41 — unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:41-85 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:921-969 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×2
  • Edited copy of a member (35 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:953 — unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:953-987 | unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:989-1023 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1300 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1300-1334 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1336-1382 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (41 corresponding lines) · ×2
  • Edited copy of a member (41 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:187 — unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:187-227 | unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:229-269 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (41 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:242 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:242-282 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:257-297 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×2
  • Edited copy of a member (33 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:37 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:37-69 | unidbg-ios/src/main/java/com/github/unidbg/ios/thread/BsdThreadCreatePatcher64.java:41-80 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARM64Emulator.java:38 — unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARM64Emulator.java:38-76 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinARMEmulator.java:35-67 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×2
  • Edited copy of a member (25 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/file/DirectoryFileIO.java:84 — unidbg-android/src/main/java/com/github/unidbg/linux/file/DirectoryFileIO.java:84-108 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/DirectoryFileIO.java:118-142 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:279 — unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:279-303 | unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:564-589 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×2
  • Edited copy of a member (20 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidARM64Unwinder.java:28 — unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidARM64Unwinder.java:28-47 | unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidARMUnwinder.java:29-53 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:54 — unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:54-73 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaLoader.java:64-84 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 13+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 13+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1802 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1802-1814 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1322-1335 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2962-2975 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:4131-4144 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 13+ corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:55 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:55-69 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:73-87 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:91-103 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:108-123 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 15+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 15+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:95 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:95-109 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:129-143 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:163-177 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:197-211 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 15+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:79 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:79-93 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:113-127 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:147-161 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmClass.java:181-195 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (5 members, 10+ corresponding lines) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:98 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:98-107 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:109-118 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:120-129 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:284-293 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java:164-173 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 10+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:709 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:709-720 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:723-733 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:736-745 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:748-758 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:761-770 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 12+ corresponding lines) unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:510 — unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:510-522 | unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:537-549 | unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:551-562 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/apk/ApkFile.java:25 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/apk/ApkFile.java:25-36 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/apk/ApkFile.java:39-50 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/apk/ApkFile.java:97-110 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 9+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1106 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1106-1115 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:706-717 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1098-1106 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:689 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:689-697 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:881-891 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1284-1293 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 7+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/file/PipedSocketIO.java:32 — unidbg-android/src/main/java/com/github/unidbg/linux/file/PipedSocketIO.java:32-40 | unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:290-298 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java:235-241 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/Arm64Svc.java:19 — unidbg-api/src/main/java/com/github/unidbg/arm/Arm64Svc.java:19-25 | unidbg-api/src/main/java/com/github/unidbg/arm/ArmSvc.java:15-21 | unidbg-api/src/main/java/com/github/unidbg/arm/ThumbSvc.java:15-21 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×2
  • Edited copy of a member (4 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/IOServiceAddNotificationRequest.java:24 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/IOServiceAddNotificationRequest.java:24-27 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/IOServiceGetMatchingServiceRequest.java:20-23 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/ARMSvcMemory.java:151 — unidbg-api/src/main/java/com/github/unidbg/arm/ARMSvcMemory.java:151-154 | unidbg-api/src/main/java/com/github/unidbg/spi/AbstractLoader.java:363-366 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (70 lines × 2) · ×2
  • Duplicated block (70 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2287 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2287-2356 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3097-3166 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2287` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (70 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/ExternProc32.java:18 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/ExternProc32.java:18-87 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/ExternProc64.java:17-86 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (52 lines × 2) · ×2
  • Duplicated block (52 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1531 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1531-1582 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1024-1075 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1531` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (52 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1923 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1923-1974 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3639-3690 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1923` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×2
  • Duplicated block (29 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:62 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:62-90 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:57-85 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:62` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (29 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:398 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:398-426 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:429-457 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:398` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×2
  • Duplicated block (27 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:84 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:84-110 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:141-167 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:84` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (27 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2200 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2200-2226 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2878-2904 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2200` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×2
  • Duplicated block (26 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1595 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1595-1620 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1080-1105 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1595` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (26 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:529 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:529-554 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:632-657 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:529` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12 lines × 5) · ×2
  • Duplicated block (12 lines × 5) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1424 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1424-1435 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:277-288 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:304-315 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:326-337 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:373-384 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1424` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:543 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:543-554 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:569-580 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:552-563 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:578-589 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1016-1027 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:543` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×2
  • Duplicated block (12 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:81 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:81-92 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:138-149 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:1210-1221 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:81` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:79` calls `toHexString` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:137` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 3) REDACTED:180 — REDACTED:180-191 | unidbg-android/src/main/java/com/github/unidbg/linux/file/UdpSocket.java:81-92 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/UdpSocket.java:74-85 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:180` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×2
  • Duplicated block (10–11 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:558 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:558-567 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:683-693 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:558` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–11 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:232 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:232-242 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2033-2042 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:232` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×2
  • Duplicated block (10 lines × 6) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:238 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:238-247 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:351-360 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2753-2762 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2787-2796 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2809-2818 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2824-2833 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:238` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 6) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2958 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2958-2967 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3209-3218 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3229-3238 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3285-3294 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3338-3347 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3415-3424 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2958` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3337` calls `requireNonNull`, `setData` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2957` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10 lines × 5) · ×2
  • Duplicated block (10 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3018 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3018-3027 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3034-3043 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3057-3066 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3080-3089 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3496-3505 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3018` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3119 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3119-3128 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3139-3148 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3195-3204 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3248-3257 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3319-3328 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3119` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (9 lines × 6) · ×2
  • Duplicated block (9 lines × 6) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3008 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3008-3016 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3024-3032 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3047-3055 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3070-3078 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3339-3347 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3486-3494 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3008` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 6) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3101 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3101-3109 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3117-3125 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3137-3145 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3160-3168 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3438-3446 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3585-3593 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3101` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3110` calls `isDebugEnabled`, `debug` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3126` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–9 lines × 3) · ×2
  • Duplicated block (8–9 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:779 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:779-786 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:990-997 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3998-4006 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:779` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8–9 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2456 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2456-2463 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2511-2518 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2541-2549 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2541` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×2
  • Duplicated block (8–9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:65 — unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:65-72 | unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:75-83 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:65` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–9 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/DirectoryFileIO.java:87 — unidbg-android/src/main/java/com/github/unidbg/linux/file/DirectoryFileIO.java:87-95 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/DirectoryFileIO.java:122-129 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: `Dirent` names `com.github.unidbg.ios.struct.Dirent` in one and `com.github.unidbg.linux.struct.Dirent` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (7 lines × 19) · ×2
  • Duplicated block (7 lines × 19) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:99 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:99-105 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:682-688 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:743-749 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:776-782 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:937-943 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:974-980 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1010-1016 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1152-1158 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1336-1342 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1511-1517 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1594-1600 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1667-1673 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2011-2017 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2201-2207 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2243-2249 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2425-2431 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2485-2491 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2556-2562 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2647-2653 — all 19 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:99` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 19) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1897 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1897-1903 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1943-1950 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1976-1983 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2119-2126 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2488-2495 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2578-2585 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2607-2614 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2999-3006 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3215-3222 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3298-3305 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3323-3330 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3443-3450 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3464-3471 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3487-3494 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3548-3555 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3611-3617 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3659-3666 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3696-3703 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3756-3763 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2588` calls `calculateSize`, `allocateAllImage` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2498` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 23) · ×2
  • Duplicated block (6 lines × 23) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1758 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1758-1763 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1857-1862 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1969-1974 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2025-2030 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2083-2088 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2125-2130 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2170-2175 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2269-2274 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2292-2297 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2315-2320 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2352-2357 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2375-2380 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1806-1811 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1880-1885 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2017-2022 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2091-2096 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2165-2170 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2207-2212 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2249-2254 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2348-2353 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2371-2376 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2394-2399 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2431-2436 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 23) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1406 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1406-1411 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1430-1435 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1475-1480 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1499-1504 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1524-1529 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1560-1565 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1586-1591 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1633-1638 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1659-1664 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1688-1693 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1714-1719 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1436-1441 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1460-1465 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1484-1489 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1522-1527 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1546-1551 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1570-1575 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1606-1611 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1632-1637 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1679-1684 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1704-1709 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1733-1738 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1762-1767 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1406` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×2
  • Duplicated block (5 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:951 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:951-955 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2096-2100 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:958-962 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2178-2182 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:951` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2138 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2138-2142 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:994-998 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1031-1035 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2220-2224 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2138` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · ARM64SyscallHandler.hook (cyclomatic 168) · ×1
  • ARM64SyscallHandler.hook (cyclomatic 168) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:146 — ARM64SyscallHandler.hook has cyclomatic complexity 168 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ARM32SyscallHandler.hook (cyclomatic 152) · ×1
  • ARM32SyscallHandler.hook (cyclomatic 152) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:70 — ARM32SyscallHandler.hook has cyclomatic complexity 152 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MachOLoader.loadInternalPhase (cyclomatic 151) · ×1
  • MachOLoader.loadInternalPhase (cyclomatic 151) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:298 — MachOLoader.loadInternalPhase has cyclomatic complexity 151 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ARM32SyscallHandler.hook (cyclomatic 137) · ×1
  • ARM32SyscallHandler.hook (cyclomatic 137) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:133 — ARM32SyscallHandler.hook has cyclomatic complexity 137 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AbstractARMDebugger.handleCommon (cyclomatic 132) · ×1
  • AbstractARMDebugger.handleCommon (cyclomatic 132) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:626 — AbstractARMDebugger.handleCommon has cyclomatic complexity 132 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ARM64SyscallHandler.sysctl (cyclomatic 124) · ×1
  • ARM64SyscallHandler.sysctl (cyclomatic 124) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1825 — ARM64SyscallHandler.sysctl has cyclomatic complexity 124 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ARM64SyscallHandler.mach_msg_trap (cyclomatic 123) · ×1
  • ARM64SyscallHandler.mach_msg_trap (cyclomatic 123) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2714 — ARM64SyscallHandler.mach_msg_trap has cyclomatic complexity 123 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ARM.showRegs64 (cyclomatic 111) · ×1
  • ARM.showRegs64 (cyclomatic 111) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:277 — ARM.showRegs64 has cyclomatic complexity 111 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ARM64SyscallHandler.hook (cyclomatic 109) · ×1
  • ARM64SyscallHandler.hook (cyclomatic 109) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:69 — ARM64SyscallHandler.hook has cyclomatic complexity 109 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AndroidElfLoader.loadInternal (cyclomatic 105) · ×1
  • AndroidElfLoader.loadInternal (cyclomatic 105) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:311 — AndroidElfLoader.loadInternal has cyclomatic complexity 105 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ARM32SyscallHandler.mach_msg_trap (cyclomatic 102) · ×1
  • ARM32SyscallHandler.mach_msg_trap (cyclomatic 102) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1796 — ARM32SyscallHandler.mach_msg_trap has cyclomatic complexity 102 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ARM32SyscallHandler.sysctl (cyclomatic 82) · ×1
  • ARM32SyscallHandler.sysctl (cyclomatic 82) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1328 — ARM32SyscallHandler.sysctl has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AbstractJni.callObjectMethodV (cyclomatic 79) · ×1
  • AbstractJni.callObjectMethodV (cyclomatic 79) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:282 — AbstractJni.callObjectMethodV has cyclomatic complexity 79 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SymbolResolver.hook (cyclomatic 77) · ×1
  • SymbolResolver.hook (cyclomatic 77) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:75 — SymbolResolver.hook has cyclomatic complexity 77 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Dyld64.hook (cyclomatic 75) · ×1
  • Dyld64.hook (cyclomatic 75) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:773 — Dyld64.hook has cyclomatic complexity 75 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ElfDynamicStructure.<init> (cyclomatic 55) · ×1
  • ElfDynamicStructure.<init> (cyclomatic 55) unidbg-android/src/main/java/net/fornwall/jelf/ElfDynamicStructure.java:159 — ElfDynamicStructure.<init> has cyclomatic complexity 55 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · GnuEhFrameHeader.dwarf_get_loc (cyclomatic 55) · ×1
  • GnuEhFrameHeader.dwarf_get_loc (cyclomatic 55) unidbg-android/src/main/java/net/fornwall/jelf/GnuEhFrameHeader.java:415 — GnuEhFrameHeader.dwarf_get_loc has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ARM.showRegs (cyclomatic 54) · ×1
  • ARM.showRegs (cyclomatic 54) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:63 — ARM.showRegs has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MachOLoader.fixupAllChainedFixups (cyclomatic 51) · ×1
  • MachOLoader.fixupAllChainedFixups (cyclomatic 51) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:932 — MachOLoader.fixupAllChainedFixups has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MachOLoader.mmap2 (cyclomatic 41) · ×1
  • MachOLoader.mmap2 (cyclomatic 41) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2272 — MachOLoader.mmap2 has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AndroidElfLoader.mmap2 (cyclomatic 35) · ×1
  • AndroidElfLoader.mmap2 (cyclomatic 35) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:762 — AndroidElfLoader.mmap2 has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MachOModule.findClosestSymbolByAddress (cyclomatic 35) · ×1
  • MachOModule.findClosestSymbolByAddress (cyclomatic 35) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:776 — MachOModule.findClosestSymbolByAddress has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ArmExIdx.arm_exidx_decode (cyclomatic 33) · ×1
  • ArmExIdx.arm_exidx_decode (cyclomatic 33) unidbg-android/src/main/java/net/fornwall/jelf/ArmExIdx.java:164 — ArmExIdx.arm_exidx_decode has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpTools.formatRegValues (cyclomatic 33) · ×1
  • McpTools.formatRegValues (cyclomatic 33) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1028 — McpTools.formatRegValues has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: McpTools.dispatchTool (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ArmExIdx.arm_exidx_apply_cmd (cyclomatic 32) · ×1
  • ArmExIdx.arm_exidx_apply_cmd (cyclomatic 32) unidbg-android/src/main/java/net/fornwall/jelf/ArmExIdx.java:265 — ArmExIdx.arm_exidx_apply_cmd has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpTools.searchMemory (cyclomatic 32) · ×1
  • McpTools.searchMemory (cyclomatic 32) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:420 — McpTools.searchMemory has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: McpTools.dispatchTool (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AssemblyCodeDumper.handleArm32MultipleAccess (cyclomatic 32) · ×1
  • AssemblyCodeDumper.handleArm32MultipleAccess (cyclomatic 32) unidbg-api/src/main/java/com/github/unidbg/AssemblyCodeDumper.java:245 — AssemblyCodeDumper.handleArm32MultipleAccess has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpTools.readTyped (cyclomatic 31) · ×1
  • McpTools.readTyped (cyclomatic 31) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1319 — McpTools.readTyped has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: McpTools.dispatchTool (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · RegAccessPrinter.print (cyclomatic 31) · ×1
  • RegAccessPrinter.print (cyclomatic 31) unidbg-api/src/main/java/com/github/unidbg/RegAccessPrinter.java:25 — RegAccessPrinter.print has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BaseDarwinFileIO.getattrlist (cyclomatic 30) · ×1
  • BaseDarwinFileIO.getattrlist (cyclomatic 30) unidbg-ios/src/main/java/com/github/unidbg/file/ios/BaseDarwinFileIO.java:88 — BaseDarwinFileIO.getattrlist has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GnuEhFrameHeader.dwarf_step (cyclomatic 29) · ×1
  • GnuEhFrameHeader.dwarf_step (cyclomatic 29) unidbg-android/src/main/java/net/fornwall/jelf/GnuEhFrameHeader.java:209 — GnuEhFrameHeader.dwarf_step has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CDObjectiveCProcessor.findObjcSymbol (cyclomatic 29) · ×1
  • CDObjectiveCProcessor.findObjcSymbol (cyclomatic 29) unidbg-ios/src/main/java/com/github/unidbg/ios/objc/processor/CDObjectiveCProcessor.java:31 — CDObjectiveCProcessor.findObjcSymbol has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ARM.appendMemoryDetails32 (cyclomatic 27) · ×1
  • ARM.appendMemoryDetails32 (cyclomatic 27) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:923 — ARM.appendMemoryDetails32 has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MachOModule.findSymbol (cyclomatic 27) · ×1
  • MachOModule.findSymbol (cyclomatic 27) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:508 — MachOModule.findSymbol has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MachOModule.<init> (cyclomatic 27) · ×1
  • MachOModule.<init> (cyclomatic 27) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:189 — MachOModule.<init> has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnixSyscallHandler.resolve (cyclomatic 26) · ×1
  • UnixSyscallHandler.resolve (cyclomatic 26) unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:110 — UnixSyscallHandler.resolve has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: UnixSyscallHandler.sigaction (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · McpTools.resolveRegister (cyclomatic 25) · ×1
  • McpTools.resolveRegister (cyclomatic 25) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1874 — McpTools.resolveRegister has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: McpTools.dispatchTool (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · BindTarget.resolveSymbol (cyclomatic 25) · ×1
  • BindTarget.resolveSymbol (cyclomatic 25) unidbg-ios/src/main/java/com/github/unidbg/ios/FixupChains.java:164 — BindTarget.resolveSymbol has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MachOLoader.dlopen (cyclomatic 25) · ×1
  • MachOLoader.dlopen (cyclomatic 25) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1991 — MachOLoader.dlopen has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AndroidSyscallHandler.futex (cyclomatic 24) · ×1
  • AndroidSyscallHandler.futex (cyclomatic 24) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:297 — AndroidSyscallHandler.futex has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AssemblyCodeDumper.hookMemoryAccess (cyclomatic 24) · ×1
  • AssemblyCodeDumper.hookMemoryAccess (cyclomatic 24) unidbg-api/src/main/java/com/github/unidbg/AssemblyCodeDumper.java:153 — AssemblyCodeDumper.hookMemoryAccess has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MachOLoader.eachBind (cyclomatic 24) · ×1
  • MachOLoader.eachBind (cyclomatic 24) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1620 — MachOLoader.eachBind has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ARM.initArgs (cyclomatic 23) · ×1
  • ARM.initArgs (cyclomatic 23) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:1187 — ARM.initArgs has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UniThreadDispatcher.run (cyclomatic 23) · ×1
  • UniThreadDispatcher.run (cyclomatic 23) unidbg-api/src/main/java/com/github/unidbg/thread/UniThreadDispatcher.java:121 — UniThreadDispatcher.run has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProxyUtils.matchMethodTypes (cyclomatic 22) · ×1
  • ProxyUtils.matchMethodTypes (cyclomatic 22) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:164 — ProxyUtils.matchMethodTypes has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AbstractJni.callObjectMethod (cyclomatic 22) · ×1
  • AbstractJni.callObjectMethod (cyclomatic 22) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:1038 — AbstractJni.callObjectMethod has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AbstractJni.callStaticObjectMethodV (cyclomatic 22) · ×1
  • AbstractJni.callStaticObjectMethodV (cyclomatic 22) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:576 — AbstractJni.callStaticObjectMethodV has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · VaList64.<init> (cyclomatic 22) · ×1
  • VaList64.<init> (cyclomatic 22) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VaList64.java:15 — VaList64.<init> has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpTools.inspectObjcMsg (cyclomatic 22) · ×1
  • McpTools.inspectObjcMsg (cyclomatic 22) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1717 — McpTools.inspectObjcMsg has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: McpTools.dispatchTool (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · UnidbgStructure.toString (cyclomatic 22) · ×1
  • UnidbgStructure.toString (cyclomatic 22) unidbg-api/src/main/java/com/github/unidbg/pointer/UnidbgStructure.java:129 — UnidbgStructure.toString has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SocketIO.setsockopt (cyclomatic 21) · ×1
  • SocketIO.setsockopt (cyclomatic 21) unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:142 — SocketIO.setsockopt has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ARM32SyscallHandler.bionic_clone (cyclomatic 21) · ×1
  • ARM32SyscallHandler.bionic_clone (cyclomatic 21) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:877 — ARM32SyscallHandler.bionic_clone has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ARM32SyscallHandler.pthread_clone (cyclomatic 21) · ×1
  • ARM32SyscallHandler.pthread_clone (cyclomatic 21) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:798 — ARM32SyscallHandler.pthread_clone has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ARM64SyscallHandler.bionic_clone (cyclomatic 21) · ×1
  • ARM64SyscallHandler.bionic_clone (cyclomatic 21) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:584 — ARM64SyscallHandler.bionic_clone has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ARM64SyscallHandler.pthread_clone (cyclomatic 20) · ×1
  • ARM64SyscallHandler.pthread_clone (cyclomatic 20) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:485 — ARM64SyscallHandler.pthread_clone has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MachOLoader.rebase (cyclomatic 20) · ×1
  • MachOLoader.rebase (cyclomatic 20) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1197 — MachOLoader.rebase has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProxyUtils.matchField (cyclomatic 19) · ×1
  • ProxyUtils.matchField (cyclomatic 19) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:272 — ProxyUtils.matchField has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ArmExIdx.arm_exidx_step (cyclomatic 19) · ×1
  • ArmExIdx.arm_exidx_step (cyclomatic 19) unidbg-android/src/main/java/net/fornwall/jelf/ArmExIdx.java:56 — ArmExIdx.arm_exidx_step has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpTools.allocateMemory (cyclomatic 19) · ×1
  • McpTools.allocateMemory (cyclomatic 19) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1610 — McpTools.allocateMemory has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: McpTools.dispatchTool (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AbstractLoader.munmap (cyclomatic 19) · ×1
  • AbstractLoader.munmap (cyclomatic 19) unidbg-api/src/main/java/com/github/unidbg/spi/AbstractLoader.java:166 — AbstractLoader.munmap has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SocketIO.setsockopt (cyclomatic 19) · ×1
  • SocketIO.setsockopt (cyclomatic 19) unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java:95 — SocketIO.setsockopt has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FixupChains.handleChain (cyclomatic 19) · ×1
  • FixupChains.handleChain (cyclomatic 19) unidbg-ios/src/main/java/com/github/unidbg/ios/FixupChains.java:55 — FixupChains.handleChain has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AbstractARMDebugger.dumpMemory (cyclomatic 18) · ×1
  • AbstractARMDebugger.dumpMemory (cyclomatic 18) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:439 — AbstractARMDebugger.dumpMemory has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpTools.doCallFunction (cyclomatic 18) · ×1
  • McpTools.doCallFunction (cyclomatic 18) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1411 — McpTools.doCallFunction has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: McpTools.dispatchTool (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · McpTools.listExports (cyclomatic 18) · ×1
  • McpTools.listExports (cyclomatic 18) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1543 — McpTools.listExports has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: McpTools.dispatchTool (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · DefaultWorkerPool.run (cyclomatic 18) · ×1
  • DefaultWorkerPool.run (cyclomatic 18) unidbg-api/src/main/java/com/github/unidbg/worker/DefaultWorkerPool.java:107 — DefaultWorkerPool.run has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MachOLoader.notifySingle (cyclomatic 18) · ×1
  • MachOLoader.notifySingle (cyclomatic 18) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2161 — MachOLoader.notifySingle has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MachOLoader.setupLazyPointerHandler (cyclomatic 18) · ×1
  • MachOLoader.setupLazyPointerHandler (cyclomatic 18) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1417 — MachOLoader.setupLazyPointerHandler has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MachOModule.doBindFastLazySymbol (cyclomatic 18) · ×1
  • MachOModule.doBindFastLazySymbol (cyclomatic 18) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:978 — MachOModule.doBindFastLazySymbol has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Uleb128._read (cyclomatic 18) · ×1
  • Uleb128._read (cyclomatic 18) unidbg-ios/src/main/java/io/kaitai/MachO.java:243 — Uleb128._read has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: LoadCommand._read (cyclomatic 45) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · DvmMethod.decodeArgsShorty (cyclomatic 17) · ×1
  • DvmMethod.decodeArgsShorty (cyclomatic 17) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmMethod.java:261 — DvmMethod.decodeArgsShorty has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpTools.traceCode (cyclomatic 17) · ×1
  • McpTools.traceCode (cyclomatic 17) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1078 — McpTools.traceCode has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: McpTools.dispatchTool (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Inspector.inspectInternal (cyclomatic 17) · ×1
  • Inspector.inspectInternal (cyclomatic 17) unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:213 — Inspector.inspectInternal has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MachOLoader.loadInternal (cyclomatic 17) · ×1
  • MachOLoader.loadInternal (cyclomatic 17) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:214 — MachOLoader.loadInternal has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DvmField.decodeShorty (cyclomatic 16) · ×1
  • DvmField.decodeShorty (cyclomatic 16) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java:56 — DvmField.decodeShorty has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · 1.handle (cyclomatic 16) · ×1
  • 1.handle (cyclomatic 16) unidbg-android/src/main/java/com/github/unidbg/linux/file/LocalAndroidUdpSocket.java:38 — 1.handle has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ARM32SyscallHandler.prctl (cyclomatic 16) · ×1
  • ARM32SyscallHandler.prctl (cyclomatic 16) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1665 — ARM32SyscallHandler.prctl has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModuleSymbol.resolve (cyclomatic 16) · ×1
  • ModuleSymbol.resolve (cyclomatic 16) unidbg-android/src/main/java/com/github/unidbg/linux/ModuleSymbol.java:35 — ModuleSymbol.resolve has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ElfSegment.toString (cyclomatic 16) · ×1
  • ElfSegment.toString (cyclomatic 16) unidbg-android/src/main/java/net/fornwall/jelf/ElfSegment.java:192 — ElfSegment.toString has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ARM.assembleDetail (cyclomatic 16) · ×1
  • ARM.assembleDetail (cyclomatic 16) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:1063 — ARM.assembleDetail has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TraceFunctionCall.hook (cyclomatic 16) · ×1
  • TraceFunctionCall.hook (cyclomatic 16) unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall.java:41 — TraceFunctionCall.hook has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · KEvent.processKev (cyclomatic 16) · ×1
  • KEvent.processKev (cyclomatic 16) unidbg-ios/src/main/java/com/github/unidbg/ios/kevent/KEvent.java:41 — KEvent.processKev has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Dyld64.dlopen (cyclomatic 16) · ×1
  • Dyld64.dlopen (cyclomatic 16) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:654 — Dyld64.dlopen has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Dyld64._dyld_func_lookup (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · MachOLoader.doBindAt (cyclomatic 16) · ×1
  • MachOLoader.doBindAt (cyclomatic 16) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1849 — MachOLoader.doBindAt has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HypervisorBackend64.handleException (cyclomatic 16) · ×1
  • HypervisorBackend64.handleException (cyclomatic 16) backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/HypervisorBackend64.java:163 — HypervisorBackend64.handleException has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: HypervisorBackend64.handleCommRead (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · gpb.list_gpbs (cyclomatic 16) · ×1
  • gpb.list_gpbs (cyclomatic 16) unidbg-ios/assets/gpb.js:284 — gpb.list_gpbs has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: gpb.buildDataTypeMsgDef (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D15 · Churn × Complexity Hotspots · Hotspot · ×1
  • Hotspot: unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:311 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 105 in AndroidElfLoader.loadInternal at line 311. 2 of those changes were fix/bug commits, and the other 2 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 17:19:27 +08:00' --until='2026-11-16 17:19:27 +08:00' --full-history --no-merges -- unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D2 · Cognitive Complexity · AbstractARMDebugger.handleCommon (cognitive 254) · ×1
  • AbstractARMDebugger.handleCommon (cognitive 254) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:626 — AbstractARMDebugger.handleCommon has cognitive complexity 254 (threshold 15). Drivers by points: if/else 90 (174 pts), ternaries 10 (31 pts), boolean chains 21, error handling 6 (16 pts), loops 4 (9 pts), match/switch 3 (nesting depth added 120). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MachOLoader.loadInternalPhase (cognitive 236) · ×1
  • MachOLoader.loadInternalPhase (cognitive 236) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:298 — MachOLoader.loadInternalPhase has cognitive complexity 236 (threshold 15). Drivers by points: if/else 85 (196 pts), loops 10 (17 pts), boolean chains 11, match/switch 4 (6 pts), ternaries 3 (6 pts) (nesting depth added 123). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM64SyscallHandler.sysctl (cognitive 221) · ×1
  • ARM64SyscallHandler.sysctl (cognitive 221) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1825 — ARM64SyscallHandler.sysctl has cognitive complexity 221 (threshold 15). Drivers by points: if/else 63 (194 pts), loops 2 (9 pts), match/switch 4 (8 pts), ternaries 1 (4 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 147). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AndroidElfLoader.loadInternal (cognitive 186) · ×1
  • AndroidElfLoader.loadInternal (cognitive 186) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:311 — AndroidElfLoader.loadInternal has cognitive complexity 186 (threshold 15). Drivers by points: if/else 61 (144 pts), loops 11 (19 pts), boolean chains 11, ternaries 3 (7 pts), match/switch 2 (4 pts), error handling 1 (nesting depth added 97). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ARM64SyscallHandler.mach_msg_trap (cognitive 186) · ×1
  • ARM64SyscallHandler.mach_msg_trap (cognitive 186) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2714 — ARM64SyscallHandler.mach_msg_trap has cognitive complexity 186 (threshold 15). Drivers by points: if/else 79 (166 pts), ternaries 3 (9 pts), loops 3 (6 pts), boolean chains 4, match/switch 1 (nesting depth added 96). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM32SyscallHandler.mach_msg_trap (cognitive 154) · ×1
  • ARM32SyscallHandler.mach_msg_trap (cognitive 154) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1796 — ARM32SyscallHandler.mach_msg_trap has cognitive complexity 154 (threshold 15). Drivers by points: if/else 64 (134 pts), ternaries 3 (9 pts), loops 3 (6 pts), boolean chains 4, match/switch 1 (nesting depth added 79). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM32SyscallHandler.sysctl (cognitive 141) · ×1
  • ARM32SyscallHandler.sysctl (cognitive 141) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1328 — ARM32SyscallHandler.sysctl has cognitive complexity 141 (threshold 15). Drivers by points: if/else 41 (121 pts), match/switch 4 (8 pts), loops 1 (4 pts), ternaries 1 (4 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 92). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Dyld64.hook (cognitive 139) · ×1
  • Dyld64.hook (cognitive 139) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:773 — Dyld64.hook has cognitive complexity 139 (threshold 15). Drivers by points: if/else 74 (139 pts) (nesting depth added 65). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM.showRegs64 (cognitive 133) · ×1
  • ARM.showRegs64 (cognitive 133) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:277 — ARM.showRegs64 has cognitive complexity 133 (threshold 15). Drivers by points: if/else 38 (109 pts), ternaries 5 (20 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 87). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SymbolResolver.hook (cognitive 131) · ×1
  • SymbolResolver.hook (cognitive 131) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:75 — SymbolResolver.hook has cognitive complexity 131 (threshold 15). Drivers by points: if/else 60 (101 pts), ternaries 6 (17 pts), boolean chains 12, match/switch 1 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpTools.formatRegValues (cognitive 101) · ×1
  • McpTools.formatRegValues (cognitive 101) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1028 — McpTools.formatRegValues has cognitive complexity 101 (threshold 15). Drivers by points: ternaries 13 (61 pts), if/else 14 (32 pts), boolean chains 7, loops 1 (nesting depth added 66). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · RegAccessPrinter.print (cognitive 99) · ×1
  • RegAccessPrinter.print (cognitive 99) unidbg-api/src/main/java/com/github/unidbg/RegAccessPrinter.java:25 — RegAccessPrinter.print has cognitive complexity 99 (threshold 15). Drivers by points: ternaries 12 (60 pts), if/else 14 (32 pts), boolean chains 6, loops 1 (nesting depth added 66). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · GnuEhFrameHeader.dwarf_get_loc (cognitive 87) · ×1
  • GnuEhFrameHeader.dwarf_get_loc (cognitive 87) unidbg-android/src/main/java/net/fornwall/jelf/GnuEhFrameHeader.java:415 — GnuEhFrameHeader.dwarf_get_loc has cognitive complexity 87 (threshold 15). Drivers by points: if/else 22 (67 pts), ternaries 3 (11 pts), match/switch 2 (5 pts), loops 2 (4 pts) (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UniThreadDispatcher.run (cognitive 78) · ×1
  • UniThreadDispatcher.run (cognitive 78) unidbg-api/src/main/java/com/github/unidbg/thread/UniThreadDispatcher.java:121 — UniThreadDispatcher.run has cognitive complexity 78 (threshold 15). Drivers by points: if/else 16 (45 pts), error handling 3 (14 pts), loops 4 (10 pts), ternaries 1 (7 pts), boolean chains 2 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MachOLoader.mmap2 (cognitive 77) · ×1
  • MachOLoader.mmap2 (cognitive 77) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2272 — MachOLoader.mmap2 has cognitive complexity 77 (threshold 15). Drivers by points: if/else 31 (63 pts), boolean chains 7, loops 3 (6 pts), error handling 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOLoader.fixupAllChainedFixups (cognitive 75) · ×1
  • MachOLoader.fixupAllChainedFixups (cognitive 75) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:932 — MachOLoader.fixupAllChainedFixups has cognitive complexity 75 (threshold 15). Drivers by points: if/else 30 (57 pts), loops 7 (12 pts), match/switch 2 (3 pts), boolean chains 2, error handling 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOModule.<init> (cognitive 75) · ×1
  • MachOModule.<init> (cognitive 75) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:189 — MachOModule.<init> has cognitive complexity 75 (threshold 15). Drivers by points: if/else 20 (63 pts), boolean chains 5, ternaries 3, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · GnuEhFrameHeader.dwarf_step (cognitive 68) · ×1
  • GnuEhFrameHeader.dwarf_step (cognitive 68) unidbg-android/src/main/java/net/fornwall/jelf/GnuEhFrameHeader.java:209 — GnuEhFrameHeader.dwarf_step has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 9 (36 pts), if/else 10 (25 pts), match/switch 2 (5 pts), loops 1 (2 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOLoader.setupLazyPointerHandler (cognitive 65) · ×1
  • MachOLoader.setupLazyPointerHandler (cognitive 65) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1417 — MachOLoader.setupLazyPointerHandler has cognitive complexity 65 (threshold 15). Drivers by points: if/else 12 (54 pts), loops 3 (9 pts), match/switch 1 (2 pts) (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AndroidElfLoader.mmap2 (cognitive 59) · ×1
  • AndroidElfLoader.mmap2 (cognitive 59) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:762 — AndroidElfLoader.mmap2 has cognitive complexity 59 (threshold 15). Drivers by points: if/else 24 (47 pts), boolean chains 6, loops 2 (4 pts), error handling 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpTools.searchMemory (cognitive 59) · ×1
  • McpTools.searchMemory (cognitive 59) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:420 — McpTools.searchMemory has cognitive complexity 59 (threshold 15). Drivers by points: if/else 19 (36 pts), loops 7 (13 pts), boolean chains 4, error handling 2 (4 pts), ternaries 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BindTarget.resolveSymbol (cognitive 59) · ×1
  • BindTarget.resolveSymbol (cognitive 59) unidbg-ios/src/main/java/com/github/unidbg/ios/FixupChains.java:164 — BindTarget.resolveSymbol has cognitive complexity 59 (threshold 15). Drivers by points: if/else 14 (42 pts), loops 3 (11 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArmExIdx.arm_exidx_decode (cognitive 57) · ×1
  • ArmExIdx.arm_exidx_decode (cognitive 57) unidbg-android/src/main/java/net/fornwall/jelf/ArmExIdx.java:164 — ArmExIdx.arm_exidx_decode has cognitive complexity 57 (threshold 15). Drivers by points: if/else 28 (46 pts), boolean chains 7, loops 2 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CDObjectiveCProcessor.findObjcSymbol (cognitive 57) · ×1
  • CDObjectiveCProcessor.findObjcSymbol (cognitive 57) unidbg-ios/src/main/java/com/github/unidbg/ios/objc/processor/CDObjectiveCProcessor.java:31 — CDObjectiveCProcessor.findObjcSymbol has cognitive complexity 57 (threshold 15). Drivers by points: if/else 16 (39 pts), loops 6 (11 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM.showRegs (cognitive 56) · ×1
  • ARM.showRegs (cognitive 56) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:63 — ARM.showRegs has cognitive complexity 56 (threshold 15). Drivers by points: if/else 18 (52 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FixupChains.handleChain (cognitive 56) · ×1
  • FixupChains.handleChain (cognitive 56) unidbg-ios/src/main/java/com/github/unidbg/ios/FixupChains.java:55 — FixupChains.handleChain has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (47 pts), ternaries 2 (8 pts), match/switch 1 (nesting depth added 33). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MachOModule.findClosestSymbolByAddress (cognitive 56) · ×1
  • MachOModule.findClosestSymbolByAddress (cognitive 56) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:776 — MachOModule.findClosestSymbolByAddress has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (40 pts), boolean chains 9, loops 3 (4 pts), error handling 2 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM.appendMemoryDetails32 (cognitive 50) · ×1
  • ARM.appendMemoryDetails32 (cognitive 50) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:923 — ARM.appendMemoryDetails32 has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 7 (22 pts), if/else 12 (21 pts), boolean chains 7 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · VaList64.<init> (cognitive 49) · ×1
  • VaList64.<init> (cognitive 49) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VaList64.java:15 — VaList64.<init> has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (46 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArmExIdx.arm_exidx_apply_cmd (cognitive 49) · ×1
  • ArmExIdx.arm_exidx_apply_cmd (cognitive 49) unidbg-android/src/main/java/net/fornwall/jelf/ArmExIdx.java:265 — ArmExIdx.arm_exidx_apply_cmd has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (39 pts), loops 4 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MachOLoader.dlopen (cognitive 47) · ×1
  • MachOLoader.dlopen (cognitive 47) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1991 — MachOLoader.dlopen has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 8 (12 pts), error handling 1 (3 pts), ternaries 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AndroidSyscallHandler.futex (cognitive 46) · ×1
  • AndroidSyscallHandler.futex (cognitive 46) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:297 — AndroidSyscallHandler.futex has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (38 pts), boolean chains 3, loops 1 (2 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Uleb128.value (cognitive 46) · ×1
  • Uleb128.value (cognitive 46) unidbg-ios/src/main/java/io/kaitai/MachO.java:274 — Uleb128.value has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 9 (45 pts), if/else 1 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ARM.initArgs (cognitive 45) · ×1
  • ARM.initArgs (cognitive 45) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:1187 — ARM.initArgs has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (39 pts), boolean chains 3, loops 3 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AbstractARMDebugger.dumpMemory (cognitive 45) · ×1
  • AbstractARMDebugger.dumpMemory (cognitive 45) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:439 — AbstractARMDebugger.dumpMemory has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (29 pts), ternaries 2 (7 pts), error handling 2 (6 pts), loops 1 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOLoader.notifySingle (cognitive 43) · ×1
  • MachOLoader.notifySingle (cognitive 43) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2161 — MachOLoader.notifySingle has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (33 pts), loops 4 (9 pts), match/switch 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AssemblyCodeDumper.hookMemoryAccess (cognitive 42) · ×1
  • AssemblyCodeDumper.hookMemoryAccess (cognitive 42) unidbg-api/src/main/java/com/github/unidbg/AssemblyCodeDumper.java:153 — AssemblyCodeDumper.hookMemoryAccess has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (24 pts), ternaries 6 (11 pts), loops 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BaseDarwinFileIO.getattrlist (cognitive 42) · ×1
  • BaseDarwinFileIO.getattrlist (cognitive 42) unidbg-ios/src/main/java/com/github/unidbg/file/ios/BaseDarwinFileIO.java:88 — BaseDarwinFileIO.getattrlist has cognitive complexity 42 (threshold 15). Drivers by points: if/else 24 (35 pts), loops 3 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AbstractLoader.munmap (cognitive 41) · ×1
  • AbstractLoader.munmap (cognitive 41) unidbg-api/src/main/java/com/github/unidbg/spi/AbstractLoader.java:166 — AbstractLoader.munmap has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (38 pts), loops 1 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Dyld64.dlopen (cognitive 40) · ×1
  • Dyld64.dlopen (cognitive 40) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:654 — Dyld64.dlopen has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 3 (8 pts), boolean chains 1, ternaries 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnidbgStructure.toString (cognitive 39) · ×1
  • UnidbgStructure.toString (cognitive 39) unidbg-api/src/main/java/com/github/unidbg/pointer/UnidbgStructure.java:129 — UnidbgStructure.toString has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnixSyscallHandler.resolve (cognitive 39) · ×1
  • UnixSyscallHandler.resolve (cognitive 39) unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:110 — UnixSyscallHandler.resolve has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 8, loops 3 (6 pts), error handling 1 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM32SyscallHandler.hook (cognitive 39) · ×1
  • ARM32SyscallHandler.hook (cognitive 39) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:133 — ARM32SyscallHandler.hook has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (26 pts), ternaries 2 (6 pts), boolean chains 3, error handling 3, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Dyld32.dlopen (cognitive 39) · ×1
  • Dyld32.dlopen (cognitive 39) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:530 — Dyld32.dlopen has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 3 (8 pts), ternaries 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOModule.findSymbol (cognitive 39) · ×1
  • MachOModule.findSymbol (cognitive 39) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:508 — MachOModule.findSymbol has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 3 (7 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DefaultWorkerPool.run (cognitive 38) · ×1
  • DefaultWorkerPool.run (cognitive 38) unidbg-api/src/main/java/com/github/unidbg/worker/DefaultWorkerPool.java:107 — DefaultWorkerPool.run has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (24 pts), error handling 2 (5 pts), loops 2 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM64SyscallHandler.hook (cognitive 38) · ×1
  • ARM64SyscallHandler.hook (cognitive 38) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:146 — ARM64SyscallHandler.hook has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 4, error handling 3, ternaries 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AbstractJni.callObjectMethodV (cognitive 37) · ×1
  • AbstractJni.callObjectMethodV (cognitive 37) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:282 — AbstractJni.callObjectMethodV has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 7 (13 pts), error handling 3 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 17). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ARM32SyscallHandler.hook (cognitive 35) · ×1
  • ARM32SyscallHandler.hook (cognitive 35) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:70 — ARM32SyscallHandler.hook has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (24 pts), ternaries 2 (4 pts), boolean chains 3, error handling 3, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AbstractDebugServer.runServer (cognitive 35) · ×1
  • AbstractDebugServer.runServer (cognitive 35) unidbg-api/src/main/java/com/github/unidbg/debugger/AbstractDebugServer.java:59 — AbstractDebugServer.runServer has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (28 pts), error handling 2 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Inspector.inspectInternal (cognitive 35) · ×1
  • Inspector.inspectInternal (cognitive 35) unidbg-api/src/main/java/com/github/unidbg/utils/Inspector.java:213 — Inspector.inspectInternal has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 5 (14 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProxyUtils.matchMethodTypes (cognitive 34) · ×1
  • ProxyUtils.matchMethodTypes (cognitive 34) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:164 — ProxyUtils.matchMethodTypes has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 6 (9 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpTools.inspectObjcMsg (cognitive 34) · ×1
  • McpTools.inspectObjcMsg (cognitive 34) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1717 — McpTools.inspectObjcMsg has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (20 pts), error handling 4 (9 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOLoader.loadInternal (cognitive 34) · ×1
  • MachOLoader.loadInternal (cognitive 34) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:214 — MachOLoader.loadInternal has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 5 (7 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gpb.list_gpbs (cognitive 34) · ×1
  • gpb.list_gpbs (cognitive 34) unidbg-ios/assets/gpb.js:284 — gpb.list_gpbs has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (7 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArmExIdx.arm_exidx_step (cognitive 33) · ×1
  • ArmExIdx.arm_exidx_step (cognitive 33) unidbg-android/src/main/java/net/fornwall/jelf/ArmExIdx.java:56 — ArmExIdx.arm_exidx_step has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 3 (8 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AssemblyCodeDumper.handleArm32MultipleAccess (cognitive 33) · ×1
  • AssemblyCodeDumper.handleArm32MultipleAccess (cognitive 33) unidbg-api/src/main/java/com/github/unidbg/AssemblyCodeDumper.java:245 — AssemblyCodeDumper.handleArm32MultipleAccess has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 9 (11 pts), boolean chains 5, match/switch 2 (3 pts), loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM64SyscallHandler.hook (cognitive 32) · ×1
  • ARM64SyscallHandler.hook (cognitive 32) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:69 — ARM64SyscallHandler.hook has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (21 pts), ternaries 2 (4 pts), boolean chains 3, error handling 3, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gpb.buildMsgDef (cognitive 32) · ×1
  • gpb.buildMsgDef (cognitive 32) unidbg-ios/assets/gpb.js:220 — gpb.buildMsgDef has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 5 (10 pts), error handling 1 (4 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModuleSymbol.resolve (cognitive 31) · ×1
  • ModuleSymbol.resolve (cognitive 31) unidbg-android/src/main/java/com/github/unidbg/linux/ModuleSymbol.java:35 — ModuleSymbol.resolve has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (8 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOLoader.processSection (cognitive 31) · ×1
  • MachOLoader.processSection (cognitive 31) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1553 — MachOLoader.processSection has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOLoader.rebase (cognitive 31) · ×1
  • MachOLoader.rebase (cognitive 31) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1197 — MachOLoader.rebase has cognitive complexity 31 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 4 (10 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KEvent.processKev (cognitive 30) · ×1
  • KEvent.processKev (cognitive 30) unidbg-ios/src/main/java/com/github/unidbg/ios/kevent/KEvent.java:41 — KEvent.processKev has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 1, match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MachOLoader.eachBind (cognitive 30) · ×1
  • MachOLoader.eachBind (cognitive 30) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1620 — MachOLoader.eachBind has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 3 (7 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOModule.findSymbolByNameInternal (cognitive 30) · ×1
  • MachOModule.findSymbolByNameInternal (cognitive 30) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:724 — MachOModule.findSymbolByNameInternal has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 2 (4 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AbstractARMDebugger.disassemble (cognitive 29) · ×1
  • AbstractARMDebugger.disassemble (cognitive 29) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:1198 — AbstractARMDebugger.disassemble has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (6 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpTools.resolveRegister (cognitive 29) · ×1
  • McpTools.resolveRegister (cognitive 29) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1874 — McpTools.resolveRegister has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProxyUtils.matchField (cognitive 28) · ×1
  • ProxyUtils.matchField (cognitive 28) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:272 — ProxyUtils.matchField has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 5 (7 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AndroidResolver.createFileIO (cognitive 28) · ×1
  • AndroidResolver.createFileIO (cognitive 28) unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidResolver.java:124 — AndroidResolver.createFileIO has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 1 (3 pts), error handling 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · DarwinResolver.createFileIO (cognitive 28) · ×1
  • DarwinResolver.createFileIO (cognitive 28) unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinResolver.java:154 — DarwinResolver.createFileIO has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 1 (3 pts), error handling 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SocketIO.setsockopt (cognitive 27) · ×1
  • SocketIO.setsockopt (cognitive 27) unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:142 — SocketIO.setsockopt has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 3 (5 pts), error handling 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ElfDynamicStructure.<init> (cognitive 27) · ×1
  • ElfDynamicStructure.<init> (cognitive 27) unidbg-android/src/main/java/net/fornwall/jelf/ElfDynamicStructure.java:159 — ElfDynamicStructure.<init> has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 4 (6 pts), match/switch 1 (2 pts), ternaries 2 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · McpTools.doCallFunction (cognitive 27) · ×1
  • McpTools.doCallFunction (cognitive 27) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1411 — McpTools.doCallFunction has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 3 (6 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IpaResolver.resolve (cognitive 27) · ×1
  • IpaResolver.resolve (cognitive 27) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaResolver.java:39 — IpaResolver.resolve has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProxyUtils.unpack (cognitive 26) · ×1
  • ProxyUtils.unpack (cognitive 26) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:90 — ProxyUtils.unpack has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2 (7 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TraceFunctionCall.hook (cognitive 26) · ×1
  • TraceFunctionCall.hook (cognitive 26) unidbg-api/src/main/java/com/github/unidbg/arm/TraceFunctionCall.java:41 — TraceFunctionCall.hook has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 2, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpTools.readPointer (cognitive 26) · ×1
  • McpTools.readPointer (cognitive 26) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1269 — McpTools.readPointer has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (9 pts), ternaries 3, error handling 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GPBDescriptor.buildMsgDef (cognitive 26) · ×1
  • GPBDescriptor.buildMsgDef (cognitive 26) unidbg-ios/src/main/java/com/github/unidbg/ios/gpb/GPBDescriptor.java:89 — GPBDescriptor.buildMsgDef has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (10 pts), ternaries 3 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpTools.traceCode (cognitive 24) · ×1
  • McpTools.traceCode (cognitive 24) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1078 — McpTools.traceCode has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SocketIO.setsockopt (cognitive 24) · ×1
  • SocketIO.setsockopt (cognitive 24) unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java:95 — SocketIO.setsockopt has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 3 (5 pts), error handling 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AbstractARMDebugger.setupTraceMemory (cognitive 23) · ×1
  • AbstractARMDebugger.setupTraceMemory (cognitive 23) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:569 — AbstractARMDebugger.setupTraceMemory has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 3, ternaries 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpTools.listExports (cognitive 23) · ×1
  • McpTools.listExports (cognitive 23) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1543 — McpTools.listExports has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, ternaries 3 (5 pts), loops 2, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dyld_chained_import_addend64.resolve (cognitive 23) · ×1
  • dyld_chained_import_addend64.resolve (cognitive 23) unidbg-ios/src/main/java/com/github/unidbg/ios/FixupChains.java:251 — dyld_chained_import_addend64.resolve has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AndroidElfLoader.dlsym (cognitive 22) · ×1
  • AndroidElfLoader.dlsym (cognitive 22) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:261 — AndroidElfLoader.dlsym has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SimpleARM64Debugger.loop (cognitive 22) · ×1
  • SimpleARM64Debugger.loop (cognitive 22) unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:41 — SimpleARM64Debugger.loop has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 2 (3 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SimpleARMDebugger.loop (cognitive 22) · ×1
  • SimpleARMDebugger.loop (cognitive 22) unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARMDebugger.java:41 — SimpleARMDebugger.loop has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 2 (3 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GdbStub.processInput (cognitive 22) · ×1
  • GdbStub.processInput (cognitive 22) unidbg-api/src/main/java/com/github/unidbg/debugger/gdb/GdbStub.java:123 — GdbStub.processInput has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · McpTools.allocateMemory (cognitive 22) · ×1
  • McpTools.allocateMemory (cognitive 22) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1610 — McpTools.allocateMemory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 4 (5 pts), boolean chains 4, error handling 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ARM32SyscallHandler.bionic_clone (cognitive 21) · ×1
  • ARM32SyscallHandler.bionic_clone (cognitive 21) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:877 — ARM32SyscallHandler.bionic_clone has cognitive complexity 21 (threshold 15). Drivers by points: if/else 20 (21 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ARM32SyscallHandler.pthread_clone (cognitive 21) · ×1
  • ARM32SyscallHandler.pthread_clone (cognitive 21) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:798 — ARM32SyscallHandler.pthread_clone has cognitive complexity 21 (threshold 15). Drivers by points: if/else 20 (21 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ARM64SyscallHandler.bionic_clone (cognitive 21) · ×1
  • ARM64SyscallHandler.bionic_clone (cognitive 21) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:584 — ARM64SyscallHandler.bionic_clone has cognitive complexity 21 (threshold 15). Drivers by points: if/else 20 (21 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ARM64SyscallHandler.openat (cognitive 21) · ×1
  • ARM64SyscallHandler.openat (cognitive 21) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1429 — ARM64SyscallHandler.openat has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM.appendAddrValue (cognitive 21) · ×1
  • ARM.appendAddrValue (cognitive 21) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:1124 — ARM.appendAddrValue has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 2 (5 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM.appendMemoryDetails64 (cognitive 21) · ×1
  • ARM.appendMemoryDetails64 (cognitive 21) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:997 — ARM.appendMemoryDetails64 has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (6 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM64SyscallHandler._kernelrpc_mach_vm_allocate_trap (cognitive 21) · ×1
  • ARM64SyscallHandler._kernelrpc_mach_vm_allocate_trap (cognitive 21) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2626 — ARM64SyscallHandler._kernelrpc_mach_vm_allocate_trap has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnidbgPointer.toString (cognitive 20) · ×1
  • UnidbgPointer.toString (cognitive 20) unidbg-api/src/main/java/com/github/unidbg/pointer/UnidbgPointer.java:502 — UnidbgPointer.toString has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (2 pts), ternaries 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IpaResolver.createDirectoryFileIO (cognitive 20) · ×1
  • IpaResolver.createDirectoryFileIO (cognitive 20) unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaResolver.java:89 — IpaResolver.createDirectoryFileIO has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Objc2Category.read (cognitive 20) · ×1
  • Objc2Category.read (cognitive 20) unidbg-ios/src/main/java/com/github/unidbg/ios/objc/processor/Objc2Category.java:17 — Objc2Category.read has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 pts), error handling 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOLoader.bindExternalRelocations (cognitive 20) · ×1
  • MachOLoader.bindExternalRelocations (cognitive 20) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1336 — MachOLoader.bindExternalRelocations has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOLoader.bindIndirectSymbolPointers (cognitive 20) · ×1
  • MachOLoader.bindIndirectSymbolPointers (cognitive 20) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1497 — MachOLoader.bindIndirectSymbolPointers has cognitive complexity 20 (threshold 15). Drivers by points: loops 3 (10 pts), if/else 6 (7 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · MachOLoader.doBindAt (cognitive 20) · ×1
  • MachOLoader.doBindAt (cognitive 20) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1849 — MachOLoader.doBindAt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (4 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SystemPropertyHook.hook (cognitive 19) · ×1
  • SystemPropertyHook.hook (cognitive 19) unidbg-android/src/main/java/com/github/unidbg/linux/android/SystemPropertyHook.java:33 — SystemPropertyHook.hook has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (19 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM64SyscallHandler.pthread_clone (cognitive 19) · ×1
  • ARM64SyscallHandler.pthread_clone (cognitive 19) unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:485 — ARM64SyscallHandler.pthread_clone has cognitive complexity 19 (threshold 15). Drivers by points: if/else 19. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ARM.assembleDetail (cognitive 19) · ×1
  • ARM.assembleDetail (cognitive 19) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:1063 — ARM.assembleDetail has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4 (6 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · UniThreadDispatcher.sendSignal (cognitive 19) · ×1
  • UniThreadDispatcher.sendSignal (cognitive 19) unidbg-api/src/main/java/com/github/unidbg/thread/UniThreadDispatcher.java:44 — UniThreadDispatcher.sendSignal has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM64SyscallHandler.newselect (cognitive 19) · ×1
  • ARM64SyscallHandler.newselect (cognitive 19) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:659 — ARM64SyscallHandler.newselect has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), error handling 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOModule.processExportNode (cognitive 19) · ×1
  • MachOModule.processExportNode (cognitive 19) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:424 — MachOModule.processExportNode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AbstractJni.getObjectField (cognitive 18) · ×1
  • AbstractJni.getObjectField (cognitive 18) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java:147 — AbstractJni.getObjectField has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 1 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArmLD.dlopen (cognitive 18) · ×1
  • ArmLD.dlopen (cognitive 18) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:293 — ArmLD.dlopen has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArmLD64.dlopen (cognitive 18) · ×1
  • ArmLD64.dlopen (cognitive 18) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:350 — ArmLD64.dlopen has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AbstractARMDebugger.handleWriteCommand (cognitive 18) · ×1
  • AbstractARMDebugger.handleWriteCommand (cognitive 18) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:148 — AbstractARMDebugger.handleWriteCommand has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegistersCommand.processCommand (cognitive 18) · ×1
  • RegistersCommand.processCommand (cognitive 18) unidbg-api/src/main/java/com/github/unidbg/debugger/gdb/RegistersCommand.java:14 — RegistersCommand.processCommand has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpTools.getRegisters (cognitive 18) · ×1
  • McpTools.getRegisters (cognitive 18) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:557 — McpTools.getRegisters has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpTools.listMemoryMap (cognitive 18) · ×1
  • McpTools.listMemoryMap (cognitive 18) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:386 — McpTools.listMemoryMap has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ARM64SyscallHandler.proc_info (cognitive 18) · ×1
  • ARM64SyscallHandler.proc_info (cognitive 18) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1651 — ARM64SyscallHandler.proc_info has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOLoader.findSymbolInternal (cognitive 18) · ×1
  • MachOLoader.findSymbolInternal (cognitive 18) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1816 — MachOLoader.findSymbolInternal has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · DvmObject.callJniMethod (cognitive 17) · ×1
  • DvmObject.callJniMethod (cognitive 17) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmObject.java:100 — DvmObject.callJniMethod has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 1 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SocketIO.getNetworkIFs (cognitive 17) · ×1
  • SocketIO.getNetworkIFs (cognitive 17) unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:84 — SocketIO.getNetworkIFs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (7 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GnuEhFrameHeader.dwarf_get_cie (cognitive 17) · ×1
  • GnuEhFrameHeader.dwarf_get_cie (cognitive 17) unidbg-android/src/main/java/net/fornwall/jelf/GnuEhFrameHeader.java:728 — GnuEhFrameHeader.dwarf_get_cie has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), loops 3 (4 pts), match/switch 1 (3 pts) (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ARMSvcMemory.registerSvc (cognitive 17) · ×1
  • ARMSvcMemory.registerSvc (cognitive 17) unidbg-api/src/main/java/com/github/unidbg/arm/ARMSvcMemory.java:118 — ARMSvcMemory.registerSvc has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DarwinSyscallHandler.bsdthread_create (cognitive 17) · ×1
  • DarwinSyscallHandler.bsdthread_create (cognitive 17) unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:805 — DarwinSyscallHandler.bsdthread_create has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOLoader.doBindAt (cognitive 17) · ×1
  • MachOLoader.doBindAt (cognitive 17) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1719 — MachOLoader.doBindAt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Uleb128._read (cognitive 17) · ×1
  • Uleb128._read (cognitive 17) unidbg-ios/src/main/java/io/kaitai/MachO.java:243 — Uleb128._read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · gpb.buildDefaultValue (cognitive 17) · ×1
  • gpb.buildDefaultValue (cognitive 17) unidbg-ios/assets/gpb.js:107 — gpb.buildDefaultValue has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Shorty.decodeType (cognitive 16) · ×1
  • Shorty.decodeType (cognitive 16) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/Shorty.java:47 — Shorty.decodeType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 2 (4 pts), loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AbstractARMDebugger.handleMemoryCommand (cognitive 16) · ×1
  • AbstractARMDebugger.handleMemoryCommand (cognitive 16) unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java:201 — AbstractARMDebugger.handleMemoryCommand has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (15 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · McpTools.readTyped (cognitive 16) · ×1
  • McpTools.readTyped (cognitive 16) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1319 — McpTools.readTyped has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (6 pts), if/else 2 (4 pts), match/switch 2 (3 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryTracker.printReport (cognitive 16) · ×1
  • MemoryTracker.printReport (cognitive 16) unidbg-api/src/main/java/com/github/unidbg/memory/MemoryTracker.java:136 — MemoryTracker.printReport has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Utils.readFile (cognitive 16) · ×1
  • Utils.readFile (cognitive 16) unidbg-api/src/main/java/com/github/unidbg/Utils.java:89 — Utils.readFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Dyld.generateDyldImageInfo (cognitive 16) · ×1
  • Dyld.generateDyldImageInfo (cognitive 16) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld.java:59 — Dyld.generateDyldImageInfo has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IndirectSymbol.resolveSymbol (cognitive 16) · ×1
  • IndirectSymbol.resolveSymbol (cognitive 16) unidbg-ios/src/main/java/com/github/unidbg/ios/IndirectSymbol.java:20 — IndirectSymbol.resolveSymbol has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (16 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MachOModule.bindAt (cognitive 16) · ×1
  • MachOModule.bindAt (cognitive 16) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:1077 — MachOModule.bindAt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 2 (4 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (6 members, 6 shared lines) · ×1
  • Near-duplicate member family (6 members, 6 shared lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1552 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1552-1573 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1453-1472 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1477-1496 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1515-1534 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1539-1558 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1563-1586 — These 6 members are variants of one another: a block of 6 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Near-duplicate member family (5 members, 11 shared lines) · ×1
  • Near-duplicate member family (5 members, 11 shared lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1828 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1828-1848 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1902-1922 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2039-2059 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2113-2133 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2271-2291 — These 5 members are variants of one another: a block of 11 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 15 shared lines) · ×1
  • Near-duplicate member family (4 members, 15 shared lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3423 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3423-3447 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3452-3471 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3522-3546 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3551-3570 — These 4 members are variants of one another: a block of 15 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 10 shared lines) · ×1
  • Near-duplicate member family (4 members, 10 shared lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:677 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:677-698 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:717-738 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:757-778 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1991-2011 — These 4 members are variants of one another: a block of 10 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 6 shared lines) · ×1
  • Near-duplicate member family (4 members, 6 shared lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1423 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1423-1442 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1468-1487 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1517-1540 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1598-1619 — These 4 members are variants of one another: a block of 6 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member pair (996 shared lines) · ×1
  • Near-duplicate member pair (996 shared lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:41 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:41-3893 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:36-4014 — These two members are variants of one another: 996 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (654 shared lines) · ×1
  • Near-duplicate member pair (654 shared lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1796 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1796-2636 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2714-3786 — These two members are variants of one another: 654 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (101 shared lines) · ×1
  • Near-duplicate member pair (101 shared lines) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:63 — unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:63-275 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:277-703 — These two members are variants of one another: 101 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (47 shared lines) · ×1
  • Near-duplicate member pair (47 shared lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:530 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:530-606 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:654-732 — These two members are variants of one another: 47 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (44 shared lines) · ×1
  • Near-duplicate member pair (44 shared lines) unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:41 — unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARM64Debugger.java:41-90 | unidbg-api/src/main/java/com/github/unidbg/arm/SimpleARMDebugger.java:41-91 — These two members are variants of one another: 44 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (38 shared lines) · ×1
  • Near-duplicate member pair (38 shared lines) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1620 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1620-1717 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:508-599 — These two members are variants of one another: 38 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (37 shared lines) · ×1
  • Near-duplicate member pair (37 shared lines) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:762 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:762-865 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2272-2398 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×1
  • Edited copy of a member (30 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:72 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher32.java:72-101 | unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadClonePatcher32.java:61-91 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (15 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (15 members, 50+ identical tokens) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:231 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:231-245 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:248-262 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:265-279 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:282-296 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:299-313 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:316-330 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:333-347 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:350-364 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:367-381 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:384-398 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:401-416 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:419-433 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:436-450 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:453-467 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:470-484 — These 15 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 15 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 15 times.
D4 · Code Duplication · Members sharing a duplicated core (12 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (12 members, 50+ identical tokens) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:507 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:507-522 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:525-539 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:542-556 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:559-572 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:575-588 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:591-604 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:607-621 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:624-638 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:641-655 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:658-672 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:675-689 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:692-706 — These 12 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 12 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 12 times.
D4 · Code Duplication · Edited copy of a member (398 corresponding lines) · ×1
  • Edited copy of a member (398 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:40 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:40-437 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:37-545 — These two members are one piece of code written twice and then edited apart: 398 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (240 corresponding lines) · ×1
  • Edited copy of a member (240 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:52 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:52-291 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:50-348 — These two members are one piece of code written twice and then edited apart: 240 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (49 corresponding lines) · ×1
  • Edited copy of a member (49 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/RegAccessPrinter.java:25 — unidbg-api/src/main/java/com/github/unidbg/RegAccessPrinter.java:25-87 | unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1028-1076 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (66 corresponding lines) · ×1
  • Edited copy of a member (66 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:93 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:93-158 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:150-215 — These two members are one piece of code written twice and then edited apart: 66 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (55 corresponding lines) · ×1
  • Edited copy of a member (55 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:214 — unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:214-268 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:317-373 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (51 corresponding lines) · ×1
  • Edited copy of a member (51 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:143 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:143-193 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:168-218 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (43 corresponding lines) · ×1
  • Edited copy of a member (43 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:30 — unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:30-77 | unidbg-api/src/main/java/com/github/unidbg/arm/InlineHook.java:82-124 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (54 corresponding lines) · ×1
  • Edited copy of a member (54 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1849 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1849-1908 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:1077-1130 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (46 corresponding lines) · ×1
  • Edited copy of a member (46 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:293 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:293-338 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:350-395 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (61 corresponding lines) · ×1
  • Edited copy of a member (61 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:142 — unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:142-208 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java:95-155 — These two members are one piece of code written twice and then edited apart: 61 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (60 corresponding lines) · ×1
  • Edited copy of a member (60 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:466 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:466-525 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:580-652 — These two members are one piece of code written twice and then edited apart: 60 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×1
  • Edited copy of a member (27 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2495 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2495-2524 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2526-2552 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (44 corresponding lines) · ×1
  • Edited copy of a member (44 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:164 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:164-218 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyUtils.java:272-315 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (59 corresponding lines) · ×1
  • Edited copy of a member (59 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java:56 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java:56-114 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmMethod.java:261-322 — These two members are one piece of code written twice and then edited apart: 59 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×1
  • Edited copy of a member (32 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:656 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:656-687 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1139-1170 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×1
  • Edited copy of a member (38 corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1719 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1719-1757 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:1038-1075 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (37 corresponding lines) · ×1
  • Edited copy of a member (37 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/JniGraphics.java:31 — unidbg-android/src/main/java/com/github/unidbg/virtualmodule/android/JniGraphics.java:31-67 | REDACTED:30-80 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (40 corresponding lines) · ×1
  • Edited copy of a member (40 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:225 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:225-264 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:669-713 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×1
  • Edited copy of a member (29 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:374 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:374-402 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:582-610 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 22+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 22+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin19.java:18 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin19.java:18-41 | unidbg-android/src/main/java/com/github/unidbg/linux/thread/ThreadJoin23.java:18-42 | unidbg-ios/src/main/java/com/github/unidbg/ios/thread/ThreadJoin64.java:18-39 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 21+ corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:906 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:906-926 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2471-2493 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:236-262 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (52 corresponding lines) · ×1
  • Edited copy of a member (52 corresponding lines) backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/arm64/SimpleMemorySizeDetector.java:29 — backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/arm64/SimpleMemorySizeDetector.java:29-80 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/arm64/SimpleMemorySizeDetector.java:83-134 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 23+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 23+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:232 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:232-255 | unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:296-319 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:381-403 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:474-497 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×1
  • Edited copy of a member (28 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1593 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1593-1620 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1077-1105 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 21+ corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1392 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1392-1412 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1414-1435 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:264-288 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:317-337 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:363-384 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×1
  • Edited copy of a member (21 corresponding lines) REDACTED:101 — REDACTED:101-121 | REDACTED:74-94 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 20+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1731 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1731-1755 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1239-1264 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:357-376 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 13+ corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:94 — unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLoader.java:94-110 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaLoader.java:118-130 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaLoader.java:132-148 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 27+ corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:134 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:134-165 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:222-255 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:369-395 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 16+ corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:124 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:124-140 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:224-240 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:335-350 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 14+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:588 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:588-601 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2716-2729 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3919-3932 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (8 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (8 members, 11+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:127 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:127-137 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:140-150 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:153-163 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:166-176 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:179-189 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:192-202 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:205-215 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:218-228 — These 8 members are one piece of code written 8 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 8 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 11+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:773 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:773-783 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:786-796 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:799-809 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:812-822 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:825-835 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:838-848 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 14+ corresponding lines) unidbg-ios/src/main/java/com/github/unidbg/file/ios/BaseDarwinFileIO.java:311 — unidbg-ios/src/main/java/com/github/unidbg/file/ios/BaseDarwinFileIO.java:311-324 | unidbg-ios/src/main/java/com/github/unidbg/file/ios/BaseDarwinFileIO.java:326-339 | unidbg-ios/src/main/java/com/github/unidbg/file/ios/BaseDarwinFileIO.java:341-355 | unidbg-ios/src/main/java/com/github/unidbg/file/ios/BaseDarwinFileIO.java:411-427 | unidbg-ios/src/main/java/com/github/unidbg/file/ios/BaseDarwinFileIO.java:429-445 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 8+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/XHookImpl.java:65 — unidbg-android/src/main/java/com/github/unidbg/linux/android/XHookImpl.java:65-72 | unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/Dobby.java:113-123 | unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/Dobby.java:131-138 | unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZz.java:101-111 | unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZz.java:119-126 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 8+ corresponding lines) backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:171 — backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:171-178 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:180-187 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:189-196 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:296-303 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (8 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (8 members, 9+ corresponding lines) backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:175 — backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:175-183 | backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:206-214 | backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:217-225 | backend/unicorn2/src/main/java/com/github/unidbg/arm/backend/Unicorn2Backend.java:266-274 | unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java:150-158 | unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java:181-189 | unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java:192-200 | unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java:240-248 — These 8 members are one piece of code written 8 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 8 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 10+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 10+ corresponding lines) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:210 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:210-222 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:234-245 | backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java:198-207 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java:217-228 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 9+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1086 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1086-1094 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1096-1104 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1126-1136 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1456-1465 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 12+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/ByteArray.java:40 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/ByteArray.java:40-51 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/DoubleArray.java:39-50 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/FloatArray.java:39-50 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/IntArray.java:39-50 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/array/ShortArray.java:39-50 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 9+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:760 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:760-768 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1263-1271 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1282-1290 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1303-1311 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2750-2759 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 8+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1410 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1410-1417 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:899-906 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1772-1781 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×1
  • Edited copy of a member (3 corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/XxHash32.java:107 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/XxHash32.java:107-112 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/apk/ApkSigningBlockParser.java:190-192 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 6+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 6+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1395 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1395-1400 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2046-2052 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2054-2060 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1108-1114 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2828-2834 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (5 corresponding lines) · ×1
  • Edited copy of a member (5 corresponding lines) unidbg-api/src/main/java/com/github/unidbg/hook/whale/Whale.java:110 — unidbg-api/src/main/java/com/github/unidbg/hook/whale/Whale.java:110-114 | unidbg-ios/src/main/java/com/github/unidbg/ios/hook/Substrate.java:172-176 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 5+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 5+ corresponding lines) unidbg-android/src/main/java/com/github/unidbg/linux/thread/FutexIndefinitelyWaiter.java:16 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/FutexIndefinitelyWaiter.java:16-20 | unidbg-android/src/main/java/com/github/unidbg/linux/thread/FutexNanoSleepWaiter.java:40-44 | unidbg-android/src/main/java/com/github/unidbg/linux/thread/NanoSleepWaiter.java:46-52 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (62 lines × 2) · ×1
  • Duplicated block (62 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2000 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2000-2061 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2810-2871 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2000` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (52 lines × 4) · ×1
  • Duplicated block (52 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:802 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:802-853 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:886-937 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:489-540 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:593-644 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (42–43 lines × 2) · ×1
  • Duplicated block (42–43 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1848 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1848-1889 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2769-2811 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1848` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (39 lines × 2) · ×1
  • Duplicated block (39 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:170 — unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:170-208 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java:117-155 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 117 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:170` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (38 lines × 2) · ×1
  • Duplicated block (38 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java:73 — unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java:73-110 | unidbg-ios/src/main/java/com/github/unidbg/ios/thread/BsdThreadCreatePatcher64.java:84-121 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/thread/ClonePatcher64.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/thread/BsdThreadCreatePatcher64.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (35–36 lines × 2) · ×1
  • Duplicated block (35–36 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2231 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2231-2265 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2909-2944 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2231` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (31 lines × 4) · ×1
  • Duplicated block (31 lines × 4) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend64.java:37 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend64.java:37-67 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend64.java:89-119 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:188-218 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java:274-304 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/DynarmicBackend64.java:37` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (28–29 lines × 2) · ×1
  • Duplicated block (28–29 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:141 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:141-169 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:231-258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:141` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1633 — unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1633-1660 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOModule.java:987-1014 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1633` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (23–26 lines × 2) · ×1
  • Duplicated block (23–26 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:142 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:142-164 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:137-162 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:142` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24 lines × 5) · ×1
  • Duplicated block (24 lines × 5) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2427 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2427-2450 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2457-2480 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3237-3260 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3267-3290 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3348-3371 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2427` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (23 lines × 4) · ×1
  • Duplicated block (23 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1126 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1126-1148 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1169-1191 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:811-833 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:669-691 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1126` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21 lines × 3) · ×1
  • Duplicated block (21 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:106 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:106-126 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:136-158 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:224-245 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:106` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–20 lines × 3) · ×1
  • Duplicated block (19–20 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:145 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:145-164 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:236-254 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:376-394 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:145` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:374` calls `toHexString` and `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:144` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×1
  • Duplicated block (20 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:83 — unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:83-102 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java:93-112 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: `IOConstants` names `com.github.unidbg.file.ios.IOConstants` in one and `com.github.unidbg.file.linux.IOConstants` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (16–18 lines × 5) · ×1
  • Duplicated block (16–18 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:105 — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:105-120 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:135-151 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:223-239 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:370-387 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:1187-1204 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:105` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:1205` calls `toHexString` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java:121` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (18 lines × 4) · ×1
  • Duplicated block (18 lines × 4) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2281 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2281-2298 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2409-2426 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3091-3108 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3219-3236 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2281` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2078 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2078-2094 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2105-2121 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:1597-1613 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2078` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (16 lines × 6) · ×1
  • Duplicated block (16 lines × 6) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1125 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1125-1140 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1309-1324 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1341-1356 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1155-1170 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1339-1354 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1371-1386 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1125` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16 lines × 5) · ×1
  • Duplicated block (16 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VaList64.java:30 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VaList64.java:30-45 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VaList64.java:49-64 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VaList64.java:68-83 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VaList64.java:87-102 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VaList64.java:106-121 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VaList64.java:30` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 21) · ×1
  • Duplicated block (15 lines × 21) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:93 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:93-107 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:167-181 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:702-716 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:742-756 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:919-933 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:999-1013 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1090-1104 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1155-1169 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1446-1460 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1603-1617 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1903-1917 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2108-2122 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2153-2167 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2335-2349 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2396-2410 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2460-2474 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2759-2773 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3089-3103 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3165-3179 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3505-3519 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3552-3566 — all 21 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:93` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (15 lines × 18) · ×1
  • Duplicated block (15 lines × 18) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:88 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:88-102 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:165-179 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:711-725 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1120-1134 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1185-1199 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1500-1514 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1649-1663 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1951-1965 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2190-2204 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2232-2246 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2414-2428 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2474-2488 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2538-2552 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3090-3104 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3179-3193 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3255-3269 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3604-3618 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3651-3665 — all 18 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:88` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (13–15 lines × 6) · ×1
  • Duplicated block (13–15 lines × 6) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:130 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:130-143 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:230-242 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:340-352 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:154-168 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:244-257 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:384-397 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:130` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (4–14 lines × 4) · ×1
  • Duplicated block (4–14 lines × 4) unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/AttachExecutableEvent.java:19 — unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/AttachExecutableEvent.java:19-32 | unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/DetachEvent.java:14-17 | unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/LoadExecutableEvent.java:19-32 | unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/LoadModuleEvent.java:21-24 — before extracting anything, compare `unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/AttachExecutableEvent.java` and `unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/LoadExecutableEvent.java` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/AttachExecutableEvent.java:19` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/AttachExecutableEvent.java:17` calls `put`, `pack_dd`, `getPid` and `unidbg-api/src/main/java/com/github/unidbg/debugger/ida/event/DetachEvent.java:14` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13 lines × 13) · ×1
  • Duplicated block (13 lines × 13) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:188 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:188-200 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:224-236 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1598-1610 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2455-2467 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2714-2726 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3038-3050 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3061-3073 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3084-3096 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3160-3172 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3216-3228 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3269-3281 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3294-3306 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3500-3512 — all 13 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:188` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (13 lines × 12) · ×1
  • Duplicated block (13 lines × 12) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:229 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:229-241 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1644-1656 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2533-2545 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2744-2756 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3128-3140 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3151-3163 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3174-3186 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3250-3262 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3306-3318 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3359-3371 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3387-3399 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3599-3611 — all 12 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:229` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×1
  • Duplicated block (13 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1527 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1527-1539 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2905-2917 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:4074-4086 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1527` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `SocketIO` names `com.github.unidbg.ios.file.SocketIO` in one and `com.github.unidbg.linux.file.SocketIO` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (12 lines × 43) · ×1
  • Duplicated block (12 lines × 43) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:52 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:52-63 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:90-101 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:164-175 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:190-201 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:208-219 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:226-237 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:666-677 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:699-710 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:739-750 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:779-790 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:916-927 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:960-971 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:996-1007 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1087-1098 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1152-1163 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1443-1454 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1541-1552 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1600-1611 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1900-1911 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2070-2081 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2105-2116 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2150-2161 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2332-2343 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2393-2404 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2457-2468 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2716-2727 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2738-2749 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2756-2767 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2800-2811 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2837-2848 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2872-2883 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3001-3012 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3040-3051 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3063-3074 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3086-3097 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3162-3173 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3218-3229 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3271-3282 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3296-3307 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3373-3384 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3502-3513 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3532-3543 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3549-3560 — all 43 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:52` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:238` calls `getContext`, `getIntArg` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3544` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12 lines × 40) · ×1
  • Duplicated block (12 lines × 40) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:47 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:47-58 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:85-96 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:162-173 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:213-224 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:231-242 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:675-686 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:708-719 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:769-780 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:930-941 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:967-978 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1003-1014 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1117-1128 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1182-1193 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1497-1508 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1587-1598 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1646-1657 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1948-1959 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2187-2198 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2229-2240 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2411-2422 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2471-2482 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2535-2546 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2746-2757 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2780-2791 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2802-2813 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2839-2850 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2880-2891 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3066-3077 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3087-3098 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3130-3141 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3153-3164 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3176-3187 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3252-3263 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3308-3319 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3361-3372 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3389-3400 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3472-3483 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3601-3612 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3631-3642 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3648-3659 — all 40 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:47` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:243` calls `getContext`, `getIntArg` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3643` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×1
  • Duplicated block (12 lines × 4) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1717 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1717-1728 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1746-1757 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2904-2915 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2932-2943 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1717` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5–12 lines × 3) · ×1
  • Duplicated block (5–12 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:1079 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:1079-1090 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:1096-1107 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:1112-1116 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:1079` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11 lines × 33) · ×1
  • Duplicated block (11 lines × 33) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:100 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:100-110 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:174-184 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:669-679 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:709-719 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:749-759 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:782-792 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:926-936 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:963-973 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1006-1016 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1118-1128 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1302-1312 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1460-1470 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1544-1554 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1617-1627 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1959-1969 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2073-2083 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2160-2170 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2342-2352 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2403-2413 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2474-2484 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2741-2751 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2840-2850 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2875-2885 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3004-3014 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3043-3053 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3066-3076 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3096-3106 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3172-3182 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3221-3231 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3274-3284 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3299-3309 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3512-3522 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3566-3576 — all 33 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:100` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2887` calls `getObject`, `toIntPeer` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:794` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11 lines × 32) · ×1
  • Duplicated block (11 lines × 32) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:95 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:95-105 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:172-182 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:678-688 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:739-749 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:772-782 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:933-943 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:970-980 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1006-1016 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1148-1158 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1332-1342 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1507-1517 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1590-1600 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1663-1673 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2007-2017 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2197-2207 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2239-2249 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2421-2431 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2481-2491 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2552-2562 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2842-2852 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2883-2893 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3069-3079 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3097-3107 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3133-3143 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3156-3166 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3186-3196 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3262-3272 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3311-3321 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3364-3374 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3392-3402 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3611-3621 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3665-3675 — all 32 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:95` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2895` calls `getObject`, `toIntPeer` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:784` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11 lines × 16) · ×1
  • Duplicated block (11 lines × 16) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1782 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1782-1792 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1807-1817 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1832-1842 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1881-1891 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1993-2003 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2194-2204 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2219-2229 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1830-1840 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1855-1865 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1904-1914 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1929-1939 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2041-2051 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2066-2076 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2140-2150 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2273-2283 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2298-2308 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1782` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 6) · ×1
  • Duplicated block (11 lines × 6) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1839 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1839-1849 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2439-2449 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2469-2479 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3249-3259 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3279-3289 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3360-3370 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1839` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (11 lines × 5) · ×1
  • Duplicated block (11 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:696 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:696-706 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:736-746 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:776-786 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2009-2019 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2329-2339 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:696` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×1
  • Duplicated block (9–11 lines × 2) unidbg-ios/src/main/java/com/github/unidbg/ios/objc/processor/Objc2Category.java:23 — unidbg-ios/src/main/java/com/github/unidbg/ios/objc/processor/Objc2Category.java:23-33 | unidbg-ios/src/main/java/com/github/unidbg/ios/objc/processor/Objc2Class.java:50-58 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (10 lines × 39) · ×1
  • Duplicated block (10 lines × 39) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:55 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:55-64 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:100-109 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:174-183 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:229-238 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:669-678 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:709-718 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:749-758 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:782-791 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:926-935 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:963-972 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1006-1015 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1118-1127 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1302-1311 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1460-1469 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1544-1553 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1617-1626 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1959-1968 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2073-2082 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2160-2169 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2342-2351 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2403-2412 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2474-2483 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2719-2728 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2741-2750 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2766-2775 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2803-2812 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2840-2849 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2875-2884 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3004-3013 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3043-3052 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3066-3075 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3096-3105 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3172-3181 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3221-3230 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3274-3283 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3299-3308 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3376-3385 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3512-3521 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3566-3575 — all 39 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:55` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1627` calls `getPointerArg` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:239` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10 lines × 38) · ×1
  • Duplicated block (10 lines × 38) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:50 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:50-59 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:95-104 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:172-181 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:234-243 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:678-687 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:739-748 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:772-781 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:933-942 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:970-979 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1006-1015 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1148-1157 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1332-1341 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1507-1516 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1590-1599 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1663-1672 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2007-2016 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2197-2206 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2239-2248 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2421-2430 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2481-2490 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2552-2561 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2749-2758 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2783-2792 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2805-2814 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2842-2851 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2883-2892 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3069-3078 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3097-3106 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3133-3142 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3156-3165 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3186-3195 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3262-3271 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3311-3320 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3364-3373 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3392-3401 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3475-3484 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3611-3620 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3665-3674 — all 38 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:50` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1673` calls `getPointerArg` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:244` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10 lines × 14) · ×1
  • Duplicated block (10 lines × 14) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1758 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1758-1767 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1857-1866 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1969-1978 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2025-2034 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2083-2092 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2125-2134 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2170-2179 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1806-1815 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1880-1889 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2017-2026 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2091-2100 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2165-2174 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2207-2216 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2249-2258 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1758` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 11) · ×1
  • Duplicated block (10 lines × 11) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2243 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2243-2252 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2277-2286 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2306-2315 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2336-2345 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2365-2374 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2405-2414 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2921-2930 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3087-3096 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3116-3125 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3146-3155 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3175-3184 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10 lines × 9) · ×1
  • Duplicated block (10 lines × 9) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:309 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:309-318 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1572-1581 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1644-1653 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1670-1679 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1699-1708 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2430-2439 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2500-2509 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2525-2534 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2553-2562 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:309` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (9 lines × 30) · ×1
  • Duplicated block (9 lines × 30) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:408 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:408-416 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:433-441 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:546-554 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:572-580 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:623-631 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:649-657 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:682-690 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:743-751 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:801-809 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:827-835 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:878-886 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:904-912 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:937-945 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1010-1018 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1065-1073 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1091-1099 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1152-1160 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1336-1344 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1368-1376 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1594-1602 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1824-1832 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1849-1857 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1898-1906 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1923-1931 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2035-2043 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2060-2068 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2109-2117 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2134-2142 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2292-2300 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2485-2493 — all 30 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:408` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:417` calls `get`, `toIntPeer`, `getMethod` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:555` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 23) · ×1
  • Duplicated block (9 lines × 23) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:319 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:319-327 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:521-529 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:598-606 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:776-784 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:853-861 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:974-982 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1040-1048 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1425-1433 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1449-1457 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1473-1481 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1511-1519 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1535-1543 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1559-1567 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1800-1808 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1874-1882 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2011-2019 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2159-2167 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2201-2209 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2243-2251 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2342-2350 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2365-2373 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2388-2396 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2425-2433 — all 23 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:319` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9 lines × 22) · ×1
  • Duplicated block (9 lines × 22) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:623 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:623-631 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:649-657 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:682-690 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:722-730 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:762-770 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:820-828 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:846-854 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:898-906 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:939-947 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1044-1052 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1070-1078 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:632-640 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:658-666 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:691-699 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:752-760 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:810-818 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:836-844 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:887-895 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:913-921 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:946-954 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1074-1082 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1100-1108 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:623` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9 lines × 19) · ×1
  • Duplicated block (9 lines × 19) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:311 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:311-319 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:512-520 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:589-597 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:786-794 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:967-975 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1010-1018 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1395-1403 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1419-1427 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1464-1472 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1513-1521 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1752-1760 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1851-1859 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1963-1971 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2077-2085 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2164-2172 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2263-2271 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2286-2294 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2309-2317 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2346-2354 — all 19 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:311` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9 lines × 10) · ×1
  • Duplicated block (9 lines × 10) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2280 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2280-2288 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2309-2317 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2339-2347 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2368-2376 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2408-2416 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3090-3098 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3119-3127 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3149-3157 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3178-3186 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3218-3226 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2319` calls `getPid` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2348` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 8) · ×1
  • Duplicated block (9 lines × 8) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1577 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1577-1585 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1624-1632 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2435-2443 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2481-2489 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1623-1631 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1670-1678 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2513-2521 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2559-2567 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1577` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–9 lines × 5) · ×1
  • Duplicated block (8–9 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:977 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:977-984 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1373-1380 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1493-1501 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:935-943 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:954-962 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:977` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1369` calls `reg_read`, `intValue`, `register` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:976` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 30) · ×1
  • Duplicated block (8 lines × 30) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:400 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:400-407 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:425-432 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:537-544 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:563-570 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:614-621 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:640-647 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:673-680 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:713-720 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:753-760 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:811-818 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:837-844 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:930-937 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1035-1042 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1061-1068 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1122-1129 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1306-1313 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1338-1345 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1548-1555 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1646-1653 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1701-1708 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1776-1783 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1801-1808 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1826-1833 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1875-1882 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1987-1994 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2188-2195 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2213-2220 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2407-2414 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2502-2509 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2555-2562 — all 30 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:400` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:409` calls `get`, `toIntPeer`, `getMethod` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:546` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 24) · ×1
  • Duplicated block (8 lines × 24) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:620 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:620-627 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:646-653 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:679-686 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:719-726 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:759-766 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:817-824 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:843-850 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:895-902 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:936-943 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1041-1048 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1067-1074 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1554-1561 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:629-636 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:655-662 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:688-695 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:749-756 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:807-814 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:833-840 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:884-891 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:910-917 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:943-950 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1071-1078 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1097-1104 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1600-1607 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8 lines × 18) · ×1
  • Duplicated block (8 lines × 18) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1861 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1861-1868 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2069-2076 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2204-2211 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2243-2250 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2277-2284 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2306-2313 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2336-2343 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2365-2372 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2405-2412 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2782-2789 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2882-2889 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2921-2928 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2952-2959 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3087-3094 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3116-3123 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3146-3153 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3175-3182 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3584-3591 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8 lines × 13) · ×1
  • Duplicated block (8 lines × 13) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2119 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2119-2126 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2488-2495 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2578-2585 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2607-2614 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:2999-3006 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3215-3222 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3298-3305 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3323-3330 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3443-3450 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3464-3471 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3487-3494 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:3696-3703 | unidbg-ios/src/main/java/com/github/unidbg/ios/DarwinSyscallHandler.java:396-403 — before extracting anything, compare `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 77 separate duplicated blocks between them, totalling at least 1187 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2588` calls `calculateSize`, `allocateAllImage` and `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2498` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 8) · ×1
  • Duplicated block (7–8 lines × 8) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:787 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:787-794 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:801-808 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:817-824 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:851-858 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2233-2240 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2291-2297 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2309-2316 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2325-2332 — there are 8 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:787` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:826` calls `IllegalStateException` and `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:809` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×1
  • Duplicated block (7–8 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1051 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1051-1058 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1945-1951 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:2072-2079 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1051` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–8 lines × 2) · ×1
  • Duplicated block (6–8 lines × 2) unidbg-api/src/main/java/com/github/unidbg/RegAccessPrinter.java:66 — unidbg-api/src/main/java/com/github/unidbg/RegAccessPrinter.java:66-73 | unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:1059-1064 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/RegAccessPrinter.java:66` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×1
  • Duplicated block (7–8 lines × 2) unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:1008 — unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:1008-1015 | unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:1026-1032 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/arm/ARM.java:1008` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 46) · ×1
  • Duplicated block (7 lines × 46) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:540 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:540-546 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:566-572 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:617-623 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:643-649 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:676-682 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:716-722 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:756-762 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:814-820 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:840-846 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:933-939 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1038-1044 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1064-1070 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1551-1557 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1779-1785 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1804-1810 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1829-1835 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1878-1884 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1990-1996 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2191-2197 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2216-2222 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2410-2416 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:549-555 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:575-581 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:626-632 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:652-658 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:685-691 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:746-752 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:804-810 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:830-836 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:881-887 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:907-913 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:940-946 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1013-1019 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1068-1074 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1094-1100 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1597-1603 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1827-1833 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1852-1858 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1901-1907 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1926-1932 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2038-2044 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2063-2069 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2112-2118 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2137-2143 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2295-2301 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2488-2494 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:540` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 41) · ×1
  • Duplicated block (7 lines × 41) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:516 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:516-522 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:593-599 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:790-796 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:971-977 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1014-1020 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1399-1405 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1423-1429 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1468-1474 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1517-1523 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1756-1762 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1855-1861 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1967-1973 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2081-2087 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2168-2174 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2267-2273 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2290-2296 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2313-2319 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2350-2356 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:323-329 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:525-531 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:602-608 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:780-786 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:857-863 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:978-984 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1044-1050 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1429-1435 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1453-1459 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1477-1483 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1515-1521 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1539-1545 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1563-1569 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1804-1810 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1878-1884 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2015-2021 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2163-2169 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2205-2211 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2247-2253 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2346-2352 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2369-2375 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2392-2398 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2429-2435 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:516` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 24) · ×1
  • Duplicated block (7 lines × 24) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3103 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3103-3109 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3124-3130 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3144-3150 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3179-3185 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3200-3206 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3228-3234 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3253-3259 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3281-3287 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3306-3312 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3324-3330 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3422-3428 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3451-3457 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3193-3199 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3214-3220 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3234-3240 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3269-3275 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3290-3296 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3318-3324 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3343-3349 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3371-3377 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3399-3405 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3420-3426 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3521-3527 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:3550-3556 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3103` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 23) · ×1
  • Duplicated block (7 lines × 23) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:518 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:518-524 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:595-601 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:792-798 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:869-875 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:973-979 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1016-1022 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1401-1407 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1425-1431 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1470-1476 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1494-1500 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1519-1525 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:527-533 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:604-610 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:782-788 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:859-865 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:980-986 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1046-1052 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1431-1437 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1455-1461 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1479-1485 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1517-1523 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1541-1547 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1565-1571 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7 lines × 15) · ×1
  • Duplicated block (7 lines × 15) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:232 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:232-238 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:249-255 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:266-272 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:283-289 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:300-306 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:317-323 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:334-340 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:351-357 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:368-374 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:385-391 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:402-408 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:420-426 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:437-443 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:454-460 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:471-477 — all 15 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:232` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 12) · ×1
  • Duplicated block (7 lines × 12) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:508 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:508-514 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:526-532 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:543-549 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:560-566 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:576-582 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:592-598 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:608-614 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:625-631 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:642-648 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:659-665 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:676-682 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:693-699 — all 12 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/jni/ProxyJni.java:508` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 11) · ×1
  • Duplicated block (7 lines × 11) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2623 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2623-2629 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2745-2751 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2844-2850 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2858-2864 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2879-2885 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2936-2942 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2966-2972 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3008-3014 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3047-3053 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3070-3076 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3486-3492 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2623` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:3016` calls `getIntArg` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2852` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×1
  • Duplicated block (7 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:210 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:210-216 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:712-718 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:557-563 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:906-912 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:965-971 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: the declarations holding them bind `emulator` to `Emulator<AndroidFileIO>` in one and `Emulator<?>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:973` calls `printf`, `getContext`, `getLRPointer` and `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidSyscallHandler.java:217` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:911 — unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:911-916 | unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:927-933 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java:911` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (4–7 lines × 3) · ×1
  • Duplicated block (4–7 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:897 — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:897-903 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1167-1173 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1236-1239 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:897` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6 lines × 18) · ×1
  • Duplicated block (6 lines × 18) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1783 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1783-1788 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1808-1813 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1833-1838 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1882-1887 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1994-1999 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2195-2200 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2220-2225 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2664-2669 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1831-1836 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1856-1861 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1905-1910 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1930-1935 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2042-2047 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2067-2072 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2141-2146 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2274-2279 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2299-2304 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2688-2693 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6 lines × 9) · ×1
  • Duplicated block (6 lines × 9) unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:787 — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:787-792 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:801-806 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:817-822 | unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:851-856 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2233-2238 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2291-2296 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2309-2314 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2325-2330 | unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2382-2387 — there are 9 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 9 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:2389` calls `setMMapBaseAddress` and `unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:793` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 7) · ×1
  • Duplicated block (6 lines × 7) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:543 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:543-548 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:569-574 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2050-2055 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:552-557 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:578-583 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1016-1021 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2115-2120 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (4–6 lines × 3) · ×1
  • Duplicated block (4–6 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:85 — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:85-90 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:97-102 | unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:107-110 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:107` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:84` calls `handle`, `getContext`, `getIntArg` and `unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java:107` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 47) · ×1
  • Duplicated block (5 lines × 47) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:542 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:542-546 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:568-572 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:619-623 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:645-649 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:678-682 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:718-722 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:758-762 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:816-820 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:842-846 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:935-939 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1040-1044 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1066-1070 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1553-1557 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1781-1785 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1806-1810 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1831-1835 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1880-1884 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1992-1996 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2193-2197 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2218-2222 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:2412-2416 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:551-555 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:577-581 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:628-632 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:654-658 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:687-691 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:748-752 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:806-810 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:832-836 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:883-887 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:909-913 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:942-946 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1015-1019 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1070-1074 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1096-1100 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1599-1603 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1829-1833 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1854-1858 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1903-1907 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1928-1932 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2040-2044 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2065-2069 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2114-2118 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2139-2143 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2272-2276 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2297-2301 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2490-2494 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:542` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 34) · ×1
  • Duplicated block (6 lines × 34) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:523 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:523-528 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:600-605 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:626-631 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:652-657 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:685-690 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:725-730 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:765-770 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:797-802 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:823-828 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:849-854 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:874-879 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:901-906 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:942-947 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:978-983 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1021-1026 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1047-1052 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:1073-1078 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:532-537 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:609-614 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:635-640 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:661-666 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:694-699 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:755-760 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:787-792 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:813-818 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:839-844 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:864-869 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:890-895 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:916-921 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:949-954 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:985-990 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1051-1056 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1077-1082 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1103-1108 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java` as WHOLE FILES: this scan already matched 100 separate duplicated blocks between them, totalling at least 994 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM.java:523` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • Duplicated block (5 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:957 — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:957-961 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:993-997 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:1030-1034 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2177-2181 | unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DalvikVM64.java:2219-2223 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (4–5 lines × 3) · ×1
  • Duplicated block (4–5 lines × 3) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1367 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1367-1370 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1389-1393 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2822-2826 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1389` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (35 lines × 2) · ×1
  • Duplicated block (35 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/struct/StatFS32.java:7 — unidbg-android/src/main/java/com/github/unidbg/linux/struct/StatFS32.java:7-41 | unidbg-android/src/main/java/com/github/unidbg/linux/struct/StatFS64.java:7-41 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×1
  • Duplicated block (32 lines × 2) unidbg-api/src/main/java/com/github/unidbg/unix/struct/StdString32.java:15 — unidbg-api/src/main/java/com/github/unidbg/unix/struct/StdString32.java:15-46 | unidbg-api/src/main/java/com/github/unidbg/unix/struct/StdString64.java:15-47 — before extracting anything, compare `unidbg-api/src/main/java/com/github/unidbg/unix/struct/StdString32.java` and `unidbg-api/src/main/java/com/github/unidbg/unix/struct/StdString64.java` as WHOLE FILES: 87% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (75 lines × 2) · ×1
  • Duplicated block (75 lines × 2) unidbg-android/src/main/java/com/github/unidbg/linux/file/LocalUdpSocket.java:22 — unidbg-android/src/main/java/com/github/unidbg/linux/file/LocalUdpSocket.java:22-101 | unidbg-ios/src/main/java/com/github/unidbg/ios/file/LocalUdpSocket.java:22-96 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/file/LocalUdpSocket.java` and `unidbg-ios/src/main/java/com/github/unidbg/ios/file/LocalUdpSocket.java` as WHOLE FILES: 96% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17 lines × 8) · ×1
  • Duplicated block (17 lines × 8) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/HostInfo.java:11 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/HostInfo.java:11-27 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/MachPortsLookupReply64.java:11-27 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/MakeMemoryEntryRequest.java:11-27 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/NDR_record.java:11-27 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/TaskSetExceptionPortsRequest.java:11-27 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/ThreadBasicInfo.java:12-32 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/kernel/VmRegionReply.java:11-27 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/SockAddrDL.java:14-30 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 8 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 8 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (30 lines × 3) · ×1
  • Duplicated block (30 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/EProc32.java:17 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/EProc32.java:17-46 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/EProc64.java:17-46 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/TaskVmInfo64.java:11-46 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (20 lines × 3) · ×1
  • Duplicated block (20 lines × 3) unidbg-ios/src/main/java/com/github/unidbg/ios/struct/objc/ClassRO.java:16 — unidbg-ios/src/main/java/com/github/unidbg/ios/struct/objc/ClassRO.java:16-35 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/VmSpace32.java:11-30 | unidbg-ios/src/main/java/com/github/unidbg/ios/struct/sysctl/VmSpace64.java:11-30 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:570 — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:570-578 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:580-588 | unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java:659-667 | unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java:1364-1372 | unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java:322-330 — before extracting anything, compare `unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java` and `unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `emulator` to `Emulator<AndroidFileIO>` in one and `Emulator<?>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (9 lines × 13) · ×1
  • Duplicated block (9 lines × 13) backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:131 — backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:131-139 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:165-173 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:175-183 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:185-193 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:224-232 | backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java:264-272 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java:93-101 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java:103-111 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java:113-121 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java:123-131 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java:187-195 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java:197-205 | backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java:207-215 — before extracting anything, compare `backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/Dynarmic.java` and `backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/Kvm.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `value` to `long` in one and `int` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Minor — 72 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×38
  • Duplicated predicate unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLibraryFile.java:68 — `!loadList.isEmpty() && !loadList.contains(FilenameUtils.getName(path))` appears character-identically in 2 files — unidbg-ios/src/main/java/com/github/unidbg/ios/dmg/DmgLibraryFile.java, unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/IpaLibraryFile.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:1898 — `"/data/misc/zoneinfo/current/tzdata".equals(pathname) || "/dev/pmsg0".equals(pathname)` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java, unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/file/DriverFileIO.java:18 — `"/dev/urandom".equals(pathname) || "/dev/random".equals(pathname) || "/dev/srandom".equals(pathname)` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/file/DriverFileIO.java, unidbg-ios/src/main/java/com/github/unidbg/ios/file/DriverFileIO.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2230 — `(args.anywhere != MachO.VM_FLAGS_OVERWRITE && args.anywhere != MachO.VM_FLAGS_FIXED) || args.mask != 0` appears character-identically in 2 files — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java, unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:372 — `(int) handle == Dyld.RTLD_MAIN_ONLY && "_os_trace_redirect_func".equals(symbolName)` appears character-identically in 2 files — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java, unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-api/src/main/java/com/github/unidbg/RegAccessPrinter.java:52 — `(regId >= Arm64Const.UC_ARM64_REG_X0 && regId <= Arm64Const.UC_ARM64_REG_X28) || (regId >= Arm64Const.UC_ARM64_REG_X29 && regId <= Arm64Cons…` appears character-identically in 2 files — unidbg-api/src/main/java/com/github/unidbg/RegAccessPrinter.java, unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-api/src/main/java/com/github/unidbg/RegAccessPrinter.java:32 — `(regId >= ArmConst.UC_ARM_REG_R0 && regId <= ArmConst.UC_ARM_REG_R12) || regId == ArmConst.UC_ARM_REG_LR || regId == ArmConst.UC_ARM_REG_SP …` appears character-identically in 2 files — unidbg-api/src/main/java/com/github/unidbg/RegAccessPrinter.java, unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:199 — `IO.STDOUT.equals(path) || IO.STDERR.equals(path)` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java, unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1253 — `PROC_INFO_CALL_PIDINFO == callNum && PROC_PIDT_SHORTBSDINFO == flavor` appears character-identically in 2 files — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java, unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1247 — `PROC_INFO_CALL_SETCONTROL == callNum && PROC_SELFSET_THREADNAME == flavor` appears character-identically in 2 files — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java, unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1614 — `action == AF_ROUTE && rt == NET_RT_IFLIST` appears character-identically in 2 files — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java, unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/signal/SignalFunction.java:48 — `action.needSigInfo() && infoBlock == null` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/signal/SignalFunction.java, unidbg-ios/src/main/java/com/github/unidbg/ios/signal/SignalTask.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2080 — `args.getAddress() >= mm.base && args.getAddress() < mm.base + mm.size` appears character-identically in 2 files — unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java, unidbg-ios/src/main/java/com/github/unidbg/ios/ARM64SyscallHandler.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:159 — `callback != null && !loader.addImageCallbacks.contains(callback)` appears character-identically in 2 files — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java, unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:554 — `child_stack == null && context.getPointerArg(2) == null` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java, unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/HypervisorBackend64.java:238 — `dfsc == 0x00 && emulator.getFamily() == Family.iOS` appears character-identically in 2 files — backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/HypervisorBackend64.java, backend/kvm/src/main/java/com/github/unidbg/arm/backend/kvm/KvmBackend64.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java:47 — `dvmClass.getClass() == DvmClass.class && dvmClass.vm != null && dvmClass.vm.reserveSignatureCache(signature)` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmField.java, unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/DvmMethod.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java:130 — `dynamicStructure != null && dynamicStructure.soName > 0 && dynamicStructure.dt_strtab_offset > 0` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD.java, unidbg-android/src/main/java/com/github/unidbg/linux/android/ArmLD64.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:171 — `elfSymbol != null && !elfSymbol.isUndef()` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java, unidbg-android/src/main/java/com/github/unidbg/linux/ModuleSymbol.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java:532 — `exception == null && handleUnknownSyscall(emulator, NR)` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java, unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:293 — `flags == 0x0 && dest_addr == null && addrlen == 0` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java, unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java:282 — `flags == 0x0 && src_addr == null && addrlen == null` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/file/SocketIO.java, unidbg-ios/src/main/java/com/github/unidbg/ios/file/SocketIO.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java:59 — `image_index < 0 || image_index >= modules.length` appears character-identically in 2 files — unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld32.java, unidbg-ios/src/main/java/com/github/unidbg/ios/Dyld64.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:468 — `libraryResolver != null && neededLibraryFile == null` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java, unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java:89 — `log.isDebugEnabled() && data.length < 0x3000` appears character-identically in 2 files — unidbg-android/src/main/java/com/github/unidbg/linux/file/SimpleFileIO.java, unidbg-ios/src/main/java/com/github/unidbg/ios/file/SimpleFileIO.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • + 13 more in this group — see findings.md.
AX6 · Interface segregation · Fat interface · ×9
  • Fat interface: Jni (109 abstract methods) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/Jni.java:3 — `Jni` declares 109 abstract methods: `acceptField`, `acceptMethod`, `allocObject`, `callBooleanMethod`, `callBooleanMethod`, `callBooleanMethodV`, `callBooleanMethodV`, `callByteMethodV`, `callByteMethodV`, `callCharMethodV`, `callCharMethodV`, `callDoubleMethod`, `callDoubleMethod`, `callFloatMethodV`, `callFloatMethodV`, `callIntMethod`, `callIntMethod`, `callIntMethodV`, `callIntMethodV`, `callLongMethod`, `callLongMethod`, `callLongMethodV`, `callLongMethodV`, `callObjectMethod`, `callObjectMethod`, `callObjectMethodV`, `callObjectMethodV`, `callShortMethodV`, `callShortMethodV`, `callStaticBooleanMethod`, `callStaticBooleanMethod`, `callStaticBooleanMethodV`, `callStaticBooleanMethodV`, `callStaticDoubleMethod`, `callStaticDoubleMethod`, `callStaticFloatMethod`, `callStaticFloatMethod`, `callStaticIntMethod`, `callStaticIntMethod`, `callStaticIntMethodV`, and 69 more. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 109 declarations carry 56 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 56 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: VM (30 abstract methods) unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/VM.java:13 — `VM` declares 30 abstract methods: `addGlobalObject`, `addLocalObject`, `addNotFoundClass`, `callJNI_OnLoad`, `findClass`, `findLibrary`, `getEmulator`, `getJNIEnv`, `getJavaVM`, `getManifestXml`, `getObject`, `getPackageName`, `getSignatures`, `getVersionCode`, `getVersionName`, `loadLibrary`, `loadLibrary`, `loadLibrary`, `openAsset`, `printMemoryInfo`, `resolveClass`, `setAssetResolver`, `setDvmClassFactory`, `setHashFunction`, `setJni`, `setVerbose`, `setVerboseFieldOperation`, `setVerboseMethodOperation`, `throwException`, `unzip`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 30 declarations carry 28 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 28 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: Backend (36 abstract methods) unidbg-api/src/main/java/com/github/unidbg/arm/backend/Backend.java:8 — `Backend` declares 36 abstract methods: `addBreakPoint`, `context_alloc`, `context_free`, `context_restore`, `context_save`, `debugger_add`, `destroy`, `emu_start`, `emu_stop`, `enableVFP`, `getCpuFeatures`, `getMemAllocatedSize`, `getMemResidentSize`, `getPageSize`, `hook_add_new`, `hook_add_new`, `hook_add_new`, `hook_add_new`, `hook_add_new`, `hook_add_new`, `mem_map`, `mem_protect`, `mem_read`, `mem_unmap`, `mem_write`, `onInitialize`, `reg_read`, `reg_read_vector`, `reg_write`, `reg_write_vector`, `registerEmuCountHook`, `removeBreakPoint`, `removeJitCodeCache`, `setFastDebug`, `setSingleStep`, `switchUserMode`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 36 declarations carry 31 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 31 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: Arm32RegisterContext (39 abstract methods) unidbg-api/src/main/java/com/github/unidbg/arm/context/Arm32RegisterContext.java:5 — `Arm32RegisterContext` declares 39 abstract methods: `getR0Int`, `getR0Long`, `getR0Pointer`, `getR10Int`, `getR10Long`, `getR10Pointer`, `getR11Int`, `getR11Long`, `getR11Pointer`, `getR12Int`, `getR12Long`, `getR12Pointer`, `getR1Int`, `getR1Long`, `getR1Pointer`, `getR2Int`, `getR2Long`, `getR2Pointer`, `getR3Int`, `getR3Long`, `getR3Pointer`, `getR4Int`, `getR4Long`, `getR4Pointer`, `getR5Int`, `getR5Long`, `getR5Pointer`, `getR6Int`, `getR6Long`, `getR6Pointer`, `getR7Int`, `getR7Long`, `getR7Pointer`, `getR8Int`, `getR8Long`, `getR8Pointer`, `getR9Int`, `getR9Long`, `getR9Pointer`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: FileIO (23 abstract methods) unidbg-api/src/main/java/com/github/unidbg/file/FileIO.java:9 — `FileIO` declares 23 abstract methods: `bind`, `close`, `connect`, `dup2`, `fcntl`, `ftruncate`, `getPath`, `getpeername`, `getsockname`, `getsockopt`, `ioctl`, `isStdIO`, `listen`, `llseek`, `lseek`, `mmap2`, `pread`, `read`, `recvfrom`, `sendto`, `setsockopt`, `shutdown`, `write`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: Debugger (17 abstract methods) unidbg-api/src/main/java/com/github/unidbg/debugger/Debugger.java:10 — `Debugger` declares 17 abstract methods under just 11 distinct name(s): `addBreakPoint`, `addBreakPoint`, `addBreakPoint`, `addBreakPoint`, `addBreakPoint`, `addBreakPoint`, `addMcpTool`, `close`, `disassembleBlock`, `getBreakPoints`, `hasRunnable`, `isDebugging`, `removeBreakPoint`, `run`, `setDebugListener`, `traceFunctionCall`, `traceFunctionCall`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. That is an OVERLOAD SET, not 17 separate responsibilities: a caller binds to 11 operation(s) and uses the overload it selected, so the Interface-Segregation harm does NOT apply on the caller's side and splitting this into role-interfaces would scatter one operation without relieving anything. The burden that does remain is the IMPLEMENTER's — all 17 signatures must be written and kept in step. Reduce it by collapsing overloads (optional or default parameters, or an options object) rather than by segregating the interface.
  • Fat interface: Memory (20 abstract methods) unidbg-api/src/main/java/com/github/unidbg/memory/Memory.java:11 — `Memory` declares 20 abstract methods: `allocateStack`, `allocateThreadIndex`, `allocateThreadStack`, `brk`, `freeThreadIndex`, `getLastErrno`, `getMMapListener`, `getMemoryMap`, `getStackBase`, `getStackPoint`, `getStackSize`, `malloc`, `mmap`, `mmap2`, `mprotect`, `munmap`, `pointer`, `setErrno`, `setMMapListener`, `setStackPoint`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: Loader (19 abstract methods) unidbg-api/src/main/java/com/github/unidbg/spi/Loader.java:15 — `Loader` declares 19 abstract methods under just 15 distinct name(s): `addHookListener`, `addModuleListener`, `disableCallInitFunction`, `dlclose`, `dlopen`, `dlopen`, `dlsym`, `findModule`, `findModuleByAddress`, `getLoadedModules`, `getMaxLengthLibraryName`, `getMaxSizeOfLibrary`, `load`, `load`, `load`, `load`, `loadVirtualModule`, `setCallInitFunction`, `setLibraryResolver`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. That is an OVERLOAD SET, not 19 separate responsibilities: a caller binds to 15 operation(s) and uses the overload it selected, so the Interface-Segregation harm does NOT apply on the caller's side and splitting this into role-interfaces would scatter one operation without relieving anything. The burden that does remain is the IMPLEMENTER's — all 19 signatures must be written and kept in step. Reduce it by collapsing overloads (optional or default parameters, or an options object) rather than by segregating the interface.
  • Fat interface: Emulator<T> (43 abstract methods) unidbg-api/src/main/java/com/github/unidbg/Emulator.java:33 — `Emulator<T>` declares 43 abstract methods: `attach`, `attach`, `createURLibraryFile`, `eEntry`, `eFunc`, `emulateSignal`, `get`, `getBackend`, `getContext`, `getDlfcn`, `getFamily`, `getFileSystem`, `getMemory`, `getPageAlign`, `getPid`, `getPointerSize`, `getProcessName`, `getReturnAddress`, `getSvcMemory`, `getSyscallHandler`, `getThreadDispatcher`, `getUnwinder`, `is32Bit`, `is64Bit`, `isRunning`, `loadLibrary`, `loadLibrary`, `popContext`, `pushContext`, `set`, `setTimeout`, `setTraceSystemMemoryWrite`, `showRegs`, `showRegs`, `traceCode`, `traceCode`, `traceCode`, `traceRead`, `traceRead`, `traceRead`, and 3 more. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 43 declarations carry 34 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 34 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
X4 · Structured logging · Interpolated log message defeats structured logging · ×4
  • Interpolated log message defeats structured logging unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:1680 — `debug` at line 1680 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.debug("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
  • Interpolated log message defeats structured logging unidbg-ios/src/main/java/com/github/unidbg/ios/ARM32SyscallHandler.java:2894 — `debug` at line 2894 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.debug("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
  • Interpolated log message defeats structured logging unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java:1892 — `trace` at line 1892 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.trace("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
  • Interpolated log message defeats structured logging unidbg-android/src/main/java/net/fornwall/jelf/ElfDynamicStructure.java:269 — `warn` at line 269 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×3
  • Projects may be oversized for their cohesion unidbg-android/pom.xml:1 — `unidbg-android` (30114 LoC, 175 module-visible types across 18 directories) overshoots its size bounds. 3 of 7 build unit(s) (Maven) overshoot their size bounds, lowering Project Cohesion to 1.4/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
  • Projects may be oversized for their cohesion unidbg-ios/pom.xml:1 — `unidbg-ios` (29116 LoC, 349 module-visible types across 27 directories) overshoots its size bounds. 3 of 7 build unit(s) (Maven) overshoot their size bounds, lowering Project Cohesion to 1.4/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
  • Projects may be oversized for their cohesion unidbg-api/pom.xml:1 — `unidbg-api` (18608 LoC, 207 module-visible types across 26 directories) overshoots its size bounds. 3 of 7 build unit(s) (Maven) overshoot their size bounds, lowering Project Cohesion to 1.4/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
P10 · Library API & versioning · Implementation type on the public API · ×3
  • Implementation type on the public API unidbg-android/src/main/java/com/github/unidbg/linux/android/XHookImpl.java:12 — 1 public type in `com.github.unidbg.linux.android` is marked as implementation by its own namespace, folder or name: `XHookImpl` (unidbg-android/src/main/java/com/github/unidbg/linux/android/XHookImpl.java:12, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZzArm32RegisterContextImpl.java:11 — 2 public types in `com.github.unidbg.hook.hookzz` are marked as implementation by their own namespace, folder or name: `HookZzArm32RegisterContextImpl` (unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZzArm32RegisterContextImpl.java:11, name ends in `Impl`), `HookZzArm64RegisterContextImpl` (unidbg-api/src/main/java/com/github/unidbg/hook/hookzz/HookZzArm64RegisterContextImpl.java:10, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
  • Implementation type on the public API unidbg-api/src/main/java/com/github/unidbg/memory/MemoryBlockImpl.java:7 — 1 public type in `com.github.unidbg.memory` is marked as implementation by its own namespace, folder or name: `MemoryBlockImpl` (unidbg-api/src/main/java/com/github/unidbg/memory/MemoryBlockImpl.java:7, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
D16 · Bus Factor · Off-boarding risk · ×2
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 17 significant file(s) lose their only recent owner: unidbg-ios/src/main/java/com/github/unidbg/ios/MachOLoader.java, unidbg-api/src/main/java/com/github/unidbg/mcp/McpTools.java, unidbg-api/src/main/java/com/github/unidbg/arm/AbstractARMDebugger.java, backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/HypervisorBackend64.java, unidbg-ios/src/main/java/com/github/unidbg/ios/ipa/SymbolResolver.java, unidbg-api/src/main/java/com/github/unidbg/mcp/McpServer.java, backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/Hypervisor.java, unidbg-api/src/main/java/com/github/unidbg/arm/backend/UnicornBackend.java (+9 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 4 significant file(s) lose their only recent owner: unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/AbstractJni.java, unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java, unidbg-api/src/main/java/com/github/unidbg/Module.java, unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/apk/ApkFile.java. Pair on, review, or document these before any departure.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 2 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (26 single-owned of 198 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 198 of the 752 production source files in this repository met that bar). They are anonymized user #3 (2 file(s)), anonymized user #4 (2 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/FallbackJni.java, unidbg-api/src/main/java/com/github/unidbg/arm/FastTracer.java, unidbg-api/src/main/java/com/github/unidbg/AssemblyCodeDumper.java, unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/XxHash32.java.
D21 · Naming Consistency · `AndroidElfLoader` spells `Elf` where 17 names in the project spell it `ELF` · ×1
  • `AndroidElfLoader` spells `Elf` where 17 names in the project spell it `ELF` unidbg-android/src/main/java/com/github/unidbg/linux/AndroidElfLoader.java:58 — 17 of 18 names in project unidbg-android spell the token `ELF` (17 of 18; unit: names in project unidbg-android containing `ELF`). Peers: EmptySymbolLocator.getELFSymbol (unidbg-android/src/main/java/com/github/unidbg/linux/EmptySymbolLocator.java:12); EmptySymbolLocator.getELFSymbolByName (unidbg-android/src/main/java/com/github/unidbg/linux/EmptySymbolLocator.java:17); EmptySymbolLocator.getELFSymbolByAddr (unidbg-android/src/main/java/com/github/unidbg/linux/EmptySymbolLocator.java:22); 1.getELFSymbolByName (unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:73); LinuxModule.getELFSymbolByName (unidbg-android/src/main/java/com/github/unidbg/linux/LinuxModule.java:184). Rename to `AndroidELFLoader`. [rule N6]
D21 · Naming Consistency · `notifyCallSVC` spells `SVC` where 13 names in the project spell it `Svc` · ×1
  • `notifyCallSVC` spells `SVC` where 13 names in the project spell it `Svc` unidbg-api/src/main/java/com/github/unidbg/arm/backend/InterruptHookNotifier.java:13 — 13 of 14 names in project unidbg-api spell the token `Svc` (13 of 14; unit: names in project unidbg-api containing `Svc`). Peers: AbstractEmulator.getSvcMemory (unidbg-api/src/main/java/com/github/unidbg/AbstractEmulator.java:122); Emulator.getSvcMemory (unidbg-api/src/main/java/com/github/unidbg/Emulator.java:109); com.github.unidbg.arm.ARMSvcMemory (unidbg-api/src/main/java/com/github/unidbg/arm/ARMSvcMemory.java:23); ARMSvcMemory.getSvc (unidbg-api/src/main/java/com/github/unidbg/arm/ARMSvcMemory.java:113); ARMSvcMemory.registerSvc (unidbg-api/src/main/java/com/github/unidbg/arm/ARMSvcMemory.java:118). Rename to `notifyCallSvc`. [rule N6]
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
M2 · Architecture documentation · No architecture diagram/doc · ×1
  • No architecture diagram/doc — No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST — No static application security testing detected. For this repository's stack, add spotbugs with find-sec-bugs (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 1 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation pom.xml:128 — `pom.xml` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
P6 · Release Hygiene · No changelog · ×1
  • No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
X5 · Nullable reference types · Java packages are not null-marked everywhere · ×1
  • Java packages are not null-marked everywhere — 0/79 of this repository's Java package directories are under a non-null default: a `package-info.java` declaring `@NullMarked` (JSpecify) or `@NonNullApi`, `@ParametersAreNonnullByDefault`, `@NonNullByDefault`, `@DefaultQualifier(NonNull.class)`; a `module-info.java` declaring `@NullMarked`; every type in it `@NullMarked`; or a build that runs NullAway with the package in `AnnotatedPackages`, or the Checker Framework's `NullnessChecker`. Elsewhere every reference admits null and no checker warns on the dereference that throws a `NullPointerException`.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×1
  • Silent fallback default on parse failure unidbg-api/src/main/java/com/github/unidbg/unix/UnixSyscallHandler.java:411 — `parseProcFd` returns `-1` when `NumberFormatException` is thrown, with no log or throw — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the Javadoc, and the row stops firing.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=0 --max-count=200" --report-format json --report-path /tmp/watchdog-gitleaks-9835d7c767d74b18abd63218e43a282a/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=200 --max-count=800" --report-format json --report-path /tmp/watchdog-gitleaks-9835d7c767d74b18abd63218e43a282a/history-1.json --exit-code 0 --source .0artifacts/raw/gitleaks-history-1.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=1000 --max-count=827" --report-format json --report-path /tmp/watchdog-gitleaks-9835d7c767d74b18abd63218e43a282a/history-2.json --exit-code 0 --source .0artifacts/raw/gitleaks-history-2.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-9835d7c767d74b18abd63218e43a282a/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .5artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .28artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json

Run 01a1eacd-b8f8-7614-bf75-2e60e71b16c8 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md